Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 89f7357

Browse files
authored
Merge pull request #1621 from matrix-org/dbkr/fix_force_turn
Fix the force TURN option
2 parents 6fd09bc + 6d23182 commit 89f7357

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

src/CallHandler.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ limitations under the License.
5252
*/
5353

5454
import MatrixClientPeg from './MatrixClientPeg';
55-
import UserSettingsStore from './UserSettingsStore';
5655
import PlatformPeg from './PlatformPeg';
5756
import Modal from './Modal';
5857
import sdk from './index';
@@ -245,9 +244,7 @@ function _onAction(payload) {
245244
return;
246245
} else if (members.length === 2) {
247246
console.log("Place %s call in %s", payload.type, payload.room_id);
248-
const call = Matrix.createNewMatrixCall(MatrixClientPeg.get(), payload.room_id, {
249-
forceTURN: UserSettingsStore.getLocalSetting('webRtcForceTURN', false),
250-
});
247+
const call = Matrix.createNewMatrixCall(MatrixClientPeg.get(), payload.room_id);
251248
placeCall(call);
252249
} else { // > 2
253250
dis.dispatch({

src/MatrixClientPeg.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,13 +136,17 @@ class MatrixClientPeg {
136136
}
137137

138138
_createClient(creds: MatrixClientCreds) {
139+
// XXX: This is here and as a require because apparently circular dependencies
140+
// are just broken in webpack (https://github.com/webpack/webpack/issues/1788)
141+
const UserSettingsStore = require('./UserSettingsStore');
139142
const opts = {
140143
baseUrl: creds.homeserverUrl,
141144
idBaseUrl: creds.identityServerUrl,
142145
accessToken: creds.accessToken,
143146
userId: creds.userId,
144147
deviceId: creds.deviceId,
145148
timelineSupport: true,
149+
forceTURN: UserSettingsStore.getLocalSetting('webRtcForceTURN', false),
146150
};
147151

148152
this.matrixClient = createMatrixClient(opts, this.indexedDbWorkerScript);

src/components/structures/UserSettings.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -877,6 +877,11 @@ module.exports = React.createClass({
877877
// TODO: this ought to be a separate component so that we don't need
878878
// to rebind the onChange each time we render
879879
const onChange = (e) => {
880+
// XXX: awful, but at time of writing, granular settings has landed on
881+
// develop which will almost certainly mean we'll handle this differently.
882+
if (setting.id === 'webRtcForceTURN') {
883+
MatrixClientPeg.get().setForceTURN(e.target.checked);
884+
}
880885
UserSettingsStore.setLocalSetting(setting.id, e.target.checked);
881886
if (setting.fn) setting.fn(e.target.checked);
882887
};

0 commit comments

Comments
 (0)