From b387929023739719ffc920cdc742d26c261b6a4f Mon Sep 17 00:00:00 2001 From: enlineawork Date: Tue, 8 Sep 2026 17:06:10 -0300 Subject: [PATCH] fix(android): make signature GPS permission guard lint-visible --- .../com/korexlabs/dhinspeccion/ui/MobileActsScreen.kt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/android-app/app/src/main/java/com/korexlabs/dhinspeccion/ui/MobileActsScreen.kt b/android-app/app/src/main/java/com/korexlabs/dhinspeccion/ui/MobileActsScreen.kt index 2f2d3d9..03e0ff8 100644 --- a/android-app/app/src/main/java/com/korexlabs/dhinspeccion/ui/MobileActsScreen.kt +++ b/android-app/app/src/main/java/com/korexlabs/dhinspeccion/ui/MobileActsScreen.kt @@ -426,13 +426,15 @@ private fun hasActLocation(context: Context): Boolean = ContextCompat.checkSelfPermission(context, Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED private suspend fun currentActSignatureGeo(context: Context): ActSignatureGeo = suspendCancellableCoroutine { continuation -> - if (!hasActLocation(context)) { + val fineGranted = ContextCompat.checkSelfPermission(context, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED + val coarseGranted = ContextCompat.checkSelfPermission(context, Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED + if (!fineGranted && !coarseGranted) { continuation.resumeWithException(SecurityException("Ubicación no autorizada")) return@suspendCancellableCoroutine } val source = CancellationTokenSource() - LocationServices.getFusedLocationProviderClient(context) - .getCurrentLocation(Priority.PRIORITY_HIGH_ACCURACY, source.token) + val client = LocationServices.getFusedLocationProviderClient(context) + client.getCurrentLocation(Priority.PRIORITY_HIGH_ACCURACY, source.token) .addOnSuccessListener { location -> if (!continuation.isActive) return@addOnSuccessListener if (location == null) continuation.resumeWithException(IllegalStateException("Ubicación no disponible"))