From ecc3bdb889ad78f693b7ed03ee9696703dcb19ae Mon Sep 17 00:00:00 2001 From: Jason Goveas <95233082+JustAGhost23@users.noreply.github.com> Date: Sun, 25 Feb 2024 18:36:47 +0530 Subject: [PATCH] Refactor permission request function (#355) Since the requestReadStoragePermission function now also requests for notification permissions, it is more appropriate to use requestPermission for the function instead --- .../main/java/crux/bphc/cms/activities/MainActivity.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/crux/bphc/cms/activities/MainActivity.kt b/app/src/main/java/crux/bphc/cms/activities/MainActivity.kt index d4fde3ef..78d46705 100644 --- a/app/src/main/java/crux/bphc/cms/activities/MainActivity.kt +++ b/app/src/main/java/crux/bphc/cms/activities/MainActivity.kt @@ -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() @@ -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(