From 9ba5d11229ce1b545bc350317797775f9621e5f7 Mon Sep 17 00:00:00 2001 From: callebtc <93376500+callebtc@users.noreply.github.com> Date: Sat, 18 Oct 2025 01:34:53 +0200 Subject: [PATCH] unify location enabled / disabled --- .../com/bitchat/android/geohash/LocationChannelManager.kt | 7 +++++++ .../com/bitchat/android/ui/LocationNotesSheetPresenter.kt | 3 +++ 2 files changed, 10 insertions(+) diff --git a/app/src/main/java/com/bitchat/android/geohash/LocationChannelManager.kt b/app/src/main/java/com/bitchat/android/geohash/LocationChannelManager.kt index 5f0ed439..b8da1fee 100644 --- a/app/src/main/java/com/bitchat/android/geohash/LocationChannelManager.kt +++ b/app/src/main/java/com/bitchat/android/geohash/LocationChannelManager.kt @@ -88,10 +88,17 @@ class LocationChannelManager private constructor(private val context: Context) { /** * Enable location channels (request permission if needed) + * UNIFIED: Only requests location if location services are enabled by user */ fun enableLocationChannels() { Log.d(TAG, "enableLocationChannels() called") + // UNIFIED FIX: Check if location services are enabled by user + if (!isLocationServicesEnabled()) { + Log.w(TAG, "Location services disabled by user - not requesting location") + return + } + when (getCurrentPermissionStatus()) { PermissionState.NOT_DETERMINED -> { Log.d(TAG, "Permission not determined - user needs to grant in app settings") diff --git a/app/src/main/java/com/bitchat/android/ui/LocationNotesSheetPresenter.kt b/app/src/main/java/com/bitchat/android/ui/LocationNotesSheetPresenter.kt index 3971066a..25af0a83 100644 --- a/app/src/main/java/com/bitchat/android/ui/LocationNotesSheetPresenter.kt +++ b/app/src/main/java/com/bitchat/android/ui/LocationNotesSheetPresenter.kt @@ -85,6 +85,9 @@ private fun LocationNotesErrorSheet( ) Spacer(modifier = Modifier.height(24.dp)) Button(onClick = { + // UNIFIED FIX: Enable location services first (user toggle) + locationManager.enableLocationServices() + // Then request location channels (which will also request permission if needed) locationManager.enableLocationChannels() locationManager.refreshChannels() }) {