mirror of
https://github.com/zen-browser/desktop.git
synced 2026-01-19 11:27:16 +00:00
feat: Add a informational dialog for window sync migration, b=no-bug, c=common
This commit is contained in:
@@ -132,3 +132,12 @@ zen-sidebar-notification-updated-tooltip =
|
||||
zen-sidebar-notification-restart-safe-mode-label = Something broke?
|
||||
zen-sidebar-notification-restart-safe-mode-tooltip =
|
||||
.title = Restart in Safe Mode
|
||||
|
||||
# Section: Dialog contents
|
||||
|
||||
# notification for when window sync has been enabled and
|
||||
# users might want to know about it
|
||||
zen-window-sync-migration-dialog-title = Keep Your Windows in Sync
|
||||
zen-window-sync-migration-dialog-message = Zen now syncs windows on the same device, so changes in one window are reflected across the others instantly.
|
||||
zen-window-sync-migration-dialog-learn-more = Learn More
|
||||
zen-window-sync-migration-dialog-accept = Got It
|
||||
|
||||
@@ -4,9 +4,15 @@
|
||||
|
||||
import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs";
|
||||
|
||||
const lazy = {};
|
||||
|
||||
ChromeUtils.defineESModuleGetters(lazy, {
|
||||
SessionStore: "resource:///modules/sessionstore/SessionStore.sys.mjs",
|
||||
});
|
||||
|
||||
class nsZenUIMigration {
|
||||
PREF_NAME = "zen.ui.migration.version";
|
||||
MIGRATION_VERSION = 5;
|
||||
MIGRATION_VERSION = 6;
|
||||
|
||||
init(isNewProfile) {
|
||||
if (!isNewProfile) {
|
||||
@@ -89,6 +95,38 @@ class nsZenUIMigration {
|
||||
_migrateV5() {
|
||||
Services.prefs.setBoolPref("zen.site-data-panel.show-callout", true);
|
||||
}
|
||||
|
||||
_migrateV6() {
|
||||
lazy.SessionStore.promiseAllWindowsRestored.then(() => {
|
||||
const win = Services.wm.getMostRecentWindow("navigator:browser");
|
||||
win.setTimeout(async () => {
|
||||
const [title, message, learnMore, accept] = await win.document.l10n.formatMessages([
|
||||
"zen-window-sync-migration-dialog-title",
|
||||
"zen-window-sync-migration-dialog-message",
|
||||
"zen-window-sync-migration-dialog-learn-more",
|
||||
"zen-window-sync-migration-dialog-accept",
|
||||
]);
|
||||
|
||||
// buttonPressed will be 0 for cancel, 1 for "more info"
|
||||
let buttonPressed = Services.prompt.confirmEx(
|
||||
win,
|
||||
title.value,
|
||||
message.value,
|
||||
Services.prompt.BUTTON_POS_0 * Services.prompt.BUTTON_TITLE_IS_STRING +
|
||||
Services.prompt.BUTTON_POS_1 * Services.prompt.BUTTON_TITLE_IS_STRING,
|
||||
learnMore.value,
|
||||
accept.value,
|
||||
null,
|
||||
null,
|
||||
{}
|
||||
);
|
||||
// User has clicked on "Learn More"
|
||||
if (buttonPressed === 0) {
|
||||
win.openTrustedLinkIn("https://docs.zen-browser.app/user-manual/window-sync", "tab");
|
||||
}
|
||||
}, 1000);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export var gZenUIMigration = new nsZenUIMigration();
|
||||
|
||||
@@ -1243,6 +1243,9 @@
|
||||
#makeDragImageEssential(event) {
|
||||
const dt = event.dataTransfer;
|
||||
const draggedTab = event.dataTransfer.mozGetDataAt(TAB_DROP_TYPE, 0);
|
||||
if (draggedTab.hasAttribute("zen-essential")) {
|
||||
return;
|
||||
}
|
||||
const dragData = draggedTab._dragData;
|
||||
const [wrapper] = this.originalDragImageArgs;
|
||||
const tab = wrapper.firstElementChild;
|
||||
|
||||
Reference in New Issue
Block a user