Fix #1550 WhatsApp location

This commit is contained in:
GaidamakUA 2015-11-13 10:06:18 +02:00
parent 594d1e70f3
commit b28a8b5c60

View file

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