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.sync.Mutex
|
||||
import java.io.Serializable
|
||||
import kotlin.experimental.and
|
||||
import kotlin.experimental.or
|
||||
|
||||
object ManageCategoryBlockedTimes {
|
||||
private const val LOG_TAG = "ManageBlockedTimes"
|
||||
|
@ -157,10 +157,13 @@ object ManageCategoryBlockedTimes {
|
|||
if (existingRuleId == null) rulesToCreate.add(rule.value)
|
||||
else rulesToUpdate.add(rule.value.copy(id = existingRuleId))
|
||||
} else {
|
||||
if (!isChild || currentRule.dayMask and rule.value.dayMask == currentRule.dayMask)
|
||||
if (currentRule.dayMask != rule.value.dayMask) rulesToUpdate.add(
|
||||
currentRule.copy(dayMask = rule.value.dayMask)
|
||||
)
|
||||
val targetDayMask =
|
||||
if (isChild) currentRule.dayMask or 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