Blame

433723 admin 2026-08-07 11:31:12
init
1
---
2
title: Frontend & Navigation
3
aliases: [Navigation Graph, Screen Catalog]
4
tags: [3netra/wiki, frontend, navigation, diagrams]
5
product: 3netra Meta Android App
6
source_repository: 3Netra-ai/3n_meta_android
7
source_ref: origin/prod
8
source_revision: b48aada8fd5427b5db0c02945569963c4ae543c8
9
last_verified: 2026-08-06
10
up: "[[Home]]"
11
---
12
13
# Frontend & Navigation
14
15
Single-activity Compose app. Start destination computed in `MainActivity` after Supabase session resolves:
16
17
```
18
user == null → "login"
19
!permissions_asked → "permissions"
20
!onboarding_complete → "onboarding_welcome"
21
else → "main"
22
```
23
24
## Navigation Graph
25
26
```mermaid
27
flowchart TD
28
LOGIN[login<br/>LoginScreen] -->|success| PERM{permissions_asked?}
29
LOGIN --> SU[signup<br/>SignUpScreen] -->|verify email| LOGIN
30
PERM -->|no| PERMISSIONS[permissions<br/>PermissionRationaleScreen]
31
PERM -->|yes| ONB{onboarding_complete?}
32
PERMISSIONS --> ONB
33
ONB -->|no| OW[onboarding_welcome] --> OG[onboarding_grade<br/>legacy K–6 labels in code] --> OP[onboarding_pair<br/>BluetoothPairingScreen]
34
OP -->|connect or skip| MAIN
35
ONB -->|yes| MAIN
36
37
MAIN["main — MainAppScreen (bottom bar)"]
38
39
subgraph INNER["Inner NavHost (bottom tabs)"]
40
HOME[home_tab<br/>StudentHomeScreen]
41
CHAT[chat_tab<br/>AssistantChatScreen 'Be My Eyes']
42
STORY[story_tab<br/>TodaysStoryScreen]
43
FRIENDS[classmates_tab<br/>ClassmatesScreen]
44
end
45
MAIN --> INNER
46
47
HOME -->|quick actions| SCENE["scene_description/{mode}<br/>Scene|Read|Classroom|People|Emotions"]
48
HOME --> LN[lecture_notes<br/>LectureNotesScreen]
49
HOME --> SETTINGS[settings<br/>SettingsScreen]
50
SETTINGS --> COMP[companion_select<br/>CompanionSelectScreen]
51
FRIENDS -->|FAB + Teacher PIN| FACE[face_registration<br/>FaceRegistrationScreen]
52
53
LEGACY["dashboard → glassesConfig / chatHistory<br/>(orphaned legacy routes)"]
54
```
55
56
**Bottom bar (4 tabs):** Home 🏠 · Chat ✈️ · My Story ❤ · Friends 👥. Settings & Lecture Notes are pushed from Home, not tabs.
57
58
## Screen Catalog
59
60
| Route | Screen | What it does |
61
|---|---|---|
62
| `login` | LoginScreen | Email/password, email OTP (6-digit), Google Sign-In |
63
| `signup` | SignUpScreen | First/last/email/password; email verification required |
64
| `permissions` | PermissionRationaleScreen | Batch request: BT scan/connect, location, camera, mic, notifications; FERPA/COPPA banner |
65
| `onboarding_welcome` | OnboardingWelcomeScreen | "Hi! I'm Netra." 🦉 step 1/3 |
66
| `onboarding_grade` | GradeSelectionScreen | Persists `student_grade`; source currently presents legacy K–6 grade labels, so it does not implement the higher-education taxonomy in this wiki |
67
| `onboarding_pair` | BluetoothPairingScreen | Connect/skip glasses pairing → `onboarding_complete` |
68
| `home_tab` | StudentHomeScreen | Greeting hero, glasses connection pill, Academic Mode toggle, 6 quick actions, voice-command receiver |
69
| `scene_description/{mode}` | SceneDescriptionScreen | Four mode chips; capture starts only when a chip is tapped (the first-load auto-capture is commented out). It invokes `SupabaseAiService`, whose current client returns fixed success text |
70
| `chat_tab` | AssistantChatScreen | Text/gallery media UI → `BluetoothService``SupabaseAiService`/`chat-vision`; not the AWS client |
71
| `story_tab` | TodaysStoryScreen | Day timeline from session history; "🔊 Read My Day Out Loud" |
72
| `classmates_tab` | ClassmatesScreen | Face library (Instructors/Classmates/Family sections), search, FAB → PIN-gated registration |
73
| `face_registration` | FaceRegistrationScreen | 2-step: name → CameraX capture → FaceNet embedding → Supabase |
74
| `lecture_notes` | LectureNotesScreen | Live dictation transcript (SpeechRecognizer) + "Summarize Now" |
75
| `companion_select` | CompanionSelectScreen | Pick guide (Netra/Cosmo/Sage/Ripple — see [[05-Avatars-Companions]]) + nickname |
76
| `settings` | SettingsScreen | Profile, companion, speaking speed, high contrast, reduce motion, battery saver, grade, sign out |
77
| `dashboard` / `glassesConfig` / `chatHistory` | legacy screens | Orphaned — no code navigates to `dashboard` |
78
79
**Home quick actions (2×3 grid):** 🔍 What do I see? · 📖 Read this · 🏫 Classroom · 👤 Who's here? · ❤️ Feelings · 📝 Notes.
80
81
## Frontend Flow Chart (core capture loop)
82
83
```mermaid
84
sequenceDiagram
85
participant U as Student
86
participant H as Home/Scene Screen
87
participant B as BluetoothService
88
participant W as WearableCameraService
89
participant F as FaceNet + EncryptedStore
90
participant A as SupabaseAiService
91
participant L as Supabase chat-vision
92
participant T as Android TTS
93
participant S as Supabase
94
95
U->>H: tap a scene-mode chip
96
H->>W: capturePhoto()
97
W->>W: MWDAT session → 15fps stream → photo bytes
98
W-->>H: ByteArray (or error "glasses connected?")
99
opt People / Emotions mode
100
H->>F: embedding → cosine vs Supabase-fetched embeddings (>0.5)
101
F-->>H: match → "I see {name}!" (People: done)
102
end
103
H->>A: analyzeImage(bytes, mode prompt)
104
A->>L: invoke chat-vision
105
L-->>A: model response (discarded)
106
A-->>H: fixed "AI response received"
107
H->>B: logLocalSession(mode, text)
108
B->>S: insert sessions row
109
H->>T: speak(text) via ChildVoicePersonaManager
110
T-->>U: audio narration
111
```
112
113
## State Management
114
115
- **Auth:** `MainViewModel` StateFlow over Supabase `SessionStatus`
116
- **Connection / chat history:** `BluetoothService` StateFlows (`connectionState`, `chatHistory`) shared app-wide
117
- **Prefs (`3n_prefs`):** `permissions_asked`, `onboarding_complete`, `student_grade`, `student_nickname`, `companion_id`, `school_mode_enabled`, `tts_speed`, `high_contrast`, `reduce_motion`, `battery_saver`
118
- **Secure prefs:** teacher PIN (`3netra_secure`, BCrypt). `EncryptedFaceStorageManager` exists but is not called by the active face flow.
119
120
## Voice Command Wiring
121
122
`VoiceCommandService` can broadcast `com.threenetra.app.VOICE_COMMAND`, and Home registers handlers. At this revision, no source path emits the documented `WHAT_DO_I_SEE`/`CLASSROOM_MODE` broadcasts or connects a DAT long-press callback; `onLongPress()` only starts the Android recognition service when invoked. See [[04-User-Journeys]].
123
124
---
125
126
> [!tip] Navigation
127
> ⬅️ [[02-System-Architecture|System Architecture]] · 🏠 [[Home]] · ➡️ [[04-User-Journeys|User Journeys]]