TF-439 Delete all class not used
This commit is contained in:
@@ -1,44 +1,15 @@
|
||||
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;
|
||||
|
||||
static const String fcmDeviceIdKey = 'FCM_DEVICE_ID';
|
||||
|
||||
FCMCacheManager(this._fcmTokenCacheClient, 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);
|
||||
}
|
||||
FCMCacheManager(this._sharedPreferences);
|
||||
|
||||
Future<bool> storeStateToRefresh(TypeName typeName, jmap.State newState) {
|
||||
return _sharedPreferences.setString(typeName.value, newState.value);
|
||||
|
||||
Reference in New Issue
Block a user