Skip to content

Commit

Permalink
Refactor permission request function (#355)
Browse files Browse the repository at this point in the history
Since the requestReadStoragePermission function now also requests for notification permissions, it is more appropriate to use requestPermission for the function instead
  • Loading branch information
JustAGhost23 authored Feb 25, 2024
1 parent f98aac8 commit ecc3bdb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions app/src/main/java/crux/bphc/cms/activities/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -279,17 +279,17 @@ class MainActivity : AppCompatActivity() {
"We need permission to move course content"
}
else {
"We need permission to send course notifications"
"We need permission to send notifications"
}
MaterialAlertDialogBuilder(this)
.setTitle("Permission required")
.setMessage(messageText)
.setPositiveButton("OK") { _, _ ->
requestReadStoragePermission()
requestPermission()
}
.show()
} else {
requestReadStoragePermission()
requestPermission()
}
} else {
startDataMigrationIfRequired()
Expand All @@ -303,7 +303,7 @@ class MainActivity : AppCompatActivity() {
startDataMigrationIfRequired()
}

private fun requestReadStoragePermission() {
private fun requestPermission() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
askPermission.launch(
arrayOf(
Expand Down

0 comments on commit ecc3bdb

Please sign in to comment.