The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.
TypeScript budget-trackercollaborativedockeritinerarymcp-serveroffline-firstopen-sourceopenstreetmappacking-listpwareal-timeself-hostedselfhostedtraveltravel-apptravel-journaltravel-plannertripitwanderlog
refactor(native): keep the Android bridge additions apart from the iOS ones in trekShell.ts
Mauriceda05ba112103
diff --git a/client/src/native/iap.ts b/client/src/native/iap.tsindex b1091fb94..a3d29e5e6 100644--- a/client/src/native/iap.ts+++ b/client/src/native/iap.ts@@ -1,5 +1,5 @@import { isNativeAndroid, isNativeIos } from './platform';-import { TrekShell } from './trekShell';+import { TrekShell, type StoreRestoreResult } from './trekShell';/*** In-app purchase, from the app's side. A seam, like {@link TrekShell}: the@@ -162,7 +162,10 @@ export const nativeIapClient: IapClient = {},async restore() {try {- const { jws, purchaseToken, productId, transactionId } = await TrekShell.storeRestore({ prefix: PRODUCT_PREFIX });+ // Google Play answers with a purchase token where the App Store answers with a signed transaction.+ const { jws, purchaseToken, productId, transactionId }: StoreRestoreResult = await TrekShell.storeRestore({+ prefix: PRODUCT_PREFIX,+ });if (purchaseToken && transactionId) {return { platform: 'google', productId: productId ?? '', receipt: purchaseToken, transactionId };}diff --git a/client/src/native/trekShell.ts b/client/src/native/trekShell.tsindex 57c2609f6..8b8539a47 100644--- a/client/src/native/trekShell.ts+++ b/client/src/native/trekShell.ts@@ -96,10 +96,12 @@ export interface TrekShellPlugin {storeFinish(options: { transactionId: string }): Promise<void>;/** iOS, feature wallet: adds a .pkpass (base64) to Apple Wallet, or opens it there when it is already in. */addToWallet(options: { data: string }): Promise<{ result: 'added' | 'opened' | 'cancelled' }>;- /** The newest active subscription under `prefix` on this Apple ID or Google account, if any. */- storeRestore(options: {- prefix: string;- }): Promise<{ jws?: string; purchaseToken?: string; productId?: string; transactionId?: string }>;+ /** iOS, feature storeKit: the newest active subscription under `prefix` on this Apple ID, if any. */+ storeRestore(options: { prefix: string }): Promise<{ jws?: string; transactionId?: string }>;+ addListener(+ event: 'pushOpened',+ listener: (payload: { url: string }) => void+ ): Promise<{ remove: () => Promise<void> }>;/** Android, feature googleWallet: opens a Google Wallet save link (https://pay.google.com/gp/v/save/...). */addToGoogleWallet(options: { url: string }): Promise<{ result: 'opened' }>;/** Android, feature windowLayout: the window's size classes and a foldable's posture and hinge. */@@ -108,10 +110,14 @@ export interface TrekShellPlugin {event: 'windowLayout',listener: (payload: NativeWindowLayout) => void): Promise<{ remove: () => Promise<void> }>;- addListener(- event: 'pushOpened',- listener: (payload: { url: string }) => void- ): Promise<{ remove: () => Promise<void> }>;+}++/** What Google Play Billing answers a restore with (Android, feature playBilling), beside iOS's `jws`. */+export interface StoreRestoreResult {+ jws?: string;+ purchaseToken?: string;+ productId?: string;+ transactionId?: string;}/** A document shared to TREK, as the native side reads it. */