diff --git a/l10n b/l10n index 0d64a530f..fb2f27225 160000 --- a/l10n +++ b/l10n @@ -1 +1 @@ -Subproject commit 0d64a530f4f72ad19e508097a508fc8ef1ad7ede +Subproject commit fb2f27225e6ec810354ce4c95913d6a2105e200b diff --git a/src/browser/base/content/ZenStartup.mjs b/src/browser/base/content/ZenStartup.mjs index 67847f5f4..055bc2eee 100644 --- a/src/browser/base/content/ZenStartup.mjs +++ b/src/browser/base/content/ZenStartup.mjs @@ -33,6 +33,8 @@ this._initSidebarScrolling(); + gZenUIMigration.init(); + gZenCompactModeManager.init(); ZenWorkspaces.init(); gZenVerticalTabsManager.init(); diff --git a/src/browser/base/content/browser-init-js.patch b/src/browser/base/content/browser-init-js.patch index 3d3d188ed..a604b8ef9 100644 --- a/src/browser/base/content/browser-init-js.patch +++ b/src/browser/base/content/browser-init-js.patch @@ -1,11 +1,11 @@ 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 = { - elem.setAttribute("skipintoolbarset", "true"); - } - } +@@ -162,13 +162,15 @@ var gBrowserInit = { + elem.setAttribute("skipintoolbarset", "true"); + } + } + ZenCustomizableUI.init(window); for (let area of CustomizableUI.areas) { let type = CustomizableUI.getAreaType(area); @@ -16,14 +16,15 @@ index 9df41bb3c82919839ee1408aa4d177ea7ee40a56..e37c64fa2c2ea39762be4285a1a70554 } } + ZenCustomizableUI.registerToolbarNodes(window); - if (isVerticalTabs) { - // Show the vertical tabs toolbar - setToolbarVisibility( -@@ -253,6 +255,10 @@ var gBrowserInit = { + if (isVerticalTabs) { + // Show the vertical tabs toolbar + setToolbarVisibility( +@@ -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); + diff --git a/src/browser/base/content/zen-assets.jar.inc.mn b/src/browser/base/content/zen-assets.jar.inc.mn index 69b4c1c56..563908e14 100644 --- a/src/browser/base/content/zen-assets.jar.inc.mn +++ b/src/browser/base/content/zen-assets.jar.inc.mn @@ -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) diff --git a/src/browser/base/zen-components/ZenUIMigration.mjs b/src/browser/base/zen-components/ZenUIMigration.mjs new file mode 100644 index 000000000..b93d6f267 --- /dev/null +++ b/src/browser/base/zen-components/ZenUIMigration.mjs @@ -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(); +}