Add permission modules

This commit is contained in:
Benoit Marty
2023-03-21 18:48:38 +01:00
committed by Benoit Marty
parent c133caf442
commit 500d4801a7
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.
*/