feat(native): swipe rows, long-press menus, placeholders while loading, fading pictures, iOS bounce and app icon quick actions

Packing items, tasks and expenses swipe sideways to their actions, as in
Mail or Reminders: done or open one way, delete and edit the other, the
first one run by a full swipe. They are second ways to what each row
already offers; an expense still asks before it goes.

A long press on a trip card lifts it and opens its menu with the card's own
actions. Plain confirmations in MConfirmSheet now also ask through the
system where the app can.

Lists, the atlas and a journey show grey placeholders in their shape while
loading instead of a spinner in an empty screen (MSkeleton); buttons keep
theirs. A picture still loading fades in once it is there; one from the
cache shows at once. In the iOS app the page bounces at its ends again,
except on screens with pull-to-refresh, whose pull it would race; Android
keeps its stretch off.

On iOS a long press on the app icon offers "New trip" and the trip coming
up by its name, set by the UI in its language (TrekShell.setQuickActions,
feature quickActions), and a tap opens it, also from a cold start.

The app's own CSS moves out of index.css into native/nativeApp.css, which
had outgrown its size budget.
This commit is contained in:
Maurice
2026-11-09 09:37:36 +01:00
parent c9a91bbdad
commit 80c04df4fc
44 changed files with 1315 additions and 120 deletions
+66
View File
@@ -0,0 +1,66 @@
import { afterEach, describe, expect, it } from 'vitest';
import { fadeInImages } from './imageFade';
let stop: (() => void) | null = null;
afterEach(() => {
stop?.();
stop = null;
document.body.innerHTML = '';
});
/** Lets the MutationObserver deliver what was just added. */
const settle = () => new Promise((resolve) => setTimeout(resolve, 0));
function loadingImage(): HTMLImageElement {
const img = document.createElement('img');
Object.defineProperty(img, 'complete', { value: false, configurable: true });
return img;
}
describe('fadeInImages', () => {
it('holds a loading picture back and fades it in once it has loaded', async () => {
stop = fadeInImages();
const img = loadingImage();
document.body.appendChild(img);
await settle();
expect(img.hasAttribute('data-fading')).toBe(true);
img.dispatchEvent(new Event('load'));
expect(img.hasAttribute('data-fading')).toBe(false);
expect(img.hasAttribute('data-faded')).toBe(true);
});
it('shows a picture that failed, so it never stays invisible', async () => {
stop = fadeInImages();
const img = loadingImage();
document.body.appendChild(img);
await settle();
img.dispatchEvent(new Event('error'));
expect(img.hasAttribute('data-fading')).toBe(false);
});
it('shows a picture from the cache at once, and finds pictures inside what was added', async () => {
stop = fadeInImages();
const wrap = document.createElement('div');
const cached = document.createElement('img');
Object.defineProperty(cached, 'complete', { value: true });
const fresh = loadingImage();
wrap.append(cached, fresh);
document.body.appendChild(wrap);
await settle();
expect(cached.hasAttribute('data-fading')).toBe(false);
expect(fresh.hasAttribute('data-fading')).toBe(true);
});
it('leaves map tiles and opted-out pictures alone', async () => {
stop = fadeInImages();
document.body.innerHTML = '<div class="leaflet-container"></div><div data-no-fade></div>';
const tile = loadingImage();
const own = loadingImage();
document.body.children[0]?.appendChild(tile);
document.body.children[1]?.appendChild(own);
await settle();
expect(tile.hasAttribute('data-fading')).toBe(false);
expect(own.hasAttribute('data-fading')).toBe(false);
});
});