Skip to content

Commit

Permalink
Auto update apps even when notifications are disabled
Browse files Browse the repository at this point in the history
Closes #747
  • Loading branch information
Iamlooker committed Dec 25, 2024
1 parent 2996966 commit fdaf8d2
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions app/src/main/kotlin/com/looker/droidify/service/SyncService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -471,7 +472,7 @@ class SyncService : ConnectionService<SyncService.Binder>() {
autoUpdate: Boolean
) {
try {
if (!hasUpdates || !notifyUpdates) {
if (!hasUpdates) {
syncState.emit(State.Finish)
val needStop = started == Started.MANUAL
started = Started.NO
Expand All @@ -481,10 +482,14 @@ class SyncService : ConnectionService<SyncService.Binder>() {
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 }
Expand All @@ -494,6 +499,7 @@ class SyncService : ConnectionService<SyncService.Binder>() {
}

private suspend fun updateAllAppsInternal() {
log("Check Running", "Syncing")
Database.ProductAdapter
.getUpdates()
// Update Droid-ify the last
Expand Down

0 comments on commit fdaf8d2

Please sign in to comment.