Skip to content

Commit d7f8b2a

Browse files
authored
Merge pull request #77 from canopas/megh/fix-null-journey-text-shown-to-user
Fix null journey text shown to user
2 parents a68bc11 + b032956 commit d7f8b2a

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

app/src/main/java/com/canopas/yourspace/ui/flow/journey/components/LocationHistory.kt

+6-6
Original file line numberDiff line numberDiff line change
@@ -345,14 +345,14 @@ internal fun getFormattedLocationTimeForFirstItem(createdAt: Long): String {
345345
}
346346

347347
fun Address.formattedTitle(toAddress: Address?): String {
348-
val fromCity = this.locality
349-
val toCity = toAddress?.locality ?: ""
348+
val fromCity = this.locality ?: this.subAdminArea ?: this.adminArea ?: this.featureName ?: "Unknown"
349+
val toCity = toAddress?.locality ?: toAddress?.subAdminArea ?: toAddress?.adminArea ?: toAddress?.featureName ?: "Unknown"
350350

351-
val fromArea = this.subLocality
352-
val toArea = toAddress?.subLocality ?: ""
351+
val fromArea = this.subLocality ?: this.thoroughfare ?: this.featureName ?: fromCity
352+
val toArea = toAddress?.subLocality ?: toAddress?.thoroughfare ?: toAddress?.featureName ?: toCity
353353

354-
val fromState = this.adminArea
355-
val toState = toAddress?.adminArea ?: ""
354+
val fromState = this.adminArea ?: this.countryName ?: "Unknown"
355+
val toState = toAddress?.adminArea ?: toAddress?.countryName ?: "Unknown"
356356

357357
return when {
358358
toAddress == null -> "$fromArea, $fromCity"

0 commit comments

Comments
 (0)