mirror of
https://github.com/zen-browser/desktop.git
synced 2025-07-09 00:35:31 +02:00
Implement Zen UI migration functionality and initialize on startup
This commit is contained in:
parent
23fb79c9a3
commit
5e0b684b53
5 changed files with 75 additions and 10 deletions
2
l10n
2
l10n
|
@ -1 +1 @@
|
|||
Subproject commit 0d64a530f4f72ad19e508097a508fc8ef1ad7ede
|
||||
Subproject commit fb2f27225e6ec810354ce4c95913d6a2105e200b
|
|
@ -33,6 +33,8 @@
|
|||
|
||||
this._initSidebarScrolling();
|
||||
|
||||
gZenUIMigration.init();
|
||||
|
||||
gZenCompactModeManager.init();
|
||||
ZenWorkspaces.init();
|
||||
gZenVerticalTabsManager.init();
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
diff --git a/browser/base/content/browser-init.js b/browser/base/content/browser-init.js
|
||||
index 9df41bb3c82919839ee1408aa4d177ea7ee40a56..e37c64fa2c2ea39762be4285a1a7055463ded537 100644
|
||||
index 63100defacf66c6b3232b9e0a783a5fd14e3a46a..eb7ed966628a595847b850f981418d425b78f14b 100644
|
||||
--- a/browser/base/content/browser-init.js
|
||||
+++ b/browser/base/content/browser-init.js
|
||||
@@ -152,13 +152,15 @@ var gBrowserInit = {
|
||||
@@ -162,13 +162,15 @@ var gBrowserInit = {
|
||||
elem.setAttribute("skipintoolbarset", "true");
|
||||
}
|
||||
}
|
||||
|
@ -19,11 +19,12 @@ index 9df41bb3c82919839ee1408aa4d177ea7ee40a56..e37c64fa2c2ea39762be4285a1a70554
|
|||
if (isVerticalTabs) {
|
||||
// Show the vertical tabs toolbar
|
||||
setToolbarVisibility(
|
||||
@@ -253,6 +255,10 @@ var gBrowserInit = {
|
||||
@@ -287,6 +289,11 @@ var gBrowserInit = {
|
||||
gPrivateBrowsingUI.init();
|
||||
BrowserSearch.init();
|
||||
BrowserPageActions.init();
|
||||
+
|
||||
+Services.scriptloader.loadSubScript("chrome://browser/content/zen-components/ZenUIMigration.mjs", window);
|
||||
+Services.scriptloader.loadSubScript("chrome://browser/content/ZenStartup.mjs", window);
|
||||
+Services.scriptloader.loadSubScript("chrome://browser/content/zenThemeModifier.js", window);
|
||||
+
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
content/browser/ZenStartup.mjs (content/ZenStartup.mjs)
|
||||
content/browser/ZenUIManager.mjs (content/ZenUIManager.mjs)
|
||||
content/browser/ZenCustomizableUI.sys.mjs (content/ZenCustomizableUI.sys.mjs)
|
||||
content/browser/zen-components/ZenUIMigration.mjs (zen-components/ZenUIMigration.mjs)
|
||||
content/browser/zen-components/ZenCompactMode.mjs (zen-components/ZenCompactMode.mjs)
|
||||
content/browser/zen-components/ZenViewSplitter.mjs (zen-components/ZenViewSplitter.mjs)
|
||||
content/browser/zen-components/ZenThemesCommon.mjs (zen-components/ZenThemesCommon.mjs)
|
||||
|
|
61
src/browser/base/zen-components/ZenUIMigration.mjs
Normal file
61
src/browser/base/zen-components/ZenUIMigration.mjs
Normal file
|
@ -0,0 +1,61 @@
|
|||
|
||||
{
|
||||
const PREF_NAME = "zen.migration.version";
|
||||
const MIGRATION_VERSION = 1;
|
||||
|
||||
class ZenUIMigration {
|
||||
init() {
|
||||
if (Services.prefs.prefHasUserValue(PREF_NAME)) {
|
||||
this._migrate();
|
||||
}
|
||||
this.clearVariables();
|
||||
}
|
||||
|
||||
get _migrationVersion() {
|
||||
return Services.prefs.getIntPref(PREF_NAME, 0);
|
||||
}
|
||||
|
||||
set _migrationVersion(value) {
|
||||
Services.prefs.setIntPref(PREF_NAME, value);
|
||||
}
|
||||
|
||||
_migrate() {
|
||||
if (this._migrationVersion < 1) {
|
||||
this._migrateV1();
|
||||
}
|
||||
}
|
||||
|
||||
clearVariables() {
|
||||
this._migrationVersion = MIGRATION_VERSION;
|
||||
window.gZenUIMigration = null;
|
||||
}
|
||||
|
||||
async _migrateV1() {
|
||||
// Introduction of the new URL bar, show a message to the user
|
||||
const notification = gNotificationBox.appendNotification(
|
||||
'zen-new-urlbar-notification',
|
||||
{
|
||||
label: { 'l10n-id': 'zen-new-urlbar-notification' },
|
||||
image: 'chrome://browser/skin/notification-icons/persistent-storage-blocked.svg',
|
||||
priority: gNotificationBox.PRIORITY_WARNING_HIGH,
|
||||
},
|
||||
[
|
||||
{
|
||||
'l10n-id': 'zen-disable',
|
||||
accessKey: 'D',
|
||||
callback: () => {
|
||||
Services.prefs.setBoolPref('zen.urlbar.replace-newtab', false);
|
||||
},
|
||||
},
|
||||
{
|
||||
link: "https://docs.zen-browser.app/user-manual/urlbar/",
|
||||
'l10n-id': "zen-learn-more-text",
|
||||
}
|
||||
],
|
||||
);
|
||||
notification.persistence = -1;
|
||||
}
|
||||
}
|
||||
|
||||
window.gZenUIMigration = new ZenUIMigration();
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue