mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-05 19:04:02 +00:00
fix(street-level): re-check an unknown key, Esc leaves full screen, say why a view is empty
- A failed or missing key status is asked again on the next switch-on, and the check gives up after 10 s instead of holding LOADING forever. - Waiting for the key status reads as LOADING while the layer is on. - Esc shrinks the photo in full screen too, before the panel's own Esc. - Destroying the panel with the iPhone popover open leaves no popover behind. - An empty view says whether the filter emptied it. - A freed upstream tile slot passes straight to the oldest waiter. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
d313b6e62c
commit
8e5e3cdd3b
10 files changed
+201
-30
No files matched your search
@@ -16,6 +16,9 @@ import {
|
||||
|
||||
export { STREET_LEVEL_LAYER_ID } from './policy.js';
|
||||
|
||||
/** Longest wait for the server's key status; past it, the bundle's token decides. */
|
||||
const KEY_STATUS_TIMEOUT_MS = 10_000;
|
||||
|
||||
/** Coverage as the panel sees it while the `mapillary` switch is off. */
|
||||
const COVERAGE_OFF = Object.freeze({
|
||||
count: 0,
|
||||
@@ -73,15 +76,25 @@ export function createStreetLevelLayer({
|
||||
}
|
||||
state.notify = notify;
|
||||
|
||||
/** The key-status request in flight; overlapping checks share it. */
|
||||
let keyCheck = null;
|
||||
|
||||
/** Coverage waits for the key status: no tile requests without a key. */
|
||||
async function checkKey() {
|
||||
let configured;
|
||||
try {
|
||||
configured = (await source.getStatus())?.configured === true;
|
||||
} catch {
|
||||
configured = source.hasToken?.() === true;
|
||||
}
|
||||
parts.coverage.setKeyStatus(configured);
|
||||
function checkKey() {
|
||||
keyCheck ||= (async () => {
|
||||
let configured;
|
||||
try {
|
||||
// A hung server must not hold LOADING, or the next check, forever.
|
||||
const signal = AbortSignal.timeout(KEY_STATUS_TIMEOUT_MS);
|
||||
configured = (await source.getStatus({ signal }))?.configured === true;
|
||||
} catch {
|
||||
configured = source.hasToken?.() === true;
|
||||
}
|
||||
parts.coverage.setKeyStatus(configured);
|
||||
})().finally(() => {
|
||||
keyCheck = null;
|
||||
});
|
||||
return keyCheck;
|
||||
}
|
||||
|
||||
function startDrawing() {
|
||||
@@ -90,6 +103,9 @@ export function createStreetLevelLayer({
|
||||
parts.sequences.setVisible(true);
|
||||
parts.coverage.attach(viewer);
|
||||
credit.show(viewer);
|
||||
// Without a known key, a switch-on asks again: the server may be back,
|
||||
// or have a key now.
|
||||
if (['status', 'no-key'].includes(state.coverage.blocked)) checkKey();
|
||||
}
|
||||
|
||||
/** Close the photo, clear lines and cones, forget refusals. */
|
||||
|
||||
Reference in new issue
Block a user