mirror of
https://github.com/permissionlesstech/bitchat-android.git
synced 2026-07-24 22:45:20 +00:00
country -> region, region –> province (#298)
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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<GeohashChannelLevel> = values().toList()
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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 "~"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user