diff --git a/lib/features/base/base_controller.dart b/lib/features/base/base_controller.dart index 7db92437f4..f6997f517a 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 ed3315248e..7a7d389dc4 100644 --- a/lib/features/mailbox_dashboard/presentation/controller/mailbox_dashboard_controller.dart +++ b/lib/features/mailbox_dashboard/presentation/controller/mailbox_dashboard_controller.dart @@ -427,6 +427,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(); @@ -1671,12 +1672,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 || @@ -3225,6 +3228,7 @@ class MailboxDashBoardController extends ReloadableController mapDefaultMailboxIdByRole = {}; WebSocketController.instance.onClose(); _currentEmailState = null; + 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 8c1c44a376..872b3c5611 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", @@ -2930,12 +2930,6 @@ "placeholders_order": [], "placeholders": {} }, - "errorWhileFetchingSubaddress": "Error while fetching the subaddress", - "@errorWhileFetchingSubaddress": { - "type": "text", - "placeholders_order": [], - "placeholders": {} - }, "connectedToTheInternet": "Connected to the internet", "@connectedToTheInternet": { "type": "text", @@ -4038,12 +4032,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", @@ -4211,5 +4199,17 @@ "type": "text", "placeholders_order": [], "placeholders": {} + }, + "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": {} + }, + "saveAndRefresh": "Save & refresh", + "@saveAndRefresh": { + "type": "text", + "placeholders_order": [], + "placeholders": {} } } \ No newline at end of file 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 9725bac0d5..b220c3e363 100644 --- a/lib/main/bindings/core/core_bindings.dart +++ b/lib/main/bindings/core/core_bindings.dart @@ -18,6 +18,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 { @@ -72,6 +73,7 @@ class CoreBindings extends Bindings { if (PlatformInfo.isIOS) { Get.put(IOSNotificationManager()); } + Get.put(TwakeAppManager()); } void _bindingIsolate() { diff --git a/lib/main/localizations/app_localizations.dart b/lib/main/localizations/app_localizations.dart index b61f9ff835..6d1666dfbc 100644 --- a/lib/main/localizations/app_localizations.dart +++ b/lib/main/localizations/app_localizations.dart @@ -4221,13 +4221,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.', @@ -4414,4 +4407,19 @@ class AppLocalizations { name: 'getHelpOrReportABug', ); } + + 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 saveAndRefresh { + return Intl.message( + 'Save & refresh', + name: 'saveAndRefresh', + ); + } + } 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 cd512ab0d0..b437d94a56 100644 --- a/test/features/composer/presentation/composer_controller_test.dart +++ b/test/features/composer/presentation/composer_controller_test.dart @@ -67,6 +67,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'; @@ -142,6 +143,7 @@ class MockMailboxDashBoardController extends Mock implements MailboxDashBoardCon MockSpec(), MockSpec(), MockSpec(), + MockSpec(), // Composer controller mock specs MockSpec(), @@ -182,6 +184,7 @@ void main() { late MockUuid mockUuid; late MockApplicationManager mockApplicationManager; late MockToastManager mockToastManager; + late MockTwakeAppManager mockTwakeAppManager; // Declaration composer controller late ComposerController? composerController; @@ -223,6 +226,7 @@ void main() { mockUuid = MockUuid(); mockApplicationManager = MockApplicationManager(); mockToastManager = MockToastManager(); + mockTwakeAppManager = MockTwakeAppManager(); Get.put(mockCachingManager); Get.put(mockLanguageCacheManager); @@ -241,6 +245,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 9ba67d1e37..17992e28de 100644 --- a/test/features/email/presentation/controller/single_email_controller_test.dart +++ b/test/features/email/presentation/controller/single_email_controller_test.dart @@ -56,6 +56,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'; @@ -103,6 +104,7 @@ const fallbackGenerators = { MockSpec(), MockSpec(), MockSpec(), + MockSpec(), ]) void main() { TestWidgetsFlutterBinding.ensureInitialized(); @@ -137,6 +139,7 @@ void main() { final printUtils = MockPrintUtils(); final applicationManager = MockApplicationManager(); final mockToastManager = MockToastManager(); + final mockTwakeAppManager = MockTwakeAppManager(); late SingleEmailController singleEmailController; @@ -172,6 +175,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 4430334dab..1251847546 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 @@ -96,6 +96,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'; @@ -174,6 +175,7 @@ const fallbackGenerators = { MockSpec(), MockSpec(), MockSpec(), + MockSpec(), MockSpec(), MockSpec(), ]) @@ -239,6 +241,7 @@ void main() { final uuid = MockUuid(); final applicationManager = MockApplicationManager(); final mockToastManager = MockToastManager(); + final mockTwakeAppManager = MockTwakeAppManager(); // mock reloadable controller Get dependencies final getSessionInteractor = MockGetSessionInteractor(); @@ -305,6 +308,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 0d022941f9..a090c81866 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 @@ -95,6 +95,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'; @@ -177,6 +178,7 @@ const fallbackGenerators = { MockSpec(), MockSpec(), MockSpec(), + MockSpec(), MockSpec(), ]) void main() { @@ -224,6 +226,7 @@ void main() { final deleteAuthorityOidcInteractor = MockDeleteAuthorityOidcInteractor(); final appToast = MockAppToast(); final toastManager = MockToastManager(); + final mockTwakeAppManager = MockTwakeAppManager(); final imagePaths = ImagePaths(); final responsiveUtils = MockResponsiveUtils(); final uuid = MockUuid(); @@ -299,6 +302,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();