diff --git a/app/src/main/java/com/bnyro/wallpaper/util/BackgroundWorker.kt b/app/src/main/java/com/bnyro/wallpaper/util/BackgroundWorker.kt index fd0a382..4b86840 100644 --- a/app/src/main/java/com/bnyro/wallpaper/util/BackgroundWorker.kt +++ b/app/src/main/java/com/bnyro/wallpaper/util/BackgroundWorker.kt @@ -16,10 +16,17 @@ class BackgroundWorker( private val workerParameters: WorkerParameters ) : CoroutineWorker(applicationContext, workerParameters) { override suspend fun doWork(): Result { + val wallpaperConfigs = Preferences.getWallpaperConfigs() + val configId = workerParameters.inputData.getInt(WorkerHelper.WALLPAPER_CONFIG_ID, -1) - if (configId == -1) return Result.failure() + if (configId == -1) { + for (config in wallpaperConfigs) { + runWallpaperChanger(config) + } + return Result.success() + } - val config = Preferences.getWallpaperConfigs().firstOrNull { + val config = wallpaperConfigs.firstOrNull { it.id == configId } ?: return Result.success()