mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-11-08 04:59:29 +01:00
Merge branch 'krille/webrtc-opt-in' into 'main'
chore: Make webRTC opt-in See merge request famedly/fluffychat!752
This commit is contained in:
commit
4e281247a4
@ -2730,5 +2730,6 @@
|
|||||||
"voiceCall": "Voice call",
|
"voiceCall": "Voice call",
|
||||||
"unsupportedAndroidVersion": "Unsupported Android version",
|
"unsupportedAndroidVersion": "Unsupported Android version",
|
||||||
"unsupportedAndroidVersionLong": "This feature required a never Android version. Please check for updates or Lineage OS support.",
|
"unsupportedAndroidVersionLong": "This feature required a never Android version. Please check for updates or Lineage OS support.",
|
||||||
"videoCallsBetaWarning": "Please note that video calls are currently in beta. They might not work as expected or work at all on all platforms."
|
"videoCallsBetaWarning": "Please note that video calls are currently in beta. They might not work as expected or work at all on all platforms.",
|
||||||
|
"experimentalVideoCalls": "Experimental video calls"
|
||||||
}
|
}
|
||||||
|
@ -38,6 +38,7 @@ abstract class AppConfig {
|
|||||||
static bool hideUnknownEvents = true;
|
static bool hideUnknownEvents = true;
|
||||||
static bool autoplayImages = true;
|
static bool autoplayImages = true;
|
||||||
static bool sendOnEnter = false;
|
static bool sendOnEnter = false;
|
||||||
|
static bool experimentalVoip = false;
|
||||||
static const bool hideTypingUsernames = false;
|
static const bool hideTypingUsernames = false;
|
||||||
static const bool hideAllStateEvents = false;
|
static const bool hideAllStateEvents = false;
|
||||||
static const String inviteLinkPrefix = 'https://matrix.to/#/';
|
static const String inviteLinkPrefix = 'https://matrix.to/#/';
|
||||||
|
@ -23,4 +23,5 @@ abstract class SettingKeys {
|
|||||||
'chat.fluffychat.dont_ask_bootstrap';
|
'chat.fluffychat.dont_ask_bootstrap';
|
||||||
static const String autoplayImages = 'chat.fluffy.autoplay_images';
|
static const String autoplayImages = 'chat.fluffy.autoplay_images';
|
||||||
static const String sendOnEnter = 'chat.fluffy.send_on_enter';
|
static const String sendOnEnter = 'chat.fluffy.send_on_enter';
|
||||||
|
static const String experimentalVoip = 'chat.fluffy.experimental_voip';
|
||||||
}
|
}
|
||||||
|
@ -113,7 +113,7 @@ class ChatView extends StatelessWidget {
|
|||||||
];
|
];
|
||||||
} else {
|
} else {
|
||||||
return [
|
return [
|
||||||
if (Matrix.of(context).webrtcIsSupported &&
|
if (Matrix.of(context).voipPlugin != null &&
|
||||||
controller.room!.isDirectChat)
|
controller.room!.isDirectChat)
|
||||||
IconButton(
|
IconButton(
|
||||||
onPressed: controller.onPhoneButtonTap,
|
onPressed: controller.onPhoneButtonTap,
|
||||||
|
@ -7,6 +7,7 @@ import 'package:fluffychat/config/app_config.dart';
|
|||||||
import 'package:fluffychat/config/setting_keys.dart';
|
import 'package:fluffychat/config/setting_keys.dart';
|
||||||
import 'package:fluffychat/utils/platform_infos.dart';
|
import 'package:fluffychat/utils/platform_infos.dart';
|
||||||
import 'package:fluffychat/widgets/layouts/max_width_body.dart';
|
import 'package:fluffychat/widgets/layouts/max_width_body.dart';
|
||||||
|
import 'package:fluffychat/widgets/matrix.dart';
|
||||||
import 'package:fluffychat/widgets/settings_switch_list_tile.dart';
|
import 'package:fluffychat/widgets/settings_switch_list_tile.dart';
|
||||||
import 'settings_chat.dart';
|
import 'settings_chat.dart';
|
||||||
|
|
||||||
@ -42,18 +43,23 @@ class SettingsChatView extends StatelessWidget {
|
|||||||
storeKey: SettingKeys.hideUnknownEvents,
|
storeKey: SettingKeys.hideUnknownEvents,
|
||||||
defaultValue: AppConfig.hideUnknownEvents,
|
defaultValue: AppConfig.hideUnknownEvents,
|
||||||
),
|
),
|
||||||
SettingsSwitchListTile.adaptive(
|
|
||||||
title: L10n.of(context)!.autoplayImages,
|
|
||||||
onChanged: (b) => AppConfig.autoplayImages = b,
|
|
||||||
storeKey: SettingKeys.autoplayImages,
|
|
||||||
defaultValue: AppConfig.autoplayImages,
|
|
||||||
),
|
|
||||||
if (PlatformInfos.isMobile)
|
if (PlatformInfos.isMobile)
|
||||||
SettingsSwitchListTile.adaptive(
|
SettingsSwitchListTile.adaptive(
|
||||||
title: L10n.of(context)!.sendOnEnter,
|
title: L10n.of(context)!.autoplayImages,
|
||||||
onChanged: (b) => AppConfig.sendOnEnter = b,
|
onChanged: (b) => AppConfig.autoplayImages = b,
|
||||||
storeKey: SettingKeys.sendOnEnter,
|
storeKey: SettingKeys.autoplayImages,
|
||||||
defaultValue: AppConfig.sendOnEnter,
|
defaultValue: AppConfig.autoplayImages,
|
||||||
|
),
|
||||||
|
if (Matrix.of(context).webrtcIsSupported)
|
||||||
|
SettingsSwitchListTile.adaptive(
|
||||||
|
title: L10n.of(context)!.experimentalVideoCalls,
|
||||||
|
onChanged: (b) {
|
||||||
|
AppConfig.experimentalVoip = b;
|
||||||
|
Matrix.of(context).createVoipPlugin();
|
||||||
|
return;
|
||||||
|
},
|
||||||
|
storeKey: SettingKeys.experimentalVoip,
|
||||||
|
defaultValue: AppConfig.experimentalVoip,
|
||||||
),
|
),
|
||||||
const Divider(height: 1),
|
const Divider(height: 1),
|
||||||
ListTile(
|
ListTile(
|
||||||
|
@ -431,7 +431,11 @@ class MatrixState extends State<Matrix> with WidgetsBindingObserver {
|
|||||||
createVoipPlugin();
|
createVoipPlugin();
|
||||||
}
|
}
|
||||||
|
|
||||||
void createVoipPlugin() {
|
void createVoipPlugin() async {
|
||||||
|
if (await store.getItemBool(SettingKeys.experimentalVoip) == false) {
|
||||||
|
voipPlugin = null;
|
||||||
|
return;
|
||||||
|
}
|
||||||
voipPlugin =
|
voipPlugin =
|
||||||
webrtcIsSupported ? VoipPlugin(client: client, context: context) : null;
|
webrtcIsSupported ? VoipPlugin(client: client, context: context) : null;
|
||||||
}
|
}
|
||||||
@ -482,6 +486,9 @@ class MatrixState extends State<Matrix> with WidgetsBindingObserver {
|
|||||||
store
|
store
|
||||||
.getItemBool(SettingKeys.sendOnEnter, AppConfig.sendOnEnter)
|
.getItemBool(SettingKeys.sendOnEnter, AppConfig.sendOnEnter)
|
||||||
.then((value) => AppConfig.sendOnEnter = value);
|
.then((value) => AppConfig.sendOnEnter = value);
|
||||||
|
store
|
||||||
|
.getItemBool(SettingKeys.experimentalVoip, AppConfig.experimentalVoip)
|
||||||
|
.then((value) => AppConfig.experimentalVoip = value);
|
||||||
store.getItem(SettingKeys.chatColor).then((value) {
|
store.getItem(SettingKeys.chatColor).then((value) {
|
||||||
if (value != null && int.tryParse(value) != null) {
|
if (value != null && int.tryParse(value) != null) {
|
||||||
AppConfig.chatColor = Color(int.parse(value));
|
AppConfig.chatColor = Color(int.parse(value));
|
||||||
|
@ -32,9 +32,7 @@ class _SettingsSwitchListTileState extends State<SettingsSwitchListTile> {
|
|||||||
title: Text(widget.title),
|
title: Text(widget.title),
|
||||||
onChanged: (bool newValue) async {
|
onChanged: (bool newValue) async {
|
||||||
widget.onChanged?.call(newValue);
|
widget.onChanged?.call(newValue);
|
||||||
await Matrix.of(context)
|
await Matrix.of(context).store.setItemBool(widget.storeKey, newValue);
|
||||||
.store
|
|
||||||
.setItem(widget.storeKey, newValue.toString());
|
|
||||||
setState(() {});
|
setState(() {});
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
Loading…
Reference in New Issue
Block a user