@aws-amplify/rtn-web-browser 1.0.23 → 1.0.24
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { NativeModule } from 'react-native';
|
|
2
2
|
export interface WebBrowserNativeModule extends NativeModule {
|
|
3
|
-
openAuthSessionAsync
|
|
3
|
+
openAuthSessionAsync(url: string, redirectUrl?: string, prefersEphemeralSession?: boolean): Promise<string | null>;
|
|
4
4
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-amplify/rtn-web-browser",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.24",
|
|
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",
|
|
@@ -19,7 +19,8 @@
|
|
|
19
19
|
"build": "npm run clean && npm run build:esm-cjs",
|
|
20
20
|
"clean": "rimraf dist lib lib-esm",
|
|
21
21
|
"format": "echo \"Not implemented\"",
|
|
22
|
-
"lint": "
|
|
22
|
+
"lint": "eslint '**/*.{ts,tsx}' && npm run ts-coverage",
|
|
23
|
+
"lint:fix": "eslint '**/*.{ts,tsx}' --fix",
|
|
23
24
|
"ts-coverage": "typescript-coverage-report -p ./tsconfig.build.json -t 88.21"
|
|
24
25
|
},
|
|
25
26
|
"devDependencies": {
|
|
@@ -45,5 +46,5 @@
|
|
|
45
46
|
"dist/esm",
|
|
46
47
|
"src"
|
|
47
48
|
],
|
|
48
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "6c46368559f4c3229024d10c18aabb34c58efe68"
|
|
49
50
|
}
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
NativeEventSubscription,
|
|
8
8
|
Platform,
|
|
9
9
|
} from 'react-native';
|
|
10
|
+
|
|
10
11
|
import { nativeModule } from '../nativeModule';
|
|
11
12
|
|
|
12
13
|
let appStateListener: NativeEventSubscription | undefined;
|
|
@@ -31,12 +32,13 @@ export const openAuthSessionAsync = async (
|
|
|
31
32
|
const openAuthSessionIOS = async (
|
|
32
33
|
url: string,
|
|
33
34
|
redirectUrls: string[],
|
|
34
|
-
prefersEphemeralSession
|
|
35
|
+
prefersEphemeralSession = false,
|
|
35
36
|
) => {
|
|
36
37
|
const redirectUrl = redirectUrls.find(
|
|
37
38
|
// take the first non-web url as the deeplink
|
|
38
39
|
item => !item.startsWith('https://') && !item.startsWith('http://'),
|
|
39
40
|
);
|
|
41
|
+
|
|
40
42
|
return nativeModule.openAuthSessionAsync(
|
|
41
43
|
url,
|
|
42
44
|
redirectUrl,
|
|
@@ -56,6 +58,7 @@ const openAuthSessionAndroid = async (url: string, redirectUrls: string[]) => {
|
|
|
56
58
|
// open chrome tab
|
|
57
59
|
nativeModule.openAuthSessionAsync(url),
|
|
58
60
|
]);
|
|
61
|
+
|
|
59
62
|
return redirectUrl;
|
|
60
63
|
} finally {
|
|
61
64
|
appStateListener?.remove();
|
package/src/nativeModule.ts
CHANGED
package/src/types/native.ts
CHANGED
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
import { NativeModule } from 'react-native';
|
|
5
5
|
|
|
6
6
|
export interface WebBrowserNativeModule extends NativeModule {
|
|
7
|
-
openAuthSessionAsync
|
|
7
|
+
openAuthSessionAsync(
|
|
8
8
|
url: string,
|
|
9
9
|
redirectUrl?: string,
|
|
10
10
|
prefersEphemeralSession?: boolean,
|
|
11
|
-
)
|
|
11
|
+
): Promise<string | null>;
|
|
12
12
|
}
|