[IMPROVE] Make `system default` the default browser (#3265)
* [FIX] use systemdefault: as the default browser, not inApp * Fix Co-authored-by: Diego Mello <diegolmello@gmail.com>
This commit is contained in:
parent
c9d5bc37c4
commit
4882ccd588
|
@ -39,16 +39,16 @@ const openLink = async(url, theme = 'light') => {
|
|||
try {
|
||||
const browser = await UserPreferences.getStringAsync(DEFAULT_BROWSER_KEY);
|
||||
|
||||
if (browser) {
|
||||
const schemeUrl = appSchemeURL(url, browser.replace(':', ''));
|
||||
await Linking.openURL(schemeUrl);
|
||||
} else {
|
||||
if (browser === 'inApp') {
|
||||
await WebBrowser.openBrowserAsync(url, {
|
||||
toolbarColor: themes[theme].headerBackground,
|
||||
controlsColor: themes[theme].headerTintColor,
|
||||
collapseToolbar: true,
|
||||
showTitle: true
|
||||
});
|
||||
} else {
|
||||
const schemeUrl = appSchemeURL(url, browser.replace(':', ''));
|
||||
await Linking.openURL(schemeUrl);
|
||||
}
|
||||
} catch {
|
||||
try {
|
||||
|
|
|
@ -83,7 +83,7 @@ class DefaultBrowserView extends React.Component {
|
|||
|
||||
isSelected = (value) => {
|
||||
const { browser } = this.state;
|
||||
if (!browser && value === 'inApp') {
|
||||
if (!browser && value === 'systemDefault:') {
|
||||
return true;
|
||||
}
|
||||
return browser === value;
|
||||
|
@ -92,7 +92,7 @@ class DefaultBrowserView extends React.Component {
|
|||
changeDefaultBrowser = async(newBrowser) => {
|
||||
logEvent(events.DB_CHANGE_DEFAULT_BROWSER, { browser: newBrowser });
|
||||
try {
|
||||
const browser = newBrowser !== 'inApp' ? newBrowser : null;
|
||||
const browser = newBrowser !== 'systemDefault:' ? newBrowser : null;
|
||||
await UserPreferences.setStringAsync(DEFAULT_BROWSER_KEY, browser);
|
||||
this.setState({ browser });
|
||||
} catch {
|
||||
|
|
Loading…
Reference in New Issue