mirror of
https://github.com/permissionlesstech/bitchat-android.git
synced 2026-07-25 02:25:21 +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
|
7 -> com.bitchat.android.geohash.GeohashChannelLevel.BLOCK
|
||||||
6 -> com.bitchat.android.geohash.GeohashChannelLevel.NEIGHBORHOOD
|
6 -> com.bitchat.android.geohash.GeohashChannelLevel.NEIGHBORHOOD
|
||||||
5 -> com.bitchat.android.geohash.GeohashChannelLevel.CITY
|
5 -> com.bitchat.android.geohash.GeohashChannelLevel.CITY
|
||||||
4 -> com.bitchat.android.geohash.GeohashChannelLevel.REGION
|
4 -> com.bitchat.android.geohash.GeohashChannelLevel.PROVINCE
|
||||||
2 -> com.bitchat.android.geohash.GeohashChannelLevel.COUNTRY
|
2 -> com.bitchat.android.geohash.GeohashChannelLevel.REGION
|
||||||
else -> com.bitchat.android.geohash.GeohashChannelLevel.CITY // Default fallback
|
else -> com.bitchat.android.geohash.GeohashChannelLevel.CITY // Default fallback
|
||||||
}
|
}
|
||||||
val geohashChannel = com.bitchat.android.geohash.GeohashChannel(level, geohash)
|
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"),
|
BLOCK(7, "Block"),
|
||||||
NEIGHBORHOOD(6, "Neighborhood"),
|
NEIGHBORHOOD(6, "Neighborhood"),
|
||||||
CITY(5, "City"),
|
CITY(5, "City"),
|
||||||
REGION(4, "Region"),
|
PROVINCE(4, "Province"),
|
||||||
COUNTRY(2, "Country");
|
REGION(2, "REGION");
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
fun allCases(): List<GeohashChannelLevel> = values().toList()
|
fun allCases(): List<GeohashChannelLevel> = values().toList()
|
||||||
|
|||||||
@@ -309,14 +309,14 @@ class LocationChannelManager private constructor(private val context: Context) {
|
|||||||
|
|
||||||
// Country
|
// Country
|
||||||
address.countryName?.takeIf { it.isNotEmpty() }?.let {
|
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 {
|
address.adminArea?.takeIf { it.isNotEmpty() }?.let {
|
||||||
dict[GeohashChannelLevel.REGION] = it
|
dict[GeohashChannelLevel.PROVINCE] = it
|
||||||
} ?: address.subAdminArea?.takeIf { it.isNotEmpty() }?.let {
|
} ?: address.subAdminArea?.takeIf { it.isNotEmpty() }?.let {
|
||||||
dict[GeohashChannelLevel.REGION] = it
|
dict[GeohashChannelLevel.PROVINCE] = it
|
||||||
}
|
}
|
||||||
|
|
||||||
// City (locality)
|
// City (locality)
|
||||||
|
|||||||
@@ -529,8 +529,8 @@ private fun validateGeohash(geohash: String): Boolean {
|
|||||||
|
|
||||||
private fun levelForLength(length: Int): GeohashChannelLevel {
|
private fun levelForLength(length: Int): GeohashChannelLevel {
|
||||||
return when (length) {
|
return when (length) {
|
||||||
in 0..2 -> GeohashChannelLevel.COUNTRY
|
in 0..2 -> GeohashChannelLevel.REGION
|
||||||
in 3..4 -> GeohashChannelLevel.REGION
|
in 3..4 -> GeohashChannelLevel.PROVINCE
|
||||||
5 -> GeohashChannelLevel.CITY
|
5 -> GeohashChannelLevel.CITY
|
||||||
6 -> GeohashChannelLevel.NEIGHBORHOOD
|
6 -> GeohashChannelLevel.NEIGHBORHOOD
|
||||||
7 -> GeohashChannelLevel.BLOCK
|
7 -> GeohashChannelLevel.BLOCK
|
||||||
@@ -572,8 +572,9 @@ private fun bluetoothRangeString(): String {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun formattedNamePrefix(level: GeohashChannelLevel): String {
|
private fun formattedNamePrefix(level: GeohashChannelLevel): String {
|
||||||
return when (level) {
|
// return when (level) {
|
||||||
GeohashChannelLevel.COUNTRY -> ""
|
// GeohashChannelLevel.REGION -> ""
|
||||||
else -> "~"
|
// else -> "~"
|
||||||
}
|
// }
|
||||||
|
return "~"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user