From fdaf8d27bc7accd8528af2839e455769f4c661db Mon Sep 17 00:00:00 2001 From: LooKeR Date: Wed, 25 Dec 2024 23:03:35 +0530 Subject: [PATCH] Auto update apps even when notifications are disabled Closes #747 --- .../com/looker/droidify/service/SyncService.kt | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/app/src/main/kotlin/com/looker/droidify/service/SyncService.kt b/app/src/main/kotlin/com/looker/droidify/service/SyncService.kt index 01da7dba..fae9464d 100644 --- a/app/src/main/kotlin/com/looker/droidify/service/SyncService.kt +++ b/app/src/main/kotlin/com/looker/droidify/service/SyncService.kt @@ -22,6 +22,7 @@ import com.looker.core.common.extension.getColorFromAttr import com.looker.core.common.extension.notificationManager import com.looker.core.common.extension.startSelf import com.looker.core.common.extension.stopForegroundCompat +import com.looker.core.common.log import com.looker.core.common.result.Result import com.looker.core.common.sdkAbove import com.looker.core.datastore.SettingsRepository @@ -471,7 +472,7 @@ class SyncService : ConnectionService() { autoUpdate: Boolean ) { try { - if (!hasUpdates || !notifyUpdates) { + if (!hasUpdates) { syncState.emit(State.Finish) val needStop = started == Started.MANUAL started = Started.NO @@ -481,10 +482,14 @@ class SyncService : ConnectionService() { val blocked = updateNotificationBlockerFragment?.get()?.isAdded == true val updates = Database.ProductAdapter.getUpdates() if (!blocked && updates.isNotEmpty()) { - displayUpdatesNotification(updates) + if (notifyUpdates) displayUpdatesNotification(updates) if (autoUpdate) updateAllAppsInternal() } - handleUpdates(hasUpdates = false, notifyUpdates = true, autoUpdate = autoUpdate) + handleUpdates( + hasUpdates = false, + notifyUpdates = notifyUpdates, + autoUpdate = autoUpdate + ) } finally { withContext(NonCancellable) { lock.withLock { currentTask = null } @@ -494,6 +499,7 @@ class SyncService : ConnectionService() { } private suspend fun updateAllAppsInternal() { + log("Check Running", "Syncing") Database.ProductAdapter .getUpdates() // Update Droid-ify the last