diff --git a/OsmAnd-java/src/net/osmand/util/GeoPointParserUtil.java b/OsmAnd-java/src/net/osmand/util/GeoPointParserUtil.java index a4661d7203..6aa1d46e35 100644 --- a/OsmAnd-java/src/net/osmand/util/GeoPointParserUtil.java +++ b/OsmAnd-java/src/net/osmand/util/GeoPointParserUtil.java @@ -397,7 +397,6 @@ public class GeoPointParserUtil { actual = GeoPointParserUtil.parse(url); assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon, z)); - // TODO this URL does not work, where is it used? // whatsapp // https://maps.google.com/maps?q=loc:34.99393,-106.61568 (You) z = GeoParsedPoint.NO_ZOOM; @@ -406,6 +405,14 @@ public class GeoPointParserUtil { actual = GeoPointParserUtil.parse(url); assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon, z)); + // whatsapp + // https://maps.google.com/maps?q=loc:34.99393,-106.61568 (USERNAME) + z = GeoParsedPoint.NO_ZOOM; + url = "https://maps.google.com/maps?q=loc:" + dlat + "," + dlon + " (USER NAME)"; + System.out.println("url: " + url); + actual = GeoPointParserUtil.parse(url); + assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon, z)); + // http://www.google.com/maps/search/food/34,-106,14z url = "http://www.google.com/maps/search/food/" + ilat + "," + ilon + "," + z + "z"; System.out.println("url: " + url); @@ -947,10 +954,9 @@ public class GeoPointParserUtil { if(opath.contains(pref)) { opath = opath.substring(opath.lastIndexOf(pref) + pref.length()); } - final String postf = " (You)"; - if (opath.contains(postf)) { - opath = opath.substring(0, opath.indexOf(postf)); - } + final String postf = "\\s\\((\\p{IsAlphabetic}|\\s)*\\)$"; + opath = opath.replaceAll(postf, ""); + System.out.println("opath=" + opath); return parseGoogleMapsPath(opath, params); } if (fragment != null) {