Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
},
{ text: 'Go back', onPress: resolve },
],
)
})
if (!allowNonSecure) {
return
}
}
} catch {
Alert.alert('The provided URL is not supported')
return
}
if (await InAppBrowser.isAvailable()) {
try {
const response: any = await InAppBrowser.openAuth(authURL, 'berty://', {
dismissButtonStyle: 'cancel',
readerMode: false,
modalPresentationStyle: 'pageSheet',
modalEnabled: true,
showTitle: true,
enableDefaultShare: false,
ephemeralWebSession: true,
// forceCloseOnRedirection: false,
})
if (!response.url) {
return
}
async openLink() {
const { url, statusBarStyle } = this.state;
try {
if (await InAppBrowser.isAvailable()) {
// A delay to change the StatusBar when the browser is opened
const animated = true;
const delay = animated && Platform.OS === 'ios' ? 400 : 0;
setTimeout(() => StatusBar.setBarStyle('light-content'), delay);
const result = await InAppBrowser.open(url, {
// iOS Properties
dismissButtonStyle: 'cancel',
preferredBarTintColor: '#453AA4',
preferredControlTintColor: 'white',
readerMode: false,
animated,
modalPresentationStyle: 'fullScreen',
modalTransitionStyle: 'partialCurl',
modalEnabled: true,
enableBarCollapsing: false,
// Android Properties
async tryDeepLinking() {
const loginUrl = 'https://proyecto26.github.io/react-native-inappbrowser/';
const redirectUrl = this.getDeepLink();
const url = `${loginUrl}?redirect_url=${encodeURIComponent(redirectUrl)}`;
try {
if (await InAppBrowser.isAvailable()) {
const result = await InAppBrowser.openAuth(url, redirectUrl, {
showTitle: true,
toolbarColor: '#6200EE',
secondaryToolbarColor: 'black',
enableUrlBarHiding: true,
enableDefaultShare: true
});
await this.sleep(800);
Alert.alert('Response', JSON.stringify(result));
} else {
Alert.alert('InAppBrowser is not supported :/');
}
} catch (error) {
Alert.alert('Something’s wrong with the app :(');
}
}