@aws-amplify/rtn-web-browser 1.2.0 → 1.2.1-unstable.1fe3c5d.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/src/main/kotlin/com/amazonaws/amplify/rtnwebbrowser/ChromeOSModule.kt +37 -0
- package/android/src/main/kotlin/com/amazonaws/amplify/rtnwebbrowser/WebBrowserPackage.kt +4 -1
- package/dist/cjs/apis/openAuthSessionAsync.js +5 -3
- package/dist/cjs/apis/openAuthSessionAsync.js.map +1 -1
- package/dist/esm/apis/openAuthSessionAsync.mjs +5 -3
- package/dist/esm/apis/openAuthSessionAsync.mjs.map +1 -1
- package/package.json +2 -2
- package/src/apis/openAuthSessionAsync.ts +5 -3
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
package com.amazonaws.amplify.rtnwebbrowser
|
|
5
|
+
|
|
6
|
+
import com.facebook.react.bridge.Promise
|
|
7
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
8
|
+
import com.facebook.react.bridge.ReactContextBaseJavaModule
|
|
9
|
+
import com.facebook.react.bridge.ReactMethod
|
|
10
|
+
|
|
11
|
+
class ChromeOSModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaModule(reactContext) {
|
|
12
|
+
|
|
13
|
+
override fun getName() = "ChromeOS"
|
|
14
|
+
|
|
15
|
+
@ReactMethod
|
|
16
|
+
fun isChromeOS(promise: Promise) {
|
|
17
|
+
try {
|
|
18
|
+
val isChromeOS = detectChromeOS()
|
|
19
|
+
promise.resolve(isChromeOS)
|
|
20
|
+
} catch (e: Exception) {
|
|
21
|
+
promise.reject("CHROMEOS_DETECTION_ERROR", "Failed to detect ChromeOS", e)
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
private fun detectChromeOS(): Boolean {
|
|
26
|
+
return try {
|
|
27
|
+
// Check for Android Runtime for Chrome (ARC) system feature
|
|
28
|
+
val packageManager = reactApplicationContext.packageManager
|
|
29
|
+
|
|
30
|
+
packageManager.hasSystemFeature("org.chromium.arc.device_management") ||
|
|
31
|
+
packageManager.hasSystemFeature("org.chromium.arc")
|
|
32
|
+
} catch (e: Exception) {
|
|
33
|
+
// If we can't check system features, return false
|
|
34
|
+
false
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -18,5 +18,8 @@ class WebBrowserPackage : ReactPackage {
|
|
|
18
18
|
|
|
19
19
|
override fun createNativeModules(
|
|
20
20
|
reactContext: ReactApplicationContext
|
|
21
|
-
): MutableList<NativeModule> = listOf(
|
|
21
|
+
): MutableList<NativeModule> = listOf(
|
|
22
|
+
WebBrowserModule(reactContext),
|
|
23
|
+
ChromeOSModule(reactContext)
|
|
24
|
+
).toMutableList()
|
|
22
25
|
}
|
|
@@ -27,14 +27,16 @@ const openAuthSessionAsync = async (url, redirectUrls, prefersEphemeralSession)
|
|
|
27
27
|
if (react_native_1.Platform.OS === 'android') {
|
|
28
28
|
try {
|
|
29
29
|
const isChromebookRes = await isChromebook();
|
|
30
|
-
if (isChromebookRes) {
|
|
31
|
-
|
|
30
|
+
if (!isChromebookRes) {
|
|
31
|
+
// If it is not a Chromebook, it probably supports custom tabs
|
|
32
|
+
return await openAuthSessionAndroid(httpsUrl, redirectUrls);
|
|
32
33
|
}
|
|
33
34
|
}
|
|
34
35
|
catch {
|
|
35
36
|
// ignore and fallback to android
|
|
36
37
|
}
|
|
37
|
-
|
|
38
|
+
// The ChromeOS way without custom tabs works everywhere
|
|
39
|
+
return openAuthSessionChromeOs(httpsUrl, redirectUrls);
|
|
38
40
|
}
|
|
39
41
|
};
|
|
40
42
|
exports.openAuthSessionAsync = openAuthSessionAsync;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openAuthSessionAsync.js","sources":["../../../src/apis/openAuthSessionAsync.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.openAuthSessionAsync = void 0;\nexports.isChromebook = isChromebook;\nconst react_native_1 = require(\"react-native\");\nconst nativeModule_1 = require(\"../nativeModule\");\nlet appStateListener;\nlet redirectListener;\nasync function isChromebook() {\n try {\n const nm = react_native_1.NativeModules?.ChromeOS;\n if (nm?.isChromeOS)\n return !!(await nm.isChromeOS());\n }\n catch { }\n return false;\n}\nconst openAuthSessionAsync = async (url, redirectUrls, prefersEphemeralSession) => {\n // enforce HTTPS\n const httpsUrl = url.replace('http://', 'https://');\n if (react_native_1.Platform.OS === 'ios') {\n return openAuthSessionIOS(httpsUrl, redirectUrls, prefersEphemeralSession);\n }\n if (react_native_1.Platform.OS === 'android') {\n try {\n const isChromebookRes = await isChromebook();\n if (isChromebookRes) {\n return
|
|
1
|
+
{"version":3,"file":"openAuthSessionAsync.js","sources":["../../../src/apis/openAuthSessionAsync.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.openAuthSessionAsync = void 0;\nexports.isChromebook = isChromebook;\nconst react_native_1 = require(\"react-native\");\nconst nativeModule_1 = require(\"../nativeModule\");\nlet appStateListener;\nlet redirectListener;\nasync function isChromebook() {\n try {\n const nm = react_native_1.NativeModules?.ChromeOS;\n if (nm?.isChromeOS)\n return !!(await nm.isChromeOS());\n }\n catch { }\n return false;\n}\nconst openAuthSessionAsync = async (url, redirectUrls, prefersEphemeralSession) => {\n // enforce HTTPS\n const httpsUrl = url.replace('http://', 'https://');\n if (react_native_1.Platform.OS === 'ios') {\n return openAuthSessionIOS(httpsUrl, redirectUrls, prefersEphemeralSession);\n }\n if (react_native_1.Platform.OS === 'android') {\n try {\n const isChromebookRes = await isChromebook();\n if (!isChromebookRes) {\n // If it is not a Chromebook, it probably supports custom tabs\n return await openAuthSessionAndroid(httpsUrl, redirectUrls);\n }\n }\n catch {\n // ignore and fallback to android\n }\n // The ChromeOS way without custom tabs works everywhere\n return openAuthSessionChromeOs(httpsUrl, redirectUrls);\n }\n};\nexports.openAuthSessionAsync = openAuthSessionAsync;\nconst openAuthSessionIOS = async (url, redirectUrls, prefersEphemeralSession = false) => {\n const redirectUrl = redirectUrls.find(\n // take the first non-web url as the deeplink\n item => !item.startsWith('https://') && !item.startsWith('http://'));\n return nativeModule_1.nativeModule.openAuthSessionAsync(url, redirectUrl, prefersEphemeralSession);\n};\nconst openAuthSessionAndroid = async (url, redirectUrls) => {\n try {\n const [redirectUrl] = await Promise.all([\n Promise.race([\n // wait for app to redirect, resulting in a redirectUrl\n getRedirectPromise(redirectUrls),\n // wait for app to return some other way, resulting in null\n getAppStatePromise(),\n ]),\n // open chrome tab\n nativeModule_1.nativeModule.openAuthSessionAsync(url),\n ]);\n return redirectUrl;\n }\n finally {\n removeAppStateListener();\n removeRedirectListener();\n }\n};\nconst openAuthSessionChromeOs = async (url, redirectUrls) => {\n try {\n const [redirectUrl] = await Promise.all([\n Promise.race([\n // wait for app to redirect, resulting in a redirectUrl\n getRedirectPromise(redirectUrls),\n // wait for app to return some other way, resulting in null\n getAppStatePromise(),\n ]),\n react_native_1.Linking.openURL(url),\n ]);\n if (redirectUrl)\n react_native_1.Linking.openURL(redirectUrl);\n return redirectUrl;\n }\n finally {\n removeAppStateListener();\n removeRedirectListener();\n }\n};\nconst getAppStatePromise = () => new Promise(resolve => {\n // remove any stray listeners before creating new ones\n removeAppStateListener();\n let previousState = react_native_1.AppState.currentState;\n appStateListener = react_native_1.AppState.addEventListener('change', nextAppState => {\n if (previousState !== 'active' && nextAppState === 'active') {\n removeAppStateListener();\n resolve(null);\n }\n previousState = nextAppState;\n });\n});\nconst getRedirectPromise = (redirectUrls) => new Promise(resolve => {\n // remove any stray listeners before creating new ones\n removeRedirectListener();\n redirectListener = react_native_1.Linking.addEventListener('url', event => {\n if (redirectUrls.some(url => event.url.startsWith(url))) {\n resolve(event.url);\n }\n });\n});\nconst removeAppStateListener = () => {\n appStateListener?.remove();\n appStateListener = undefined;\n};\nconst removeRedirectListener = () => {\n redirectListener?.remove();\n redirectListener = undefined;\n};\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,oBAAoB,GAAG,MAAM;AACrC,OAAO,CAAC,YAAY,GAAG,YAAY;AACnC,MAAM,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC;AAC9C,MAAM,cAAc,GAAG,OAAO,CAAC,iBAAiB,CAAC;AACjD,IAAI,gBAAgB;AACpB,IAAI,gBAAgB;AACpB,eAAe,YAAY,GAAG;AAC9B,IAAI,IAAI;AACR,QAAQ,MAAM,EAAE,GAAG,cAAc,CAAC,aAAa,EAAE,QAAQ;AACzD,QAAQ,IAAI,EAAE,EAAE,UAAU;AAC1B,YAAY,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC,UAAU,EAAE,CAAC;AAC5C,IAAI;AACJ,IAAI,MAAM,EAAE;AACZ,IAAI,OAAO,KAAK;AAChB;AACA,MAAM,oBAAoB,GAAG,OAAO,GAAG,EAAE,YAAY,EAAE,uBAAuB,KAAK;AACnF;AACA,IAAI,MAAM,QAAQ,GAAG,GAAG,CAAC,OAAO,CAAC,SAAS,EAAE,UAAU,CAAC;AACvD,IAAI,IAAI,cAAc,CAAC,QAAQ,CAAC,EAAE,KAAK,KAAK,EAAE;AAC9C,QAAQ,OAAO,kBAAkB,CAAC,QAAQ,EAAE,YAAY,EAAE,uBAAuB,CAAC;AAClF,IAAI;AACJ,IAAI,IAAI,cAAc,CAAC,QAAQ,CAAC,EAAE,KAAK,SAAS,EAAE;AAClD,QAAQ,IAAI;AACZ,YAAY,M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,GAAG,IAAI,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,EAAE;AACjE,YAAY,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC;AAC9B,QAAQ;AACR,IAAI,CAAC,CAAC;AACN,CAAC,CAAC;AACF,MAAM,sBAAsB,GAAG,MAAM;AACrC,IAAI,gBAAgB,EAAE,MAAM,EAAE;AAC9B,IAAI,gBAAgB,GAAG,SAAS;AAChC,CAAC;AACD,MAAM,sBAAsB,GAAG,MAAM;AACrC,IAAI,gBAAgB,EAAE,MAAM,EAAE;AAC9B,IAAI,gBAAgB,GAAG,SAAS;AAChC,CAAC;;"}
|
|
@@ -23,14 +23,16 @@ const openAuthSessionAsync = async (url, redirectUrls, prefersEphemeralSession)
|
|
|
23
23
|
if (Platform.OS === 'android') {
|
|
24
24
|
try {
|
|
25
25
|
const isChromebookRes = await isChromebook();
|
|
26
|
-
if (isChromebookRes) {
|
|
27
|
-
|
|
26
|
+
if (!isChromebookRes) {
|
|
27
|
+
// If it is not a Chromebook, it probably supports custom tabs
|
|
28
|
+
return await openAuthSessionAndroid(httpsUrl, redirectUrls);
|
|
28
29
|
}
|
|
29
30
|
}
|
|
30
31
|
catch {
|
|
31
32
|
// ignore and fallback to android
|
|
32
33
|
}
|
|
33
|
-
|
|
34
|
+
// The ChromeOS way without custom tabs works everywhere
|
|
35
|
+
return openAuthSessionChromeOs(httpsUrl, redirectUrls);
|
|
34
36
|
}
|
|
35
37
|
};
|
|
36
38
|
const openAuthSessionIOS = async (url, redirectUrls, prefersEphemeralSession = false) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openAuthSessionAsync.mjs","sources":["../../../src/apis/openAuthSessionAsync.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { AppState, Linking, NativeModules, Platform, } from 'react-native';\nimport { nativeModule } from '../nativeModule';\nlet appStateListener;\nlet redirectListener;\nexport async function isChromebook() {\n try {\n const nm = NativeModules?.ChromeOS;\n if (nm?.isChromeOS)\n return !!(await nm.isChromeOS());\n }\n catch { }\n return false;\n}\nexport const openAuthSessionAsync = async (url, redirectUrls, prefersEphemeralSession) => {\n // enforce HTTPS\n const httpsUrl = url.replace('http://', 'https://');\n if (Platform.OS === 'ios') {\n return openAuthSessionIOS(httpsUrl, redirectUrls, prefersEphemeralSession);\n }\n if (Platform.OS === 'android') {\n try {\n const isChromebookRes = await isChromebook();\n if (isChromebookRes) {\n return
|
|
1
|
+
{"version":3,"file":"openAuthSessionAsync.mjs","sources":["../../../src/apis/openAuthSessionAsync.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { AppState, Linking, NativeModules, Platform, } from 'react-native';\nimport { nativeModule } from '../nativeModule';\nlet appStateListener;\nlet redirectListener;\nexport async function isChromebook() {\n try {\n const nm = NativeModules?.ChromeOS;\n if (nm?.isChromeOS)\n return !!(await nm.isChromeOS());\n }\n catch { }\n return false;\n}\nexport const openAuthSessionAsync = async (url, redirectUrls, prefersEphemeralSession) => {\n // enforce HTTPS\n const httpsUrl = url.replace('http://', 'https://');\n if (Platform.OS === 'ios') {\n return openAuthSessionIOS(httpsUrl, redirectUrls, prefersEphemeralSession);\n }\n if (Platform.OS === 'android') {\n try {\n const isChromebookRes = await isChromebook();\n if (!isChromebookRes) {\n // If it is not a Chromebook, it probably supports custom tabs\n return await openAuthSessionAndroid(httpsUrl, redirectUrls);\n }\n }\n catch {\n // ignore and fallback to android\n }\n // The ChromeOS way without custom tabs works everywhere\n return openAuthSessionChromeOs(httpsUrl, redirectUrls);\n }\n};\nconst openAuthSessionIOS = async (url, redirectUrls, prefersEphemeralSession = false) => {\n const redirectUrl = redirectUrls.find(\n // take the first non-web url as the deeplink\n item => !item.startsWith('https://') && !item.startsWith('http://'));\n return nativeModule.openAuthSessionAsync(url, redirectUrl, prefersEphemeralSession);\n};\nconst openAuthSessionAndroid = async (url, redirectUrls) => {\n try {\n const [redirectUrl] = await Promise.all([\n Promise.race([\n // wait for app to redirect, resulting in a redirectUrl\n getRedirectPromise(redirectUrls),\n // wait for app to return some other way, resulting in null\n getAppStatePromise(),\n ]),\n // open chrome tab\n nativeModule.openAuthSessionAsync(url),\n ]);\n return redirectUrl;\n }\n finally {\n removeAppStateListener();\n removeRedirectListener();\n }\n};\nconst openAuthSessionChromeOs = async (url, redirectUrls) => {\n try {\n const [redirectUrl] = await Promise.all([\n Promise.race([\n // wait for app to redirect, resulting in a redirectUrl\n getRedirectPromise(redirectUrls),\n // wait for app to return some other way, resulting in null\n getAppStatePromise(),\n ]),\n Linking.openURL(url),\n ]);\n if (redirectUrl)\n Linking.openURL(redirectUrl);\n return redirectUrl;\n }\n finally {\n removeAppStateListener();\n removeRedirectListener();\n }\n};\nconst getAppStatePromise = () => new Promise(resolve => {\n // remove any stray listeners before creating new ones\n removeAppStateListener();\n let previousState = AppState.currentState;\n appStateListener = AppState.addEventListener('change', nextAppState => {\n if (previousState !== 'active' && nextAppState === 'active') {\n removeAppStateListener();\n resolve(null);\n }\n previousState = nextAppState;\n });\n});\nconst getRedirectPromise = (redirectUrls) => new Promise(resolve => {\n // remove any stray listeners before creating new ones\n removeRedirectListener();\n redirectListener = Linking.addEventListener('url', event => {\n if (redirectUrls.some(url => event.url.startsWith(url))) {\n resolve(event.url);\n }\n });\n});\nconst removeAppStateListener = () => {\n appStateListener?.remove();\n appStateListener = undefined;\n};\nconst removeRedirectListener = () => {\n redirectListener?.remove();\n redirectListener = undefined;\n};\n"],"names":[],"mappings":";;;AAAA;AACA;AAGA,IAAI,gBAAgB;AACpB,IAAI,gBAAgB;AACb,eAAe,YAAY,GAAG;AACrC,IAAI,IAAI;AACR,QAAQ,MAAM,EAAE,GAAG,aAAa,EAAE,QAAQ;AAC1C,QAAQ,IAAI,EAAE,EAAE,UAAU;AAC1B,YAAY,OAAO,CAAC,EAAE,MAA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EAAE;AACpC,YAAY,OAAO,CAAC,IAAI,CAAC;AACzB,QAAQ;AACR,QAAQ,aAAa,GAAG,YAAY;AACpC,IAAI,CAAC,CAAC;AACN,CAAC,CAAC;AACF,MAAM,kBAAkB,GAAG,CAAC,YAAY,KAAK,IAAI,OAAO,CAAC,OAAO,IAAI;AACpE;AACA,IAAI,sBAAsB,EAAE;AAC5B,IAAI,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC,KAAK,EAAE,KAAK,IAAI;AAChE,QAAQ,IAAI,YAAY,CAAC,IAAI,CAAC,GAAG,IAAI,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,EAAE;AACjE,YAAY,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC;AAC9B,QAAQ;AACR,IAAI,CAAC,CAAC;AACN,CAAC,CAAC;AACF,MAAM,sBAAsB,GAAG,MAAM;AACrC,IAAI,gBAAgB,EAAE,MAAM,EAAE;AAC9B,IAAI,gBAAgB,GAAG,SAAS;AAChC,CAAC;AACD,MAAM,sBAAsB,GAAG,MAAM;AACrC,IAAI,gBAAgB,EAAE,MAAM,EAAE;AAC9B,IAAI,gBAAgB,GAAG,SAAS;AAChC,CAAC;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-amplify/rtn-web-browser",
|
|
3
|
-
"version": "1.2.0",
|
|
3
|
+
"version": "1.2.1-unstable.1fe3c5d.0+1fe3c5d",
|
|
4
4
|
"description": "React Native module for aws-amplify web browser",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"module": "./dist/esm/index.mjs",
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"dist/esm",
|
|
48
48
|
"src"
|
|
49
49
|
],
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "1fe3c5dbea26a7394c43a97af05e3fa8cec95a92"
|
|
51
51
|
}
|
|
@@ -37,14 +37,16 @@ export const openAuthSessionAsync = async (
|
|
|
37
37
|
if (Platform.OS === 'android') {
|
|
38
38
|
try {
|
|
39
39
|
const isChromebookRes = await isChromebook();
|
|
40
|
-
if (isChromebookRes) {
|
|
41
|
-
|
|
40
|
+
if (!isChromebookRes) {
|
|
41
|
+
// If it is not a Chromebook, it probably supports custom tabs
|
|
42
|
+
return await openAuthSessionAndroid(httpsUrl, redirectUrls);
|
|
42
43
|
}
|
|
43
44
|
} catch {
|
|
44
45
|
// ignore and fallback to android
|
|
45
46
|
}
|
|
46
47
|
|
|
47
|
-
|
|
48
|
+
// The ChromeOS way without custom tabs works everywhere
|
|
49
|
+
return openAuthSessionChromeOs(httpsUrl, redirectUrls);
|
|
48
50
|
}
|
|
49
51
|
};
|
|
50
52
|
|