TF-439 Implement handle store device id
This commit is contained in:
@@ -65,4 +65,13 @@ class HiveFCMDatasourceImpl extends FCMDatasource {
|
||||
_exceptionThrower.throwException(error);
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Future<bool> storeDeviceId(String deviceId) {
|
||||
return Future.sync(() async {
|
||||
return await _firebaseCacheManager.storeDeviceId(deviceId);
|
||||
}).catchError((error) {
|
||||
_exceptionThrower.throwException(error);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,8 @@ 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 {
|
||||
@@ -69,4 +71,8 @@ class FCMCacheManager {
|
||||
_sharedPreferences.remove(TypeName.emailDelivery.value)
|
||||
]).then((listResult) => listResult.every((result) => result));
|
||||
}
|
||||
|
||||
Future<bool> storeDeviceId(String deviceId) {
|
||||
return _sharedPreferences.setString(fcmDeviceIdKey, deviceId);
|
||||
}
|
||||
}
|
||||
@@ -88,4 +88,9 @@ class FCMRepositoryImpl extends FCMRepository {
|
||||
Future<bool> deleteStateToRefresh(TypeName typeName) {
|
||||
return _fcmDatasource.deleteStateToRefresh(typeName);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<bool> storeDeviceId(String deviceId) {
|
||||
return _fcmDatasource.storeDeviceId(deviceId);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user