Skip to content

Commit

Permalink
Open initial startup page when it is the initial startup
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Dec 24, 2024
1 parent 75d06c0 commit c7bd58b
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
8 changes: 7 additions & 1 deletion webextensions/background/handle-misc.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,14 @@ Background.onDestroy.addListener(() => {

function onToolbarButtonClick(tab) {
if (mInitializationPhase < PHASE_BACKGROUND_INITIALIZED ||
Permissions.requestPostProcess())
Permissions.requestPostProcess()) {
return;
}

if (Migration.isInitialStartup()) {
Migration.openInitialStartupPage();
return;
}

if (typeof browser.sidebarAction.toggle == 'function')
browser.sidebarAction.toggle();
Expand Down
24 changes: 24 additions & 0 deletions webextensions/background/migration.js
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,8 @@ export function migrateConfigs() {
configs.configsVersion = kCONFIGS_VERSION;
}

let mShouldShowInitialStartupPage = false;

export function tryNotifyNewFeatures() {
/*
let featuresVersionOffset = 0;
Expand Down Expand Up @@ -352,6 +354,28 @@ export function tryNotifyNewFeatures() {
message: browser.i18n.getMessage(`startup_notification_message_${typeSuffix}${platformSuffix}`),
timeout: 90 * 1000
});

if (isInitialInstall) {
mShouldShowInitialStartupPage = true;
browser.browserAction.setBadgeText({
text: '!',
});
}
}

export function isInitialStartup() {
return !!mShouldShowInitialStartupPage;
}

export function openInitialStartupPage() {
mShouldShowInitialStartupPage = false;
browser.browserAction.setBadgeText({
text: null,
});
browser.tabs.create({
url: Constants.kSHORTHAND_URIS.startup,
active: true,
});
}


Expand Down

0 comments on commit c7bd58b

Please sign in to comment.