Skip to content

Mobile App

Two Capacitor Android shells (full dashboard and staff portal) around the Kagami web app, with biometric unlock and push.

3 min read

Overview

Kagami's mobile apps are thin Capacitor Android shells around the web app. They are not native rewrites: there is no native calendar, client-lookup, booking or checkout UI. Every screen is the same Next.js page served to a desktop browser, rendered in the Android WebView. Native code is limited to device-level features the browser cannot provide.

Kagami responsive mobile salon management interface for salon owners and stylists on the floor

There is no Expo / React Native app and no apps/mobile directory. An earlier react-native-webview app was replaced by Capacitor (SALO-538, SALO-541). The older plan for native screens, offline write queueing and per-brand white-label builds never shipped.

The two apps

App Directory Android package Opens
Kagami (full) apps/mobile-app com.kagamihq.app https://app.kagamihq.com/dashboard (owner/manager dashboard)
Kagami Staff apps/mobile-capacitor com.kagamihq.staff https://app.kagamihq.com/my (staff portal)

Both are Capacitor 8 projects with an android/ folder only. There is no ios/ folder, so iOS is not built. server.allowNavigation keeps app.kagamihq.com, *.kagamihq.com, app.modernsalonowner.com, *.modernsalonowner.com and *.supabase.co inside the WebView.

The portal is server-rendered, so it cannot be bundled as a static dist/. Each app ships a small local bootstrap page (www/index.html + src/main.ts) that runs native setup (biometric gate, push registration) and then navigates the WebView to the remote portal URL. Because the remote page has no Capacitor runtime, native features reach it through Android JavascriptInterface bridges registered in MainActivity:

Bridge (window global) Purpose
SalonOSNative Device location (web/src/lib/device/native-location.ts)
SalonOSPermissions Runtime permission requests (native-permissions.ts)
SalonOSSpeech Speech input (native-speech.ts)
SalonOSPush FCM token and tapped-notification URL (native-push.ts)

In a normal browser none of these globals exist and the web helpers return null or false.

What the native shell does

  • Biometric unlock on launch when the device has biometrics enrolled (@aparajita/capacitor-biometric-auth). After unlock the app opens the portal URL, so an existing session stays signed in.
  • Session persistence: MainActivity backs up the portal's sb-* session cookies and restores them before the WebView loads on the next cold start. Capacitor's own cookie plugin is disabled (CapacitorCookies.enabled = false in both capacitor.config.json files).
  • Device permissions: location, camera and microphone for features the portal uses (for example GPS attendance clock-in and voice). New permissions must follow the standing rule in CLAUDE.md ("Device permissions"); android-permissions-sync.test.ts fails if manifests and bridge code drift.
  • Android back button goes through WebView history.
  • Push notifications (below).

What it does not do

  • No native calendar, client list, booking or checkout UI.
  • No offline support: no write queue or cached-data fallback. With no connectivity the WebView cannot load the portal.
  • No white-labelling or per-brand builds. One bundle per app covers every tenant; brands are distinguished inside the portal, as on desktop web.
  • No iOS build.

Push notifications (SALO-2075, SALO-2551)

Staff devices receive push through Firebase Cloud Messaging (Firebase project kagami-102d7; one google-services.json covers both package names) in addition to browser Web Push.

  • NativePushBridge exposes the FCM token as window.SalonOSPush. NativePushRegistrar registers it per signed-in user in device_push_tokens (migration 0217); sign-out removes it.
  • Server code sends with notifyUsers({ orgId, userIds?, title, body, url }) (web/src/lib/push/notify.ts), which also covers Web Push and prunes dead endpoints and tokens. Delivery is best-effort and never throws into the caller.
  • url is a portal path; tapping the notification opens it inside the app.
  • Server env vars: FIREBASE_PROJECT_ID, FIREBASE_CLIENT_EMAIL, FIREBASE_PRIVATE_KEY. When unset, FCM is disabled and Web Push still works.
  • Release builds fail if google-services.json has no client for the app's package id (see android/app/build.gradle).

Build and distribution

Both apps build a debug APK in GitHub Actions (.github/workflows/mobile-android.yml for the staff app, .github/workflows/mobile-app-android.yml for the full app). These run on workflow_dispatch and also on pushes/PRs that touch the app directory. Local steps and Firebase setup are in apps/mobile-app/README.md and apps/mobile-capacitor/README.md.

Native changes need an APK rebuild before they reach phones. Play Store signing/listing status is not tracked in this repo.