set locationName to "Shared location" when geocoding failed

e.g. when someone shares a location from the ocean the name is not "null" anymore

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
Marcel Hibbe 2021-07-05 11:47:39 +02:00
parent 305e64279f
commit 83001990b0
No known key found for this signature in database
GPG Key ID: C793F8B59F43CE7B
2 changed files with 9 additions and 2 deletions

View File

@ -386,9 +386,15 @@ class LocationPickerController(args: Bundle) :
private fun executeShareLocation(selectedLat: Double?, selectedLon: Double?, locationName: String?) { private fun executeShareLocation(selectedLat: Double?, selectedLon: Double?, locationName: String?) {
val objectId = "geo:$selectedLat,$selectedLon" val objectId = "geo:$selectedLat,$selectedLon"
var locationNameToShare = locationName
if (locationNameToShare.isNullOrBlank()) {
locationNameToShare = resources?.getString(R.string.nc_shared_location)
}
val metaData: String = val metaData: String =
"{\"type\":\"geo-location\",\"id\":\"geo:$selectedLat,$selectedLon\",\"latitude\":\"$selectedLat\"," + "{\"type\":\"geo-location\",\"id\":\"geo:$selectedLat,$selectedLon\",\"latitude\":\"$selectedLat\"," +
"\"longitude\":\"$selectedLon\",\"name\":\"$locationName\"}" "\"longitude\":\"$selectedLon\",\"name\":\"$locationNameToShare\"}"
ncApi.sendLocation( ncApi.sendLocation(
ApiUtils.getCredentials(userUtils.currentUser?.username, userUtils.currentUser?.token), ApiUtils.getCredentials(userUtils.currentUser?.username, userUtils.currentUser?.token),

View File

@ -382,7 +382,9 @@
<string name="nc_location_permission_required">location permission is required</string> <string name="nc_location_permission_required">location permission is required</string>
<string name="nc_share_current_location">Share current location</string> <string name="nc_share_current_location">Share current location</string>
<string name="nc_share_this_location">Share this location</string> <string name="nc_share_this_location">Share this location</string>
<string name="nc_shared_location">Shared location</string>
<string name="nc_location_current_position_description">Your current location</string> <string name="nc_location_current_position_description">Your current location</string>
<string name="nc_location_unknown">Position unknown</string>
<!-- voice messages --> <!-- voice messages -->
<string name="nc_voice_message_filename">Talk recording from %1$s (%2$s)</string> <string name="nc_voice_message_filename">Talk recording from %1$s (%2$s)</string>
@ -451,5 +453,4 @@
<string name="filename_progress">%1$s (%2$d)</string> <string name="filename_progress">%1$s (%2$d)</string>
<string name="nc_dialog_invalid_password">Invalid password</string> <string name="nc_dialog_invalid_password">Invalid password</string>
<string name="nc_dialog_reauth_or_delete">Do you want to reauthorize or delete this account?</string> <string name="nc_dialog_reauth_or_delete">Do you want to reauthorize or delete this account?</string>
<string name="nc_location_unknown">Position unknown</string>
</resources> </resources>