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