File tree Expand file tree Collapse file tree
api/src/main/kotlin/com/ninecraft/booket/core/data/api/repository
impl/src/main/kotlin/com/ninecraft/booket/core/data/impl/repository Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ interface UserRepository {
2828
2929 suspend fun setLastNotificationSyncedEnabled (isEnabled : Boolean )
3030
31- suspend fun resetNotificationData ()
32-
3331 suspend fun updateNotificationSettings (notificationEnabled : Boolean ): Result <UserProfileModel >
32+
33+ suspend fun resetNotificationData ()
3434}
Original file line number Diff line number Diff line change @@ -71,15 +71,19 @@ internal class DefaultUserRepository @Inject constructor(
7171 notificationDataSource.setLastSyncedNotificationEnabled(isEnabled)
7272 }
7373
74- override suspend fun resetNotificationData () {
75- deleteRemoteFcmToken()
76- clearNotificationDataStore()
77- }
78-
7974 override suspend fun updateNotificationSettings (notificationEnabled : Boolean ) = runSuspendCatching {
8075 service.updateNotificationSettings(NotificationSettingsRequest (notificationEnabled)).toModel()
8176 }
8277
78+ override suspend fun resetNotificationData () {
79+ try {
80+ deleteRemoteFcmToken()
81+ clearNotificationDataStore()
82+ } catch (e: Exception ) {
83+ Logger .e(" Failed to reset notification data: ${e.message} " )
84+ }
85+ }
86+
8387 private suspend fun getRemoteFcmToken (): String {
8488 return try {
8589 firebaseMessaging.token.await()
@@ -110,11 +114,7 @@ internal class DefaultUserRepository @Inject constructor(
110114 }
111115
112116 private suspend fun deleteRemoteFcmToken () {
113- try {
114- firebaseMessaging.deleteToken().await()
115- } catch (e: Exception ) {
116- Logger .e(" Failed to delete FCM token: ${e.message} " )
117- }
117+ firebaseMessaging.deleteToken().await()
118118 }
119119
120120 private suspend fun clearNotificationDataStore () {
You can’t perform that action at this time.
0 commit comments