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,
|
||||
openAbout = ::launchAbout,
|
||||
openSleepTimer = {
|
||||
showSleepTimerPermission(sleepTimerPermissionDialogState) {
|
||||
sleepTimerDialogState.show()
|
||||
}
|
||||
showSleepTimerPermission(
|
||||
requestAlarmPermission = sleepTimerPermissionDialogState::show,
|
||||
onNoPermissionRequired = sleepTimerDialogState::show
|
||||
)
|
||||
},
|
||||
moreAppsFromUs = ::launchMoreAppsFromUsIntent
|
||||
)
|
||||
@ -353,15 +354,15 @@ class MainActivity : ComponentActivity() {
|
||||
}
|
||||
|
||||
private fun showSleepTimerPermission(
|
||||
showSleepTimerDialogState: AlertDialogState,
|
||||
callback: () -> Unit
|
||||
requestAlarmPermission: () -> Unit,
|
||||
onNoPermissionRequired: () -> Unit
|
||||
) {
|
||||
val alarmManager = getSystemService(Context.ALARM_SERVICE) as AlarmManager
|
||||
if (isSPlus() && !alarmManager.canScheduleExactAlarms()) {
|
||||
showSleepTimerDialogState.show()
|
||||
requestAlarmPermission()
|
||||
return
|
||||
}
|
||||
callback()
|
||||
onNoPermissionRequired()
|
||||
}
|
||||
|
||||
private fun secondsToString(seconds: Int): String {
|
||||
|
Reference in New Issue
Block a user