Get old battery optimizations already in composable("settings")
This commit is contained in:
@@ -99,6 +99,9 @@ fun NavGraphBuilder.settingsScreenRoute(
|
|||||||
composable("settings") {
|
composable("settings") {
|
||||||
val ctx = LocalContext.current
|
val ctx = LocalContext.current
|
||||||
|
|
||||||
|
val powerManager = ctx.getSystemService(POWER_SERVICE) as PowerManager
|
||||||
|
oldBatteryOptimizations = powerManager.isIgnoringBatteryOptimizations(ctx.packageName) == false
|
||||||
|
|
||||||
oldDarkTheme = Preferences(ctx).displayTheme == AppCompatDelegate.MODE_NIGHT_YES
|
oldDarkTheme = Preferences(ctx).displayTheme == AppCompatDelegate.MODE_NIGHT_YES
|
||||||
|
|
||||||
if (VERSION.SDK_INT >= 29) {
|
if (VERSION.SDK_INT >= 29) {
|
||||||
@@ -908,8 +911,6 @@ private fun BatteryOptimizations() {
|
|||||||
},
|
},
|
||||||
color = LocalCustomColors.current.itemText,
|
color = LocalCustomColors.current.itemText,
|
||||||
fontSize = 18.sp)
|
fontSize = 18.sp)
|
||||||
val powerManager = ctx.getSystemService(POWER_SERVICE) as PowerManager
|
|
||||||
oldBatteryOptimizations = powerManager.isIgnoringBatteryOptimizations(ctx.packageName) == false
|
|
||||||
var battery by remember { mutableStateOf(oldBatteryOptimizations) }
|
var battery by remember { mutableStateOf(oldBatteryOptimizations) }
|
||||||
newBatteryOptimizations = battery
|
newBatteryOptimizations = battery
|
||||||
Switch(
|
Switch(
|
||||||
|
|||||||
Reference in New Issue
Block a user