mirror of
				https://gitlab.com/famedly/fluffychat.git
				synced 2025-11-04 14:27:23 +01:00 
			
		
		
		
	chore: Adjust start video call UX
This commit is contained in:
		
							parent
							
								
									ddecffa531
								
							
						
					
					
						commit
						890db2bc45
					
				@ -2729,5 +2729,6 @@
 | 
			
		||||
  "placeCall": "Place call",
 | 
			
		||||
  "voiceCall": "Voice call",
 | 
			
		||||
  "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."
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -8,7 +8,6 @@ import 'package:flutter/scheduler.dart';
 | 
			
		||||
import 'package:flutter/services.dart';
 | 
			
		||||
 | 
			
		||||
import 'package:adaptive_dialog/adaptive_dialog.dart';
 | 
			
		||||
import 'package:animations/animations.dart';
 | 
			
		||||
import 'package:desktop_drop/desktop_drop.dart';
 | 
			
		||||
import 'package:device_info_plus/device_info_plus.dart';
 | 
			
		||||
import 'package:emoji_picker_flutter/emoji_picker_flutter.dart';
 | 
			
		||||
@ -959,56 +958,34 @@ class ChatController extends State<Chat> {
 | 
			
		||||
      DeviceInfoPlugin().androidInfo.then((value) {
 | 
			
		||||
        if ((value.version.sdkInt ?? 16) < 21) {
 | 
			
		||||
          Navigator.pop(context);
 | 
			
		||||
          showModal(
 | 
			
		||||
          showOkAlertDialog(
 | 
			
		||||
            context: context,
 | 
			
		||||
            builder: (context) => AlertDialog(
 | 
			
		||||
              title: Text(L10n.of(context)!.unsupportedAndroidVersion),
 | 
			
		||||
              content: Text(L10n.of(context)!.unsupportedAndroidVersionLong),
 | 
			
		||||
              actions: [
 | 
			
		||||
                TextButton(
 | 
			
		||||
                    onPressed: Navigator.of(context).pop,
 | 
			
		||||
                    child: Text(L10n.of(context)!.ok))
 | 
			
		||||
              ],
 | 
			
		||||
            ),
 | 
			
		||||
            title: L10n.of(context)!.unsupportedAndroidVersion,
 | 
			
		||||
            message: L10n.of(context)!.unsupportedAndroidVersionLong,
 | 
			
		||||
            okLabel: L10n.of(context)!.close,
 | 
			
		||||
          );
 | 
			
		||||
        }
 | 
			
		||||
      });
 | 
			
		||||
    }
 | 
			
		||||
    final callType = await showDialog<CallType>(
 | 
			
		||||
        context: context,
 | 
			
		||||
        builder: (BuildContext context) {
 | 
			
		||||
          return SimpleDialog(
 | 
			
		||||
            title: Text(L10n.of(context)!.placeCall),
 | 
			
		||||
            children: [
 | 
			
		||||
              ListTile(
 | 
			
		||||
                leading: const Icon(Icons.phone),
 | 
			
		||||
                title: Text(L10n.of(context)!.voiceCall),
 | 
			
		||||
                onTap: () {
 | 
			
		||||
                  Navigator.pop(context, CallType.kVoice);
 | 
			
		||||
                },
 | 
			
		||||
              ),
 | 
			
		||||
              ListTile(
 | 
			
		||||
                leading: const Icon(Icons.videocam),
 | 
			
		||||
                title: Text(L10n.of(context)!.videoCall),
 | 
			
		||||
                onTap: () {
 | 
			
		||||
                  Navigator.pop(context, CallType.kVideo);
 | 
			
		||||
                },
 | 
			
		||||
              ),
 | 
			
		||||
              ListTile(
 | 
			
		||||
                leading: const Icon(Icons.cancel),
 | 
			
		||||
                title: Text(L10n.of(context)!.cancel),
 | 
			
		||||
                onTap: () {
 | 
			
		||||
                  Navigator.pop(context, null);
 | 
			
		||||
                },
 | 
			
		||||
              ),
 | 
			
		||||
            ],
 | 
			
		||||
          );
 | 
			
		||||
        },
 | 
			
		||||
        useRootNavigator: false);
 | 
			
		||||
    final callType = await showModalActionSheet<CallType>(
 | 
			
		||||
      context: context,
 | 
			
		||||
      title: L10n.of(context)!.videoCallsBetaWarning,
 | 
			
		||||
      cancelLabel: L10n.of(context)!.cancel,
 | 
			
		||||
      actions: [
 | 
			
		||||
        SheetAction(
 | 
			
		||||
          label: L10n.of(context)!.voiceCall,
 | 
			
		||||
          icon: Icons.phone_outlined,
 | 
			
		||||
          key: CallType.kVoice,
 | 
			
		||||
        ),
 | 
			
		||||
        SheetAction(
 | 
			
		||||
          label: L10n.of(context)!.videoCall,
 | 
			
		||||
          icon: Icons.video_call_outlined,
 | 
			
		||||
          key: CallType.kVideo,
 | 
			
		||||
        ),
 | 
			
		||||
      ],
 | 
			
		||||
    );
 | 
			
		||||
    if (callType == null) return;
 | 
			
		||||
 | 
			
		||||
    if (callType == null) {
 | 
			
		||||
      return;
 | 
			
		||||
    }
 | 
			
		||||
    final success = await showFutureLoadingDialog(
 | 
			
		||||
        context: context,
 | 
			
		||||
        future: () =>
 | 
			
		||||
 | 
			
		||||
@ -122,7 +122,7 @@ class ChatView extends StatelessWidget {
 | 
			
		||||
          ),
 | 
			
		||||
        IconButton(
 | 
			
		||||
          onPressed: controller.onPhoneButtonTap,
 | 
			
		||||
          icon: const Icon(Icons.phone),
 | 
			
		||||
          icon: const Icon(Icons.call_outlined),
 | 
			
		||||
          tooltip: L10n.of(context)!.placeCall,
 | 
			
		||||
        ),
 | 
			
		||||
        EncryptionButton(controller.room!),
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user