mirror of
https://github.com/SimpleMobileTools/Simple-Flashlight.git
synced 2025-06-05 21:59:19 +02:00
Use more descriptive names for showSleepTimerPermission
arguments
This commit is contained in:
@ -151,9 +151,10 @@ class MainActivity : ComponentActivity() {
|
|||||||
openSettings = ::launchSettings,
|
openSettings = ::launchSettings,
|
||||||
openAbout = ::launchAbout,
|
openAbout = ::launchAbout,
|
||||||
openSleepTimer = {
|
openSleepTimer = {
|
||||||
showSleepTimerPermission(sleepTimerPermissionDialogState) {
|
showSleepTimerPermission(
|
||||||
sleepTimerDialogState.show()
|
requestAlarmPermission = sleepTimerPermissionDialogState::show,
|
||||||
}
|
onNoPermissionRequired = sleepTimerDialogState::show
|
||||||
|
)
|
||||||
},
|
},
|
||||||
moreAppsFromUs = ::launchMoreAppsFromUsIntent
|
moreAppsFromUs = ::launchMoreAppsFromUsIntent
|
||||||
)
|
)
|
||||||
@ -353,15 +354,15 @@ class MainActivity : ComponentActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun showSleepTimerPermission(
|
private fun showSleepTimerPermission(
|
||||||
showSleepTimerDialogState: AlertDialogState,
|
requestAlarmPermission: () -> Unit,
|
||||||
callback: () -> Unit
|
onNoPermissionRequired: () -> Unit
|
||||||
) {
|
) {
|
||||||
val alarmManager = getSystemService(Context.ALARM_SERVICE) as AlarmManager
|
val alarmManager = getSystemService(Context.ALARM_SERVICE) as AlarmManager
|
||||||
if (isSPlus() && !alarmManager.canScheduleExactAlarms()) {
|
if (isSPlus() && !alarmManager.canScheduleExactAlarms()) {
|
||||||
showSleepTimerDialogState.show()
|
requestAlarmPermission()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
callback()
|
onNoPermissionRequired()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun secondsToString(seconds: Int): String {
|
private fun secondsToString(seconds: Int): String {
|
||||||
|
Reference in New Issue
Block a user