mirror of
https://codeberg.org/timelimit/timelimit-android.git
synced 2025-10-03 01:39:22 +02:00
Fix adding new days to rule during blocked time area self limit adding
This commit is contained in:
parent
01d5fce6cd
commit
c92b24519d
1 changed files with 8 additions and 5 deletions
|
@ -47,7 +47,7 @@ import kotlinx.coroutines.flow.flow
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlinx.coroutines.sync.Mutex
|
import kotlinx.coroutines.sync.Mutex
|
||||||
import java.io.Serializable
|
import java.io.Serializable
|
||||||
import kotlin.experimental.and
|
import kotlin.experimental.or
|
||||||
|
|
||||||
object ManageCategoryBlockedTimes {
|
object ManageCategoryBlockedTimes {
|
||||||
private const val LOG_TAG = "ManageBlockedTimes"
|
private const val LOG_TAG = "ManageBlockedTimes"
|
||||||
|
@ -157,10 +157,13 @@ object ManageCategoryBlockedTimes {
|
||||||
if (existingRuleId == null) rulesToCreate.add(rule.value)
|
if (existingRuleId == null) rulesToCreate.add(rule.value)
|
||||||
else rulesToUpdate.add(rule.value.copy(id = existingRuleId))
|
else rulesToUpdate.add(rule.value.copy(id = existingRuleId))
|
||||||
} else {
|
} else {
|
||||||
if (!isChild || currentRule.dayMask and rule.value.dayMask == currentRule.dayMask)
|
val targetDayMask =
|
||||||
if (currentRule.dayMask != rule.value.dayMask) rulesToUpdate.add(
|
if (isChild) currentRule.dayMask or rule.value.dayMask
|
||||||
currentRule.copy(dayMask = rule.value.dayMask)
|
else rule.value.dayMask
|
||||||
)
|
|
||||||
|
if (currentRule.dayMask != targetDayMask) rulesToUpdate.add(
|
||||||
|
currentRule.copy(dayMask = targetDayMask)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue