mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-03 17:41:51 +00:00
68 lines
3.0 KiB
TypeScript
68 lines
3.0 KiB
TypeScript
/// <reference types="@capacitor/push-notifications" />
|
|
/// <reference types="@capacitor/local-notifications" />
|
|
/// <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!',
|
|
webDir: 'dist',
|
|
// TREK is self-hosted: the server the app talks to is whatever the user
|
|
// enters, so every request is cross-origin. Both schemes stay https so the
|
|
// webview origin is a secure context (crypto.subtle, WebAuthn, service
|
|
// workers, IndexedDB persistence all require it).
|
|
server: {
|
|
androidScheme: 'https',
|
|
iosScheme: 'https',
|
|
},
|
|
plugins: {
|
|
PushNotifications: {
|
|
// No `badge`: TREK has no unread count the OS could keep honest, and a
|
|
// badge that only ever grows is worse than none.
|
|
presentationOptions: ['sound', 'banner', 'list'],
|
|
},
|
|
LocalNotifications: {
|
|
// Same white-on-transparent mask as FCM uses; generated by
|
|
// scripts/generate-native-icons.mjs. Without it Android falls back to the
|
|
// launcher icon and renders a white blob.
|
|
smallIcon: 'notification_icon',
|
|
presentationOptions: ['sound', 'banner', 'list'],
|
|
},
|
|
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',
|
|
launchShowDuration: 500,
|
|
// Deliberately true. With `false` the splash stays up until JS calls
|
|
// SplashScreen.hide(), and until that call exists a failure to boot the
|
|
// bundle looks like a frozen app. Flip this to false — and drop
|
|
// launchShowDuration — in the same change that adds the hide() call once
|
|
// the React tree has mounted.
|
|
launchAutoHide: true,
|
|
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,
|
|
// No `style`: TREK has a real appearance system, so the keyboard should
|
|
// follow the device/app theme rather than being pinned here.
|
|
},
|
|
// No StatusBar block on purpose. From Android 15 / Capacitor 8 the app is
|
|
// always edge-to-edge, so `overlaysWebView` and `backgroundColor` no longer
|
|
// do anything. The status-bar style has to follow the user's chosen scheme
|
|
// at runtime — call StatusBar.setStyle() from applyAppearance().
|
|
},
|
|
};
|
|
|
|
export default config;
|