Add permission modules

This commit is contained in:
Benoit Marty 2023-03-21 18:48:38 +01:00 committed by Benoit Marty
parent 23e11836b4
commit d8b37d6ead
23 changed files with 811 additions and 15 deletions

View file

@ -121,6 +121,23 @@ fun startNotificationSettingsIntent(context: Context, activityResultLauncher: Ac
activityResultLauncher.launch(intent)
}
fun openAppSettingsPage(
activity: Activity,
noActivityFoundMessage: String,
) {
try {
activity.startActivity(
Intent().apply {
action = Settings.ACTION_APPLICATION_DETAILS_SETTINGS
addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
data = Uri.fromParts("package", activity.packageName, null)
}
)
} catch (activityNotFoundException: ActivityNotFoundException) {
activity.toast(noActivityFoundMessage)
}
}
/**
* Shows notification system settings for the given channel id.
*/