From c1416c88faca4b80631cee92b6db15d5963f4614 Mon Sep 17 00:00:00 2001 From: dab246 Date: Thu, 24 Nov 2022 14:30:58 +0700 Subject: [PATCH] TF-438 Implement method for get/store/delete `StateToRefresh` and get email changes --- .../hive_fcm_datasource_impl.dart | 29 ++++++++ .../data/local/fcm_cache_manager.dart | 38 ++++++++++- .../data/repository/fcm_repository_impl.dart | 66 ++++++++++++++++++- .../domain/exceptions/fcm_exception.dart | 2 + .../delete_email_state_to_refresh_state.dart | 22 +++++++ .../domain/state/get_email_changes_state.dart | 25 +++++++ .../get_email_state_to_refresh_state.dart | 25 +++++++ .../get_stored_email_delivery_state.dart | 25 +++++++ .../state/store_email_delivery_state.dart | 22 +++++++ .../state/store_fcm_state_change_state.dart | 22 +++++++ ...ete_email_state_to_refresh_interactor.dart | 22 +++++++ ...anges_to_push_notification_interactor.dart | 42 ++++++++++++ ...get_email_state_to_refresh_interactor.dart | 22 +++++++ ...tored_email_delivery_state_interactor.dart | 22 +++++++ ...store_email_delivery_state_interactor.dart | 23 +++++++ ...ore_email_state_to_refresh_interactor.dart | 23 +++++++ 16 files changed, 428 insertions(+), 2 deletions(-) create mode 100644 lib/features/push_notification/domain/state/delete_email_state_to_refresh_state.dart create mode 100644 lib/features/push_notification/domain/state/get_email_changes_state.dart create mode 100644 lib/features/push_notification/domain/state/get_email_state_to_refresh_state.dart create mode 100644 lib/features/push_notification/domain/state/get_stored_email_delivery_state.dart create mode 100644 lib/features/push_notification/domain/state/store_email_delivery_state.dart create mode 100644 lib/features/push_notification/domain/state/store_fcm_state_change_state.dart create mode 100644 lib/features/push_notification/domain/usecases/delete_email_state_to_refresh_interactor.dart create mode 100644 lib/features/push_notification/domain/usecases/get_email_changes_to_push_notification_interactor.dart create mode 100644 lib/features/push_notification/domain/usecases/get_email_state_to_refresh_interactor.dart create mode 100644 lib/features/push_notification/domain/usecases/get_stored_email_delivery_state_interactor.dart create mode 100644 lib/features/push_notification/domain/usecases/store_email_delivery_state_interactor.dart create mode 100644 lib/features/push_notification/domain/usecases/store_email_state_to_refresh_interactor.dart diff --git a/lib/features/push_notification/data/datasource_impl/hive_fcm_datasource_impl.dart b/lib/features/push_notification/data/datasource_impl/hive_fcm_datasource_impl.dart index b89b9f51a..4cb64198d 100644 --- a/lib/features/push_notification/data/datasource_impl/hive_fcm_datasource_impl.dart +++ b/lib/features/push_notification/data/datasource_impl/hive_fcm_datasource_impl.dart @@ -1,3 +1,5 @@ +import 'package:fcm/model/type_name.dart'; +import 'package:jmap_dart_client/jmap/core/state.dart' as jmap; import 'package:model/fcm/fcm_token_dto.dart'; import 'package:tmail_ui_user/features/push_notification/data/datasource/fcm_datasource.dart'; import 'package:tmail_ui_user/features/push_notification/data/local/fcm_cache_manager.dart'; @@ -36,4 +38,31 @@ class HiveFCMDatasourceImpl extends FCMDatasource { _exceptionThrower.throwException(error); }); } + + @override + Future storeStateToRefresh(TypeName typeName, jmap.State newState) { + return Future.sync(() async { + return await _firebaseCacheManager.storeStateToRefresh(typeName, newState); + }).catchError((error) { + _exceptionThrower.throwException(error); + }); + } + + @override + Future getStateToRefresh(TypeName typeName) { + return Future.sync(() async { + return await _firebaseCacheManager.getStateToRefresh(typeName); + }).catchError((error) { + _exceptionThrower.throwException(error); + }); + } + + @override + Future deleteStateToRefresh(TypeName typeName) { + return Future.sync(() async { + return await _firebaseCacheManager.deleteStateToRefresh(typeName); + }).catchError((error) { + _exceptionThrower.throwException(error); + }); + } } \ No newline at end of file diff --git a/lib/features/push_notification/data/local/fcm_cache_manager.dart b/lib/features/push_notification/data/local/fcm_cache_manager.dart index cd991e8b4..ebe2e48e5 100644 --- a/lib/features/push_notification/data/local/fcm_cache_manager.dart +++ b/lib/features/push_notification/data/local/fcm_cache_manager.dart @@ -1,14 +1,18 @@ import 'package:core/utils/app_logger.dart'; +import 'package:fcm/model/type_name.dart'; import 'package:model/fcm/fcm_token_dto.dart'; +import 'package:shared_preferences/shared_preferences.dart'; import 'package:tmail_ui_user/features/caching/fcm_token_cache_client.dart'; import 'package:tmail_ui_user/features/push_notification/data/extensions/fcm_cache_extensions.dart'; import 'package:tmail_ui_user/features/push_notification/data/extensions/fcm_extensions.dart'; import 'package:tmail_ui_user/features/push_notification/domain/exceptions/fcm_exception.dart'; +import 'package:jmap_dart_client/jmap/core/state.dart' as jmap; class FCMCacheManager { final FcmTokenCacheClient _fcmTokenCacheClient; + final SharedPreferences _sharedPreferences; - FCMCacheManager(this._fcmTokenCacheClient); + FCMCacheManager(this._fcmTokenCacheClient, this._sharedPreferences); Future getFCMToken(String accountId) async { try { @@ -33,4 +37,36 @@ class FCMCacheManager { log('FCMCacheManager::deleteSelectedFCM(): $accountId'); return _fcmTokenCacheClient.deleteItem(accountId); } + + Future storeStateToRefresh(TypeName typeName, jmap.State newState) { + return _sharedPreferences.setString(typeName.value, newState.value); + } + + Future getStateToRefresh(TypeName typeName) async { + log('FCMCacheManager::getStoredFcmStateChange():keys_BEFORE: ${_sharedPreferences.getKeys().toString()}'); + await _sharedPreferences.reload(); + log('FCMCacheManager::getStoredFcmStateChange():keys_AFTER: ${_sharedPreferences.getKeys().toString()}'); + final stateValue = _sharedPreferences.getString(typeName.value); + if (stateValue != null) { + return jmap.State(stateValue); + } else { + if (typeName == TypeName.emailDelivery) { + throw NotFoundEmailDeliveryStateException(); + } else { + throw NotFoundStateToRefreshException(); + } + } + } + + Future deleteStateToRefresh(TypeName typeName) { + return _sharedPreferences.remove(typeName.value); + } + + Future clearAllStateToRefresh() async { + return await Future.wait([ + _sharedPreferences.remove(TypeName.emailType.value), + _sharedPreferences.remove(TypeName.mailboxType.value), + _sharedPreferences.remove(TypeName.emailDelivery.value) + ]).then((listResult) => listResult.every((result) => result)); + } } \ No newline at end of file diff --git a/lib/features/push_notification/data/repository/fcm_repository_impl.dart b/lib/features/push_notification/data/repository/fcm_repository_impl.dart index 453ab18df..5c29219cd 100644 --- a/lib/features/push_notification/data/repository/fcm_repository_impl.dart +++ b/lib/features/push_notification/data/repository/fcm_repository_impl.dart @@ -1,13 +1,24 @@ import 'package:core/utils/app_logger.dart'; +import 'package:fcm/model/type_name.dart'; +import 'package:jmap_dart_client/jmap/account_id.dart'; +import 'package:jmap_dart_client/jmap/core/properties/properties.dart'; import 'package:model/fcm/fcm_token_dto.dart'; import 'package:tmail_ui_user/features/push_notification/data/datasource/fcm_datasource.dart'; import 'package:tmail_ui_user/features/push_notification/domain/repository/fcm_repository.dart'; +import 'package:tmail_ui_user/features/thread/data/datasource/thread_datasource.dart'; +import 'package:tmail_ui_user/features/thread/data/model/email_change_response.dart'; +import 'package:jmap_dart_client/jmap/core/state.dart' as jmap; +import 'package:tmail_ui_user/features/thread/domain/model/email_response.dart'; class FCMRepositoryImpl extends FCMRepository { final FCMDatasource _fcmDatasource; + final ThreadDataSource _threadDataSource; - FCMRepositoryImpl(this._fcmDatasource); + FCMRepositoryImpl( + this._fcmDatasource, + this._threadDataSource + ); @override Future getFCMToken(String accountId) { @@ -24,4 +35,57 @@ class FCMRepositoryImpl extends FCMRepository { Future deleteFCMToken(String accountId) { return _fcmDatasource.deleteFCMToken(accountId); } + + @override + Future getEmailChangesToPushNotification( + AccountId accountId, + jmap.State currentState, + { + Properties? propertiesCreated, + Properties? propertiesUpdated + } + ) async { + EmailChangeResponse? emailChangeResponse; + bool hasMoreChanges = true; + jmap.State? sinceState = currentState; + + while (hasMoreChanges && sinceState != null) { + final changesResponse = await _threadDataSource.getChanges( + accountId, + sinceState, + propertiesCreated: propertiesCreated, + propertiesUpdated: propertiesUpdated + ); + + hasMoreChanges = changesResponse.hasMoreChanges; + sinceState = changesResponse.newStateChanges; + + if (emailChangeResponse != null) { + emailChangeResponse.union(changesResponse); + } else { + emailChangeResponse = changesResponse; + } + } + + if (emailChangeResponse != null) { + return EmailsResponse(emailList: emailChangeResponse.created ?? []); + } else { + return EmailsResponse(); + } + } + + @override + Future storeStateToRefresh(TypeName typeName, jmap.State newState) { + return _fcmDatasource.storeStateToRefresh(typeName, newState); + } + + @override + Future getStateToRefresh(TypeName typeName) { + return _fcmDatasource.getStateToRefresh(typeName); + } + + @override + Future deleteStateToRefresh(TypeName typeName) { + return _fcmDatasource.deleteStateToRefresh(typeName); + } } \ No newline at end of file diff --git a/lib/features/push_notification/domain/exceptions/fcm_exception.dart b/lib/features/push_notification/domain/exceptions/fcm_exception.dart index a2756d2cb..440da59c7 100644 --- a/lib/features/push_notification/domain/exceptions/fcm_exception.dart +++ b/lib/features/push_notification/domain/exceptions/fcm_exception.dart @@ -2,4 +2,6 @@ class NotFoundStoredFCMException implements Exception {} class NotSupportFCMException implements Exception {} +class NotFoundStateToRefreshException implements Exception {} +class NotFoundEmailDeliveryStateException implements Exception {} \ No newline at end of file diff --git a/lib/features/push_notification/domain/state/delete_email_state_to_refresh_state.dart b/lib/features/push_notification/domain/state/delete_email_state_to_refresh_state.dart new file mode 100644 index 000000000..0850245b1 --- /dev/null +++ b/lib/features/push_notification/domain/state/delete_email_state_to_refresh_state.dart @@ -0,0 +1,22 @@ + +import 'package:core/presentation/state/failure.dart'; +import 'package:core/presentation/state/success.dart'; + +class DeleteEmailStateToRefreshLoading extends UIState {} + +class DeleteEmailStateToRefreshSuccess extends UIState { + + DeleteEmailStateToRefreshSuccess(); + + @override + List get props => []; +} + +class DeleteEmailStateToRefreshFailure extends FeatureFailure { + final dynamic exception; + + DeleteEmailStateToRefreshFailure(this.exception); + + @override + List get props => [exception]; +} \ No newline at end of file diff --git a/lib/features/push_notification/domain/state/get_email_changes_state.dart b/lib/features/push_notification/domain/state/get_email_changes_state.dart new file mode 100644 index 000000000..bb18aba64 --- /dev/null +++ b/lib/features/push_notification/domain/state/get_email_changes_state.dart @@ -0,0 +1,25 @@ + +import 'package:core/presentation/state/failure.dart'; +import 'package:core/presentation/state/success.dart'; +import 'package:model/email/presentation_email.dart'; + +class GetEmailChangesToPushNotificationLoading extends UIState {} + +class GetEmailChangesToPushNotificationSuccess extends UIState { + + final List emailList; + + GetEmailChangesToPushNotificationSuccess(this.emailList); + + @override + List get props => [emailList]; +} + +class GetEmailChangesToPushNotificationFailure extends FeatureFailure { + final dynamic exception; + + GetEmailChangesToPushNotificationFailure(this.exception); + + @override + List get props => [exception]; +} \ No newline at end of file diff --git a/lib/features/push_notification/domain/state/get_email_state_to_refresh_state.dart b/lib/features/push_notification/domain/state/get_email_state_to_refresh_state.dart new file mode 100644 index 000000000..ffe2b1059 --- /dev/null +++ b/lib/features/push_notification/domain/state/get_email_state_to_refresh_state.dart @@ -0,0 +1,25 @@ + +import 'package:core/presentation/state/failure.dart'; +import 'package:core/presentation/state/success.dart'; +import 'package:jmap_dart_client/jmap/core/state.dart' as jmap; + +class GetEmailStateToRefreshLoading extends UIState {} + +class GetEmailStateToRefreshSuccess extends UIState { + + final jmap.State storedState; + + GetEmailStateToRefreshSuccess(this.storedState); + + @override + List get props => [storedState]; +} + +class GetEmailStateToRefreshFailure extends FeatureFailure { + final dynamic exception; + + GetEmailStateToRefreshFailure(this.exception); + + @override + List get props => [exception]; +} \ No newline at end of file diff --git a/lib/features/push_notification/domain/state/get_stored_email_delivery_state.dart b/lib/features/push_notification/domain/state/get_stored_email_delivery_state.dart new file mode 100644 index 000000000..dc12355e4 --- /dev/null +++ b/lib/features/push_notification/domain/state/get_stored_email_delivery_state.dart @@ -0,0 +1,25 @@ + +import 'package:core/presentation/state/failure.dart'; +import 'package:core/presentation/state/success.dart'; +import 'package:jmap_dart_client/jmap/core/state.dart' as jmap; + +class GetStoredEmailDeliveryStateLoading extends UIState {} + +class GetStoredEmailDeliveryStateSuccess extends UIState { + + final jmap.State state; + + GetStoredEmailDeliveryStateSuccess(this.state); + + @override + List get props => [state]; +} + +class GetStoredEmailDeliveryStateFailure extends FeatureFailure { + final dynamic exception; + + GetStoredEmailDeliveryStateFailure(this.exception); + + @override + List get props => [exception]; +} \ No newline at end of file diff --git a/lib/features/push_notification/domain/state/store_email_delivery_state.dart b/lib/features/push_notification/domain/state/store_email_delivery_state.dart new file mode 100644 index 000000000..00bbbc170 --- /dev/null +++ b/lib/features/push_notification/domain/state/store_email_delivery_state.dart @@ -0,0 +1,22 @@ + +import 'package:core/presentation/state/failure.dart'; +import 'package:core/presentation/state/success.dart'; + +class StoreEmailDeliveryStateLoading extends UIState {} + +class StoreEmailDeliveryStateSuccess extends UIState { + + StoreEmailDeliveryStateSuccess(); + + @override + List get props => []; +} + +class StoreEmailDeliveryStateFailure extends FeatureFailure { + final dynamic exception; + + StoreEmailDeliveryStateFailure(this.exception); + + @override + List get props => [exception]; +} \ No newline at end of file diff --git a/lib/features/push_notification/domain/state/store_fcm_state_change_state.dart b/lib/features/push_notification/domain/state/store_fcm_state_change_state.dart new file mode 100644 index 000000000..234394dea --- /dev/null +++ b/lib/features/push_notification/domain/state/store_fcm_state_change_state.dart @@ -0,0 +1,22 @@ + +import 'package:core/presentation/state/failure.dart'; +import 'package:core/presentation/state/success.dart'; + +class StoreEmailStateToRefreshLoading extends UIState {} + +class StoreEmailStateToRefreshSuccess extends UIState { + + StoreEmailStateToRefreshSuccess(); + + @override + List get props => []; +} + +class StoreEmailStateToRefreshFailure extends FeatureFailure { + final dynamic exception; + + StoreEmailStateToRefreshFailure(this.exception); + + @override + List get props => [exception]; +} \ No newline at end of file diff --git a/lib/features/push_notification/domain/usecases/delete_email_state_to_refresh_interactor.dart b/lib/features/push_notification/domain/usecases/delete_email_state_to_refresh_interactor.dart new file mode 100644 index 000000000..5ffebb6f8 --- /dev/null +++ b/lib/features/push_notification/domain/usecases/delete_email_state_to_refresh_interactor.dart @@ -0,0 +1,22 @@ +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:tmail_ui_user/features/push_notification/domain/repository/fcm_repository.dart'; +import 'package:tmail_ui_user/features/push_notification/domain/state/delete_email_state_to_refresh_state.dart'; + +class DeleteEmailStateToRefreshInteractor { + final FCMRepository _fcmRepository; + + DeleteEmailStateToRefreshInteractor(this._fcmRepository); + + Stream> execute(TypeName typeName) async* { + try { + yield Right(DeleteEmailStateToRefreshLoading()); + await _fcmRepository.deleteStateToRefresh(typeName); + yield Right(DeleteEmailStateToRefreshSuccess()); + } catch (e) { + yield Left(DeleteEmailStateToRefreshFailure(e)); + } + } +} \ No newline at end of file diff --git a/lib/features/push_notification/domain/usecases/get_email_changes_to_push_notification_interactor.dart b/lib/features/push_notification/domain/usecases/get_email_changes_to_push_notification_interactor.dart new file mode 100644 index 000000000..57ff490ce --- /dev/null +++ b/lib/features/push_notification/domain/usecases/get_email_changes_to_push_notification_interactor.dart @@ -0,0 +1,42 @@ +import 'package:core/presentation/state/failure.dart'; +import 'package:core/presentation/state/success.dart'; +import 'package:dartz/dartz.dart'; +import 'package:jmap_dart_client/jmap/account_id.dart'; +import 'package:jmap_dart_client/jmap/core/properties/properties.dart'; +import 'package:jmap_dart_client/jmap/core/state.dart' as jmap; +import 'package:model/extensions/email_extension.dart'; +import 'package:tmail_ui_user/features/push_notification/domain/repository/fcm_repository.dart'; +import 'package:tmail_ui_user/features/push_notification/domain/state/get_email_changes_state.dart'; + +class GetEmailChangesToPushNotificationInteractor { + final FCMRepository _fcmRepository; + + GetEmailChangesToPushNotificationInteractor(this._fcmRepository); + + Stream> execute( + AccountId accountId, + jmap.State currentState, + { + Properties? propertiesCreated, + Properties? propertiesUpdated + } + ) async* { + try { + yield Right(GetEmailChangesToPushNotificationLoading()); + + final emailsResponse = await _fcmRepository.getEmailChangesToPushNotification( + accountId, + currentState, + propertiesCreated: propertiesCreated, + propertiesUpdated: propertiesUpdated); + + final presentationEmailList = emailsResponse.emailList + ?.map((email) => email.toPresentationEmail()) + .toList() ?? List.empty(); + + yield Right(GetEmailChangesToPushNotificationSuccess(presentationEmailList)); + } catch (e) { + yield Left(GetEmailChangesToPushNotificationFailure(e)); + } + } +} \ No newline at end of file diff --git a/lib/features/push_notification/domain/usecases/get_email_state_to_refresh_interactor.dart b/lib/features/push_notification/domain/usecases/get_email_state_to_refresh_interactor.dart new file mode 100644 index 000000000..0476ba7a6 --- /dev/null +++ b/lib/features/push_notification/domain/usecases/get_email_state_to_refresh_interactor.dart @@ -0,0 +1,22 @@ +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:tmail_ui_user/features/push_notification/domain/repository/fcm_repository.dart'; +import 'package:tmail_ui_user/features/push_notification/domain/state/get_email_state_to_refresh_state.dart'; + +class GetEmailStateToRefreshInteractor { + final FCMRepository _fcmRepository; + + GetEmailStateToRefreshInteractor(this._fcmRepository); + + Stream> execute() async* { + try { + yield Right(GetEmailStateToRefreshLoading()); + final storedState = await _fcmRepository.getStateToRefresh(TypeName.emailType); + yield Right(GetEmailStateToRefreshSuccess(storedState)); + } catch (e) { + yield Left(GetEmailStateToRefreshFailure(e)); + } + } +} \ No newline at end of file diff --git a/lib/features/push_notification/domain/usecases/get_stored_email_delivery_state_interactor.dart b/lib/features/push_notification/domain/usecases/get_stored_email_delivery_state_interactor.dart new file mode 100644 index 000000000..a14e8a98c --- /dev/null +++ b/lib/features/push_notification/domain/usecases/get_stored_email_delivery_state_interactor.dart @@ -0,0 +1,22 @@ +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:tmail_ui_user/features/push_notification/domain/repository/fcm_repository.dart'; +import 'package:tmail_ui_user/features/push_notification/domain/state/get_stored_email_delivery_state.dart'; + +class GetStoredEmailDeliveryStateInteractor { + final FCMRepository _fcmRepository; + + GetStoredEmailDeliveryStateInteractor(this._fcmRepository); + + Stream> execute() async* { + try { + yield Right(GetStoredEmailDeliveryStateLoading()); + final storedState = await _fcmRepository.getStateToRefresh(TypeName.emailDelivery); + yield Right(GetStoredEmailDeliveryStateSuccess(storedState)); + } catch (e) { + yield Left(GetStoredEmailDeliveryStateFailure(e)); + } + } +} \ No newline at end of file diff --git a/lib/features/push_notification/domain/usecases/store_email_delivery_state_interactor.dart b/lib/features/push_notification/domain/usecases/store_email_delivery_state_interactor.dart new file mode 100644 index 000000000..134c6a51a --- /dev/null +++ b/lib/features/push_notification/domain/usecases/store_email_delivery_state_interactor.dart @@ -0,0 +1,23 @@ +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/core/state.dart' as jmap; +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_delivery_state.dart'; + +class StoreEmailDeliveryStateInteractor { + final FCMRepository _fcmRepository; + + StoreEmailDeliveryStateInteractor(this._fcmRepository); + + Stream> execute(jmap.State newState) async* { + try { + yield Right(StoreEmailDeliveryStateLoading()); + await _fcmRepository.storeStateToRefresh(TypeName.emailDelivery, newState); + yield Right(StoreEmailDeliveryStateSuccess()); + } catch (e) { + yield Left(StoreEmailDeliveryStateFailure(e)); + } + } +} \ 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 new file mode 100644 index 000000000..10aef9502 --- /dev/null +++ b/lib/features/push_notification/domain/usecases/store_email_state_to_refresh_interactor.dart @@ -0,0 +1,23 @@ +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/core/state.dart' as jmap; +import 'package:tmail_ui_user/features/push_notification/domain/repository/fcm_repository.dart'; +import 'package:tmail_ui_user/features/push_notification/domain/state/store_fcm_state_change_state.dart'; + +class StoreEmailStateToRefreshInteractor { + final FCMRepository _fcmRepository; + + StoreEmailStateToRefreshInteractor(this._fcmRepository); + + Stream> execute(TypeName typeName, jmap.State newState) async* { + try { + yield Right(StoreEmailStateToRefreshLoading()); + await _fcmRepository.storeStateToRefresh(typeName, newState); + yield Right(StoreEmailStateToRefreshSuccess()); + } catch (e) { + yield Left(StoreEmailStateToRefreshFailure(e)); + } + } +} \ No newline at end of file