Skip to content

Commit

Permalink
Always use Google maps to share position
Browse files Browse the repository at this point in the history
Gmaps links are like an universal geo: URI,
most platform uses these link to open their own
GPS app (iOS/Android/Browsers)
  • Loading branch information
p1gp1g authored and valldrac committed May 9, 2023
1 parent fa7f630 commit 659612c
Showing 1 changed file with 5 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,14 @@
import com.google.android.gms.maps.model.LatLng;

import org.signal.core.util.logging.Log;
import org.thoughtcrime.securesms.BuildConfig;
import org.thoughtcrime.securesms.maps.AddressData;
import org.thoughtcrime.securesms.util.JsonUtils;

import java.io.IOException;

public class SignalPlace {

private static final String GMS_URL = "https://maps.google.com/maps";
private static final String OSM_URL = "https://www.openstreetmap.org/";
private static final String URL = "https://maps.google.com/maps";

private static final String TAG = Log.tag(SignalPlace.class);

Expand Down Expand Up @@ -65,17 +63,10 @@ public String getDescription() {
description += (address + "\n");
}

if (BuildConfig.USE_OSM) {
description += Uri.parse(OSM_URL)
.buildUpon()
.encodedFragment(String.format("map=15/%s/%s", latitude, longitude))
.build().toString();
} else {
description += Uri.parse(GMS_URL)
.buildUpon()
.appendQueryParameter("q", String.format("%s,%s", latitude, longitude))
.build().toString();
}
description += Uri.parse(URL)
.buildUpon()
.appendQueryParameter("q", String.format("%s,%s", latitude, longitude))
.build().toString();

return description;
}
Expand Down

0 comments on commit 659612c

Please sign in to comment.