diff --git a/lib/features/push_notification/data/datasource/fcm_datasource.dart b/lib/features/push_notification/data/datasource/fcm_datasource.dart index 1b0238363..38efcca75 100644 --- a/lib/features/push_notification/data/datasource/fcm_datasource.dart +++ b/lib/features/push_notification/data/datasource/fcm_datasource.dart @@ -19,4 +19,6 @@ abstract class FCMDatasource { Future registerNewToken(RegisterNewTokenRequest newTokenRequest); Future geSubscription(); + + Future destroySubscription(String subscriptionId); } \ No newline at end of file diff --git a/lib/features/push_notification/data/datasource_impl/cache_fcm_datasource_impl.dart b/lib/features/push_notification/data/datasource_impl/cache_fcm_datasource_impl.dart index 0cf843f2b..889a8421d 100644 --- a/lib/features/push_notification/data/datasource_impl/cache_fcm_datasource_impl.dart +++ b/lib/features/push_notification/data/datasource_impl/cache_fcm_datasource_impl.dart @@ -68,4 +68,9 @@ class CacheFCMDatasourceImpl extends FCMDatasource { _exceptionThrower.throwException(error); }); } + + @override + Future destroySubscription(String subscriptionId) { + throw UnimplementedError(); + } } \ No newline at end of file diff --git a/lib/features/push_notification/data/datasource_impl/fcm_datasource_impl.dart b/lib/features/push_notification/data/datasource_impl/fcm_datasource_impl.dart index aa10ba78c..d6a80a1fe 100644 --- a/lib/features/push_notification/data/datasource_impl/fcm_datasource_impl.dart +++ b/lib/features/push_notification/data/datasource_impl/fcm_datasource_impl.dart @@ -58,4 +58,13 @@ class FcmDatasourceImpl extends FCMDatasource { Future geSubscription() { throw UnimplementedError(); } + + @override + Future destroySubscription(String subscriptionId) { + return Future.sync(() async { + return await _fcmApi.destroySubscription(subscriptionId); + }).catchError((error) { + _exceptionThrower.throwException(error); + }); + } } \ No newline at end of file diff --git a/lib/main/bindings/local/local_bindings.dart b/lib/main/bindings/local/local_bindings.dart index 42e3fe64f..94a366f49 100644 --- a/lib/main/bindings/local/local_bindings.dart +++ b/lib/main/bindings/local/local_bindings.dart @@ -11,6 +11,7 @@ import 'package:tmail_ui_user/features/caching/recent_login_url_cache_client.dar import 'package:tmail_ui_user/features/caching/recent_login_username_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/subscription_cache_client.dart'; import 'package:tmail_ui_user/features/caching/token_oidc_cache_client.dart'; import 'package:tmail_ui_user/features/cleanup/data/local/recent_login_url_cache_manager.dart'; import 'package:tmail_ui_user/features/cleanup/data/local/recent_login_username_cache_manager.dart'; @@ -56,7 +57,8 @@ class LocalBindings extends Bindings { Get.put(RecentLoginUrlCacheManager((Get.find()))); Get.put(RecentLoginUsernameCacheClient()); Get.put(RecentLoginUsernameCacheManager(Get.find())); - Get.put(FCMCacheManager(Get.find())); + Get.put(FCMSubscriptionCacheClient()); + Get.put(FCMCacheManager(Get.find(),Get.find())); Get.put(CachingManager( Get.find(), Get.find(),