mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-13 15:51:00 +00:00
feat(native): home-screen widget and travel-day Live Activity on iOS
A WidgetKit extension (TREKWidgets) with two parts: the next trip on the home screen, with a countdown before it starts and today's day and next stops while it runs, and a Live Activity for the travel day on the lock screen and in the Dynamic Island showing the next timed stop and the day's progress. The web app builds both from the trips stored offline on the device (native/widgets.ts) and hands them over through TrekShell (setWidgetSnapshot, syncTripDay, endTripDay). The texts are already translated, so the widget needs no localisation of its own. The snapshot lives in the keychain group the app shares with its extensions, so no App Group is needed. Taps open com.liketrek.trek://navigate/<path>. NativeWidgetsSync refreshes on start, on returning to the foreground and every quarter hour. Both parts are gated behind the widgets / liveActivity capabilities, so older binaries and the PWA are unaffected.
This commit is contained in:
@@ -59,6 +59,19 @@ export interface TrekShellPlugin {
|
||||
registerPush(): Promise<{ endpoint: string; keys: { p256dh: string; auth: string } }>;
|
||||
/** Feature nativePush: the notification the app was opened from, before the UI ran. */
|
||||
takeOpenedPush(): Promise<{ url: string | null }>;
|
||||
/** Feature widgets: what the home-screen widget shows (native/widgets.ts), as JSON. */
|
||||
setWidgetSnapshot(options: { json: string }): Promise<void>;
|
||||
/** Feature liveActivity: starts the travel day's Live Activity, or updates the running one. */
|
||||
syncTripDay(options: {
|
||||
tripTitle: string;
|
||||
path: string;
|
||||
dayLabel: string;
|
||||
nextName: string;
|
||||
nextTime?: string;
|
||||
done: number;
|
||||
total: number;
|
||||
}): Promise<{ running: boolean }>;
|
||||
endTripDay(): Promise<void>;
|
||||
addListener(
|
||||
event: 'pushOpened',
|
||||
listener: (payload: { url: string }) => void
|
||||
|
||||
Reference in New Issue
Block a user