Skip to content

Commit

Permalink
Merge pull request #311 from PermanentOrg/release/1.9.4
Browse files Browse the repository at this point in the history
Change get ui address to handle empty locality, admin and country code
  • Loading branch information
flaviuvsp authored Nov 4, 2024
2 parents 5bed5dd + c05d8b5 commit c7450a7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ android {
applicationId "org.permanent.PermanentArchive"
minSdkVersion 26
targetSdkVersion 34
versionCode 72
versionCode 73
versionName "1.9.4"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,7 @@ class FileData private constructor() : Parcelable {
originalFileName = recordVO.uploadFileName?.substringBefore(".")
originalFileType = recordVO.uploadFileName?.substringAfter(".")

completeAddress = recordVO.LocnVO?.let {
val streetName = if (it.streetName == null) "" else it.streetName + ", "
val addressValue =
(it.streetNumber ?: "") + " " + streetName + it.locality +
", " + it.adminOneName + ", " + it.countryCode
if (!addressValue.contains("null")) addressValue else ""
}
completeAddress = recordVO.LocnVO?.getUIAddress()
latitude = recordVO.LocnVO?.latitude ?: -1.0
longitude = recordVO.LocnVO?.longitude ?: -1.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,13 @@ class LocnVO() : Parcelable {
}

fun getUIAddress(): String {
if (uiAddress == null) {
if (uiAddress.isNullOrEmpty()) {
val strName = if (streetName == null) "" else "$streetName, "
val localityName = if (locality == null) "" else "$locality, "
val adminName = if (adminOneName == null) "" else "$adminOneName, "
val countryCodeName = if (countryCode == null) "" else "$countryCode"
val addressValue = (streetNumber ?: "") + " " + strName +
locality + ", " + adminOneName + ", " + countryCode
localityName + adminName + countryCodeName
uiAddress = if (!addressValue.contains("null")) addressValue.trim() else ""
}

Expand Down

0 comments on commit c7450a7

Please sign in to comment.