Files
TREK/client/capacitor.config.ts
T
Maurice 9a69b092e8 feat(native): the small things that give a WebView away
- A short haptic tap on success, warning and error toasts, which is where
  every save and delete already reports. Info toasts stay silent.
- No "‹ › Done" strip above the iOS keyboard.
- No Safari preview when a link is long-pressed.
- The swipe from the left edge goes back on iOS, through the same history
  Android's back button walks.
2026-09-24 13:11:25 +02:00

57 lines
2.5 KiB
TypeScript

/// <reference types="@capacitor/splash-screen" />
/// <reference types="@capacitor/keyboard" />
import type { CapacitorConfig } from '@capacitor/cli';
import { KeyboardResize } from '@capacitor/keyboard';
const config: CapacitorConfig = {
appId: 'com.liketrek.trek',
appName: 'TREK - Plan your trips!',
// The app ships only the address screen. Once a server is picked, the native
// side points the WebView at it (TrekBridgeViewController.swift,
// MainActivity.java) and the UI comes from that server, always in the version
// the server runs. Session cookie, uploads, /ws and plugins work as they do in
// a browser, because the WebView is on the server's own origin.
webDir: 'native-dist',
server: {
// Android serves the address screen from https://localhost so it is a
// secure context. iOS keeps its default capacitor:// scheme: WKWebView
// handles https itself and Capacitor silently drops an iosScheme of https.
androidScheme: 'https',
// Shown, from the app bundle, whenever the server fails to load. The page
// knows a server is remembered and offers to retry or pick another one;
// on iOS it first tries the stored offline copy of the server's start page.
errorPath: 'index.html',
},
ios: {
// Long-pressing a link shows a Safari preview otherwise, which no app does.
allowsLinkPreview: false,
},
plugins: {
SplashScreen: {
// Matches <meta name="theme-color"> in index.html, so the launch image,
// the splash and the first painted frame are the same colour and there is
// no white flash between them.
backgroundColor: '#09090b',
// The server's UI hides it once React has mounted (native/nativeApp.ts),
// the address screen once it has rendered. Auto-hide stays on as the
// ceiling, so a page that never gets there cannot leave it up for good.
launchAutoHide: true,
launchShowDuration: 4000,
launchFadeOutDuration: 200,
showSpinner: false,
androidScaleType: 'CENTER_CROP',
},
Keyboard: {
// The mobile shell is built from bottom sheets (mobile/screens/**/M*Sheet).
// `body` resizes the webview itself, so a sheet's own scroll container
// keeps working; `native` resizes the whole view and fights the sheet.
resize: KeyboardResize.Body,
// Android-only workaround: with an edge-to-edge status bar the webview
// otherwise does not resize at all when the keyboard opens.
resizeOnFullScreen: true,
},
},
};
export default config;