Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// If we are on the native app and the other native app is available,
// we open the native app
onClick = AppLinker.openNativeFromNative.bind(this, props)
href = '#'
} else {
// If we are on a native app, but the other native app is not available
// we open the web link, this is done by the href prop. We still
// have to call the prop callback
onClick = AppLinker.openWeb.bind(this, props)
}
} else if (isMobile() && appInfo) {
// If we are on the "mobile web version", we try to open the native app
// if it exists with an universal links. If it fails, we redirect to the web
// version of the requested app
// Only on iOS ATM
if (isAndroid()) {
onClick = AppLinker.openNativeFromWeb.bind(this, props)
} else {
//Since generateUniversalLink can rise an error, let's catch it to not crash
//all the page.
try {
href = generateUniversalLink({ slug, nativePath, fallbackUrl: href })
} catch (err) {
console.error(err)
href = '#'
}
}
}
return {
href,
onClick