From ebb15ee06eef7f4a612747bb9e8926de89a7e13d Mon Sep 17 00:00:00 2001 From: HuyNguyen Date: Wed, 13 Sep 2023 12:14:12 +0700 Subject: [PATCH] Hotfix: Change `FluffyChatApp` to `TwakeApp` --- ...6-dom-exception-error-when-delete-disk-for-web.md | 2 +- lib/main.dart | 6 +++--- .../chat_list/receive_sharing_intent_mixin.dart | 6 +++--- .../invitation_selection/invitation_selection.dart | 4 ++-- lib/utils/background_push.dart | 4 ++-- lib/utils/voip_plugin.dart | 6 +++--- lib/widgets/matrix.dart | 12 ++++++------ lib/widgets/mixins/popup_menu_widget_mixin.dart | 4 ++-- lib/widgets/{fluffy_chat_app.dart => twake_app.dart} | 10 +++++----- 9 files changed, 27 insertions(+), 27 deletions(-) rename lib/widgets/{fluffy_chat_app.dart => twake_app.dart} (90%) diff --git a/docs/adr/0006-dom-exception-error-when-delete-disk-for-web.md b/docs/adr/0006-dom-exception-error-when-delete-disk-for-web.md index 3f0fd6ba5d..ea01007a69 100644 --- a/docs/adr/0006-dom-exception-error-when-delete-disk-for-web.md +++ b/docs/adr/0006-dom-exception-error-when-delete-disk-for-web.md @@ -18,7 +18,7 @@ and recreate it. But when we use this method, we have a DOMException error. ``` ## Decision -- Workout round +- Workaround 1. Check platform is Web we don't use deleteFromDisk() method. Only support for Mobile platform. 2. After we have used deleteFromDisk() method. When logging back in, you need to reopen the BoxCollection diff --git a/lib/main.dart b/lib/main.dart index 6aa441d60b..2e741b8fc3 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -10,7 +10,7 @@ import 'package:flutter_secure_storage/flutter_secure_storage.dart'; import 'package:go_router/go_router.dart'; import 'package:matrix/matrix.dart'; import 'utils/background_push.dart'; -import 'widgets/fluffy_chat_app.dart'; +import 'widgets/twake_app.dart'; import 'widgets/lock_screen.dart'; void main() async { @@ -71,11 +71,11 @@ Future startGui(List clients) async { runApp( PlatformInfos.isMobile ? AppLock( - builder: (args) => FluffyChatApp(clients: clients), + builder: (args) => TwakeApp(clients: clients), lockScreen: const LockScreen(), enabled: pin?.isNotEmpty ?? false, ) - : FluffyChatApp(clients: clients), + : TwakeApp(clients: clients), ); } diff --git a/lib/pages/chat_list/receive_sharing_intent_mixin.dart b/lib/pages/chat_list/receive_sharing_intent_mixin.dart index dbbbec5fb3..2b75757706 100644 --- a/lib/pages/chat_list/receive_sharing_intent_mixin.dart +++ b/lib/pages/chat_list/receive_sharing_intent_mixin.dart @@ -1,7 +1,7 @@ import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_file_extension.dart'; import 'package:fluffychat/utils/platform_infos.dart'; import 'package:fluffychat/utils/url_launcher.dart'; -import 'package:fluffychat/widgets/fluffy_chat_app.dart'; +import 'package:fluffychat/widgets/twake_app.dart'; import 'package:fluffychat/widgets/matrix.dart'; import 'package:flutter/material.dart'; import 'dart:async'; @@ -77,8 +77,8 @@ mixin ReceiveSharingIntentMixin on State { // For receiving shared Uris intentUriStreamSubscription = linkStream.listen(_processIncomingUris); - if (FluffyChatApp.gotInitialLink == false) { - FluffyChatApp.gotInitialLink = true; + if (TwakeApp.gotInitialLink == false) { + TwakeApp.gotInitialLink = true; getInitialLink().then(_processIncomingUris); } } diff --git a/lib/pages/invitation_selection/invitation_selection.dart b/lib/pages/invitation_selection/invitation_selection.dart index de92fd263e..9f4959ca95 100644 --- a/lib/pages/invitation_selection/invitation_selection.dart +++ b/lib/pages/invitation_selection/invitation_selection.dart @@ -1,6 +1,6 @@ import 'package:fluffychat/pages/new_group/contacts_selection.dart'; import 'package:fluffychat/pages/new_group/contacts_selection_view.dart'; -import 'package:fluffychat/widgets/fluffy_chat_app.dart'; +import 'package:fluffychat/widgets/twake_app.dart'; import 'package:flutter/material.dart'; import 'package:adaptive_dialog/adaptive_dialog.dart'; @@ -100,7 +100,7 @@ class InvitationSelectionController } void onCloseDialogInvite() { - FluffyChatApp.router.routerDelegate.pop(); + TwakeApp.router.routerDelegate.pop(); } @override diff --git a/lib/utils/background_push.dart b/lib/utils/background_push.dart index a32fb06549..4753b082ad 100644 --- a/lib/utils/background_push.dart +++ b/lib/utils/background_push.dart @@ -25,7 +25,7 @@ import 'package:fcm_shared_isolate/fcm_shared_isolate.dart'; import 'package:fluffychat/domain/model/extensions/push/push_notification_extension.dart'; import 'package:fluffychat/utils/matrix_sdk_extensions/client_stories_extension.dart'; import 'package:fluffychat/utils/push_helper.dart'; -import 'package:fluffychat/widgets/fluffy_chat_app.dart'; +import 'package:fluffychat/widgets/twake_app.dart'; import 'package:fluffychat/widgets/matrix.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; @@ -349,7 +349,7 @@ class BackgroundPush { ?.content .tryGet('type') == ClientStoriesExtension.storiesRoomType; - FluffyChatApp.router.go('/rooms/$roomId'); + TwakeApp.router.go('/rooms/$roomId'); } catch (e, s) { Logs().e('[Push] Failed to open room', e, s); } diff --git a/lib/utils/voip_plugin.dart b/lib/utils/voip_plugin.dart index 5d77c88789..a10414588a 100644 --- a/lib/utils/voip_plugin.dart +++ b/lib/utils/voip_plugin.dart @@ -12,7 +12,7 @@ import 'package:webrtc_interface/webrtc_interface.dart' hide Navigator; import 'package:fluffychat/pages/chat_list/chat_list.dart'; import 'package:fluffychat/pages/dialer/dialer.dart'; import 'package:fluffychat/utils/platform_infos.dart'; -import 'package:fluffychat/widgets/fluffy_chat_app.dart'; +import 'package:fluffychat/widgets/twake_app.dart'; import '../../utils/famedlysdk_store.dart'; import '../../utils/voip/callkeep_manager.dart'; import '../../utils/voip/user_media_manager.dart'; @@ -61,7 +61,7 @@ class VoipPlugin with WidgetsBindingObserver implements WebRTCDelegate { void addCallingOverlay(String callId, CallSession call) { final context = kIsWeb ? ChatList.contextForVoip! - : FluffyChatApp.routerKey.currentContext!; // web is weird + : TwakeApp.routerKey.currentContext!; // web is weird if (overlayEntry != null) { Logs().e('[VOIP] addCallingOverlay: The call session already exists?'); overlayEntry!.remove(); @@ -165,7 +165,7 @@ class VoipPlugin with WidgetsBindingObserver implements WebRTCDelegate { addCallingOverlay(call.callId, call); try { if (!hasCallingAccount) { - ScaffoldMessenger.of(FluffyChatApp.routerKey.currentContext!) + ScaffoldMessenger.of(TwakeApp.routerKey.currentContext!) .showSnackBar( const SnackBar( content: Text( diff --git a/lib/widgets/matrix.dart b/lib/widgets/matrix.dart index 4db52a881e..b290853b87 100644 --- a/lib/widgets/matrix.dart +++ b/lib/widgets/matrix.dart @@ -20,7 +20,7 @@ import 'package:fluffychat/utils/platform_infos.dart'; import 'package:fluffychat/utils/uia_request_manager.dart'; import 'package:fluffychat/utils/url_launcher.dart'; import 'package:fluffychat/utils/voip_plugin.dart'; -import 'package:fluffychat/widgets/fluffy_chat_app.dart'; +import 'package:fluffychat/widgets/twake_app.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_app_lock/flutter_app_lock.dart'; @@ -179,7 +179,7 @@ class MatrixState extends State with WidgetsBindingObserver { Logs().d('MatrixState::getLoginClient() Registering subs'); _registerSubs(_loginClientCandidate!.clientName); _loginClientCandidate = null; - FluffyChatApp.router.go('/rooms'); + TwakeApp.router.go('/rooms'); }); return candidate; } @@ -256,7 +256,7 @@ class MatrixState extends State with WidgetsBindingObserver { bool webHasFocus = true; String? get activeRoomId { - final route = FluffyChatApp.router.routeInformationProvider.value.location; + final route = TwakeApp.router.routeInformationProvider.value.location; if (route == null || !route.startsWith('/rooms/')) return null; return route.split('/')[2]; } @@ -353,16 +353,16 @@ class MatrixState extends State with WidgetsBindingObserver { ); if (state != LoginState.loggedIn) { - FluffyChatApp.router.go('/rooms'); + TwakeApp.router.go('/rooms'); } } else { if (state == LoginState.loggedIn) { Logs().v('[MATRIX] Log in successful'); setUpToMServicesInLogin(c); - FluffyChatApp.router.go('/rooms'); + TwakeApp.router.go('/rooms'); } else { Logs().v('[MATRIX] Log out successful'); - FluffyChatApp.router.go('/home'); + TwakeApp.router.go('/home'); } } }); diff --git a/lib/widgets/mixins/popup_menu_widget_mixin.dart b/lib/widgets/mixins/popup_menu_widget_mixin.dart index ee36721e74..cdb08eaee3 100644 --- a/lib/widgets/mixins/popup_menu_widget_mixin.dart +++ b/lib/widgets/mixins/popup_menu_widget_mixin.dart @@ -1,4 +1,4 @@ -import 'package:fluffychat/widgets/fluffy_chat_app.dart'; +import 'package:fluffychat/widgets/twake_app.dart'; import 'package:fluffychat/widgets/twake_components/twake_icon_button.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; @@ -20,7 +20,7 @@ mixin PopupMenuWidgetMixin { onTap: () { /// Pop the current page, snackbar, dialog or bottomsheet in the stack /// will close the currently open snackbar/dialog/bottomsheet AND the current page - FluffyChatApp.router.routerDelegate.pop(); + TwakeApp.router.routerDelegate.pop(); onCallbackAction!.call(); }, diff --git a/lib/widgets/fluffy_chat_app.dart b/lib/widgets/twake_app.dart similarity index 90% rename from lib/widgets/fluffy_chat_app.dart rename to lib/widgets/twake_app.dart index 9b1d01ca73..019c040dea 100644 --- a/lib/widgets/fluffy_chat_app.dart +++ b/lib/widgets/twake_app.dart @@ -12,12 +12,12 @@ import '../config/app_config.dart'; import '../utils/custom_scroll_behaviour.dart'; import 'matrix.dart'; -class FluffyChatApp extends StatefulWidget { +class TwakeApp extends StatefulWidget { final Widget? testWidget; final List clients; static GlobalKey routerKey = GlobalKey(); - const FluffyChatApp({ + const TwakeApp({ Key? key, this.testWidget, required this.clients, @@ -36,10 +36,10 @@ class FluffyChatApp extends StatefulWidget { ); @override - FluffyChatAppState createState() => FluffyChatAppState(); + TwakeAppState createState() => TwakeAppState(); } -class FluffyChatAppState extends State { +class TwakeAppState extends State { final networkConnectionService = getIt.get(); @override @@ -67,7 +67,7 @@ class FluffyChatAppState extends State { scrollBehavior: CustomScrollBehavior(), localizationsDelegates: L10n.localizationsDelegates, supportedLocales: L10n.supportedLocales, - routerConfig: FluffyChatApp.router, + routerConfig: TwakeApp.router, builder: (context, child) => Matrix( clients: widget.clients, child: child,