mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-24 04:02:19 +00:00
Keep the opening out of embeds, Street Level and moved cameras; fix review findings
- Embeds, inline panels, Street Level links and rejected share codes skip the opening. - The opening yields to a camera move made between its frames and keeps the view's roll. - A click skips it; the welcome waits for the cover to fade after a skip. - The first HUD summary is not spent while the opening plays. - Home countries follow tzdata backward links; the table is regenerated and checked. - QA scripts open the cockpit and Street Level checks with intro=0.
This commit is contained in:
1 parent
f4d936989b
commit
c4a846b8ad
20 files changed
+679
-291
No files matched your search
+45
-12
@@ -2,7 +2,8 @@ import { initFirstRunExperience } from '../firstRunExperience.js';
|
||||
|
||||
/**
|
||||
* Reveal welcome controls only after restoration and the loading transition.
|
||||
* `playOpening` plays the opening on a bare address (src/app/openingIntro.js).
|
||||
* `playOpening` plays the opening (src/app/openingIntro.js) on a bare address
|
||||
* or a share of only a view.
|
||||
*/
|
||||
export function startApplicationChrome({
|
||||
loadingScreen,
|
||||
@@ -22,12 +23,23 @@ export function startApplicationChrome({
|
||||
resolveDelay = resolve;
|
||||
});
|
||||
const delayTimer = setTimeout(resolveDelay, 1000);
|
||||
// A navigation stamped after this (a search, a posted view, a later link)
|
||||
// owns the camera: the opening must not take it back.
|
||||
const generationAtStart = styleManager._navigationGeneration;
|
||||
const revealFirstRun = () => {
|
||||
if (disposed || signal.aborted || firstRun) return;
|
||||
firstRun = initializeWelcome?.({ styleManager, dataManager });
|
||||
clearTimeout(revealTimer);
|
||||
loadingScreen.removeEventListener('transitionend', revealFirstRun);
|
||||
};
|
||||
// Welcome waits for the cover's fade, or for 900 ms where none ends.
|
||||
const revealAfterCover = () => {
|
||||
if (disposed || signal.aborted) return;
|
||||
loadingScreen.addEventListener('transitionend', revealFirstRun, {
|
||||
once: true,
|
||||
});
|
||||
revealTimer = setTimeout(revealFirstRun, 900);
|
||||
};
|
||||
void Promise.all([styleManager.initialRestorePromise, minimumDelay])
|
||||
.catch(() => {
|
||||
/* Restoration reports its own outcome through the controls. */
|
||||
@@ -35,31 +47,52 @@ export function startApplicationChrome({
|
||||
.then(([restored] = []) => {
|
||||
if (disposed || signal.aborted) return;
|
||||
// A bare address, or a share of only a view, opens with the opening
|
||||
// (it ends where the camera stands); welcome waits for its end. Its
|
||||
// frames stay out of the address, held before the first one: a reload
|
||||
// or a copied link mid-flight would open on a speck of a planet.
|
||||
// unless a newer navigation took the camera or the link was refused.
|
||||
// Hold the restored address through the flight so a reload or a copied
|
||||
// link opens at the destination.
|
||||
const shareLink = styleManager.shareLinkManager;
|
||||
const generation = Number.isInteger(restored?.navigationToken)
|
||||
? restored.navigationToken
|
||||
: generationAtStart;
|
||||
const navigatedSince =
|
||||
Number.isFinite(generation) &&
|
||||
styleManager._navigationGeneration !== generation;
|
||||
const wanted =
|
||||
!!playOpening &&
|
||||
!navigatedSince &&
|
||||
!shareLink?.rejectedShareCode &&
|
||||
(!styleManager.hasShareState || sharesOnlyAView(restored));
|
||||
if (wanted) shareLink?.holdWrites?.(true, 'opening');
|
||||
opening = wanted
|
||||
? playOpening({ viewer: styleManager.viewer, loadingScreen })
|
||||
: null;
|
||||
try {
|
||||
opening = wanted
|
||||
? playOpening({ viewer: styleManager.viewer, loadingScreen })
|
||||
: null;
|
||||
} catch (error) {
|
||||
console.error('The opening failed', error);
|
||||
opening = null;
|
||||
}
|
||||
const release = () => shareLink?.holdWrites?.(false, 'opening');
|
||||
if (opening) {
|
||||
// The cover fades long before a played-out opening ends; a skip
|
||||
// hides it only as the opening ends.
|
||||
let coverFaded = false;
|
||||
const onCoverFaded = () => {
|
||||
coverFaded = true;
|
||||
};
|
||||
loadingScreen.addEventListener('transitionend', onCoverFaded, {
|
||||
once: true,
|
||||
});
|
||||
void opening.done.then(() => {
|
||||
release();
|
||||
revealFirstRun();
|
||||
loadingScreen.removeEventListener('transitionend', onCoverFaded);
|
||||
if (coverFaded) revealFirstRun();
|
||||
else revealAfterCover();
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (wanted) release();
|
||||
loadingScreen.classList.add('hidden');
|
||||
loadingScreen.addEventListener('transitionend', revealFirstRun, {
|
||||
once: true,
|
||||
});
|
||||
revealTimer = setTimeout(revealFirstRun, 900);
|
||||
revealAfterCover();
|
||||
});
|
||||
const keySetup = Promise.resolve(
|
||||
signal.aborted ? null : initializeSettings?.({ signal }),
|
||||
|
||||
Reference in new issue
Block a user