Эх сурвалжийг харах

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>
Marcel Hibbe 3 жил өмнө
parent
commit
83001990b0

+ 7 - 1
app/src/main/java/com/nextcloud/talk/controllers/LocationPickerController.kt

@@ -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),

+ 2 - 1
app/src/main/res/values/strings.xml

@@ -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>