diff --git a/app/src/main/java/io/timelimit/android/logic/BackgroundTaskLogic.kt b/app/src/main/java/io/timelimit/android/logic/BackgroundTaskLogic.kt index 6a181b1..d82247e 100644 --- a/app/src/main/java/io/timelimit/android/logic/BackgroundTaskLogic.kt +++ b/app/src/main/java/io/timelimit/android/logic/BackgroundTaskLogic.kt @@ -185,6 +185,7 @@ class BackgroundTaskLogic(val appLogic: AppLogic) { } else if (foregroundAppPackageName != null) { val appCategory = appCategories.get(Pair(foregroundAppPackageName, categories.map { it.id })).waitForNullableValue() val category = categories.find { it.id == appCategory?.categoryId } + ?: categories.find { it.id == deviceUserEntry.categoryForNotAssignedApps } if (category == null) { usedTimeUpdateHelper?.commit(appLogic) diff --git a/app/src/main/java/io/timelimit/android/logic/BlockingReason.kt b/app/src/main/java/io/timelimit/android/logic/BlockingReason.kt index 1553a9c..2ff00cd 100644 --- a/app/src/main/java/io/timelimit/android/logic/BlockingReason.kt +++ b/app/src/main/java/io/timelimit/android/logic/BlockingReason.kt @@ -120,7 +120,18 @@ class BlockingReasonUtil(private val appLogic: AppLogic) { categoryEntry -> if (categoryEntry == null) { - liveDataFromValue(BlockingReason.NotPartOfAnCategory) + val defaultCategory = if (child.categoryForNotAssignedApps.isEmpty()) + liveDataFromValue(null as Category?) + else + appLogic.database.category().getCategoryByChildIdAndId(child.id, child.categoryForNotAssignedApps) + + defaultCategory.switchMap { categoryEntry2 -> + if (categoryEntry2 == null) { + liveDataFromValue(BlockingReason.NotPartOfAnCategory) + } else { + getBlockingReasonStep4Point5(categoryEntry2, child, timeZone) + } + } } else if (categoryEntry.temporarilyBlocked) { liveDataFromValue(BlockingReason.TemporarilyBlocked) } else {