expo-web-browser
Advanced tools
Comparing version 3.0.0 to 4.0.0
@@ -1,3 +0,3 @@ | ||
import { NativeModulesProxy } from 'expo-core'; | ||
import { NativeModulesProxy } from '@unimodules/core'; | ||
export default NativeModulesProxy.ExpoWebBrowser || {}; | ||
//# sourceMappingURL=ExpoWebBrowser.js.map |
@@ -0,2 +1,12 @@ | ||
declare type OpenBrowserParams = { | ||
toolbarColor?: string; | ||
package?: string; | ||
enableBarCollapsing?: boolean; | ||
showTitle?: boolean; | ||
}; | ||
declare type AuthSessionResult = RedirectResult | BrowserResult; | ||
declare type CustomTabsBrowsersResults = { | ||
default: String[]; | ||
packages: String[]; | ||
}; | ||
declare type BrowserResult = { | ||
@@ -9,3 +19,4 @@ type: 'cancel' | 'dismiss'; | ||
}; | ||
export declare function openBrowserAsync(url: string): Promise<BrowserResult>; | ||
export declare function getCustomTabsSupportingBrowsersAsync(): Promise<CustomTabsBrowsersResults>; | ||
export declare function openBrowserAsync(url: string, browserParams?: OpenBrowserParams): Promise<BrowserResult>; | ||
export declare function dismissBrowser(): void; | ||
@@ -12,0 +23,0 @@ export declare function openAuthSessionAsync(url: string, redirectUrl: string): Promise<AuthSessionResult>; |
import { Linking, Platform } from 'react-native'; | ||
import { UnavailabilityError } from 'expo-errors'; | ||
import { UnavailabilityError } from '@unimodules/core'; | ||
import ExponentWebBrowser from './ExpoWebBrowser'; | ||
export async function openBrowserAsync(url) { | ||
export async function getCustomTabsSupportingBrowsersAsync() { | ||
if (!ExponentWebBrowser.getCustomTabsSupportingBrowsersAsync) { | ||
throw new UnavailabilityError('WebBrowser', 'getCustomTabsSupportingBrowsersAsync'); | ||
} | ||
return ExponentWebBrowser.getCustomTabsSupportingBrowsersAsync(); | ||
} | ||
export async function openBrowserAsync(url, browserParams = {}) { | ||
if (!ExponentWebBrowser.openBrowserAsync) { | ||
throw new UnavailabilityError('WebBrowser', 'openBrowserAsync'); | ||
} | ||
return ExponentWebBrowser.openBrowserAsync(url); | ||
return ExponentWebBrowser.openBrowserAsync(url, browserParams); | ||
} | ||
@@ -10,0 +16,0 @@ export function dismissBrowser() { |
{ | ||
"name": "expo-web-browser", | ||
"version": "3.0.0", | ||
"version": "4.0.0", | ||
"description": "Provides access to the system's web browser and supports handling redirects. On iOS, it uses SFSafariViewController or SFAuthenticationSession, depending on the method you call, and on Android it uses ChromeCustomTabs. As of iOS 11, SFSafariViewController no longer shares cookies with the Safari, so if you are using WebBrowser for authentication you will want to use WebBrowser.openAuthSessionAsync, and if you just want to open a webpage (such as your app privacy policy), then use WebBrowser.openBrowserAsync.", | ||
"main": "build/WebBrowser.js", | ||
"types": "build/WebBrowser.d.ts", | ||
"sideEffects": false, | ||
"scripts": { | ||
@@ -36,8 +37,8 @@ "build": "expo-module build", | ||
"unimodulePeerDependencies": { | ||
"expo-core": "*", | ||
"expo-errors": "*" | ||
"@unimodules/core": "*" | ||
}, | ||
"devDependencies": { | ||
"expo-module-scripts": "^1.0.0" | ||
} | ||
}, | ||
"gitHead": "8413e821076a2eca36b302e68dd628ce2e1f591a" | ||
} |
@@ -46,3 +46,3 @@ # expo-web-browser | ||
```java | ||
import expo.modules.expo.modules.webbrowser.WebBrowserPackage; | ||
import expo.modules.webbrowser.WebBrowserPackage; | ||
``` | ||
@@ -49,0 +49,0 @@ ```java |
import { describeCrossPlatform, mockProperty, unmockAllProperties } from 'jest-expo'; | ||
import { NativeModulesProxy } from 'expo-core'; | ||
import { NativeModulesProxy } from '@unimodules/core'; | ||
import * as WebBrowser from '../WebBrowser'; | ||
@@ -4,0 +4,0 @@ |
@@ -1,2 +0,2 @@ | ||
import { NativeModulesProxy } from 'expo-core'; | ||
import { NativeModulesProxy } from '@unimodules/core'; | ||
export default NativeModulesProxy.ExpoWebBrowser || {}; |
import { Linking, Platform } from 'react-native'; | ||
import { UnavailabilityError } from 'expo-errors'; | ||
import { UnavailabilityError } from '@unimodules/core'; | ||
import ExponentWebBrowser from './ExpoWebBrowser'; | ||
@@ -9,4 +9,16 @@ | ||
type OpenBrowserParams = { | ||
toolbarColor?: string; | ||
package?: string; | ||
enableBarCollapsing?: boolean; | ||
showTitle?: boolean; | ||
}; | ||
type AuthSessionResult = RedirectResult | BrowserResult; | ||
type CustomTabsBrowsersResults = { | ||
default: String[]; | ||
packages: String[]; | ||
}; | ||
type BrowserResult = { | ||
@@ -21,7 +33,17 @@ type: 'cancel' | 'dismiss'; | ||
export async function openBrowserAsync(url: string): Promise<BrowserResult> { | ||
export async function getCustomTabsSupportingBrowsersAsync(): Promise<CustomTabsBrowsersResults> { | ||
if (!ExponentWebBrowser.getCustomTabsSupportingBrowsersAsync) { | ||
throw new UnavailabilityError('WebBrowser', 'getCustomTabsSupportingBrowsersAsync'); | ||
} | ||
return ExponentWebBrowser.getCustomTabsSupportingBrowsersAsync(); | ||
} | ||
export async function openBrowserAsync( | ||
url: string, | ||
browserParams: OpenBrowserParams = {} | ||
): Promise<BrowserResult> { | ||
if (!ExponentWebBrowser.openBrowserAsync) { | ||
throw new UnavailabilityError('WebBrowser', 'openBrowserAsync'); | ||
} | ||
return ExponentWebBrowser.openBrowserAsync(url); | ||
return ExponentWebBrowser.openBrowserAsync(url, browserParams); | ||
} | ||
@@ -36,3 +58,6 @@ | ||
export async function openAuthSessionAsync(url: string, redirectUrl: string): Promise<AuthSessionResult> { | ||
export async function openAuthSessionAsync( | ||
url: string, | ||
redirectUrl: string | ||
): Promise<AuthSessionResult> { | ||
if (_authSessionIsNativelySupported()) { | ||
@@ -39,0 +64,0 @@ if (!ExponentWebBrowser.openAuthSessionAsync) { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
646676
28
287
1