From 11dd78fb0e86a9ac144b6a603570d8435a221232 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Radovan=20=C5=A0mitala?= Date: Mon, 8 Oct 2018 12:30:50 +0200 Subject: [PATCH] Normalize schema on Android side --- Libraries/Linking/Linking.js | 7 ------- .../com/facebook/react/modules/intent/IntentModule.java | 2 +- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/Libraries/Linking/Linking.js b/Libraries/Linking/Linking.js index 309ce5824be2..bcb885b0a9c5 100644 --- a/Libraries/Linking/Linking.js +++ b/Libraries/Linking/Linking.js @@ -57,13 +57,6 @@ class Linking extends NativeEventEmitter { * See https://facebook.github.io/react-native/docs/linking.html#openurl */ openURL(url: string): Promise { - // Android Intent requires protocols http and https to be in lowercase. - // https:// and http:// works, but Https:// and Http:// doesn't. - if (url.toLowerCase().startsWith('https://')) { - url = url.replace(url.substr(0, 8), 'https://'); - } else if (url.toLowerCase().startsWith('http://')) { - url = url.replace(url.substr(0, 7), 'http://'); - } this._validateURL(url); return LinkingManager.openURL(url); } diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/intent/IntentModule.java b/ReactAndroid/src/main/java/com/facebook/react/modules/intent/IntentModule.java index 6187c943e27e..a7b84825881b 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/intent/IntentModule.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/intent/IntentModule.java @@ -79,7 +79,7 @@ public void openURL(String url, Promise promise) { try { Activity currentActivity = getCurrentActivity(); - Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); + Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url).normalizeScheme()); String selfPackageName = getReactApplicationContext().getPackageName(); ComponentName componentName = intent.resolveActivity(