feat(android): scaffold Capacitor 8 native project + hardware Back button

Add @capacitor/{core,android,app,cli,assets} to ui/, a capacitor.config.ts (appId ru.eruditgame.app, appName Эрудит, webDir dist — bundle model, no server.url), and the generated ui/android/ Gradle project (tracked; build outputs and the machine-specific local.properties gitignored, keystore patterns un-commented so signing material can never be committed). Wire the Android hardware Back button in ui/src/lib/native.ts behind a dynamic @capacitor/app import (web/mock bundles never load it), called from App.svelte onMount and reusing routeDepth for the navigation-root check. Whitelist sharp in pnpm-workspace.yaml for @capacitor/assets icon generation.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Ilia Denisov
2026-07-12 01:34:25 +02:00
parent 53b33073ac
commit 0f5db0ee91
59 changed files with 3890 additions and 0 deletions
+5
View File
@@ -4,6 +4,7 @@
import { app, bootstrap, resolveOfflinePrompt } from './lib/app.svelte';
import { router, type RouteName } from './lib/router.svelte';
import { t } from './lib/i18n/index.svelte';
import { initNativeShell } from './lib/native';
import Toast from './components/Toast.svelte';
import Splash from './components/Splash.svelte';
import StaleInviteModal from './components/StaleInviteModal.svelte';
@@ -32,6 +33,10 @@
void bootstrap().then(() => {
(window as unknown as { __booted?: boolean }).__booted = true;
});
// Native shell only: wire the Android hardware Back button. No-op — and pulls no
// @capacitor/app — on web/Telegram/VK, where initNativeShell early-returns. At the
// navigation root (lobby/login) Back exits the app; otherwise it steps history back.
void initNativeShell(() => routeDepth(router.route.name) === 0);
});
// The lobby is the cold-start landing (an empty hash and Telegram launch params both parse