Support for username with any characters after location.

This commit is contained in:
GaidamakUA 2016-03-17 10:05:39 +02:00 committed by Victor Shcherb
parent 8e0ae5d241
commit e88d32b5bd

View file

@ -423,6 +423,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 (USER NAME)
z = GeoParsedPoint.NO_ZOOM;
url = "https://maps.google.com/maps?q=loc:" + dlat + "," + dlon + " (+55 99 99999-9999)";
System.out.println("url: " + url);
actual = GeoPointParserUtil.parse(url);
assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon, z));
// whatsapp
// https://www.google.com/maps/search/34.99393,-106.61568/data=!4m4!2m3!3m1!2s-23.2776,-45.8443128!4b1
url = "https://maps.google.com/maps?q=loc:" + dlat + "," + dlon + "/data=!4m4!2m3!3m1!2s-23.2776,-45.8443128!4b1";
@ -972,7 +980,7 @@ public class GeoPointParserUtil {
if(opath.contains(pref)) {
opath = opath.substring(opath.lastIndexOf(pref) + pref.length());
}
final String postf = "\\s\\((\\p{L}|\\s)*\\)$";
final String postf = "\\s\\((\\p{L}|\\p{M}|\\p{Z}|\\p{S}|\\p{N}|\\p{P}|\\p{C})*\\)$";
opath = opath.replaceAll(postf, "");
System.out.println("opath=" + opath);
return parseGoogleMapsPath(opath, params);