forked from shihaam/thijooree
97 lines
3.6 KiB
Markdown
97 lines
3.6 KiB
Markdown
# Onboarding
|
||
|
||
Shown once on first launch. Walks the user through language selection, security setup, and appearance configuration before creating any credentials.
|
||
|
||
---
|
||
|
||
## Activity — `OnboardingActivity`
|
||
|
||
`OnboardingActivity` hosts **4** pages managed by a `ViewPager2` (`OnboardingPagerAdapter.kt:32-38`). The adapter returns `slides.size + 1` items — three text slides plus the security-setup page inserted at position 1. Tap-to-navigate on the page-indicator dots is disabled; the only forward motion is the bottom **Next** / **Get Started** button.
|
||
|
||
| Position | Fragment | Purpose |
|
||
|---|---|---|
|
||
| 0 | `OnboardingFragment` (welcome) | Language pick + welcome copy |
|
||
| 1 | `SecuritySetupFragment` | PIN or pattern setup |
|
||
| 2 | `OnboardingConfigureFragment` | Theme, accent, nav mode |
|
||
| 3 | `OnboardingFragment` (`isLast = true`) | Final screen with **Get Started** |
|
||
|
||
Each page has a gate that controls when the bottom button activates.
|
||
|
||
---
|
||
|
||
## Slide 1 — Language & Welcome (`OnboardingFragment`)
|
||
|
||
- Displays a welcome illustration and app name
|
||
- Language toggle group (`languageToggle` in `OnboardingActivity.kt:86-92`): **English** / **Dhivehi** only
|
||
- Selecting a language calls `AppCompatDelegate.setApplicationLocales()` immediately
|
||
- The language section is only visible while the user is on page 0
|
||
|
||
---
|
||
|
||
## Slide 2 — Security Setup (`SecuritySetupFragment`)
|
||
|
||
The user chooses a lock method to protect the app.
|
||
|
||
### Lock Methods
|
||
|
||
| Method | Description |
|
||
|---|---|
|
||
| PIN | 4–8 digit numeric PIN |
|
||
| Pattern | Grid pattern draw (minimum 4 nodes) |
|
||
|
||
### PIN Entry
|
||
|
||
- Two `EditText` fields: PIN + confirm PIN
|
||
- Continue activates only when both fields match and length ≥ 4
|
||
|
||
### Pattern Entry
|
||
|
||
- Custom `PatternView` widget
|
||
- Draws connecting lines between touched grid nodes in real time
|
||
- Two-phase: draw → confirm (must match first drawing)
|
||
- Continue activates after a valid matching pattern is confirmed
|
||
|
||
### Key Derivation
|
||
|
||
The chosen PIN or pattern string is hardened with **PBKDF2-HMAC-SHA256** (100 000 iterations, random 16-byte salt) before storage. The derived key is stored in encrypted `SharedPreferences` via `CredentialStore`.
|
||
|
||
### Biometric Option
|
||
|
||
After setting a PIN or pattern an optional **Enable Biometrics** toggle appears. If enabled, biometric authentication (fingerprint / face — `BIOMETRIC_WEAK`) can be used as an alternative to the PIN/pattern at the lock screen and optionally for transfer confirmation.
|
||
|
||
---
|
||
|
||
## Slide 3 — Configure (`OnboardingConfigureFragment`)
|
||
|
||
Appearance and navigation preferences, set before first login.
|
||
|
||
### Options
|
||
|
||
| Setting | Choices |
|
||
|---|---|
|
||
| Navigation mode | Drawer / Bottom Navigation |
|
||
| Theme | System default / Light / Dark |
|
||
| Accent colour | Chip selector (several Material colours) |
|
||
|
||
All preferences are written to `CredentialStore` / `SharedPreferences` immediately on selection so that `HomeActivity` inherits them on first launch.
|
||
|
||
---
|
||
|
||
## Final Slide — Get Started
|
||
|
||
The last page is another `OnboardingFragment` with `isLast = true`. After the user scrolls it to the bottom, a 5-second `CountDownTimer` (`OnboardingActivity.kt:95-97`, `155-164`) starts — the **Get Started** button is disabled until the timer reaches zero, with the remaining seconds shown in the button label.
|
||
|
||
---
|
||
|
||
## Completion
|
||
|
||
When the user taps **Get Started**, `OnboardingActivity` sets the `onboarding_done` flag, marks `app.isUnlocked = true`, and launches `LoginActivity` directly so the user does not have to re-authenticate immediately after setup.
|
||
|
||
---
|
||
|
||
|
||
|
||
---
|
||
|
||
[← App Overview](00-app-overview.md) **Next →** [Lock Screen](02-lock-screen.md)
|