From 760d206bd472cdc098453e02e9ddfb1bac35f74d Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Thu, 6 Feb 2020 11:42:12 -0500 Subject: [PATCH] Select default UI according to target platform More specifically, this commit makes it so that the new default UI for Firefox Preview will be automatically selected. A default platform-specific UI can be cancelled by setting the advanced setting `uiFlavor` to `-`. --- src/js/start.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/js/start.js b/src/js/start.js index 41ac66fc7..b2089d345 100644 --- a/src/js/start.js +++ b/src/js/start.js @@ -339,12 +339,21 @@ initializeTabs(); // active tab. µb.contextMenu.update(); -// Maybe install non-default popup document +// Maybe install non-default popup document, or automatically select +// default UI according to platform. if ( browser.browserAction instanceof Object && browser.browserAction.setPopup instanceof Function ) { - const uiFlavor = µb.hiddenSettings.uiFlavor; + let uiFlavor = µb.hiddenSettings.uiFlavor; + if ( + uiFlavor === 'unset' && + vAPI.webextFlavor.major > 68 && + vAPI.webextFlavor.soup.has('firefox') && + vAPI.webextFlavor.soup.has('mobile') + ) { + uiFlavor = 'fenix'; + } if ( uiFlavor !== 'unset' && /\w+/.test(uiFlavor) ) { browser.browserAction.setPopup({ popup: vAPI.getURL(`popup-${uiFlavor}.html`)