feat(native): everything the App Store and Google Play submissions need

- iOS: microphone usage text for "Take Video", no-export-compliance flag,
  ExportOptions.plist for App Store Connect uploads, the unused push
  forwarders gone; CI builds with Xcode 26 and lints the property lists.
- Android: version and signing from Gradle properties (unsigned without
  them), R8 with keep rules for TREK's and Capacitor's reflective classes,
  no Auto Backup of the session cookie, no external file provider path,
  template and Firebase leftovers removed, keystores and service accounts
  ignored, full-size adaptive icon layers with a monochrome layer; CI also
  builds the release APK.
- native-release.yml: signed bundle to a Play testing track and archive to
  TestFlight, by hand or on a v* tag, behind the store environment.
- Version handshake: the server reports nativeApi 1, the app refuses a
  server below its minimum and tolerates an app older than the offline copy.
- Address screen: privacy policy link, "Try the demo" and "What is a TREK
  server?"; the privacy link also in the app's server settings. Three new
  native strings in all 27 locales.
- Donation links and the notices asking for one are hidden in the app.
- Store listings for "TREK Travel Planner" in client/fastlane: texts, review
  notes with placeholders, privacy and account deletion page drafts, the
  feature graphic and icon, a length and image check in CI, and a Playwright
  store project with the scripts that turn its captures into screenshots.
