From d77a70902bab28388493575b0adb97833588d9bf Mon Sep 17 00:00:00 2001 From: rayan Date: Sun, 2 Jun 2024 18:44:12 +0200 Subject: [PATCH] feat: added gps location on the map --- app/src/main/AndroidManifest.xml | 2 + .../ui/screens/event/maptab/EventMapScreen.kt | 42 +++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index f04aad7ee..62f8c39aa 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -9,6 +9,8 @@ + + onLoad?.invoke(view) }) } +/** + * Displays a permission dialog to request location permission + * + * @param context the context to display the dialog + */ +fun requestLocationPermission(context: Context): Boolean { + if (ContextCompat.checkSelfPermission(context, Manifest.permission.ACCESS_FINE_LOCATION) != + PackageManager.PERMISSION_GRANTED) { + ActivityCompat.requestPermissions( + context as Activity, + arrayOf(Manifest.permission.ACCESS_FINE_LOCATION), + LOCATION_PERMISSION_REQUEST_CODE) + return false + } + return true +} + /** * The custom tile source from the EPFL plan API. *