[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 { try {
const browser = await UserPreferences.getStringAsync(DEFAULT_BROWSER_KEY); const browser = await UserPreferences.getStringAsync(DEFAULT_BROWSER_KEY);
if (browser) { if (browser === 'inApp') {
const schemeUrl = appSchemeURL(url, browser.replace(':', ''));
await Linking.openURL(schemeUrl);
} else {
await WebBrowser.openBrowserAsync(url, { await WebBrowser.openBrowserAsync(url, {
toolbarColor: themes[theme].headerBackground, toolbarColor: themes[theme].headerBackground,
controlsColor: themes[theme].headerTintColor, controlsColor: themes[theme].headerTintColor,
collapseToolbar: true, collapseToolbar: true,
showTitle: true showTitle: true
}); });
} else {
const schemeUrl = appSchemeURL(url, browser.replace(':', ''));
await Linking.openURL(schemeUrl);
} }
} catch { } catch {
try { try {

View File

@ -83,7 +83,7 @@ class DefaultBrowserView extends React.Component {
isSelected = (value) => { isSelected = (value) => {
const { browser } = this.state; const { browser } = this.state;
if (!browser && value === 'inApp') { if (!browser && value === 'systemDefault:') {
return true; return true;
} }
return browser === value; return browser === value;
@ -92,7 +92,7 @@ class DefaultBrowserView extends React.Component {
changeDefaultBrowser = async(newBrowser) => { changeDefaultBrowser = async(newBrowser) => {
logEvent(events.DB_CHANGE_DEFAULT_BROWSER, { browser: newBrowser }); logEvent(events.DB_CHANGE_DEFAULT_BROWSER, { browser: newBrowser });
try { try {
const browser = newBrowser !== 'inApp' ? newBrowser : null; const browser = newBrowser !== 'systemDefault:' ? newBrowser : null;
await UserPreferences.setStringAsync(DEFAULT_BROWSER_KEY, browser); await UserPreferences.setStringAsync(DEFAULT_BROWSER_KEY, browser);
this.setState({ browser }); this.setState({ browser });
} catch { } catch {