mirror of
https://github.com/zen-browser/desktop.git
synced 2026-08-23 23:11:35 +00:00
gh-14470: Run sweep animation on first sync (gh-15036)
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
|
||||
import checkForZenUpdates, {
|
||||
createWindowUpdateAnimation,
|
||||
playWindowSweepAnimation,
|
||||
} from "chrome://browser/content/ZenUpdates.mjs";
|
||||
|
||||
class ZenStartup {
|
||||
@@ -195,6 +196,14 @@ class ZenStartup {
|
||||
checkForZenUpdates();
|
||||
return await createWindowUpdateAnimation();
|
||||
}
|
||||
|
||||
/**
|
||||
* Entry point for privileged modules (e.g. the sync applier) to play the
|
||||
* update sweep animation in this window.
|
||||
*/
|
||||
playWindowSweepAnimation() {
|
||||
return playWindowSweepAnimation();
|
||||
}
|
||||
}
|
||||
|
||||
window.gZenStartup = new ZenStartup();
|
||||
|
||||
@@ -61,6 +61,14 @@ export async function createWindowUpdateAnimation() {
|
||||
return;
|
||||
}
|
||||
Services.prefs.setStringPref(ZEN_BUILD_ID_PREF, appID);
|
||||
await playWindowSweepAnimation();
|
||||
}
|
||||
|
||||
/**
|
||||
* Plays the full-window sweep shown after updates. Also used the first
|
||||
* time incoming sync data is applied on this profile.
|
||||
*/
|
||||
export async function playWindowSweepAnimation() {
|
||||
await gZenWorkspaces.promiseInitialized;
|
||||
const appWrapper = document.getElementById("zen-main-app-wrapper");
|
||||
const element = document.createElement("div");
|
||||
|
||||
@@ -22,6 +22,8 @@ ChromeUtils.defineESModuleGetters(lazy, {
|
||||
"moz-src:///toolkit/components/contextualidentity/ContextualIdentityService.sys.mjs",
|
||||
});
|
||||
|
||||
const FIRST_SYNC_ANIMATION_PREF = "zen.spaces-sync.first-sync-animation-shown";
|
||||
|
||||
/**
|
||||
* Applies batches of incoming Spaces records to the local browser.
|
||||
*/
|
||||
@@ -112,6 +114,7 @@ class nsZenSpacesSyncApplier {
|
||||
}
|
||||
} else {
|
||||
await win.gZenWorkspaces.promiseInitialized;
|
||||
this.#maybePlayFirstSyncAnimation(win);
|
||||
const removals = this.#routeTombstones(win, deletions);
|
||||
this.#deleteTabs(win, removals.tabs, fail);
|
||||
this.#deleteSplits(win, removals.splits, fail);
|
||||
@@ -141,6 +144,20 @@ class nsZenSpacesSyncApplier {
|
||||
return [...failed];
|
||||
}
|
||||
|
||||
/**
|
||||
* Plays the update sweep animation over the window the first time
|
||||
* incoming sync data lands on this profile.
|
||||
*
|
||||
* @param {Window} win
|
||||
*/
|
||||
#maybePlayFirstSyncAnimation(win) {
|
||||
if (Services.prefs.getBoolPref(FIRST_SYNC_ANIMATION_PREF, false)) {
|
||||
return;
|
||||
}
|
||||
Services.prefs.setBoolPref(FIRST_SYNC_ANIMATION_PREF, true);
|
||||
win.gZenStartup.playWindowSweepAnimation();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tombstones have no payload. Whatever local thing owns the id decides
|
||||
* what kind of deletion this is. Ids with no local counterpart need no
|
||||
|
||||
Reference in New Issue
Block a user