Routes / Navigation (Mirror)
Map of screens, flows, route guards, and inactivity behavior for the Mirror Android app.
The app supports two orientations with distinct journeys: Portrait and Landscape.
1) Entry & Orientation
- Startup → detect device orientation capability from the Mirror document in Firebase:
portrait|landscape|both
- Common first-run flow (both orientations):
- Mirror ID Screen → operator enters
mirrorId - Loading / Sync → download brands + metadata + images + 3D assets + videos; persist local paths to Realm
- Looping Video (screensaver) → tap/interaction starts the journey
- Mirror ID Screen → operator enters
At any time, Change Language is accessible (global action).
2) Portrait Journey
- Looping Video → user tap
- Gender Selection
- Frame Type Selection
- Brand Selection (only if more than one brand configured for this mirror)
- Glasses List (scrollable)
- 3D Viewer (WebView React) — shows selected glasses (transparent background overlay), UI controls in Kotlin
- VTO Activity (Second Activity) — Mediapipe face landmarker + CameraX + transparent WebView overlay
- On any screen in this flow, inactivity → return to Looping Video.
3) Landscape Journey
- From Looping Video, a tap jumps directly to Second Activity presenting an auto-advancing selection of glasses:
- Each glasses detail is shown for 10 seconds, then advances automatically to the next.
- User can interact to pause or choose a pair immediately.
4) Second Activity (VTO)
- Shared behavior for Portrait & Landscape:
- Mediapipe face landmarker + CameraX feed.
- Transparent WebView running local React renderer (3D glasses overlay).
- Inactivity / No-face fallback: if no face detected for 3 minutes, finish activity and return to Looping Video.
- Local-only assets: all 3D models, textures, and videos are loaded from local paths stored in Realm.
5) Global Inactivity & Language
- Inactivity to Video: on any screen in the portrait flow, if the user does not interact, the app returns to Looping Video.
- Change Language: available from every page; applies immediately to subsequent screens and UI labels.
6) Route Guards & Fallbacks
- Mirror ID required: block navigation beyond Loading/Sync until a valid
mirrorIdresolves to a Mirror document. - Content availability: if any asset fails to download, retry; if persistent failure, show non-blocking error and keep the item hidden from lists.
- Orientation policy: respect the Mirror document setting:
- If
portraitonly → lock portrait flow. - If
landscapeonly → lock landscape flow. - If
both→ flow determined by current physical orientation at interaction time.
- If
7) Data Hydration & Offline Cache
-
On Sync:
- Read Mirror document → resolve brands and content bundles.
- Download all referenced assets (images, 3D models, videos).
- Persist local file paths to Realm for fully offline operation.
-
At runtime:
- WebView (React) and Kotlin UI read local paths; no network dependency during the experience.