[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:
Reinaldo Neto 2021-07-12 16:19:25 -03:00 committed by GitHub
parent c9d5bc37c4
commit 4882ccd588
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 6 deletions

View File

@ -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 {

View File

@ -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 {