chore: Adjust start video call UX

This commit is contained in:
Christian Pauly 2022-02-17 09:52:53 +01:00 committed by Krille Fear
parent ddecffa531
commit 890db2bc45
3 changed files with 25 additions and 47 deletions

View File

@ -2729,5 +2729,6 @@
"placeCall": "Place call", "placeCall": "Place call",
"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."
} }

View File

@ -8,7 +8,6 @@ import 'package:flutter/scheduler.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:adaptive_dialog/adaptive_dialog.dart'; import 'package:adaptive_dialog/adaptive_dialog.dart';
import 'package:animations/animations.dart';
import 'package:desktop_drop/desktop_drop.dart'; import 'package:desktop_drop/desktop_drop.dart';
import 'package:device_info_plus/device_info_plus.dart'; import 'package:device_info_plus/device_info_plus.dart';
import 'package:emoji_picker_flutter/emoji_picker_flutter.dart'; import 'package:emoji_picker_flutter/emoji_picker_flutter.dart';
@ -959,56 +958,34 @@ class ChatController extends State<Chat> {
DeviceInfoPlugin().androidInfo.then((value) { DeviceInfoPlugin().androidInfo.then((value) {
if ((value.version.sdkInt ?? 16) < 21) { if ((value.version.sdkInt ?? 16) < 21) {
Navigator.pop(context); Navigator.pop(context);
showModal( showOkAlertDialog(
context: context, context: context,
builder: (context) => AlertDialog( title: L10n.of(context)!.unsupportedAndroidVersion,
title: Text(L10n.of(context)!.unsupportedAndroidVersion), message: L10n.of(context)!.unsupportedAndroidVersionLong,
content: Text(L10n.of(context)!.unsupportedAndroidVersionLong), okLabel: L10n.of(context)!.close,
actions: [
TextButton(
onPressed: Navigator.of(context).pop,
child: Text(L10n.of(context)!.ok))
],
),
); );
} }
}); });
} }
final callType = await showDialog<CallType>( final callType = await showModalActionSheet<CallType>(
context: context, context: context,
builder: (BuildContext context) { title: L10n.of(context)!.videoCallsBetaWarning,
return SimpleDialog( cancelLabel: L10n.of(context)!.cancel,
title: Text(L10n.of(context)!.placeCall), actions: [
children: [ SheetAction(
ListTile( label: L10n.of(context)!.voiceCall,
leading: const Icon(Icons.phone), icon: Icons.phone_outlined,
title: Text(L10n.of(context)!.voiceCall), key: CallType.kVoice,
onTap: () { ),
Navigator.pop(context, CallType.kVoice); SheetAction(
}, label: L10n.of(context)!.videoCall,
), icon: Icons.video_call_outlined,
ListTile( key: CallType.kVideo,
leading: const Icon(Icons.videocam), ),
title: Text(L10n.of(context)!.videoCall), ],
onTap: () { );
Navigator.pop(context, CallType.kVideo); if (callType == null) return;
},
),
ListTile(
leading: const Icon(Icons.cancel),
title: Text(L10n.of(context)!.cancel),
onTap: () {
Navigator.pop(context, null);
},
),
],
);
},
useRootNavigator: false);
if (callType == null) {
return;
}
final success = await showFutureLoadingDialog( final success = await showFutureLoadingDialog(
context: context, context: context,
future: () => future: () =>

View File

@ -122,7 +122,7 @@ class ChatView extends StatelessWidget {
), ),
IconButton( IconButton(
onPressed: controller.onPhoneButtonTap, onPressed: controller.onPhoneButtonTap,
icon: const Icon(Icons.phone), icon: const Icon(Icons.call_outlined),
tooltip: L10n.of(context)!.placeCall, tooltip: L10n.of(context)!.placeCall,
), ),
EncryptionButton(controller.room!), EncryptionButton(controller.room!),