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 `-`.
This commit is contained in:
Raymond Hill 2020-02-06 11:42:12 -05:00
parent bead897380
commit 760d206bd4
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
1 changed files with 11 additions and 2 deletions

View File

@ -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`)