TF-439 Delete all class not used
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:tmail_ui_user/features/caching/account_cache_client.dart';
|
import 'package:tmail_ui_user/features/caching/account_cache_client.dart';
|
||||||
import 'package:tmail_ui_user/features/caching/email_cache_client.dart';
|
import 'package:tmail_ui_user/features/caching/email_cache_client.dart';
|
||||||
import 'package:tmail_ui_user/features/caching/fcm_token_cache_client.dart';
|
|
||||||
import 'package:tmail_ui_user/features/caching/mailbox_cache_client.dart';
|
import 'package:tmail_ui_user/features/caching/mailbox_cache_client.dart';
|
||||||
import 'package:tmail_ui_user/features/caching/recent_search_cache_client.dart';
|
import 'package:tmail_ui_user/features/caching/recent_search_cache_client.dart';
|
||||||
import 'package:tmail_ui_user/features/caching/state_cache_client.dart';
|
import 'package:tmail_ui_user/features/caching/state_cache_client.dart';
|
||||||
@@ -14,7 +13,6 @@ class CachingManager {
|
|||||||
final EmailCacheClient _emailCacheClient;
|
final EmailCacheClient _emailCacheClient;
|
||||||
final RecentSearchCacheClient _recentSearchCacheClient;
|
final RecentSearchCacheClient _recentSearchCacheClient;
|
||||||
final AccountCacheClient _accountCacheClient;
|
final AccountCacheClient _accountCacheClient;
|
||||||
final FcmTokenCacheClient _fcmTokenCacheClient;
|
|
||||||
final FCMCacheManager _fcmCacheManager;
|
final FCMCacheManager _fcmCacheManager;
|
||||||
|
|
||||||
CachingManager(
|
CachingManager(
|
||||||
@@ -23,7 +21,6 @@ class CachingManager {
|
|||||||
this._emailCacheClient,
|
this._emailCacheClient,
|
||||||
this._recentSearchCacheClient,
|
this._recentSearchCacheClient,
|
||||||
this._accountCacheClient,
|
this._accountCacheClient,
|
||||||
this._fcmTokenCacheClient,
|
|
||||||
this._fcmCacheManager,
|
this._fcmCacheManager,
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -35,7 +32,6 @@ class CachingManager {
|
|||||||
_emailCacheClient.clearAllData(),
|
_emailCacheClient.clearAllData(),
|
||||||
_recentSearchCacheClient.clearAllData(),
|
_recentSearchCacheClient.clearAllData(),
|
||||||
_accountCacheClient.clearAllData(),
|
_accountCacheClient.clearAllData(),
|
||||||
_fcmTokenCacheClient.clearAllData(),
|
|
||||||
_fcmCacheManager.clearAllStateToRefresh()
|
_fcmCacheManager.clearAllStateToRefresh()
|
||||||
]);
|
]);
|
||||||
} else {
|
} else {
|
||||||
@@ -45,7 +41,6 @@ class CachingManager {
|
|||||||
_emailCacheClient.deleteBox(),
|
_emailCacheClient.deleteBox(),
|
||||||
_recentSearchCacheClient.deleteBox(),
|
_recentSearchCacheClient.deleteBox(),
|
||||||
_accountCacheClient.deleteBox(),
|
_accountCacheClient.deleteBox(),
|
||||||
_fcmTokenCacheClient.deleteBox(),
|
|
||||||
_fcmCacheManager.clearAllStateToRefresh()
|
_fcmCacheManager.clearAllStateToRefresh()
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ import 'package:tmail_ui_user/features/mailbox/data/model/mailbox_rights_cache.d
|
|||||||
import 'package:tmail_ui_user/features/mailbox/data/model/state_cache.dart';
|
import 'package:tmail_ui_user/features/mailbox/data/model/state_cache.dart';
|
||||||
import 'package:tmail_ui_user/features/mailbox/data/model/state_type.dart';
|
import 'package:tmail_ui_user/features/mailbox/data/model/state_type.dart';
|
||||||
import 'package:tmail_ui_user/features/mailbox_dashboard/data/model/recent_search_cache.dart';
|
import 'package:tmail_ui_user/features/mailbox_dashboard/data/model/recent_search_cache.dart';
|
||||||
import 'package:tmail_ui_user/features/push_notification/data/model/fcm_token_cache.dart';
|
|
||||||
import 'package:tmail_ui_user/features/thread/data/model/email_address_hive_cache.dart';
|
import 'package:tmail_ui_user/features/thread/data/model/email_address_hive_cache.dart';
|
||||||
import 'package:tmail_ui_user/features/thread/data/model/email_cache.dart';
|
import 'package:tmail_ui_user/features/thread/data/model/email_cache.dart';
|
||||||
|
|
||||||
@@ -119,10 +118,6 @@ class HiveCacheConfig {
|
|||||||
RecentLoginUsernameCacheAdapter(),
|
RecentLoginUsernameCacheAdapter(),
|
||||||
CachingConstants.RECENT_LOGIN_USERNAME_HIVE_CACHE_IDENTITY
|
CachingConstants.RECENT_LOGIN_USERNAME_HIVE_CACHE_IDENTITY
|
||||||
);
|
);
|
||||||
registerCacheAdapter<FCMTokenCache>(
|
|
||||||
FCMTokenCacheAdapter(),
|
|
||||||
CachingConstants.FCM_TOKEN_CACHE_IDENTITY
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void registerCacheAdapter<T>(TypeAdapter<T> typeAdapter, int typeId) {
|
void registerCacheAdapter<T>(TypeAdapter<T> typeAdapter, int typeId) {
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
import 'package:tmail_ui_user/features/caching/config/hive_cache_client.dart';
|
|
||||||
import 'package:tmail_ui_user/features/push_notification/data/model/fcm_token_cache.dart';
|
|
||||||
|
|
||||||
class FcmTokenCacheClient extends HiveCacheClient<FCMTokenCache> {
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get tableName => 'FCMTokenCache';
|
|
||||||
}
|
|
||||||
@@ -13,5 +13,4 @@ class CachingConstants {
|
|||||||
static const int AUTHENTICATION_INFO_HIVE_CACHE_IDENTIFY = 11;
|
static const int AUTHENTICATION_INFO_HIVE_CACHE_IDENTIFY = 11;
|
||||||
static const int RECENT_LOGIN_URL_HIVE_CACHE_IDENTITY = 12;
|
static const int RECENT_LOGIN_URL_HIVE_CACHE_IDENTITY = 12;
|
||||||
static const int RECENT_LOGIN_USERNAME_HIVE_CACHE_IDENTITY = 13;
|
static const int RECENT_LOGIN_USERNAME_HIVE_CACHE_IDENTITY = 13;
|
||||||
static const int FCM_TOKEN_CACHE_IDENTITY = 14;
|
|
||||||
}
|
}
|
||||||
@@ -1,17 +1,10 @@
|
|||||||
|
|
||||||
import 'package:fcm/model/firebase_subscription.dart';
|
import 'package:fcm/model/firebase_subscription.dart';
|
||||||
import 'package:fcm/model/type_name.dart';
|
import 'package:fcm/model/type_name.dart';
|
||||||
import 'package:model/fcm/fcm_token_dto.dart';
|
|
||||||
import 'package:jmap_dart_client/jmap/core/state.dart' as jmap;
|
import 'package:jmap_dart_client/jmap/core/state.dart' as jmap;
|
||||||
import 'package:tmail_ui_user/features/push_notification/domain/model/register_new_token_request.dart';
|
import 'package:tmail_ui_user/features/push_notification/domain/model/register_new_token_request.dart';
|
||||||
|
|
||||||
abstract class FCMDatasource {
|
abstract class FCMDatasource {
|
||||||
Future<FCMTokenDto> getFCMToken(String accountId);
|
|
||||||
|
|
||||||
Future<void> setFCMToken(FCMTokenDto fcmToken);
|
|
||||||
|
|
||||||
Future<void> deleteFCMToken(String accountId);
|
|
||||||
|
|
||||||
Future<bool> storeStateToRefresh(TypeName typeName, jmap.State newState);
|
Future<bool> storeStateToRefresh(TypeName typeName, jmap.State newState);
|
||||||
|
|
||||||
Future<jmap.State> getStateToRefresh(TypeName typeName);
|
Future<jmap.State> getStateToRefresh(TypeName typeName);
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import 'package:fcm/model/firebase_subscription.dart';
|
import 'package:fcm/model/firebase_subscription.dart';
|
||||||
import 'package:fcm/model/type_name.dart';
|
import 'package:fcm/model/type_name.dart';
|
||||||
import 'package:jmap_dart_client/jmap/core/state.dart' as jmap;
|
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/datasource/fcm_datasource.dart';
|
||||||
import 'package:tmail_ui_user/features/push_notification/data/network/fcm_api.dart';
|
import 'package:tmail_ui_user/features/push_notification/data/network/fcm_api.dart';
|
||||||
import 'package:tmail_ui_user/features/push_notification/domain/model/register_new_token_request.dart';
|
import 'package:tmail_ui_user/features/push_notification/domain/model/register_new_token_request.dart';
|
||||||
@@ -23,31 +22,16 @@ class FcmDatasourceImpl extends FCMDatasource {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
Future<void> deleteFCMToken(String accountId) {
|
|
||||||
throw UnimplementedError();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<bool> deleteStateToRefresh(TypeName typeName) {
|
Future<bool> deleteStateToRefresh(TypeName typeName) {
|
||||||
throw UnimplementedError();
|
throw UnimplementedError();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
Future<FCMTokenDto> getFCMToken(String accountId) {
|
|
||||||
throw UnimplementedError();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<jmap.State> getStateToRefresh(TypeName typeName) {
|
Future<jmap.State> getStateToRefresh(TypeName typeName) {
|
||||||
throw UnimplementedError();
|
throw UnimplementedError();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
Future<void> setFCMToken(FCMTokenDto fcmToken) {
|
|
||||||
throw UnimplementedError();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<bool> storeDeviceId(String deviceId) {
|
Future<bool> storeDeviceId(String deviceId) {
|
||||||
throw UnimplementedError();
|
throw UnimplementedError();
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import 'package:fcm/model/firebase_subscription.dart';
|
import 'package:fcm/model/firebase_subscription.dart';
|
||||||
import 'package:fcm/model/type_name.dart';
|
import 'package:fcm/model/type_name.dart';
|
||||||
import 'package:jmap_dart_client/jmap/core/state.dart' as jmap;
|
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/datasource/fcm_datasource.dart';
|
||||||
import 'package:tmail_ui_user/features/push_notification/data/local/fcm_cache_manager.dart';
|
import 'package:tmail_ui_user/features/push_notification/data/local/fcm_cache_manager.dart';
|
||||||
import 'package:tmail_ui_user/features/push_notification/domain/model/register_new_token_request.dart';
|
import 'package:tmail_ui_user/features/push_notification/domain/model/register_new_token_request.dart';
|
||||||
@@ -14,33 +13,6 @@ class HiveFCMDatasourceImpl extends FCMDatasource {
|
|||||||
|
|
||||||
HiveFCMDatasourceImpl(this._firebaseCacheManager, this._exceptionThrower);
|
HiveFCMDatasourceImpl(this._firebaseCacheManager, this._exceptionThrower);
|
||||||
|
|
||||||
@override
|
|
||||||
Future<FCMTokenDto> getFCMToken(String accountId) {
|
|
||||||
return Future.sync(() async {
|
|
||||||
return await _firebaseCacheManager.getFCMToken(accountId);
|
|
||||||
}).catchError((error) {
|
|
||||||
_exceptionThrower.throwException(error);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<void> setFCMToken(FCMTokenDto fcmToken) {
|
|
||||||
return Future.sync(() async {
|
|
||||||
return await _firebaseCacheManager.setFCMToken(fcmToken);
|
|
||||||
}).catchError((error) {
|
|
||||||
_exceptionThrower.throwException(error);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<void> deleteFCMToken(String accountId) {
|
|
||||||
return Future.sync(() async {
|
|
||||||
return await _firebaseCacheManager.deleteFCMToken(accountId);
|
|
||||||
}).catchError((error) {
|
|
||||||
_exceptionThrower.throwException(error);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<bool> storeStateToRefresh(TypeName typeName, jmap.State newState) {
|
Future<bool> storeStateToRefresh(TypeName typeName, jmap.State newState) {
|
||||||
return Future.sync(() async {
|
return Future.sync(() async {
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
import 'package:model/fcm/fcm_token_dto.dart';
|
|
||||||
import 'package:tmail_ui_user/features/push_notification/data/model/fcm_token_cache.dart';
|
|
||||||
|
|
||||||
extension FCMCacheExtension on FCMTokenCache {
|
|
||||||
FCMTokenDto toFCMDto() {
|
|
||||||
return FCMTokenDto(
|
|
||||||
token,
|
|
||||||
accountId,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
import 'package:model/fcm/fcm_token_dto.dart';
|
|
||||||
import 'package:tmail_ui_user/features/push_notification/data/model/fcm_token_cache.dart';
|
|
||||||
|
|
||||||
extension FCMExtensions on FCMTokenDto {
|
|
||||||
FCMTokenCache toCache() {
|
|
||||||
return FCMTokenCache(
|
|
||||||
token,
|
|
||||||
accountId,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,44 +1,15 @@
|
|||||||
import 'package:core/utils/app_logger.dart';
|
import 'package:core/utils/app_logger.dart';
|
||||||
import 'package:fcm/model/type_name.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: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:tmail_ui_user/features/push_notification/domain/exceptions/fcm_exception.dart';
|
||||||
import 'package:jmap_dart_client/jmap/core/state.dart' as jmap;
|
import 'package:jmap_dart_client/jmap/core/state.dart' as jmap;
|
||||||
|
|
||||||
class FCMCacheManager {
|
class FCMCacheManager {
|
||||||
final FcmTokenCacheClient _fcmTokenCacheClient;
|
|
||||||
final SharedPreferences _sharedPreferences;
|
final SharedPreferences _sharedPreferences;
|
||||||
|
|
||||||
static const String fcmDeviceIdKey = 'FCM_DEVICE_ID';
|
static const String fcmDeviceIdKey = 'FCM_DEVICE_ID';
|
||||||
|
|
||||||
FCMCacheManager(this._fcmTokenCacheClient, this._sharedPreferences);
|
FCMCacheManager(this._sharedPreferences);
|
||||||
|
|
||||||
Future<FCMTokenDto> getFCMToken(String accountId) async {
|
|
||||||
try {
|
|
||||||
final firebase = await _fcmTokenCacheClient.getItem(accountId);
|
|
||||||
if(firebase != null ) {
|
|
||||||
return firebase.toFCMDto();
|
|
||||||
} else {
|
|
||||||
throw NotFoundStoredFCMException();
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
logError('FCMCacheManager::getFCM(): $e');
|
|
||||||
throw NotFoundStoredFCMException();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> setFCMToken(FCMTokenDto firebaseDto) {
|
|
||||||
log('FCMCacheManager::setFCM(): $_fcmTokenCacheClient');
|
|
||||||
return _fcmTokenCacheClient.insertItem(firebaseDto.accountId, firebaseDto.toCache());
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> deleteFCMToken(String accountId) {
|
|
||||||
log('FCMCacheManager::deleteSelectedFCM(): $accountId');
|
|
||||||
return _fcmTokenCacheClient.deleteItem(accountId);
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<bool> storeStateToRefresh(TypeName typeName, jmap.State newState) {
|
Future<bool> storeStateToRefresh(TypeName typeName, jmap.State newState) {
|
||||||
return _sharedPreferences.setString(typeName.value, newState.value);
|
return _sharedPreferences.setString(typeName.value, newState.value);
|
||||||
|
|||||||
@@ -1,22 +0,0 @@
|
|||||||
import 'package:equatable/equatable.dart';
|
|
||||||
import 'package:hive/hive.dart';
|
|
||||||
import 'package:tmail_ui_user/features/caching/utils/caching_constants.dart';
|
|
||||||
|
|
||||||
part 'fcm_token_cache.g.dart';
|
|
||||||
|
|
||||||
@HiveType(typeId: CachingConstants.FCM_TOKEN_CACHE_IDENTITY)
|
|
||||||
class FCMTokenCache extends HiveObject with EquatableMixin {
|
|
||||||
@HiveField(0)
|
|
||||||
final String token;
|
|
||||||
|
|
||||||
@HiveField(1)
|
|
||||||
final String accountId;
|
|
||||||
|
|
||||||
FCMTokenCache(
|
|
||||||
this.token,
|
|
||||||
this.accountId,
|
|
||||||
);
|
|
||||||
|
|
||||||
@override
|
|
||||||
List<Object?> get props => [token, accountId];
|
|
||||||
}
|
|
||||||
@@ -3,7 +3,6 @@ import 'package:fcm/model/firebase_subscription.dart';
|
|||||||
import 'package:fcm/model/type_name.dart';
|
import 'package:fcm/model/type_name.dart';
|
||||||
import 'package:jmap_dart_client/jmap/account_id.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/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/data/datasource/fcm_datasource.dart';
|
||||||
import 'package:tmail_ui_user/features/push_notification/domain/model/register_new_token_request.dart';
|
import 'package:tmail_ui_user/features/push_notification/domain/model/register_new_token_request.dart';
|
||||||
import 'package:tmail_ui_user/features/push_notification/domain/repository/fcm_repository.dart';
|
import 'package:tmail_ui_user/features/push_notification/domain/repository/fcm_repository.dart';
|
||||||
@@ -22,21 +21,6 @@ class FCMRepositoryImpl extends FCMRepository {
|
|||||||
this._threadDataSource
|
this._threadDataSource
|
||||||
);
|
);
|
||||||
|
|
||||||
@override
|
|
||||||
Future<FCMTokenDto> getFCMToken(String accountId) {
|
|
||||||
return _fcmDatasource[DataSourceType.local]!.getFCMToken(accountId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<void> setFCMToken(FCMTokenDto fcmTokenDto) {
|
|
||||||
return _fcmDatasource[DataSourceType.local]!.setFCMToken(fcmTokenDto);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<void> deleteFCMToken(String accountId) {
|
|
||||||
return _fcmDatasource[DataSourceType.local]!.deleteFCMToken(accountId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<EmailsResponse> getEmailChangesToPushNotification(
|
Future<EmailsResponse> getEmailChangesToPushNotification(
|
||||||
AccountId accountId,
|
AccountId accountId,
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
class NotFoundStoredFCMException implements Exception {}
|
|
||||||
|
|
||||||
class NotSupportFCMException implements Exception {}
|
class NotSupportFCMException implements Exception {}
|
||||||
|
|
||||||
class NotFoundStateToRefreshException implements Exception {}
|
class NotFoundStateToRefreshException implements Exception {}
|
||||||
|
|||||||
@@ -2,18 +2,11 @@ import 'package:fcm/model/firebase_subscription.dart';
|
|||||||
import 'package:fcm/model/type_name.dart';
|
import 'package:fcm/model/type_name.dart';
|
||||||
import 'package:jmap_dart_client/jmap/account_id.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/properties/properties.dart';
|
||||||
import 'package:model/fcm/fcm_token_dto.dart';
|
|
||||||
import 'package:tmail_ui_user/features/push_notification/domain/model/register_new_token_request.dart';
|
import 'package:tmail_ui_user/features/push_notification/domain/model/register_new_token_request.dart';
|
||||||
import 'package:tmail_ui_user/features/thread/domain/model/email_response.dart';
|
import 'package:tmail_ui_user/features/thread/domain/model/email_response.dart';
|
||||||
import 'package:jmap_dart_client/jmap/core/state.dart' as jmap;
|
import 'package:jmap_dart_client/jmap/core/state.dart' as jmap;
|
||||||
|
|
||||||
abstract class FCMRepository {
|
abstract class FCMRepository {
|
||||||
Future<FCMTokenDto> getFCMToken(String accountId);
|
|
||||||
|
|
||||||
Future<void> setFCMToken(FCMTokenDto fcmTokenDto);
|
|
||||||
|
|
||||||
Future<void> deleteFCMToken(String accountId);
|
|
||||||
|
|
||||||
Future<EmailsResponse> getEmailChangesToPushNotification(
|
Future<EmailsResponse> getEmailChangesToPushNotification(
|
||||||
AccountId accountId,
|
AccountId accountId,
|
||||||
jmap.State currentState,
|
jmap.State currentState,
|
||||||
|
|||||||
@@ -1,19 +0,0 @@
|
|||||||
import 'package:core/core.dart';
|
|
||||||
|
|
||||||
class DeleteFCMTokenSuccess extends UIState {
|
|
||||||
|
|
||||||
|
|
||||||
DeleteFCMTokenSuccess();
|
|
||||||
|
|
||||||
@override
|
|
||||||
List<Object> get props => [];
|
|
||||||
}
|
|
||||||
|
|
||||||
class DeleteFCMTokenFailure extends FeatureFailure {
|
|
||||||
final dynamic exception;
|
|
||||||
|
|
||||||
DeleteFCMTokenFailure(this.exception);
|
|
||||||
|
|
||||||
@override
|
|
||||||
List<Object> get props => [exception];
|
|
||||||
}
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
import 'package:core/core.dart';
|
|
||||||
import 'package:model/fcm/fcm_token_dto.dart';
|
|
||||||
|
|
||||||
class GetFCMTokenSuccess extends UIState {
|
|
||||||
|
|
||||||
final FCMTokenDto firebaseDto;
|
|
||||||
|
|
||||||
GetFCMTokenSuccess(this.firebaseDto);
|
|
||||||
|
|
||||||
@override
|
|
||||||
List<Object> get props => [firebaseDto];
|
|
||||||
}
|
|
||||||
|
|
||||||
class GetFCMTokenFailure extends FeatureFailure {
|
|
||||||
final dynamic exception;
|
|
||||||
|
|
||||||
GetFCMTokenFailure(this.exception);
|
|
||||||
|
|
||||||
@override
|
|
||||||
List<Object> get props => [exception];
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
import 'package:core/core.dart';
|
|
||||||
|
|
||||||
class SaveFCMTokenSuccess extends UIState {
|
|
||||||
|
|
||||||
|
|
||||||
SaveFCMTokenSuccess();
|
|
||||||
|
|
||||||
@override
|
|
||||||
List<Object> get props => [];
|
|
||||||
}
|
|
||||||
|
|
||||||
class SaveFCMTokenFailure extends FeatureFailure {
|
|
||||||
final dynamic exception;
|
|
||||||
|
|
||||||
SaveFCMTokenFailure(this.exception);
|
|
||||||
|
|
||||||
@override
|
|
||||||
List<Object> get props => [exception];
|
|
||||||
}
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
import 'package:core/core.dart';
|
|
||||||
import 'package:dartz/dartz.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_fcm_token_state.dart';
|
|
||||||
|
|
||||||
class DeleteFCMTokenCacheInteractor {
|
|
||||||
final FCMRepository _fcmRepository;
|
|
||||||
|
|
||||||
DeleteFCMTokenCacheInteractor(this._fcmRepository);
|
|
||||||
|
|
||||||
Stream<Either<Failure, Success>> execute(String accountId) async* {
|
|
||||||
try {
|
|
||||||
await _fcmRepository.deleteFCMToken(accountId);
|
|
||||||
yield Right<Failure, Success>(DeleteFCMTokenSuccess());
|
|
||||||
} catch (e) {
|
|
||||||
logError('DeleteFirebaseCacheInteractor::execute(): $e');
|
|
||||||
yield Left<Failure, Success>(DeleteFCMTokenFailure(e));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
|
|
||||||
import 'package:core/core.dart';
|
|
||||||
import 'package:dartz/dartz.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_fcm_token_state.dart';
|
|
||||||
|
|
||||||
class GetFCMTokenCacheInteractor {
|
|
||||||
|
|
||||||
final FCMRepository _fcmRepository;
|
|
||||||
|
|
||||||
GetFCMTokenCacheInteractor(this._fcmRepository);
|
|
||||||
|
|
||||||
Stream<Either<Failure, Success>> execute(
|
|
||||||
String accountId) async* {
|
|
||||||
try {
|
|
||||||
final fcmToken = await _fcmRepository.getFCMToken(accountId);
|
|
||||||
yield Right<Failure, Success>(GetFCMTokenSuccess(fcmToken));
|
|
||||||
} catch (e) {
|
|
||||||
logError('GetFirebaseCacheInteractor::execute(): $e');
|
|
||||||
yield Left<Failure, Success>(GetFCMTokenFailure(e));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
import 'package:core/core.dart';
|
|
||||||
import 'package:dartz/dartz.dart';
|
|
||||||
import 'package:model/fcm/fcm_token_dto.dart';
|
|
||||||
import 'package:tmail_ui_user/features/push_notification/domain/repository/fcm_repository.dart';
|
|
||||||
import 'package:tmail_ui_user/features/push_notification/domain/state/save_fcm_token_state.dart';
|
|
||||||
|
|
||||||
class SaveFCMTokenCacheInteractor {
|
|
||||||
final FCMRepository _fcmRepository;
|
|
||||||
|
|
||||||
SaveFCMTokenCacheInteractor(this._fcmRepository);
|
|
||||||
|
|
||||||
Stream<Either<Failure, Success>> execute(FCMTokenDto fcmTokenDto) async* {
|
|
||||||
try {
|
|
||||||
await _fcmRepository.setFCMToken(fcmTokenDto);
|
|
||||||
yield Right<Failure, Success>(SaveFCMTokenSuccess());
|
|
||||||
} catch (e) {
|
|
||||||
logError('SaveFirebaseCacheInteractor::execute(): $e');
|
|
||||||
yield Left<Failure, Success>(SaveFCMTokenFailure(e));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -9,15 +9,12 @@ import 'package:tmail_ui_user/features/push_notification/data/network/fcm_api.da
|
|||||||
import 'package:tmail_ui_user/features/push_notification/data/repository/fcm_repository_impl.dart';
|
import 'package:tmail_ui_user/features/push_notification/data/repository/fcm_repository_impl.dart';
|
||||||
import 'package:tmail_ui_user/features/push_notification/domain/repository/fcm_repository.dart';
|
import 'package:tmail_ui_user/features/push_notification/domain/repository/fcm_repository.dart';
|
||||||
import 'package:tmail_ui_user/features/push_notification/domain/usecases/delete_email_state_to_refresh_interactor.dart';
|
import 'package:tmail_ui_user/features/push_notification/domain/usecases/delete_email_state_to_refresh_interactor.dart';
|
||||||
import 'package:tmail_ui_user/features/push_notification/domain/usecases/delete_fcm_token_cache_interactor.dart';
|
|
||||||
import 'package:tmail_ui_user/features/push_notification/domain/usecases/get_device_id_interactor.dart';
|
import 'package:tmail_ui_user/features/push_notification/domain/usecases/get_device_id_interactor.dart';
|
||||||
import 'package:tmail_ui_user/features/push_notification/domain/usecases/get_email_changes_to_push_notification_interactor.dart';
|
import 'package:tmail_ui_user/features/push_notification/domain/usecases/get_email_changes_to_push_notification_interactor.dart';
|
||||||
import 'package:tmail_ui_user/features/push_notification/domain/usecases/get_email_state_to_refresh_interactor.dart';
|
import 'package:tmail_ui_user/features/push_notification/domain/usecases/get_email_state_to_refresh_interactor.dart';
|
||||||
import 'package:tmail_ui_user/features/push_notification/domain/usecases/get_fcm_token_cache_interactor.dart';
|
|
||||||
import 'package:tmail_ui_user/features/push_notification/domain/usecases/get_firebase_subscription_interactor.dart';
|
import 'package:tmail_ui_user/features/push_notification/domain/usecases/get_firebase_subscription_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/get_stored_email_delivery_state_interactor.dart';
|
||||||
import 'package:tmail_ui_user/features/push_notification/domain/usecases/register_new_token_interactor.dart';
|
import 'package:tmail_ui_user/features/push_notification/domain/usecases/register_new_token_interactor.dart';
|
||||||
import 'package:tmail_ui_user/features/push_notification/domain/usecases/save_fcm_token_cache_interactor.dart';
|
|
||||||
import 'package:tmail_ui_user/features/push_notification/domain/usecases/store_device_id_interactor.dart';
|
import 'package:tmail_ui_user/features/push_notification/domain/usecases/store_device_id_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_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_email_state_to_refresh_interactor.dart';
|
||||||
@@ -55,9 +52,6 @@ class FcmInteractorBindings extends InteractorsBindings {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void bindingsInteractor() {
|
void bindingsInteractor() {
|
||||||
Get.lazyPut(() => DeleteFCMTokenCacheInteractor(Get.find<FCMRepositoryImpl>()));
|
|
||||||
Get.lazyPut(() => SaveFCMTokenCacheInteractor(Get.find<FCMRepositoryImpl>()));
|
|
||||||
Get.lazyPut(() => GetFCMTokenCacheInteractor(Get.find<FCMRepositoryImpl>()));
|
|
||||||
Get.lazyPut(() => GetStoredEmailDeliveryStateInteractor(Get.find<FCMRepositoryImpl>()));
|
Get.lazyPut(() => GetStoredEmailDeliveryStateInteractor(Get.find<FCMRepositoryImpl>()));
|
||||||
Get.lazyPut(() => StoreEmailDeliveryStateInteractor(Get.find<FCMRepositoryImpl>()));
|
Get.lazyPut(() => StoreEmailDeliveryStateInteractor(Get.find<FCMRepositoryImpl>()));
|
||||||
Get.lazyPut(() => GetEmailChangesToPushNotificationInteractor(Get.find<FCMRepositoryImpl>()));
|
Get.lazyPut(() => GetEmailChangesToPushNotificationInteractor(Get.find<FCMRepositoryImpl>()));
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import 'package:tmail_ui_user/features/caching/authentication_info_cache_client.
|
|||||||
import 'package:tmail_ui_user/features/caching/caching_manager.dart';
|
import 'package:tmail_ui_user/features/caching/caching_manager.dart';
|
||||||
import 'package:tmail_ui_user/features/caching/email_cache_client.dart';
|
import 'package:tmail_ui_user/features/caching/email_cache_client.dart';
|
||||||
import 'package:tmail_ui_user/features/caching/encryption_key_cache_client.dart';
|
import 'package:tmail_ui_user/features/caching/encryption_key_cache_client.dart';
|
||||||
import 'package:tmail_ui_user/features/caching/fcm_token_cache_client.dart';
|
|
||||||
import 'package:tmail_ui_user/features/caching/mailbox_cache_client.dart';
|
import 'package:tmail_ui_user/features/caching/mailbox_cache_client.dart';
|
||||||
import 'package:tmail_ui_user/features/caching/recent_login_url_cache_client.dart';
|
import 'package:tmail_ui_user/features/caching/recent_login_url_cache_client.dart';
|
||||||
import 'package:tmail_ui_user/features/caching/recent_login_username_cache_client.dart';
|
import 'package:tmail_ui_user/features/caching/recent_login_username_cache_client.dart';
|
||||||
@@ -57,15 +56,13 @@ class LocalBindings extends Bindings {
|
|||||||
Get.put(RecentLoginUrlCacheManager((Get.find<RecentLoginUrlCacheClient>())));
|
Get.put(RecentLoginUrlCacheManager((Get.find<RecentLoginUrlCacheClient>())));
|
||||||
Get.put(RecentLoginUsernameCacheClient());
|
Get.put(RecentLoginUsernameCacheClient());
|
||||||
Get.put(RecentLoginUsernameCacheManager(Get.find<RecentLoginUsernameCacheClient>()));
|
Get.put(RecentLoginUsernameCacheManager(Get.find<RecentLoginUsernameCacheClient>()));
|
||||||
Get.put(FcmTokenCacheClient());
|
Get.put(FCMCacheManager(Get.find<SharedPreferences>()));
|
||||||
Get.put(FCMCacheManager(Get.find<FcmTokenCacheClient>(), Get.find<SharedPreferences>()));
|
|
||||||
Get.put(CachingManager(
|
Get.put(CachingManager(
|
||||||
Get.find<MailboxCacheClient>(),
|
Get.find<MailboxCacheClient>(),
|
||||||
Get.find<StateCacheClient>(),
|
Get.find<StateCacheClient>(),
|
||||||
Get.find<EmailCacheClient>(),
|
Get.find<EmailCacheClient>(),
|
||||||
Get.find<RecentSearchCacheClient>(),
|
Get.find<RecentSearchCacheClient>(),
|
||||||
Get.find<AccountCacheClient>(),
|
Get.find<AccountCacheClient>(),
|
||||||
Get.find<FcmTokenCacheClient>(),
|
|
||||||
Get.find<FCMCacheManager>()
|
Get.find<FCMCacheManager>()
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user