Store ICE fallback permission in device setting

This stores the ICE server fallback permission in a device setting so it is
remembered across sessions.

Part of https://github.com/matrix-org/matrix-react-sdk/pull/3309
This commit is contained in:
J. Ryan Stinnett 2019-08-14 14:02:25 +01:00
parent c1378f8e0b
commit 1c6312d999
5 changed files with 30 additions and 9 deletions

View file

@ -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);
});

View file

@ -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>);
@ -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>
);