- Docs: wiki/Native-Apps.md, README no longer says there is no store app.
This commit is contained in:
Maurice
2026-10-25 18:37:31 +01:00
parent 5c37dd43c5
commit 8963180006
121 changed files with 1443 additions and 327 deletions
+13
View File
@@ -0,0 +1,13 @@
/**
* Pages the apps link to outside the user's server. They open in the system
* browser: the WebView hands every navigation off the server's own origin to it.
*/
/** The privacy policy the store listings name too. */
export const PRIVACY_URL = 'https://liketrek.com/privacy';
/** What a TREK server is and how to run one, for someone who has none yet. */
export const SERVER_DOCS_URL = 'https://github.com/liketrek/TREK#readme';
/** The public demo the address screen offers to someone without a server. */
export const DEMO_SERVER_URL = 'https://demo.liketrek.com';
+18
View File
@@ -106,4 +106,22 @@ describe('startNativeApp', () => {
await vi.waitFor(() => expect(report).toHaveBeenCalledWith(expect.any(Error)));
vi.unstubAllGlobals();
});
it('stays quiet when the installed app is older than the offline copy', async () => {
vi.mocked(isNativeIos).mockReturnValue(true);
vi.mocked(keepOfflineShellFresh).mockRejectedValue(
Object.assign(new Error('not implemented'), { code: 'UNIMPLEMENTED' })
);
const report = vi.fn();
vi.stubGlobal('reportError', report);
startNativeApp();
vi.advanceTimersByTime(15_000);
await vi.waitFor(() => expect(keepOfflineShellFresh).toHaveBeenCalled());
// Let the rejection reach its handler.
await Promise.resolve();
await Promise.resolve();
await Promise.resolve();
expect(report).not.toHaveBeenCalled();
vi.unstubAllGlobals();
});
});
+6 -2
View File
@@ -6,6 +6,7 @@ import { isEffectivelyOffline } from '../sync/networkMode';
import { keepOfflineShellFresh } from './offlineShell';
import { isNativeApp, isNativeIos } from './platform';
import { reportNativeFailure } from './reportFailure';
import { isUnimplemented } from './trekShell';
/** Long enough that the warm-up never competes with the first screen's requests. */
const OFFLINE_SHELL_DELAY_MS = 15_000;
@@ -35,8 +36,11 @@ export function startNativeApp(): void {
void Keyboard.setAccessoryBarVisible({ isVisible: false });
window.setTimeout(() => {
if (isEffectivelyOffline()) return;
// Not refreshed this time is no harm: the next launch tries again.
keepOfflineShellFresh().catch(reportNativeFailure);
// Not refreshed this time is no harm: the next launch tries again. An app
// older than the offline copy has no such method, which is no failure.
keepOfflineShellFresh().catch((err: unknown) => {
if (!isUnimplemented(err)) reportNativeFailure(err);
});
}, OFFLINE_SHELL_DELAY_MS);
}
}
+21 -1
View File
@@ -1,5 +1,5 @@
import { describe, expect, it, vi } from 'vitest';
import { candidateUrls, probeServer, type ProbeResponse } from './serverAddress';
import { candidateUrls, probeDemo, probeServer, type ProbeResponse } from './serverAddress';
const features = (
url: string,
@@ -25,6 +25,18 @@ describe('candidateUrls', () => {
});
describe('probeServer', () => {
it('accepts a server at the minimum native API version or above', async () => {
const data = { bookingImport: false, nativeApp: true, nativeApi: 1 };
const get = vi.fn().mockResolvedValue(features('https://trek.example.com/api/health/features', data));
expect(await probeServer('https://trek.example.com', get)).toEqual({ ok: true, url: 'https://trek.example.com' });
});
it('calls a server below the minimum native API version too old', async () => {
const data = { bookingImport: false, nativeApp: true, nativeApi: 0 };
const get = vi.fn().mockResolvedValue(features('https://trek.example.com/api/health/features', data));
expect(await probeServer('https://trek.example.com', get)).toEqual({ ok: false, reason: 'tooOld' });
});
it('accepts a server that reports nativeApp and follows its redirect', async () => {
const get = vi.fn().mockResolvedValue(features('https://trek.example.com/api/health/features'));
expect(await probeServer('http://trek.example.com', get)).toEqual({ ok: true, url: 'https://trek.example.com' });
@@ -83,3 +95,11 @@ describe('probeServer', () => {
expect(get).not.toHaveBeenCalled();
});
});
describe('probeDemo', () => {
it('probes the public demo server the address screen offers', async () => {
const get = vi.fn().mockResolvedValue(features('https://demo.liketrek.com/api/health/features'));
expect(await probeDemo(get)).toEqual({ ok: true, url: 'https://demo.liketrek.com' });
expect(get).toHaveBeenCalledWith('https://demo.liketrek.com/api/health/features');
});
});
+16
View File
@@ -1,3 +1,5 @@
import { DEMO_SERVER_URL } from './links';
/**
* Turns what someone typed into the app's address field into a TREK server it
* can load, or a reason it cannot.
@@ -16,6 +18,13 @@ export type ProbeGet = (url: string) => Promise<ProbeResponse>;
const FEATURES_PATH = '/api/health/features';
/**
* The oldest server API this app can work with (`nativeApi` in the features
* response). A server from before the field existed answers without it and is
* accepted while the minimum is 1.
*/
const MIN_NATIVE_API = 1;
function normalize(raw: string): string | null {
let parsed: URL;
try {
@@ -47,6 +56,8 @@ function isRecord(value: unknown): value is Record<string, unknown> {
function judge(response: ProbeResponse): ProbeResult {
if (response.status !== 200 || !isRecord(response.data)) return { ok: false, reason: 'notTrek' };
if (response.data.nativeApp === true) {
const api = response.data.nativeApi;
if (typeof api === 'number' && api < MIN_NATIVE_API) return { ok: false, reason: 'tooOld' };
// Follow a redirect (http to https, a canonical host) so the app loads the
// address the server actually answers on.
const base = response.url.endsWith(FEATURES_PATH) ? response.url.slice(0, -FEATURES_PATH.length) : null;
@@ -74,3 +85,8 @@ export async function probeServer(input: string, get: ProbeGet): Promise<ProbeRe
}
return { ok: false, reason: failure };
}
/** The address screen's "Try the demo": the same probe, against the public demo server. */
export function probeDemo(get: ProbeGet): Promise<ProbeResult> {
return probeServer(DEMO_SERVER_URL, get);
}
+9
View File
@@ -34,3 +34,12 @@ export interface TrekShellPlugin {
export const TrekShell = registerPlugin<TrekShellPlugin>('TrekShell');
export const APP_URL_SCHEME = 'com.liketrek.trek';
/**
* True for the rejection Capacitor gives when the installed app has no such
* native method: the UI comes from the server, so a newer server can call into
* an app binary that predates the method.
*/
export function isUnimplemented(err: unknown): boolean {
return typeof err === 'object' && err !== null && (err as { code?: unknown }).code === 'UNIMPLEMENTED';
}