chore: Make webRTC opt-in

This commit is contained in:
Krille Fear 2022-02-19 11:58:21 +01:00
commit 74100bd777
7 changed files with 30 additions and 16 deletions

View file

@ -431,7 +431,11 @@ class MatrixState extends State<Matrix> with WidgetsBindingObserver {
createVoipPlugin();
}
void createVoipPlugin() {
void createVoipPlugin() async {
if (await store.getItemBool(SettingKeys.experimentalVoip) == false) {
voipPlugin = null;
return;
}
voipPlugin =
webrtcIsSupported ? VoipPlugin(client: client, context: context) : null;
}
@ -482,6 +486,9 @@ class MatrixState extends State<Matrix> with WidgetsBindingObserver {
store
.getItemBool(SettingKeys.sendOnEnter, AppConfig.sendOnEnter)
.then((value) => AppConfig.sendOnEnter = value);
store
.getItemBool(SettingKeys.experimentalVoip, AppConfig.experimentalVoip)
.then((value) => AppConfig.experimentalVoip = value);
store.getItem(SettingKeys.chatColor).then((value) {
if (value != null && int.tryParse(value) != null) {
AppConfig.chatColor = Color(int.parse(value));

View file

@ -32,9 +32,7 @@ class _SettingsSwitchListTileState extends State<SettingsSwitchListTile> {
title: Text(widget.title),
onChanged: (bool newValue) async {
widget.onChanged?.call(newValue);
await Matrix.of(context)
.store
.setItem(widget.storeKey, newValue.toString());
await Matrix.of(context).store.setItemBool(widget.storeKey, newValue);
setState(() {});
},
),