From b83e092e4705ef7a318891c58a910c8d322abe1c Mon Sep 17 00:00:00 2001 From: dab246 Date: Thu, 12 Dec 2024 15:51:03 +0700 Subject: [PATCH] TF-3290 Only show reconnection confirm dialog when composer is opened --- lib/features/base/base_controller.dart | 76 ++++++++++--------- .../mailbox_dashboard_controller.dart | 4 + lib/l10n/intl_messages.arb | 10 +-- lib/main.dart | 3 + lib/main/bindings/core/core_bindings.dart | 2 + lib/main/localizations/app_localizations.dart | 15 ++-- lib/main/utils/twake_app_manager.dart | 20 +++++ test/features/base/base_controller_test.dart | 5 ++ .../composer_controller_test.dart | 5 ++ .../single_email_controller_test.dart | 4 + .../presentation/home_controller_test.dart | 5 ++ .../identity_creator_controller_test.dart | 5 ++ .../presentation/login_controller_test.dart | 5 ++ .../advanced_filter_controller_test.dart | 5 ++ .../mailbox_dashboard_controller_test.dart | 4 + .../mailbox_dashboard_view_widget_test.dart | 4 + .../identities_controller_test.dart | 5 ++ .../rule_filter_creator_controller_test.dart | 5 ++ .../controller/thread_controller_test.dart | 5 ++ 19 files changed, 139 insertions(+), 48 deletions(-) create mode 100644 lib/main/utils/twake_app_manager.dart diff --git a/lib/features/base/base_controller.dart b/lib/features/base/base_controller.dart index 4682df3935..2a7998c22f 100644 --- a/lib/features/base/base_controller.dart +++ b/lib/features/base/base_controller.dart @@ -60,6 +60,7 @@ import 'package:tmail_ui_user/main/routes/route_navigation.dart'; import 'package:tmail_ui_user/main/utils/app_config.dart'; import 'package:tmail_ui_user/main/universal_import/html_stub.dart' as html; import 'package:tmail_ui_user/main/utils/toast_manager.dart'; +import 'package:tmail_ui_user/main/utils/twake_app_manager.dart'; import 'package:uuid/uuid.dart'; abstract class BaseController extends GetxController @@ -81,6 +82,7 @@ abstract class BaseController extends GetxController final Uuid uuid = Get.find(); final ApplicationManager applicationManager = Get.find(); final ToastManager toastManager = Get.find(); + final TwakeAppManager twakeAppManager = Get.find(); bool _isFcmEnabled = false; @@ -218,45 +220,51 @@ abstract class BaseController extends GetxController } void _handleBadCredentialsException() { - if (PlatformInfo.isWeb) { - if (currentContext == null) { - _executeBeforeReconnectAndLogOut(); - return; - } + log('$runtimeType::_handleBadCredentialsException:'); + if (!twakeAppManager.isComposerOpened) { + _performReconnection(); + return; + } - showConfirmDialogAction( - currentContext!, - AppLocalizations.of(currentContext!).dialogMessageSessionHasExpired, - AppLocalizations.of(currentContext!).reconnect, - title: AppLocalizations.of(currentContext!).sessionExpired, - alignCenter: true, - outsideDismissible: false, - titleActionButtonMaxLines: 1, - icon: SvgPicture.asset(imagePaths.icTMailLogo, width: 64, height: 64), - onConfirmAction: _executeBeforeReconnectAndLogOut, - onCancelAction: onCancelReconnectWhenSessionExpired - ); - } else if (PlatformInfo.isMobile) { - if (currentContext == null) { - clearDataAndGoToLoginPage(); - return; - } + if (currentContext == null) { + _performSaveAndReconnection(); + return; + } - showConfirmDialogAction( - currentContext!, - AppLocalizations.of(currentContext!).dialogMessageSessionHasExpired, - AppLocalizations.of(currentContext!).reconnect, - title: AppLocalizations.of(currentContext!).sessionExpired, - alignCenter: true, - outsideDismissible: false, - titleActionButtonMaxLines: 1, - icon: SvgPicture.asset(imagePaths.icTMailLogo, width: 64, height: 64), - onConfirmAction: clearDataAndGoToLoginPage, - onCancelAction: onCancelReconnectWhenSessionExpired - ); + final appLocalizations = AppLocalizations.of(currentContext!); + showConfirmDialogAction( + currentContext!, + appLocalizations.messageWarningDialogWhenExpiredOIDCTokenAndReconnection, + appLocalizations.saveAndRefresh, + title: appLocalizations.sessionExpired, + cancelTitle: appLocalizations.no, + alignCenter: true, + outsideDismissible: false, + titleActionButtonMaxLines: 1, + marginIcon: EdgeInsetsDirectional.zero, + icon: SvgPicture.asset(imagePaths.icTMailLogo, width: 64, height: 64), + onConfirmAction: _performSaveAndReconnection, + onCancelAction: _performReconnection, + onCloseButtonAction: _performCloseReconnectionConfirmDialog + ); + } + + void _performSaveAndReconnection() { + if (PlatformInfo.isWeb) { + _executeBeforeReconnectAndLogOut(); + } else if (PlatformInfo.isMobile) { + clearDataAndGoToLoginPage(); } } + void _performReconnection() { + clearDataAndGoToLoginPage(); + } + + void _performCloseReconnectionConfirmDialog() { + popBack(); + } + void onDataFailureViewState(Failure failure) { if (failure is FeatureFailure) { final isUrgentException = validateUrgentException(failure.exception); diff --git a/lib/features/mailbox_dashboard/presentation/controller/mailbox_dashboard_controller.dart b/lib/features/mailbox_dashboard/presentation/controller/mailbox_dashboard_controller.dart index 9595dd6c52..1915e8863b 100644 --- a/lib/features/mailbox_dashboard/presentation/controller/mailbox_dashboard_controller.dart +++ b/lib/features/mailbox_dashboard/presentation/controller/mailbox_dashboard_controller.dart @@ -432,6 +432,7 @@ class MailboxDashBoardController extends ReloadableController } else if (success is GetAllIdentitiesSuccess) { _handleGetAllIdentitiesSuccess(success); } else if (success is GetComposerCacheSuccess) { + _removeComposerCacheOnWeb(); goToComposer(ComposerArguments.fromSessionStorageBrowser(success.composerCache)); } else if (success is GetIdentityCacheOnWebSuccess) { goToSettings(); @@ -1677,12 +1678,14 @@ class MailboxDashBoardController extends ReloadableController composerArguments = arguments; ComposerBindings().dependencies(); composerOverlayState.value = ComposerOverlayState.active; + twakeAppManager.openComposerOnWeb(); } void closeComposerOverlay({dynamic result}) async { composerArguments = null; ComposerBindings().dispose(); composerOverlayState.value = ComposerOverlayState.inActive; + twakeAppManager.closeComposerOnWeb(); if (result is SendingEmailArguments) { handleSendEmailAction(result); } else if (result is SendEmailSuccess || @@ -3240,6 +3243,7 @@ class MailboxDashBoardController extends ReloadableController WebSocketController.instance.onClose(); _currentEmailState = null; _isFirstSessionLoad = false; + twakeAppManager.closeComposerOnWeb(); super.onClose(); } } \ No newline at end of file diff --git a/lib/l10n/intl_messages.arb b/lib/l10n/intl_messages.arb index a566a956b1..3d784abb2f 100644 --- a/lib/l10n/intl_messages.arb +++ b/lib/l10n/intl_messages.arb @@ -1,5 +1,5 @@ { - "@@last_modified": "2024-12-09T13:59:58.460897", + "@@last_modified": "2024-12-12T15:50:46.911821", "initializing_data": "Initializing data...", "@initializing_data": { "type": "text", @@ -3968,12 +3968,6 @@ "placeholders_order": [], "placeholders": {} }, - "dialogMessageSessionHasExpired": "The current session has expired. Please reconnect to the server", - "@dialogMessageSessionHasExpired": { - "type": "text", - "placeholders_order": [], - "placeholders": {} - }, "sMimeGoodSignatureMessage": "The authenticity of this message had been verified with SMime signature.", "@sMimeGoodSignatureMessage": { "type": "text", @@ -4174,6 +4168,8 @@ }, "editAsNewEmail": "Edit as new email", "@editAsNewEmail": { + "messageWarningDialogWhenExpiredOIDCTokenAndReconnection": "Your session expired. We need to take you back to the login page in order to refresh it. You might want to save the email you are currently editing before we do so.", + "@messageWarningDialogWhenExpiredOIDCTokenAndReconnection": { "type": "text", "placeholders_order": [], "placeholders": {} diff --git a/lib/main.dart b/lib/main.dart index af3d00786e..8c81723522 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -16,6 +16,7 @@ import 'package:tmail_ui_user/main/pages/app_pages.dart'; import 'package:tmail_ui_user/main/routes/app_routes.dart'; import 'package:tmail_ui_user/main/routes/route_navigation.dart'; import 'package:tmail_ui_user/main/utils/app_utils.dart'; +import 'package:tmail_ui_user/main/utils/twake_app_manager.dart'; import 'package:url_strategy/url_strategy.dart'; import 'package:worker_manager/worker_manager.dart'; @@ -52,6 +53,7 @@ class TMailApp extends StatefulWidget { class _TMailAppState extends State { DeepLinksManager? _deepLinksManager; + final TwakeAppManager _twakeAppManager = Get.find(); @override void initState() { @@ -105,6 +107,7 @@ class _TMailAppState extends State { if (PlatformInfo.isMobile) { _deepLinksManager?.dispose(); } + _twakeAppManager.dispose(); super.dispose(); } } \ No newline at end of file diff --git a/lib/main/bindings/core/core_bindings.dart b/lib/main/bindings/core/core_bindings.dart index c932c96ba2..d929d2ff7b 100644 --- a/lib/main/bindings/core/core_bindings.dart +++ b/lib/main/bindings/core/core_bindings.dart @@ -21,6 +21,7 @@ import 'package:tmail_ui_user/main/utils/app_config.dart'; import 'package:tmail_ui_user/main/utils/email_receive_manager.dart'; import 'package:tmail_ui_user/main/utils/ios_notification_manager.dart'; import 'package:tmail_ui_user/main/utils/toast_manager.dart'; +import 'package:tmail_ui_user/main/utils/twake_app_manager.dart'; import 'package:uuid/uuid.dart'; class CoreBindings extends Bindings { @@ -76,6 +77,7 @@ class CoreBindings extends Bindings { Get.put(IOSNotificationManager()); } Get.put(PreviewEmlFileUtils()); + Get.put(TwakeAppManager()); } void _bindingIsolate() { diff --git a/lib/main/localizations/app_localizations.dart b/lib/main/localizations/app_localizations.dart index 782d6877bc..43dde4fb03 100644 --- a/lib/main/localizations/app_localizations.dart +++ b/lib/main/localizations/app_localizations.dart @@ -4149,13 +4149,6 @@ class AppLocalizations { ); } - String get dialogMessageSessionHasExpired { - return Intl.message( - 'The current session has expired. Please reconnect to the server', - name: 'dialogMessageSessionHasExpired', - ); - } - String get sMimeGoodSignatureMessage { return Intl.message( 'The authenticity of this message had been verified with SMime signature.', @@ -4343,6 +4336,14 @@ class AppLocalizations { ); } + String get messageWarningDialogWhenExpiredOIDCTokenAndReconnection { + return Intl.message( + 'Your session expired. We need to take you back to the login page in order to refresh it. You might want to save the email you are currently editing before we do so.', + name: 'messageWarningDialogWhenExpiredOIDCTokenAndReconnection', + ); + } + + String get replyToList { return Intl.message( 'Reply to list', diff --git a/lib/main/utils/twake_app_manager.dart b/lib/main/utils/twake_app_manager.dart new file mode 100644 index 0000000000..8c8c2fd978 --- /dev/null +++ b/lib/main/utils/twake_app_manager.dart @@ -0,0 +1,20 @@ +import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/model/composer_overlay_state.dart'; + +class TwakeAppManager { + ComposerOverlayState? _composerOverlayState; + + void openComposerOnWeb() => + _composerOverlayState = ComposerOverlayState.active; + + void closeComposerOnWeb() { + _composerOverlayState = ComposerOverlayState.inActive; + _composerOverlayState = null; + } + + bool get isComposerOpened => + _composerOverlayState == ComposerOverlayState.active; + + void dispose() { + _composerOverlayState = null; + } +} diff --git a/test/features/base/base_controller_test.dart b/test/features/base/base_controller_test.dart index 43449553ff..533e3d61a0 100644 --- a/test/features/base/base_controller_test.dart +++ b/test/features/base/base_controller_test.dart @@ -26,6 +26,7 @@ import 'package:tmail_ui_user/main/bindings/network/binding_tag.dart'; import 'package:tmail_ui_user/main/exceptions/remote_exception.dart'; import 'package:tmail_ui_user/main/utils/app_config.dart'; import 'package:tmail_ui_user/main/utils/toast_manager.dart'; +import 'package:tmail_ui_user/main/utils/twake_app_manager.dart'; import 'package:uuid/uuid.dart'; import '../../fixtures/account_fixtures.dart'; @@ -70,6 +71,7 @@ class SomeOtherException extends RemoteException {} MockSpec(), MockSpec(), MockSpec(), + MockSpec(), ]) void main() { TestWidgetsFlutterBinding.ensureInitialized(); @@ -88,6 +90,7 @@ void main() { late MockUuid mockUuid; late MockApplicationManager mockApplicationManager; late MockToastManager mockToastManager; + late MockTwakeAppManager mockTwakeAppManager; setUpAll(() { mockCachingManager = MockCachingManager(); @@ -103,6 +106,7 @@ void main() { mockUuid = MockUuid(); mockApplicationManager = MockApplicationManager(); mockToastManager = MockToastManager(); + mockTwakeAppManager = MockTwakeAppManager(); Get.put(mockCachingManager); Get.put(mockLanguageCacheManager); @@ -121,6 +125,7 @@ void main() { Get.put(mockUuid); Get.put(mockApplicationManager); Get.put(mockToastManager); + Get.put(mockTwakeAppManager); Get.testMode = true; mockBaseController = MockBaseController(); diff --git a/test/features/composer/presentation/composer_controller_test.dart b/test/features/composer/presentation/composer_controller_test.dart index f23ec0d1b8..307fe21565 100644 --- a/test/features/composer/presentation/composer_controller_test.dart +++ b/test/features/composer/presentation/composer_controller_test.dart @@ -68,6 +68,7 @@ import 'package:tmail_ui_user/main/bindings/network/binding_tag.dart'; import 'package:tmail_ui_user/main/exceptions/cache_exception_thrower.dart'; import 'package:tmail_ui_user/main/utils/app_config.dart'; import 'package:tmail_ui_user/main/utils/toast_manager.dart'; +import 'package:tmail_ui_user/main/utils/twake_app_manager.dart'; import 'package:uuid/uuid.dart'; import '../../../fixtures/account_fixtures.dart'; @@ -143,6 +144,7 @@ class MockMailboxDashBoardController extends Mock implements MailboxDashBoardCon MockSpec(), MockSpec(), MockSpec(), + MockSpec(), // Composer controller mock specs MockSpec(), @@ -184,6 +186,7 @@ void main() { late MockUuid mockUuid; late MockApplicationManager mockApplicationManager; late MockToastManager mockToastManager; + late MockTwakeAppManager mockTwakeAppManager; // Declaration composer controller late ComposerController? composerController; @@ -226,6 +229,7 @@ void main() { mockUuid = MockUuid(); mockApplicationManager = MockApplicationManager(); mockToastManager = MockToastManager(); + mockTwakeAppManager = MockTwakeAppManager(); Get.put(mockCachingManager); Get.put(mockLanguageCacheManager); @@ -244,6 +248,7 @@ void main() { Get.put(mockUuid); Get.put(mockApplicationManager); Get.put(mockToastManager); + Get.put(mockTwakeAppManager); // Mock Getx controllers Get.put(mockMailboxDashBoardController); diff --git a/test/features/email/presentation/controller/single_email_controller_test.dart b/test/features/email/presentation/controller/single_email_controller_test.dart index 093013f058..9851ded043 100644 --- a/test/features/email/presentation/controller/single_email_controller_test.dart +++ b/test/features/email/presentation/controller/single_email_controller_test.dart @@ -59,6 +59,7 @@ import 'package:tmail_ui_user/features/manage_account/domain/usecases/log_out_oi import 'package:tmail_ui_user/main/bindings/network/binding_tag.dart'; import 'package:tmail_ui_user/main/exceptions/cache_exception_thrower.dart'; import 'package:tmail_ui_user/main/utils/toast_manager.dart'; +import 'package:tmail_ui_user/main/utils/twake_app_manager.dart'; import 'package:uuid/uuid.dart'; import '../../../../fixtures/account_fixtures.dart'; @@ -109,6 +110,7 @@ const fallbackGenerators = { MockSpec(), MockSpec(), MockSpec(), + MockSpec(), ]) void main() { TestWidgetsFlutterBinding.ensureInitialized(); @@ -146,6 +148,7 @@ void main() { final applicationManager = MockApplicationManager(); final mockToastManager = MockToastManager(); final getHtmlContentFromAttachmentInteractor = MockGetHtmlContentFromAttachmentInteractor(); + final mockTwakeAppManager = MockTwakeAppManager(); late SingleEmailController singleEmailController; @@ -181,6 +184,7 @@ void main() { Get.put(printUtils); Get.put(applicationManager); Get.put(mockToastManager); + Get.put(mockTwakeAppManager); when(mailboxDashboardController.accountId).thenReturn(Rxn(testAccountId)); when(uuid.v4()).thenReturn(testTaskId); diff --git a/test/features/home/presentation/home_controller_test.dart b/test/features/home/presentation/home_controller_test.dart index 86328dae1c..874cd284d5 100644 --- a/test/features/home/presentation/home_controller_test.dart +++ b/test/features/home/presentation/home_controller_test.dart @@ -29,6 +29,7 @@ import 'package:tmail_ui_user/features/manage_account/domain/usecases/log_out_oi import 'package:tmail_ui_user/main/bindings/network/binding_tag.dart'; import 'package:tmail_ui_user/main/utils/email_receive_manager.dart'; import 'package:tmail_ui_user/main/utils/toast_manager.dart'; +import 'package:tmail_ui_user/main/utils/twake_app_manager.dart'; import 'package:uuid/uuid.dart'; import 'home_controller_test.mocks.dart'; @@ -55,6 +56,7 @@ import 'home_controller_test.mocks.dart'; MockSpec(), MockSpec(), MockSpec(), + MockSpec(), ]) void main() { TestWidgetsFlutterBinding.ensureInitialized(); @@ -83,6 +85,7 @@ void main() { late MockUuid mockUuid; late MockApplicationManager mockApplicationManager; late MockToastManager mockToastManager; + late MockTwakeAppManager mockTwakeAppManager; setUpAll(() { cleanupEmailCacheInteractor = MockCleanupEmailCacheInteractor(); @@ -110,6 +113,7 @@ void main() { mockUuid = MockUuid(); mockApplicationManager = MockApplicationManager(); mockToastManager = MockToastManager(); + mockTwakeAppManager = MockTwakeAppManager(); Get.put(mockGetSessionInteractor); Get.put(mockGetAuthenticatedAccountInteractor); @@ -132,6 +136,7 @@ void main() { Get.put(mockUuid); Get.put(mockApplicationManager); Get.put(mockToastManager); + Get.put(mockTwakeAppManager); Get.testMode = true; homeController = HomeController( diff --git a/test/features/identity_creator/presentation/identity_creator_controller_test.dart b/test/features/identity_creator/presentation/identity_creator_controller_test.dart index 2040407d43..86977d7636 100644 --- a/test/features/identity_creator/presentation/identity_creator_controller_test.dart +++ b/test/features/identity_creator/presentation/identity_creator_controller_test.dart @@ -49,6 +49,7 @@ import 'package:tmail_ui_user/main/bindings/network/binding_tag.dart'; import 'package:tmail_ui_user/main/exceptions/remote_exception_thrower.dart'; import 'package:tmail_ui_user/main/universal_import/html_stub.dart'; import 'package:tmail_ui_user/main/utils/toast_manager.dart'; +import 'package:tmail_ui_user/main/utils/twake_app_manager.dart'; import 'package:uuid/uuid.dart'; import 'package:worker_manager/worker_manager.dart'; @@ -69,6 +70,7 @@ import 'identity_creator_controller_test.mocks.dart'; MockSpec(), MockSpec(), MockSpec(), + MockSpec(), // Identity creator controller mockspecs MockSpec(), MockSpec(), @@ -113,6 +115,7 @@ void main() { late MockUuid mockUuid; late MockApplicationManager mockApplicationManager; late MockToastManager mockToastManager; + late MockTwakeAppManager mockTwakeAppManager; setUpAll(() { //mock base controller @@ -129,6 +132,7 @@ void main() { mockUuid = MockUuid(); mockApplicationManager = MockApplicationManager(); mockToastManager = MockToastManager(); + mockTwakeAppManager = MockTwakeAppManager(); Get.put(mockCachingManager); Get.put(mockLanguageCacheManager); @@ -147,6 +151,7 @@ void main() { Get.put(mockUuid); Get.put(mockApplicationManager); Get.put(mockToastManager); + Get.put(mockTwakeAppManager); //mock identity creator controller mockVerifyNameInteractor = MockVerifyNameInteractor(); diff --git a/test/features/login/presentation/login_controller_test.dart b/test/features/login/presentation/login_controller_test.dart index f30e210f2e..49424fc912 100644 --- a/test/features/login/presentation/login_controller_test.dart +++ b/test/features/login/presentation/login_controller_test.dart @@ -36,6 +36,7 @@ import 'package:tmail_ui_user/features/manage_account/domain/usecases/log_out_oi import 'package:tmail_ui_user/features/starting_page/domain/usecase/sign_in_twake_workplace_interactor.dart'; import 'package:tmail_ui_user/main/bindings/network/binding_tag.dart'; import 'package:tmail_ui_user/main/utils/toast_manager.dart'; +import 'package:tmail_ui_user/main/utils/twake_app_manager.dart'; import 'package:uuid/uuid.dart'; import 'login_controller_test.mocks.dart'; @@ -71,6 +72,7 @@ import 'login_controller_test.mocks.dart'; MockSpec(), MockSpec(), MockSpec(), + MockSpec(), ]) void main() { late MockAuthenticationInteractor mockAuthenticationInteractor; @@ -103,6 +105,7 @@ void main() { late MockUuid mockUuid; late MockApplicationManager mockApplicationManager; late MockToastManager mockToastManager; + late MockTwakeAppManager mockTwakeAppManager; late LoginController loginController; @@ -142,6 +145,7 @@ void main() { mockUuid = MockUuid(); mockApplicationManager = MockApplicationManager(); mockToastManager = MockToastManager(); + mockTwakeAppManager = MockTwakeAppManager(); Get.put(mockGetSessionInteractor); Get.put(mockGetAuthenticatedAccountInteractor); @@ -163,6 +167,7 @@ void main() { Get.put(mockUuid); Get.put(mockApplicationManager); Get.put(mockToastManager); + Get.put(mockTwakeAppManager); Get.testMode = true; loginController = LoginController( diff --git a/test/features/mailbox_dashboard/presentation/controller/advanced_filter_controller_test.dart b/test/features/mailbox_dashboard/presentation/controller/advanced_filter_controller_test.dart index 17c352f960..efc8237948 100644 --- a/test/features/mailbox_dashboard/presentation/controller/advanced_filter_controller_test.dart +++ b/test/features/mailbox_dashboard/presentation/controller/advanced_filter_controller_test.dart @@ -32,6 +32,7 @@ import 'package:tmail_ui_user/features/manage_account/domain/usecases/log_out_oi import 'package:tmail_ui_user/features/thread/domain/model/search_query.dart'; import 'package:tmail_ui_user/main/bindings/network/binding_tag.dart'; import 'package:tmail_ui_user/main/utils/toast_manager.dart'; +import 'package:tmail_ui_user/main/utils/twake_app_manager.dart'; import 'package:uuid/uuid.dart'; import 'advanced_filter_controller_test.mocks.dart'; @@ -57,6 +58,7 @@ const fallbackGenerators = { MockSpec(), MockSpec(), MockSpec(), + MockSpec(), // Advanced filter controller mock specs MockSpec(fallbackGenerators: fallbackGenerators), MockSpec(), @@ -93,6 +95,7 @@ void main() { late MockUuid mockUuid; late MockApplicationManager mockApplicationManager; late MockToastManager mockToastManager; + late MockTwakeAppManager mockTwakeAppManager; setUpAll(() { Get.testMode = true; @@ -110,6 +113,7 @@ void main() { mockUuid = MockUuid(); mockApplicationManager = MockApplicationManager(); mockToastManager = MockToastManager(); + mockTwakeAppManager = MockTwakeAppManager(); Get.put(mockCachingManager); Get.put(mockLanguageCacheManager); @@ -128,6 +132,7 @@ void main() { Get.put(mockUuid); Get.put(mockApplicationManager); Get.put(mockToastManager); + Get.put(mockTwakeAppManager); // Mock search controller mockQuickSearchEmailInteractor = MockQuickSearchEmailInteractor(); diff --git a/test/features/mailbox_dashboard/presentation/controller/mailbox_dashboard_controller_test.dart b/test/features/mailbox_dashboard/presentation/controller/mailbox_dashboard_controller_test.dart index 474d493b2e..3f1031f3bf 100644 --- a/test/features/mailbox_dashboard/presentation/controller/mailbox_dashboard_controller_test.dart +++ b/test/features/mailbox_dashboard/presentation/controller/mailbox_dashboard_controller_test.dart @@ -93,6 +93,7 @@ import 'package:tmail_ui_user/main/utils/email_receive_manager.dart'; import 'package:tmail_ui_user/features/network_connection/presentation/network_connection_controller.dart' if (dart.library.html) 'package:tmail_ui_user/features/network_connection/presentation/web_network_connection_controller.dart'; import 'package:tmail_ui_user/main/utils/toast_manager.dart'; +import 'package:tmail_ui_user/main/utils/twake_app_manager.dart'; import 'package:uuid/uuid.dart'; import 'mailbox_dashboard_controller_test.mocks.dart'; @@ -170,6 +171,7 @@ const fallbackGenerators = { MockSpec(), MockSpec(), MockSpec(), + MockSpec(), MockSpec(), MockSpec(), ]) @@ -235,6 +237,7 @@ void main() { final uuid = MockUuid(); final applicationManager = MockApplicationManager(); final mockToastManager = MockToastManager(); + final mockTwakeAppManager = MockTwakeAppManager(); // mock reloadable controller Get dependencies final getSessionInteractor = MockGetSessionInteractor(); @@ -300,6 +303,7 @@ void main() { Get.put(uuid); Get.put(applicationManager); Get.put(mockToastManager); + Get.put(mockTwakeAppManager); Get.put(getSessionInteractor); Get.put(getAuthenticatedAccountInteractor); Get.put(updateAccountCacheInteractor); diff --git a/test/features/mailbox_dashboard/presentation/view/mailbox_dashboard_view_widget_test.dart b/test/features/mailbox_dashboard/presentation/view/mailbox_dashboard_view_widget_test.dart index 910f68bc9f..2b2e77e41b 100644 --- a/test/features/mailbox_dashboard/presentation/view/mailbox_dashboard_view_widget_test.dart +++ b/test/features/mailbox_dashboard/presentation/view/mailbox_dashboard_view_widget_test.dart @@ -94,6 +94,7 @@ import 'package:tmail_ui_user/main/localizations/app_localizations_delegate.dart import 'package:tmail_ui_user/main/localizations/localization_service.dart'; import 'package:tmail_ui_user/main/utils/email_receive_manager.dart'; import 'package:tmail_ui_user/main/utils/toast_manager.dart'; +import 'package:tmail_ui_user/main/utils/twake_app_manager.dart'; import 'package:uuid/uuid.dart'; import '../../../../fixtures/account_fixtures.dart'; @@ -175,6 +176,7 @@ const fallbackGenerators = { MockSpec(), MockSpec(), MockSpec(), + MockSpec(), MockSpec(), ]) void main() { @@ -222,6 +224,7 @@ void main() { final deleteAuthorityOidcInteractor = MockDeleteAuthorityOidcInteractor(); final appToast = MockAppToast(); final toastManager = MockToastManager(); + final mockTwakeAppManager = MockTwakeAppManager(); final imagePaths = ImagePaths(); final responsiveUtils = MockResponsiveUtils(); final uuid = MockUuid(); @@ -296,6 +299,7 @@ void main() { Get.put(deleteAuthorityOidcInteractor); Get.put(appToast); Get.put(toastManager); + Get.put(mockTwakeAppManager); Get.put(imagePaths); Get.put(responsiveUtils); Get.put(uuid); diff --git a/test/features/manage_account/presentation/profiles/identities/identities_controller_test.dart b/test/features/manage_account/presentation/profiles/identities/identities_controller_test.dart index d185c0c3e7..8c6e3eb2dc 100644 --- a/test/features/manage_account/presentation/profiles/identities/identities_controller_test.dart +++ b/test/features/manage_account/presentation/profiles/identities/identities_controller_test.dart @@ -39,6 +39,7 @@ import 'package:tmail_ui_user/features/public_asset/domain/usecase/remove_identi import 'package:tmail_ui_user/features/public_asset/presentation/clean_up_public_assets_interactor_bindings.dart'; import 'package:tmail_ui_user/main/bindings/network/binding_tag.dart'; import 'package:tmail_ui_user/main/utils/toast_manager.dart'; +import 'package:tmail_ui_user/main/utils/twake_app_manager.dart'; import 'package:uuid/uuid.dart'; import '../../../../../fixtures/session_fixtures.dart'; @@ -65,6 +66,7 @@ const fallbackGenerators = { MockSpec(), MockSpec(), MockSpec(), + MockSpec(), // Reloadable controller mockspecs MockSpec(), @@ -109,6 +111,7 @@ void main() { late MockUuid mockUuid; late MockApplicationManager mockApplicationManager; late MockToastManager mockToastManager; + late MockTwakeAppManager mockTwakeAppManager; late MockSaveIdentityCacheOnWebInteractor mockSaveIdentityCacheOnWebInteractor; @@ -127,6 +130,7 @@ void main() { mockUuid = MockUuid(); mockApplicationManager = MockApplicationManager(); mockToastManager = MockToastManager(); + mockTwakeAppManager = MockTwakeAppManager(); mockSaveIdentityCacheOnWebInteractor = MockSaveIdentityCacheOnWebInteractor(); @@ -147,6 +151,7 @@ void main() { Get.put(mockUuid); Get.put(mockApplicationManager); Get.put(mockToastManager); + Get.put(mockTwakeAppManager); // mock reloadable controller Get.put(MockGetSessionInteractor()); diff --git a/test/features/rule_filter_creator/presentation/rule_filter_creator_controller_test.dart b/test/features/rule_filter_creator/presentation/rule_filter_creator_controller_test.dart index 9f91147e15..fd4556812e 100644 --- a/test/features/rule_filter_creator/presentation/rule_filter_creator_controller_test.dart +++ b/test/features/rule_filter_creator/presentation/rule_filter_creator_controller_test.dart @@ -48,6 +48,7 @@ import 'package:tmail_ui_user/features/rules_filter_creator/presentation/rules_f import 'package:tmail_ui_user/features/rules_filter_creator/presentation/widgets/rule_filter_action_widget.dart'; import 'package:tmail_ui_user/main/bindings/network/binding_tag.dart'; import 'package:tmail_ui_user/main/utils/toast_manager.dart'; +import 'package:tmail_ui_user/main/utils/twake_app_manager.dart'; import 'package:uuid/uuid.dart'; import '../../../fixtures/widget_fixtures.dart'; @@ -67,6 +68,7 @@ import 'rule_filter_creator_controller_test.mocks.dart'; MockSpec(), MockSpec(), MockSpec(), + MockSpec(), // Rule filter creator controller mock specs MockSpec(), MockSpec(), @@ -95,6 +97,7 @@ void main() { late MockUuid mockUuid; late MockApplicationManager mockApplicationManager; late MockToastManager mockToastManager; + late MockTwakeAppManager mockTwakeAppManager; setUpAll(() { Get.testMode = true; @@ -113,6 +116,7 @@ void main() { mockUuid = MockUuid(); mockApplicationManager = MockApplicationManager(); mockToastManager = MockToastManager(); + mockTwakeAppManager = MockTwakeAppManager(); Get.put(mockCachingManager); Get.put(mockLanguageCacheManager); @@ -131,6 +135,7 @@ void main() { Get.put(mockUuid); Get.put(mockApplicationManager); Get.put(mockToastManager); + Get.put(mockTwakeAppManager); // Mock rule filter creator controller mockTreeBuilder = MockTreeBuilder(); diff --git a/test/features/thread/presentation/controller/thread_controller_test.dart b/test/features/thread/presentation/controller/thread_controller_test.dart index acc30367d7..091aec8d47 100644 --- a/test/features/thread/presentation/controller/thread_controller_test.dart +++ b/test/features/thread/presentation/controller/thread_controller_test.dart @@ -48,6 +48,7 @@ import 'package:tmail_ui_user/features/thread/presentation/model/search_status.d import 'package:tmail_ui_user/features/thread/presentation/thread_controller.dart'; import 'package:tmail_ui_user/main/bindings/network/binding_tag.dart'; import 'package:tmail_ui_user/main/utils/toast_manager.dart'; +import 'package:tmail_ui_user/main/utils/twake_app_manager.dart'; import 'package:uuid/uuid.dart'; import '../../../../fixtures/account_fixtures.dart'; @@ -75,6 +76,7 @@ const fallbackGenerators = { MockSpec(), MockSpec(), MockSpec(), + MockSpec(), // Thread controller mock specs MockSpec(fallbackGenerators: fallbackGenerators), MockSpec(fallbackGenerators: fallbackGenerators), @@ -115,6 +117,7 @@ void main() { late MockUuid mockUuid; late MockApplicationManager mockApplicationManager; late MockToastManager mockToastManager; + late MockTwakeAppManager mockTwakeAppManager; setUpAll(() { Get.testMode = true; @@ -132,6 +135,7 @@ void main() { mockUuid = MockUuid(); mockApplicationManager = MockApplicationManager(); mockToastManager = MockToastManager(); + mockTwakeAppManager = MockTwakeAppManager(); Get.put(mockCachingManager); Get.put(mockLanguageCacheManager); @@ -150,6 +154,7 @@ void main() { Get.put(mockUuid); Get.put(mockApplicationManager); Get.put(mockToastManager); + Get.put(mockTwakeAppManager); // Mock thread controller mockNetworkConnectionController = MockNetworkConnectionController();