diff --git a/lib/features/push_notification/domain/state/store_email_state_to_refresh_state.dart b/lib/features/push_notification/domain/state/store_email_state_to_refresh_state.dart deleted file mode 100644 index 7c588ebfe..000000000 --- a/lib/features/push_notification/domain/state/store_email_state_to_refresh_state.dart +++ /dev/null @@ -1,12 +0,0 @@ - -import 'package:core/presentation/state/failure.dart'; -import 'package:core/presentation/state/success.dart'; - -class StoreEmailStateToRefreshLoading extends UIState {} - -class StoreEmailStateToRefreshSuccess extends UIState {} - -class StoreEmailStateToRefreshFailure extends FeatureFailure { - - StoreEmailStateToRefreshFailure(dynamic exception) : super(exception: exception); -} \ No newline at end of file diff --git a/lib/features/push_notification/domain/state/store_mailbox_state_to_refresh_state.dart b/lib/features/push_notification/domain/state/store_mailbox_state_to_refresh_state.dart deleted file mode 100644 index 1c6039cbf..000000000 --- a/lib/features/push_notification/domain/state/store_mailbox_state_to_refresh_state.dart +++ /dev/null @@ -1,12 +0,0 @@ - -import 'package:core/presentation/state/failure.dart'; -import 'package:core/presentation/state/success.dart'; - -class StoreMailboxStateToRefreshLoading extends UIState {} - -class StoreMailboxStateToRefreshSuccess extends UIState {} - -class StoreMailboxStateToRefreshFailure extends FeatureFailure { - - StoreMailboxStateToRefreshFailure(dynamic exception) : super(exception: exception); -} \ No newline at end of file diff --git a/lib/features/push_notification/domain/usecases/store_email_state_to_refresh_interactor.dart b/lib/features/push_notification/domain/usecases/store_email_state_to_refresh_interactor.dart deleted file mode 100644 index 3b229d93f..000000000 --- a/lib/features/push_notification/domain/usecases/store_email_state_to_refresh_interactor.dart +++ /dev/null @@ -1,25 +0,0 @@ -import 'package:core/presentation/state/failure.dart'; -import 'package:core/presentation/state/success.dart'; -import 'package:dartz/dartz.dart'; -import 'package:fcm/model/type_name.dart'; -import 'package:jmap_dart_client/jmap/account_id.dart'; -import 'package:jmap_dart_client/jmap/core/state.dart' as jmap; -import 'package:jmap_dart_client/jmap/core/user_name.dart'; -import 'package:tmail_ui_user/features/push_notification/domain/repository/fcm_repository.dart'; -import 'package:tmail_ui_user/features/push_notification/domain/state/store_email_state_to_refresh_state.dart'; - -class StoreEmailStateToRefreshInteractor { - final FCMRepository _fcmRepository; - - StoreEmailStateToRefreshInteractor(this._fcmRepository); - - Stream> execute(AccountId accountId, UserName userName, jmap.State newState) async* { - try { - yield Right(StoreEmailStateToRefreshLoading()); - await _fcmRepository.storeStateToRefresh(accountId, userName, TypeName.emailType, newState); - yield Right(StoreEmailStateToRefreshSuccess()); - } catch (e) { - yield Left(StoreEmailStateToRefreshFailure(e)); - } - } -} \ No newline at end of file diff --git a/lib/features/push_notification/domain/usecases/store_mailbox_state_to_refresh_interactor.dart b/lib/features/push_notification/domain/usecases/store_mailbox_state_to_refresh_interactor.dart deleted file mode 100644 index 1f3382d16..000000000 --- a/lib/features/push_notification/domain/usecases/store_mailbox_state_to_refresh_interactor.dart +++ /dev/null @@ -1,25 +0,0 @@ -import 'package:core/presentation/state/failure.dart'; -import 'package:core/presentation/state/success.dart'; -import 'package:dartz/dartz.dart'; -import 'package:fcm/model/type_name.dart'; -import 'package:jmap_dart_client/jmap/account_id.dart'; -import 'package:jmap_dart_client/jmap/core/state.dart' as jmap; -import 'package:jmap_dart_client/jmap/core/user_name.dart'; -import 'package:tmail_ui_user/features/push_notification/domain/repository/fcm_repository.dart'; -import 'package:tmail_ui_user/features/push_notification/domain/state/store_mailbox_state_to_refresh_state.dart'; - -class StoreMailboxStateToRefreshInteractor { - final FCMRepository _fcmRepository; - - StoreMailboxStateToRefreshInteractor(this._fcmRepository); - - Stream> execute(AccountId accountId, UserName userName, jmap.State newState) async* { - try { - yield Right(StoreMailboxStateToRefreshLoading()); - await _fcmRepository.storeStateToRefresh(accountId, userName, TypeName.mailboxType, newState); - yield Right(StoreMailboxStateToRefreshSuccess()); - } catch (e) { - yield Left(StoreMailboxStateToRefreshFailure(e)); - } - } -} \ No newline at end of file diff --git a/lib/features/push_notification/presentation/bindings/fcm_interactor_bindings.dart b/lib/features/push_notification/presentation/bindings/fcm_interactor_bindings.dart index 714644e12..7836ebd1f 100644 --- a/lib/features/push_notification/presentation/bindings/fcm_interactor_bindings.dart +++ b/lib/features/push_notification/presentation/bindings/fcm_interactor_bindings.dart @@ -57,9 +57,7 @@ import 'package:tmail_ui_user/features/push_notification/domain/usecases/get_sto import 'package:tmail_ui_user/features/push_notification/domain/usecases/get_stored_firebase_registration_interactor.dart'; import 'package:tmail_ui_user/features/push_notification/domain/usecases/register_new_firebase_registration_token_interactor.dart'; import 'package:tmail_ui_user/features/push_notification/domain/usecases/store_email_delivery_state_interactor.dart'; -import 'package:tmail_ui_user/features/push_notification/domain/usecases/store_email_state_to_refresh_interactor.dart'; import 'package:tmail_ui_user/features/push_notification/domain/usecases/store_firebase_registration_interator.dart'; -import 'package:tmail_ui_user/features/push_notification/domain/usecases/store_mailbox_state_to_refresh_interactor.dart'; import 'package:tmail_ui_user/features/push_notification/domain/usecases/update_firebase_registration_token_interactor.dart'; import 'package:tmail_ui_user/features/thread/data/datasource/thread_datasource.dart'; import 'package:tmail_ui_user/features/thread/data/datasource_impl/thread_datasource_impl.dart'; @@ -149,12 +147,10 @@ class FcmInteractorBindings extends InteractorsBindings { Get.lazyPut(() => GetEmailChangesToRemoveNotificationInteractor( Get.find(), Get.find())); - Get.lazyPut(() => StoreEmailStateToRefreshInteractor(Get.find())); Get.lazyPut(() => GetEmailStateToRefreshInteractor(Get.find())); Get.lazyPut(() => DeleteEmailStateToRefreshInteractor(Get.find())); Get.lazyPut(() => GetFirebaseRegistrationByDeviceIdInteractor(Get.find())); Get.lazyPut(() => RegisterNewFirebaseRegistrationTokenInteractor(Get.find())); - Get.lazyPut(() => StoreMailboxStateToRefreshInteractor(Get.find())); Get.lazyPut(() => GetMailboxStateToRefreshInteractor(Get.find())); Get.lazyPut(() => StoreFirebaseRegistrationInteractor(Get.find())); Get.lazyPut(() => GetStoredFirebaseRegistrationInteractor(Get.find())); diff --git a/lib/features/push_notification/presentation/listener/email_change_listener.dart b/lib/features/push_notification/presentation/listener/email_change_listener.dart index cb4aac595..860c857a4 100644 --- a/lib/features/push_notification/presentation/listener/email_change_listener.dart +++ b/lib/features/push_notification/presentation/listener/email_change_listener.dart @@ -39,7 +39,6 @@ import 'package:tmail_ui_user/features/push_notification/domain/usecases/get_mai import 'package:tmail_ui_user/features/push_notification/domain/usecases/get_new_receive_email_from_notification_interactor.dart'; import 'package:tmail_ui_user/features/push_notification/domain/usecases/get_stored_email_delivery_state_interactor.dart'; import 'package:tmail_ui_user/features/push_notification/domain/usecases/store_email_delivery_state_interactor.dart'; -import 'package:tmail_ui_user/features/push_notification/domain/usecases/store_email_state_to_refresh_interactor.dart'; import 'package:tmail_ui_user/features/push_notification/presentation/action/push_notification_state_change_action.dart'; import 'package:tmail_ui_user/features/push_notification/presentation/listener/change_listener.dart'; import 'package:tmail_ui_user/features/push_notification/presentation/notification/local_notification_manager.dart'; @@ -52,7 +51,6 @@ class EmailChangeListener extends ChangeListener { StoreEmailDeliveryStateInteractor? _storeEmailDeliveryStateInteractor; GetEmailChangesToPushNotificationInteractor? _getEmailChangesToPushNotificationInteractor; GetStoredEmailStateInteractor? _getStoredEmailStateInteractor; - StoreEmailStateToRefreshInteractor? _storeEmailStateToRefreshInteractor; GetMailboxesNotPutNotificationsInteractor? _getMailboxesNotPutNotificationsInteractor; GetEmailChangesToRemoveNotificationInteractor? _getEmailChangesToRemoveNotificationInteractor; GetNewReceiveEmailFromNotificationInteractor? _getNewReceiveEmailFromNotificationInteractor; @@ -73,7 +71,6 @@ class EmailChangeListener extends ChangeListener { _getStoredEmailDeliveryStateInteractor = getBinding(); _storeEmailDeliveryStateInteractor = getBinding(); _getEmailChangesToPushNotificationInteractor = getBinding(); - _storeEmailStateToRefreshInteractor = getBinding(); _getMailboxesNotPutNotificationsInteractor = getBinding(); _getEmailChangesToRemoveNotificationInteractor = getBinding(); _getNewReceiveEmailFromNotificationInteractor = getBinding(); @@ -111,7 +108,6 @@ class EmailChangeListener extends ChangeListener { if (PlatformInfo.isAndroid) { _handleRemoveNotificationWhenEmailMarkAsRead(action.newState, action.accountId, action.session); } - _handleStoreEmailStateToRefreshAction(action.accountId, action.userName, action.newState); } } } @@ -290,15 +286,6 @@ class EmailChangeListener extends ChangeListener { _emailsAvailablePushNotification.clear(); } - void _handleStoreEmailStateToRefreshAction(AccountId accountId, UserName userName, jmap.State newState) { - log('EmailChangeListener::_handleStoreEmailStateToRefreshAction():newState: $newState'); - if (_storeEmailStateToRefreshInteractor != null) { - consumeState(_storeEmailStateToRefreshInteractor!.execute(accountId, userName, newState)); - } else { - logError('EmailChangeListener::_handleStoreEmailStateToRefreshAction():_storeEmailStateToRefreshInteractor is null'); - } - } - void _handleRemoveNotificationWhenEmailMarkAsRead(jmap.State newState, AccountId accountId, Session? session) { if (_getEmailChangesToRemoveNotificationInteractor != null && session != null) { consumeState(_getEmailChangesToRemoveNotificationInteractor!.execute( diff --git a/lib/features/push_notification/presentation/listener/mailbox_change_listener.dart b/lib/features/push_notification/presentation/listener/mailbox_change_listener.dart index 2502f6e0a..da2d4ce93 100644 --- a/lib/features/push_notification/presentation/listener/mailbox_change_listener.dart +++ b/lib/features/push_notification/presentation/listener/mailbox_change_listener.dart @@ -2,13 +2,10 @@ import 'package:core/presentation/state/failure.dart'; import 'package:core/presentation/state/success.dart'; import 'package:core/utils/app_logger.dart'; -import 'package:jmap_dart_client/jmap/account_id.dart'; import 'package:jmap_dart_client/jmap/core/state.dart' as jmap; -import 'package:jmap_dart_client/jmap/core/user_name.dart'; import 'package:tmail_ui_user/features/base/action/ui_action.dart'; import 'package:tmail_ui_user/features/mailbox/presentation/action/mailbox_ui_action.dart'; import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/controller/mailbox_dashboard_controller.dart'; -import 'package:tmail_ui_user/features/push_notification/domain/usecases/store_mailbox_state_to_refresh_interactor.dart'; import 'package:tmail_ui_user/features/push_notification/presentation/action/push_notification_state_change_action.dart'; import 'package:tmail_ui_user/features/push_notification/presentation/listener/change_listener.dart'; import 'package:tmail_ui_user/main/routes/route_navigation.dart'; @@ -16,12 +13,10 @@ import 'package:tmail_ui_user/main/routes/route_navigation.dart'; class MailboxChangeListener extends ChangeListener { MailboxDashBoardController? _dashBoardController; - StoreMailboxStateToRefreshInteractor? _storeMailboxStateToRefreshInteractor; MailboxChangeListener._internal() { try { _dashBoardController = getBinding(); - _storeMailboxStateToRefreshInteractor = getBinding(); } catch (e) { logError('MailboxChangeListener::_internal(): IS NOT REGISTERED: ${e.toString()}'); } @@ -37,8 +32,6 @@ class MailboxChangeListener extends ChangeListener { for (var action in actions) { if (action is SynchronizeMailboxOnForegroundAction) { _synchronizeMailboxOnForegroundAction(action.newState); - } else if (action is StoreMailboxStateToRefreshAction) { - _handleStoreMailboxStateToRefreshAction(action.accountId, action.userName, action.newState); } } } @@ -59,11 +52,4 @@ class MailboxChangeListener extends ChangeListener { _dashBoardController!.dispatchMailboxUIAction(RefreshChangeMailboxAction(newState)); } } - - void _handleStoreMailboxStateToRefreshAction(AccountId accountId, UserName userName, jmap.State newState) { - log('MailboxChangeListener::_handleStoreMailboxStateToRefreshAction():newState: $newState'); - if (_storeMailboxStateToRefreshInteractor != null) { - consumeState(_storeMailboxStateToRefreshInteractor!.execute(accountId, userName, newState)); - } - } } \ No newline at end of file