mirror of
https://codeberg.org/timelimit/opentimelimit-android.git
synced 2025-10-04 02:09:42 +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) {
|
} else if (foregroundAppPackageName != null) {
|
||||||
val appCategory = appCategories.get(Pair(foregroundAppPackageName, categories.map { it.id })).waitForNullableValue()
|
val appCategory = appCategories.get(Pair(foregroundAppPackageName, categories.map { it.id })).waitForNullableValue()
|
||||||
val category = categories.find { it.id == appCategory?.categoryId }
|
val category = categories.find { it.id == appCategory?.categoryId }
|
||||||
|
?: categories.find { it.id == deviceUserEntry.categoryForNotAssignedApps }
|
||||||
|
|
||||||
if (category == null) {
|
if (category == null) {
|
||||||
usedTimeUpdateHelper?.commit(appLogic)
|
usedTimeUpdateHelper?.commit(appLogic)
|
||||||
|
|
|
@ -120,7 +120,18 @@ class BlockingReasonUtil(private val appLogic: AppLogic) {
|
||||||
categoryEntry ->
|
categoryEntry ->
|
||||||
|
|
||||||
if (categoryEntry == null) {
|
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)
|
liveDataFromValue(BlockingReason.NotPartOfAnCategory)
|
||||||
|
} else {
|
||||||
|
getBlockingReasonStep4Point5(categoryEntry2, child, timeZone)
|
||||||
|
}
|
||||||
|
}
|
||||||
} else if (categoryEntry.temporarilyBlocked) {
|
} else if (categoryEntry.temporarilyBlocked) {
|
||||||
liveDataFromValue(BlockingReason.TemporarilyBlocked)
|
liveDataFromValue(BlockingReason.TemporarilyBlocked)
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue