From fe691096b3ba0ab358a78b63651c83278f2c6597 Mon Sep 17 00:00:00 2001 From: callebtc <93376500+callebtc@users.noreply.github.com> Date: Thu, 28 Aug 2025 17:37:18 +0200 Subject: [PATCH] fix country name --- .../com/bitchat/android/nostr/NostrGeohashService.kt | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/bitchat/android/nostr/NostrGeohashService.kt b/app/src/main/java/com/bitchat/android/nostr/NostrGeohashService.kt index 01ce3060..687f79bc 100644 --- a/app/src/main/java/com/bitchat/android/nostr/NostrGeohashService.kt +++ b/app/src/main/java/com/bitchat/android/nostr/NostrGeohashService.kt @@ -1771,6 +1771,7 @@ class NostrGeohashService( return try { val locationManager = com.bitchat.android.geohash.LocationChannelManager.getInstance(application) val locationNames = locationManager.locationNames.value ?: return null + val available = locationManager.availableChannels.value ?: emptyList() // Determine the level from geohash length val level = when (geohash.length) { @@ -1781,8 +1782,14 @@ class NostrGeohashService( 7 -> com.bitchat.android.geohash.GeohashChannelLevel.BLOCK else -> com.bitchat.android.geohash.GeohashChannelLevel.BLOCK } - - locationNames[level] + + // Only show location name if the notification's geohash matches the device's current geohash at that level + val currentAtLevel = available.firstOrNull { it.level == level }?.geohash + if (currentAtLevel != null && currentAtLevel.equals(geohash, ignoreCase = true)) { + locationNames[level] + } else { + null + } } catch (e: Exception) { Log.w(TAG, "Failed to get location name for geohash $geohash: ${e.message}") null