mirror of
https://codeberg.org/timelimit/opentimelimit-android.git
synced 2025-10-03 17:59:46 +02:00
Use category for Apps without category
This commit is contained in:
parent
0c60d0be42
commit
bb918eac7a
2 changed files with 13 additions and 1 deletions
|
@ -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)
|
||||
|
|
|
@ -120,7 +120,18 @@ class BlockingReasonUtil(private val appLogic: AppLogic) {
|
|||
categoryEntry ->
|
||||
|
||||
if (categoryEntry == null) {
|
||||
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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue