From 705a430c95e5d38483c628734f65e3adf5b0aff9 Mon Sep 17 00:00:00 2001 From: callebtc <93376500+callebtc@users.noreply.github.com> Date: Sat, 18 Oct 2025 01:59:47 +0200 Subject: [PATCH] cooler --- .../java/com/bitchat/android/ui/LocationNotesButton.kt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/bitchat/android/ui/LocationNotesButton.kt b/app/src/main/java/com/bitchat/android/ui/LocationNotesButton.kt index 01686d2b..9f7faef7 100644 --- a/app/src/main/java/com/bitchat/android/ui/LocationNotesButton.kt +++ b/app/src/main/java/com/bitchat/android/ui/LocationNotesButton.kt @@ -22,7 +22,7 @@ import com.bitchat.android.nostr.LocationNotesManager /** * Location Notes button component for MainHeader - * Displays when in mesh mode and location permission is granted + * Shows in mesh mode when location permission granted AND services enabled * Icon turns primary color when notes exist, gray otherwise */ @Composable @@ -38,15 +38,19 @@ fun LocationNotesButton( val selectedLocationChannel by viewModel.selectedLocationChannel.observeAsState() val locationManager = remember { LocationChannelManager.getInstance(context) } val permissionState by locationManager.permissionState.observeAsState() + val locationServicesEnabled by locationManager.locationServicesEnabled.observeAsState(false) + + // Check both permission AND location services enabled val locationPermissionGranted = permissionState == LocationChannelManager.PermissionState.AUTHORIZED + val locationEnabled = locationPermissionGranted && locationServicesEnabled // Get notes count from LocationNotesManager val notesManager = remember { LocationNotesManager.getInstance() } val notes by notesManager.notes.observeAsState(emptyList()) val notesCount = notes.size - + // Only show in mesh mode when location is authorized (iOS pattern) - if (selectedLocationChannel is ChannelID.Mesh && locationPermissionGranted) { + if (selectedLocationChannel is ChannelID.Mesh && locationEnabled) { val hasNotes = (notesCount ?: 0) > 0 IconButton( onClick = onClick,