Extend connected mode migration routine

This commit is contained in:
Jonas Lochmann 2020-01-20 01:00:00 +01:00
parent b03f3910de
commit 214e62a5ae
No known key found for this signature in database
GPG key ID: 8B8C9AEE10FA5B36

View file

@ -1,5 +1,5 @@
/*
* TimeLimit Copyright <C> 2019 Jonas Lochmann
* TimeLimit Copyright <C> 2019 - 2020 Jonas Lochmann
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -144,6 +144,35 @@ data class OfflineModeStatus(
)
}
if (category.minBatteryLevelMobile > 0 || category.minBatteryLevelWhileCharging > 0) {
apply(
UpdateCategoryBatteryLimit(
categoryId = category.id,
mobileLimit = category.minBatteryLevelMobile,
chargingLimit = category.minBatteryLevelWhileCharging
)
)
}
if (category.timeWarnings != 0) {
apply(
UpdateCategoryTimeWarningsAction(
categoryId = category.id,
enable = true,
flags = category.timeWarnings
)
)
}
if (category.blockAllNotifications) {
apply(
UpdateCategoryBlockAllNotificationsAction(
categoryId = category.id,
blocked = true
)
)
}
// add category apps
val thisCategoryApps = categoryApps.filter { it.categoryId == category.id }
if (thisCategoryApps.isNotEmpty()) {
@ -219,5 +248,12 @@ data class OfflineModeStatus(
considerRebootManipulation = true
))
}
if (device.enableActivityLevelBlocking) {
apply(UpdateEnableActivityLevelBlocking(
deviceId = newDeviceId,
enable = true
))
}
}
}