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
+28 -1
View File
@@ -1,7 +1,7 @@
import { describe, expect, it, vi } from 'vitest';
import type { Day, Trip } from '../types';
vi.mock('./platform', () => ({ isNativeIos: vi.fn(() => true) }));
vi.mock('./platform', () => ({ isNativeIos: vi.fn(() => true), isNativeApp: vi.fn(() => true) }));
vi.mock('./capabilities', () => ({ hasNativeFeature: vi.fn(() => true) }));
vi.mock('./reportFailure', () => ({ reportNativeFailure: vi.fn() }));
vi.mock('./trekShell', () => ({
@@ -122,6 +122,33 @@ describe('todayOf and tripDayState', () => {
expect(tripDayState(today, 12 * 60, 'done')).toMatchObject({ nextName: 'Dinner', nextTime: '19:30', done: 1 });
expect(tripDayState(today, 22 * 60, 'done')).toMatchObject({ nextName: 'done', done: 2, nextTime: undefined });
});
it('gives the Android Live Update the next stop in minutes and one colour per timed stop', () => {
const state = tripDayState(
{
tripTitle: 'T',
path: '/trips/1',
dayLabel: 'D',
stops: [
{ name: 'Museum', time: '10:00', minutes: 600, color: '#D6273B' },
{ name: 'Walk', time: null, minutes: null },
{ name: 'Dinner', time: '19:30', minutes: 1170, color: null },
],
},
12 * 60,
'done'
);
expect(state).toMatchObject({
nextName: 'Dinner',
nextMinutes: 1170,
colors: ['#D6273B', null],
done: 1,
total: 2,
});
expect(
tripDayState({ tripTitle: 'T', path: '/', dayLabel: 'D', stops: [] }, 0, 'done').nextMinutes
).toBeUndefined();
});
});
describe('publishWidgets', () => {