Skip to content

Commit fab9d1f

Browse files
authored
fix(android): allow schemes that start by https (#437)
1 parent 2746dd0 commit fab9d1f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/android/com/ionicframework/cordova/webview/IonicWebViewEngine.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ public class IonicWebViewEngine extends SystemWebViewEngine {
3131

3232
private WebViewLocalServer localServer;
3333
private String CDV_LOCAL_SERVER;
34+
private String scheme;
3435
private static final String LAST_BINARY_VERSION_CODE = "lastBinaryVersionCode";
3536
private static final String LAST_BINARY_VERSION_NAME = "lastBinaryVersionName";
3637

@@ -60,7 +61,7 @@ public void init(CordovaWebView parentWebView, CordovaInterface cordova, final C
6061
parser.parse(cordova.getActivity());
6162

6263
String hostname = preferences.getString("Hostname", "localhost");
63-
String scheme = preferences.getString("Scheme", "http");
64+
scheme = preferences.getString("Scheme", "http");
6465
CDV_LOCAL_SERVER = scheme + "://" + hostname;
6566

6667
localServer = new WebViewLocalServer(cordova.getActivity(), hostname, true, parser, scheme);
@@ -138,7 +139,7 @@ public void onPageStarted(WebView view, String url, Bitmap favicon) {
138139
view.stopLoading();
139140
// When using a custom scheme the app won't load if server start url doesn't end in /
140141
String startUrl = CDV_LOCAL_SERVER;
141-
if (!CDV_LOCAL_SERVER.startsWith(WebViewLocalServer.httpsScheme) && !CDV_LOCAL_SERVER.startsWith(WebViewLocalServer.httpScheme)) {
142+
if (!scheme.equalsIgnoreCase(WebViewLocalServer.httpsScheme) && !scheme.equalsIgnoreCase(WebViewLocalServer.httpScheme)) {
142143
startUrl += "/";
143144
}
144145
view.loadUrl(startUrl);

0 commit comments

Comments
 (0)