Skip to content

Commit 5a3ca39

Browse files
author
Hirbod
committed
dropped external dependency for http.request
As the cordova repo is offline soon, we really don’t need a version check, as it just slow down start-up performance when app in debug. fixed http:// call for External on iOS, added better URL-Detection for KML and GroundOverlay (support for all valid NSURL Types on iOS)
1 parent d5c71ca commit 5a3ca39

5 files changed

Lines changed: 10 additions & 11 deletions

File tree

plugin.xml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version='1.0' encoding='utf-8'?>
2-
<plugin id="plugin.google.maps" version="1.3.0" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
2+
<plugin id="plugin.google.maps" version="1.3.1" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
33
<name>phonegap-googlemaps-plugin</name>
44
<js-module name="phonegap-googlemaps-plugin" src="www/googlemaps-cdv-plugin.js">
55
<clobbers target="plugin.google.maps" />
@@ -17,9 +17,7 @@
1717
<engines>
1818
<engine name="cordova" version=">=3.5.0" />
1919
</engines>
20-
21-
<dependency id="plugin.http.request" />
22-
20+
2321
<!-- android -->
2422
<platform name="android">
2523
<preference name="API_KEY_FOR_ANDROID" />

src/android/plugin/google/maps/GoogleMaps.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import org.json.JSONException;
1818
import org.json.JSONObject;
1919

20-
import plugin.http.request.HttpRequest;
2120
import android.annotation.SuppressLint;
2221
import android.annotation.TargetApi;
2322
import android.app.Activity;
@@ -151,6 +150,8 @@ public void run() {
151150

152151
try {
153152

153+
/*
154+
154155
JSONArray params = new JSONArray();
155156
params.put("get");
156157
params.put("http://plugins.cordova.io/api/plugin.google.maps");
@@ -172,6 +173,7 @@ public void sendPluginResult(PluginResult pluginResult) {
172173
}
173174
}
174175
});
176+
*/
175177
} catch (Exception e) {}
176178
}
177179
});

src/ios/GoogleMaps/External.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ -(void)launchNavigation:(CDVInvokedUrlCommand *)command
4545
[NSString stringWithFormat: @"comgooglemaps-x-callback://?%@", [params componentsJoinedByString: @"&"], nil];
4646
} else {
4747
directionsRequest =
48-
[NSString stringWithFormat: @"http://maps.apple.com/?saddr=%@&daddr=%@",
48+
[NSString stringWithFormat: @"https://maps.apple.com/?saddr=%@&daddr=%@",
4949
from, to, nil];
5050
}
5151
NSURL *directionsURL = [NSURL URLWithString:directionsRequest];

src/ios/GoogleMaps/GroundOverlay.m

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,8 @@ - (void)_setImage:(GMSGroundOverlay *)layer urlStr:(NSString *)urlStr completion
129129
return;
130130
}
131131

132-
133-
range = [urlStr rangeOfString:@"http://"];
134-
if (range.location == NSNotFound) {
132+
NSURL *isUrl = [NSURL URLWithString:urlStr];
133+
if (!isUrl || !isUrl.scheme || isUrl.host) {
135134
layer.icon = [UIImage imageNamed:urlStr];
136135
[self.mapCtrl.overlayManager setObject:layer.icon forKey: id];
137136
completionHandler(nil);

src/ios/GoogleMaps/KmlOverlay.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ -(void)createKmlOverlay:(CDVInvokedUrlCommand *)command
6868
}
6969

7070

71-
range = [urlStr rangeOfString:@"http://"];
72-
if (range.location == NSNotFound) {
71+
NSURL *isUrl = [NSURL URLWithString:urlStr];
72+
if (!isUrl || !isUrl.scheme || !isUrl.host) {
7373
tbxml = [tbxml initWithXMLFile:urlStr error:&error];
7474
} else {
7575
NSURLRequest *req = [NSURLRequest requestWithURL:[NSURL URLWithString:urlStr]];

0 commit comments

Comments
 (0)