Skip to content

Commit

Permalink
chore(rtn-web-browser): run yarn lint:fix
Browse files Browse the repository at this point in the history
  • Loading branch information
HuiSF committed Mar 4, 2024
1 parent b25dc69 commit dd46c1b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
5 changes: 4 additions & 1 deletion packages/rtn-web-browser/src/apis/openAuthSessionAsync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
NativeEventSubscription,
Platform,
} from 'react-native';

import { nativeModule } from '../nativeModule';

let appStateListener: NativeEventSubscription | undefined;
Expand All @@ -31,12 +32,13 @@ export const openAuthSessionAsync = async (
const openAuthSessionIOS = async (
url: string,
redirectUrls: string[],
prefersEphemeralSession: boolean = false,
prefersEphemeralSession = false,
) => {
const redirectUrl = redirectUrls.find(
// take the first non-web url as the deeplink
item => !item.startsWith('https://') && !item.startsWith('http://'),
);

return nativeModule.openAuthSessionAsync(
url,
redirectUrl,
Expand All @@ -56,6 +58,7 @@ const openAuthSessionAndroid = async (url: string, redirectUrls: string[]) => {
// open chrome tab
nativeModule.openAuthSessionAsync(url),
]);

return redirectUrl;
} finally {
appStateListener?.remove();
Expand Down
1 change: 1 addition & 0 deletions packages/rtn-web-browser/src/nativeModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// SPDX-License-Identifier: Apache-2.0

import { NativeModules } from 'react-native';

import { LINKING_ERROR } from './constants';
import { WebBrowserNativeModule } from './types';

Expand Down
4 changes: 2 additions & 2 deletions packages/rtn-web-browser/src/types/native.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
import { NativeModule } from 'react-native';

export interface WebBrowserNativeModule extends NativeModule {
openAuthSessionAsync: (
openAuthSessionAsync(
url: string,
redirectUrl?: string,
prefersEphemeralSession?: boolean,
) => Promise<string | null>;
): Promise<string | null>;
}

0 comments on commit dd46c1b

Please sign in to comment.