mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-21 02:32:18 +00:00
Street Level: leave an interrupted link and an overtaken view alone (gekh review)
- A pasted or start-up link opens its photos only when its restore's camera landed: a drag or search during the restore flight keeps the camera. - A posted view whose photo step was cancelled or superseded no longer closes the viewer or flies; one that found a photo it could not load keeps the error. - openNearest gains `replace` (keep the open photo while it looks, close it only when nothing opens, so EXPAND stays) and `proceed()` (asked before a found photo loads); the action uses both, so a navigation, a gesture or a hiding mode during the lookup loads no billed panorama. - Mapillary's timeout message is a msg() string with all eleven translations.
This commit is contained in:
1 parent
5370b8a268
commit
9c73939425
22 files changed
+329
-17
No files matched your search
@@ -1,3 +1,4 @@
|
||||
import { msg } from '../../../../i18n/marker.js';
|
||||
import { NEAREST_RADIUS_M } from '../../policy.js';
|
||||
import {
|
||||
MAPILLARY_GRAPH_HOST,
|
||||
@@ -8,6 +9,9 @@ import {
|
||||
SEQUENCE_IMAGES_LIMIT,
|
||||
} from './policy.js';
|
||||
|
||||
/** English data: the Street Level panel translates it. */
|
||||
const NO_ANSWER = msg('Mapillary did not answer in time — try again');
|
||||
|
||||
/** HTTP error flagged `keyRequired`, `keyRejected` or `retryAfterSec` (429). */
|
||||
export class MapillarySourceError extends Error {
|
||||
constructor(message, { status = 0, payload = null, retryAfterSec } = {}) {
|
||||
@@ -81,7 +85,7 @@ export function createMapillarySource({
|
||||
const timer = setTimeout(
|
||||
() =>
|
||||
controller.abort(
|
||||
new MapillarySourceError('Mapillary did not answer in time', {
|
||||
new MapillarySourceError(NO_ANSWER, {
|
||||
status: 504,
|
||||
}),
|
||||
),
|
||||
|
||||
@@ -201,6 +201,25 @@ test('a nearest-image search that never answers is given up, body included', asy
|
||||
assert.ok(error instanceof MapillarySourceError, String(error));
|
||||
assert.equal(error.status, 504);
|
||||
assert.equal(error.keyRequired, false, 'not a key problem');
|
||||
// English data, shown in the interface language like the other sources'.
|
||||
const { setLocale } = await import('../../../../i18n/index.js');
|
||||
const { translateStreetLevelError } =
|
||||
await import('../../../../ui/streetLevelPresentation.js');
|
||||
assert.equal(
|
||||
translateStreetLevelError(error.message),
|
||||
'Mapillary did not answer in time — try again',
|
||||
);
|
||||
for (const [locale, expected] of [
|
||||
['de', /nicht rechtzeitig/],
|
||||
['ja', /時間内に応答/],
|
||||
]) {
|
||||
setLocale(locale);
|
||||
try {
|
||||
assert.match(translateStreetLevelError(error.message), expected, locale);
|
||||
} finally {
|
||||
setLocale('en');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
test('the caller’s abort still ends a nearest-image search before its deadline', async () => {
|
||||
|
||||
Reference in new issue
Block a user