feat(native): the Android app's widgets, location, tile store, Play Billing and Google Wallet

The UI now turns these on by feature on Android as well as iOS:

- widgets, widgetTrips and the travel day (liveActivity) write the same
  snapshot to the Android app's Glance widgets; the travel day also sends
  the next stop's minutes and the stops' colours for the Live Update.
- geolocation answers navigator.geolocation from the app's location stream.
- tileCache: Android keeps Mapbox's resources in its WebView client, so the
  map is offline-capable there too, without the iOS trek-tile:// rewrite.
- playBilling: the purchase client buys through Google Play on Android,
  with the purchase token as the receipt the control plane verifies.
- googleWallet: a booking's button adds it to Google Wallet on Android,
  through the save link the server asks the TREK services for.
This commit is contained in:
Maurice
2026-11-07 14:11:59 +01:00
parent d41a4f0827
commit 3beb5c4223
41 changed files with 404 additions and 60 deletions
+5 -4
View File
@@ -1,11 +1,12 @@
import { hasNativeFeature } from './capabilities';
import { isNativeIos } from './platform';
import { isNativeApp } from './platform';
import { reportNativeFailure } from './reportFailure';
import { TrekShell, type NativeLocationPayload } from './trekShell';
/**
* navigator.geolocation, answered by the iOS app's CoreLocation where the binary
* has the geolocation feature.
* navigator.geolocation, answered by the app's own location stream where the
* binary has the geolocation feature: CoreLocation on iOS, the system's fused
* provider on Android.
*
* WKWebView asks for the location per server origin, under the server's name,
* and asks again across launches. The app asks once, as the app. Installing the
@@ -85,7 +86,7 @@ function add(success: Success, failure: Failure, options: PositionOptions | unde
/** Puts the app's location under navigator.geolocation. Once, inside a binary that has it. */
export function installNativeGeolocation(): boolean {
if (!isNativeIos() || !hasNativeFeature('geolocation') || typeof navigator === 'undefined') return false;
if (!isNativeApp() || !hasNativeFeature('geolocation') || typeof navigator === 'undefined') return false;
const shim: Geolocation = {
getCurrentPosition: (success, failure, options) => {
add(success, failure, options, true);