country -> region, region –> province (#298)

This commit is contained in:
callebtc
2025-08-23 15:44:46 +02:00
committed by GitHub
parent a7604d9026
commit 7106be4b07
4 changed files with 15 additions and 14 deletions
@@ -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)