Skip to content

Commit

Permalink
Select default UI according to target platform
Browse files Browse the repository at this point in the history
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 `-`.
  • Loading branch information
gorhill committed Feb 6, 2020
1 parent bead897 commit 760d206
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/js/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -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`)
Expand Down

0 comments on commit 760d206

Please sign in to comment.