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

Commit

Permalink
Store ICE fallback permission in device setting
Browse files Browse the repository at this point in the history
This stores the ICE server fallback permission in a device setting so it is
remembered across sessions.

Part of #3309
  • Loading branch information
jryans committed Aug 15, 2019
1 parent c1378f8 commit 1c6312d
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 9 deletions.
1 change: 1 addition & 0 deletions src/MatrixClientPeg.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ class MatrixClientPeg {
deviceId: creds.deviceId,
timelineSupport: true,
forceTURN: !SettingsStore.getValue('webRtcAllowPeerToPeer', false),
fallbackICEServerAllowed: !!SettingsStore.getValue('fallbackICEServerAllowed'),
verificationMethods: [verificationMethods.SAS],
unstableClientRelationAggregation: true,
};
Expand Down
14 changes: 7 additions & 7 deletions src/components/structures/MatrixChat.js
Original file line number Diff line number Diff line change
Expand Up @@ -1386,18 +1386,18 @@ export default React.createClass({
) }</p>
<p>{ _t(
"Riot can use a fallback server <code>turn.matrix.org</code> " +
"for the current session if you urgently need to make a call. " +
"Your IP address would be shared with this fallback server " +
"only if you agree and later place or receive a call.",
"if you urgently need to make a call. Your IP address would be " +
"shared with this fallback server only if you agree and later " +
"place or receive a call. You can change this permission later " +
"in the Voice & Video section of Settings.",
null, { code },
)}</p>
</div>,
button: _t('Allow Fallback'),
cancelButton: _t('Dismiss'),
onFinished: (confirmed) => {
if (confirmed) {
cli.setFallbackICEServerAllowed(true);
}
onFinished: (allow) => {
SettingsStore.setValue("fallbackICEServerAllowed", null, SettingLevel.DEVICE, allow);
cli.setFallbackICEServerAllowed(allow);
},
}, null, true);
});
Expand Down
15 changes: 14 additions & 1 deletion src/components/views/settings/tabs/user/VoiceUserSettingsTab.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ export default class VoiceUserSettingsTab extends React.Component {
MatrixClientPeg.get().setForceTURN(!p2p);
};

_changeFallbackICEServerAllowed = (allow) => {
MatrixClientPeg.get().setFallbackICEServerAllowed(allow);
};

_renderDeviceOptions(devices, category) {
return devices.map((d) => {
return (<option key={`${category}-${d.deviceId}`} value={d.deviceId}>{d.label}</option>);
Expand Down Expand Up @@ -201,7 +205,16 @@ export default class VoiceUserSettingsTab extends React.Component {
{microphoneDropdown}
{webcamDropdown}
<SettingsFlag name='VideoView.flipVideoHorizontally' level={SettingLevel.ACCOUNT} />
<SettingsFlag name='webRtcAllowPeerToPeer' level={SettingLevel.DEVICE} onChange={this._changeWebRtcMethod} />
<SettingsFlag
name='webRtcAllowPeerToPeer'
level={SettingLevel.DEVICE}
onChange={this._changeWebRtcMethod}
/>
<SettingsFlag
name='fallbackICEServerAllowed'
level={SettingLevel.DEVICE}
onChange={this._changeFallbackICEServerAllowed}
/>
</div>
</div>
);
Expand Down
3 changes: 2 additions & 1 deletion src/i18n/strings/en_EN.json
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@
"Show recently visited rooms above the room list": "Show recently visited rooms above the room list",
"Show hidden events in timeline": "Show hidden events in timeline",
"Low bandwidth mode": "Low bandwidth mode",
"Allow fallback call assist server turn.matrix.org": "Allow fallback call assist server turn.matrix.org",
"Collecting app version information": "Collecting app version information",
"Collecting logs": "Collecting logs",
"Uploading report": "Uploading report",
Expand Down Expand Up @@ -1509,7 +1510,7 @@
"This room is used for important messages from the Homeserver, so you cannot leave it.": "This room is used for important messages from the Homeserver, so you cannot leave it.",
"Homeserver not configured to support calls": "Homeserver not configured to support calls",
"Your homeserver <code>%(homeserverDomain)s</code> is currently not configured to assist with calls by offering a TURN server, which means it is likely that voice and video calls will fail. Please notify your homeserver administrator so that they can address this.": "Your homeserver <code>%(homeserverDomain)s</code> is currently not configured to assist with calls by offering a TURN server, which means it is likely that voice and video calls will fail. Please notify your homeserver administrator so that they can address this.",
"Riot can use a fallback server <code>turn.matrix.org</code> for the current session if you urgently need to make a call. Your IP address would be shared with this fallback server only if you agree and later place or receive a call.": "Riot can use a fallback server <code>turn.matrix.org</code> for the current session if you urgently need to make a call. Your IP address would be shared with this fallback server only if you agree and later place or receive a call.",
"Riot can use a fallback server <code>turn.matrix.org</code> if you urgently need to make a call. Your IP address would be shared with this fallback server only if you agree and later place or receive a call. You can change this permission later in the Voice & Video section of Settings.": "Riot can use a fallback server <code>turn.matrix.org</code> if you urgently need to make a call. Your IP address would be shared with this fallback server only if you agree and later place or receive a call. You can change this permission later in the Voice & Video section of Settings.",
"Allow Fallback": "Allow Fallback",
"Signed Out": "Signed Out",
"For security, this session has been signed out. Please sign in again.": "For security, this session has been signed out. Please sign in again.",
Expand Down
6 changes: 6 additions & 0 deletions src/settings/Settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -372,4 +372,10 @@ export const SETTINGS = {
default: false,
controller: new LowBandwidthController(),
},
"fallbackICEServerAllowed": {
supportedLevels: LEVELS_DEVICE_ONLY_SETTINGS,
displayName: _td("Allow fallback call assist server turn.matrix.org"),
// This is a tri-state value, where `null` means "prompt the user".
default: null,
},
};

0 comments on commit 1c6312d

Please sign in to comment.