From 7106be4b07c5832a518af60ab6e362f470d73d42 Mon Sep 17 00:00:00 2001 From: callebtc <93376500+callebtc@users.noreply.github.com> Date: Sat, 23 Aug 2025 15:44:46 +0200 Subject: [PATCH] =?UTF-8?q?country=20->=20region,=20region=20=E2=80=93>=20?= =?UTF-8?q?province=20(#298)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/bitchat/android/MainActivity.kt | 4 ++-- .../com/bitchat/android/geohash/LocationChannel.kt | 4 ++-- .../android/geohash/LocationChannelManager.kt | 8 ++++---- .../com/bitchat/android/ui/LocationChannelsSheet.kt | 13 +++++++------ 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/app/src/main/java/com/bitchat/android/MainActivity.kt b/app/src/main/java/com/bitchat/android/MainActivity.kt index df84b87d..83be2978 100644 --- a/app/src/main/java/com/bitchat/android/MainActivity.kt +++ b/app/src/main/java/com/bitchat/android/MainActivity.kt @@ -707,8 +707,8 @@ class MainActivity : ComponentActivity() { 7 -> com.bitchat.android.geohash.GeohashChannelLevel.BLOCK 6 -> com.bitchat.android.geohash.GeohashChannelLevel.NEIGHBORHOOD 5 -> com.bitchat.android.geohash.GeohashChannelLevel.CITY - 4 -> com.bitchat.android.geohash.GeohashChannelLevel.REGION - 2 -> com.bitchat.android.geohash.GeohashChannelLevel.COUNTRY + 4 -> com.bitchat.android.geohash.GeohashChannelLevel.PROVINCE + 2 -> com.bitchat.android.geohash.GeohashChannelLevel.REGION else -> com.bitchat.android.geohash.GeohashChannelLevel.CITY // Default fallback } val geohashChannel = com.bitchat.android.geohash.GeohashChannel(level, geohash) diff --git a/app/src/main/java/com/bitchat/android/geohash/LocationChannel.kt b/app/src/main/java/com/bitchat/android/geohash/LocationChannel.kt index 286fc4c3..aed974b6 100644 --- a/app/src/main/java/com/bitchat/android/geohash/LocationChannel.kt +++ b/app/src/main/java/com/bitchat/android/geohash/LocationChannel.kt @@ -8,8 +8,8 @@ enum class GeohashChannelLevel(val precision: Int, val displayName: String) { BLOCK(7, "Block"), NEIGHBORHOOD(6, "Neighborhood"), CITY(5, "City"), - REGION(4, "Region"), - COUNTRY(2, "Country"); + PROVINCE(4, "Province"), + REGION(2, "REGION"); companion object { fun allCases(): List = values().toList() 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 4815a64f..53bb381a 100644 --- a/app/src/main/java/com/bitchat/android/geohash/LocationChannelManager.kt +++ b/app/src/main/java/com/bitchat/android/geohash/LocationChannelManager.kt @@ -309,14 +309,14 @@ class LocationChannelManager private constructor(private val context: Context) { // Country address.countryName?.takeIf { it.isNotEmpty() }?.let { - dict[GeohashChannelLevel.COUNTRY] = it + dict[GeohashChannelLevel.REGION] = it } - // Region (state/province or county) + // Province (state/province or county) address.adminArea?.takeIf { it.isNotEmpty() }?.let { - dict[GeohashChannelLevel.REGION] = it + dict[GeohashChannelLevel.PROVINCE] = it } ?: address.subAdminArea?.takeIf { it.isNotEmpty() }?.let { - dict[GeohashChannelLevel.REGION] = it + dict[GeohashChannelLevel.PROVINCE] = it } // City (locality) diff --git a/app/src/main/java/com/bitchat/android/ui/LocationChannelsSheet.kt b/app/src/main/java/com/bitchat/android/ui/LocationChannelsSheet.kt index 1539793e..79b752ce 100644 --- a/app/src/main/java/com/bitchat/android/ui/LocationChannelsSheet.kt +++ b/app/src/main/java/com/bitchat/android/ui/LocationChannelsSheet.kt @@ -529,8 +529,8 @@ private fun validateGeohash(geohash: String): Boolean { private fun levelForLength(length: Int): GeohashChannelLevel { return when (length) { - in 0..2 -> GeohashChannelLevel.COUNTRY - in 3..4 -> GeohashChannelLevel.REGION + in 0..2 -> GeohashChannelLevel.REGION + in 3..4 -> GeohashChannelLevel.PROVINCE 5 -> GeohashChannelLevel.CITY 6 -> GeohashChannelLevel.NEIGHBORHOOD 7 -> GeohashChannelLevel.BLOCK @@ -572,8 +572,9 @@ private fun bluetoothRangeString(): String { } private fun formattedNamePrefix(level: GeohashChannelLevel): String { - return when (level) { - GeohashChannelLevel.COUNTRY -> "" - else -> "~" - } +// return when (level) { +// GeohashChannelLevel.REGION -> "" +// else -> "~" +// } + return "~" }