2023-08-04 14:07:11 +02:00
|
|
|
package com.simplemobiletools.clock.extensions
|
|
|
|
|
2023-08-04 14:12:37 +02:00
|
|
|
import com.simplemobiletools.clock.BuildConfig
|
2023-08-04 14:07:11 +02:00
|
|
|
import com.simplemobiletools.commons.activities.BaseSimpleActivity
|
|
|
|
import com.simplemobiletools.commons.dialogs.PermissionRequiredDialog
|
|
|
|
import com.simplemobiletools.commons.extensions.canUseFullScreenIntent
|
2023-08-04 14:12:37 +02:00
|
|
|
import com.simplemobiletools.commons.extensions.openFullScreenIntentSettings
|
2023-08-04 14:07:11 +02:00
|
|
|
|
|
|
|
fun BaseSimpleActivity.handleFullScreenNotificationsPermission(callback: (granted: Boolean) -> Unit) {
|
|
|
|
handleNotificationPermission { granted ->
|
|
|
|
if (granted) {
|
|
|
|
if (canUseFullScreenIntent()) {
|
|
|
|
callback(true)
|
|
|
|
} else {
|
|
|
|
PermissionRequiredDialog(
|
|
|
|
activity = this,
|
2023-08-04 16:19:11 +02:00
|
|
|
textId = com.simplemobiletools.commons.R.string.allow_full_screen_notifications_reminders,
|
2023-08-04 14:07:11 +02:00
|
|
|
positiveActionCallback = {
|
2023-08-04 14:12:37 +02:00
|
|
|
openFullScreenIntentSettings(BuildConfig.APPLICATION_ID)
|
2023-08-04 14:07:11 +02:00
|
|
|
}
|
|
|
|
)
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
callback(false)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|