File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
feature/home/src/main/kotlin/com/ninecraft/booket/feature/home Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -105,9 +105,13 @@ class HomePresenter @AssistedInject constructor(
105105 is HomeUiEvent .OnNotificationPermissionResult -> {
106106 scope.launch {
107107 val isPermissionGranted = event.granted
108+ val userEnabled = userRepository.getUserNotificationEnabled()
108109 val lastSyncedServerEnabled = userRepository.getLastSyncedNotificationEnabled()
109110
110- if (lastSyncedServerEnabled == null || isPermissionGranted != lastSyncedServerEnabled) {
111+ val shouldSync = (! isPermissionGranted && lastSyncedServerEnabled != false ) ||
112+ (userEnabled && (lastSyncedServerEnabled == null || lastSyncedServerEnabled != isPermissionGranted))
113+
114+ if (shouldSync) {
111115 syncNotificationSettings(isPermissionGranted)
112116 }
113117 }
You can’t perform that action at this time.
0 commit comments