Skip to content

Commit fdaf8d2

Browse files
committed
Auto update apps even when notifications are disabled
Closes #747
1 parent 2996966 commit fdaf8d2

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

app/src/main/kotlin/com/looker/droidify/service/SyncService.kt

+9-3
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import com.looker.core.common.extension.getColorFromAttr
2222
import com.looker.core.common.extension.notificationManager
2323
import com.looker.core.common.extension.startSelf
2424
import com.looker.core.common.extension.stopForegroundCompat
25+
import com.looker.core.common.log
2526
import com.looker.core.common.result.Result
2627
import com.looker.core.common.sdkAbove
2728
import com.looker.core.datastore.SettingsRepository
@@ -471,7 +472,7 @@ class SyncService : ConnectionService<SyncService.Binder>() {
471472
autoUpdate: Boolean
472473
) {
473474
try {
474-
if (!hasUpdates || !notifyUpdates) {
475+
if (!hasUpdates) {
475476
syncState.emit(State.Finish)
476477
val needStop = started == Started.MANUAL
477478
started = Started.NO
@@ -481,10 +482,14 @@ class SyncService : ConnectionService<SyncService.Binder>() {
481482
val blocked = updateNotificationBlockerFragment?.get()?.isAdded == true
482483
val updates = Database.ProductAdapter.getUpdates()
483484
if (!blocked && updates.isNotEmpty()) {
484-
displayUpdatesNotification(updates)
485+
if (notifyUpdates) displayUpdatesNotification(updates)
485486
if (autoUpdate) updateAllAppsInternal()
486487
}
487-
handleUpdates(hasUpdates = false, notifyUpdates = true, autoUpdate = autoUpdate)
488+
handleUpdates(
489+
hasUpdates = false,
490+
notifyUpdates = notifyUpdates,
491+
autoUpdate = autoUpdate
492+
)
488493
} finally {
489494
withContext(NonCancellable) {
490495
lock.withLock { currentTask = null }
@@ -494,6 +499,7 @@ class SyncService : ConnectionService<SyncService.Binder>() {
494499
}
495500

496501
private suspend fun updateAllAppsInternal() {
502+
log("Check Running", "Syncing")
497503
Database.ProductAdapter
498504
.getUpdates()
499505
// Update Droid-ify the last

0 commit comments

Comments
 (0)