The full flow: QR → menu → payment
Now assemble everything and walk the full flow — one order's journey through every layer. That's the heart of the capstone: a working Pica, end to end.
Setup. Run the provided Go backend locally (Chi + SQLite; go run . → localhost:8080). The app on an emulator reaches it at 10.0.2.2:8080 (or production — pica.programuoki.lt).
The flow — follow it and watch which layer is working:
1. Launch → StartupViewModel checks the token (8a)
→ none → Login screen
2. Login → POST /login → token → SecureTokenStorage (8a)
3. QR → ScanScreen (CameraX + ML Kit) → TableSession = "7" (10)
4. Menu → Room cache shows instantly, refresh from GET /menu (5, 7)
→ Koin injects MenuViewModel (6)
5. Cart → MVI: AddItem, qty ±, live total (3)
6. Payment → Checkout → POST /create-payment-intent → PaymentSheet
→ 4242… → PaymentSucceeded (11)
7. Order → completeOrder → POST /orders with table_number "7" (9, 10)
→ AuthInterceptor attaches the token (9)
8. History → GET /orders → you see ONLY your own orders (9)
Every step touches what you built across 12 lessons. One full loop shows how the layers talk: the UI sends an Event, the ViewModel changes UiState, the repository goes to network or cache, the interceptor attaches the token, the server scopes the data.
Test the resilience:
- Offline: turn off the network after the first menu load → the menu still shows (Room, 7).
- Errors: stop the backend →
Error+ "Retry", not a crash (5, 9). - Empty: a new user → "No orders yet", an empty cart (12).
- Restart: close and reopen → you stay logged in, the table and cart behave correctly.
Note (auth). The capstone is fine with email login (8a). Google sign-in (8b) is a separate, later addition; the same token contract, just another way to obtain the token. If you already have it — great; if not — email is completely fine.