From 60a72b01a63cfbf340c0f1c37d5f5aac7a62cb1f Mon Sep 17 00:00:00 2001 From: Krille Fear Date: Sun, 20 Feb 2022 10:35:37 +0100 Subject: [PATCH] chore: Follow up fix qr code scanner --- .gitlab-ci.yml | 4 +-- .../new_private_chat/new_private_chat.dart | 27 +++++++++---------- macos/Flutter/GeneratedPluginRegistrant.swift | 2 ++ 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ef890d27..48f047d5 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,8 +1,6 @@ image: - name: cirrusci/flutter + name: cirrusci/flutter:2.10.1 -variables: - GIT_SUBMODULE_STRATEGY: recursive .shared_windows_runners: tags: diff --git a/lib/pages/new_private_chat/new_private_chat.dart b/lib/pages/new_private_chat/new_private_chat.dart index 666ddda0..8eb1cdfa 100644 --- a/lib/pages/new_private_chat/new_private_chat.dart +++ b/lib/pages/new_private_chat/new_private_chat.dart @@ -8,7 +8,6 @@ import 'package:permission_handler/permission_handler.dart'; import 'package:fluffychat/pages/new_private_chat/new_private_chat_view.dart'; import 'package:fluffychat/pages/new_private_chat/qr_scanner_modal.dart'; import 'package:fluffychat/utils/fluffy_share.dart'; -import 'package:fluffychat/utils/platform_infos.dart'; import 'package:fluffychat/utils/url_launcher.dart'; import 'package:fluffychat/widgets/matrix.dart'; @@ -25,10 +24,9 @@ class NewPrivateChatController extends State { final formKey = GlobalKey(); bool loading = false; - bool _hideFab = true; - bool _qrUnsupported = true; + bool _hideFab = false; - bool get hideFab => !_qrUnsupported && _hideFab; + bool get hideFab => _hideFab; static const Set supportedSigils = {'@', '!', '#'}; @@ -43,7 +41,6 @@ class NewPrivateChatController extends State { @override void initState() { super.initState(); - _checkQrSupported(); textFieldFocus.addListener(setHideFab); } @@ -79,6 +76,17 @@ class NewPrivateChatController extends State { ); void openScannerAction() async { + final info = await DeviceInfoPlugin().androidInfo; + if ((info.version.sdkInt ?? 16) < 21) { + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: Text( + L10n.of(context)!.unsupportedAndroidVersionLong, + ), + ), + ); + return; + } await Permission.camera.request(); await showModalBottomSheet( context: context, @@ -90,13 +98,4 @@ class NewPrivateChatController extends State { @override Widget build(BuildContext context) => NewPrivateChatView(this); - - // checks whether Android < 21 in order to support Android KitKat - void _checkQrSupported() { - if (!PlatformInfos.isAndroid) _qrUnsupported = false; - DeviceInfoPlugin().androidInfo.then( - (info) => - setState(() => _qrUnsupported = (info.version.sdkInt ?? 16) < 21), - ); - } } diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index 8ca23251..8b78e3a6 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -10,6 +10,7 @@ import assets_audio_player_web import audioplayers import connectivity_plus_macos import desktop_drop +import desktop_lifecycle import device_info_plus_macos import emoji_picker_flutter import file_selector_macos @@ -33,6 +34,7 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { AudioplayersPlugin.register(with: registry.registrar(forPlugin: "AudioplayersPlugin")) ConnectivityPlugin.register(with: registry.registrar(forPlugin: "ConnectivityPlugin")) DesktopDropPlugin.register(with: registry.registrar(forPlugin: "DesktopDropPlugin")) + DesktopLifecyclePlugin.register(with: registry.registrar(forPlugin: "DesktopLifecyclePlugin")) DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin")) EmojiPickerFlutterPlugin.register(with: registry.registrar(forPlugin: "EmojiPickerFlutterPlugin")) FileSelectorPlugin.register(with: registry.registrar(forPlugin: "FileSelectorPlugin"))