File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change 11// @flow
22
3- import { Platform , Linking } from 'react-native'
3+ import { Platform , Linking , Alert } from 'react-native'
44
55import { trackUrl , trackException } from '@frogpond/analytics'
6+ import { appName } from '@frogpond/constants'
67import SafariView from 'react-native-safari-view'
78import { CustomTabs } from 'react-native-custom-tabs'
89
@@ -75,5 +76,15 @@ export function canOpenUrl(url: string) {
7576
7677export function openUrlInBrowser ( { url, id} : { url : string , id ?: string } ) {
7778 trackUrl ( id || url )
78- return genericOpen ( url )
79+ return promptConfirm ( url )
80+ }
81+
82+ function promptConfirm ( url : string ) {
83+ const app = appName ( )
84+ const title = `Leaving ${ app } `
85+ const detail = `A web page will be opened in a browser outside of ${ app } . Are you sure you want to open it?`
86+ Alert . alert ( title , detail , [
87+ { text : 'Cancel' , onPress : ( ) => { } } ,
88+ { text : 'Open' , onPress : ( ) => genericOpen ( url ) } ,
89+ ] )
7990}
You can’t perform that action at this time.
0 commit comments