feat(native): the app's own location on iOS, and a status bar tap scrolls to top

WKWebView asks for the location per server origin, under the server's name,
and again across launches. Binaries with the geolocation feature answer
navigator.geolocation from CoreLocation instead: one When-In-Use prompt as
the app, a stream that runs only while something listens, at the accuracy
the most demanding caller asked for. Every caller keeps the browser API.

A tap on the status bar now scrolls the list in the middle of the screen
back to the top, as in every iOS app.
This commit is contained in:
Maurice
2026-11-06 13:23:49 +01:00
parent 017f229cfc
commit 56f9a92054
6 changed files with 354 additions and 5 deletions
+21
View File
@@ -42,8 +42,29 @@ export interface TrekShellPlugin {
authenticateBiometric(options: { reason: string }): Promise<{ ok: true }>;
/** Feature biometricLock: a blurred cover in the app switcher while the lock is on. */
setPrivacyCover(options: { enabled: boolean }): Promise<void>;
/** iOS, feature geolocation: starts the native location stream (the "location" event). */
startLocation(options: { highAccuracy: boolean }): Promise<void>;
stopLocation(): Promise<void>;
addListener(
event: 'location',
listener: (payload: NativeLocationPayload) => void
): Promise<{ remove: () => Promise<void> }>;
}
/** A position, or an error shaped like GeolocationPositionError (1 denied, 2 unavailable). */
export type NativeLocationPayload =
| {
latitude: number;
longitude: number;
accuracy: number;
altitude: number | null;
speed: number | null;
heading: number | null;
timestamp: number;
error?: undefined;
}
| { error: { code: number; message: string } };
export const TrekShell = registerPlugin<TrekShellPlugin>('TrekShell');
export const APP_URL_SCHEME = 'com.liketrek.trek';