fix: redirect the user to the phone app (#5441)
* fix: redirect the user to the phone app * minor tweak
This commit is contained in:
parent
2ff39d9a62
commit
30253aa4cf
|
@ -6,6 +6,7 @@ import { themes } from '../../constants';
|
|||
import { TSupportedThemes } from '../../../theme';
|
||||
import UserPreferences from '../userPreferences';
|
||||
import ensureSecureProtocol from './ensureSecureProtocol';
|
||||
import log from './log';
|
||||
|
||||
export const DEFAULT_BROWSER_KEY = 'DEFAULT_BROWSER_KEY';
|
||||
|
||||
|
@ -38,6 +39,16 @@ const appSchemeURL = (url: string, browser: string): string => {
|
|||
};
|
||||
|
||||
const openLink = async (url: string, theme: TSupportedThemes = 'light'): Promise<void> => {
|
||||
const telRegExp = new RegExp(/^(tel:)/);
|
||||
if (telRegExp.test(url)) {
|
||||
try {
|
||||
await Linking.openURL(url);
|
||||
return;
|
||||
} catch (e) {
|
||||
log(e);
|
||||
}
|
||||
}
|
||||
|
||||
url = ensureSecureProtocol(url);
|
||||
try {
|
||||
const browser = UserPreferences.getString(DEFAULT_BROWSER_KEY);
|
||||
|
|
|
@ -54,6 +54,7 @@
|
|||
<string>googlechromes</string>
|
||||
<string>firefox</string>
|
||||
<string>brave</string>
|
||||
<string>tel</string>
|
||||
</array>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
|
|
Loading…
Reference in New Issue