6.9 KiB
App Overview
Architecture overview of the app's entry point, main container, navigation system, and global session lifecycle.
Entry Point — MainActivity
MainActivity is a transparent trampoline activity. On onCreate it reads app state and immediately forwards to the correct destination with no visible UI of its own:
| Condition | Destination |
|---|---|
| Onboarding not done | OnboardingActivity |
| No saved credentials | LoginActivity |
| Security lock configured | LockActivity |
| All checks pass | HomeActivity |
Intent Actions
External intents (from NFC, shortcuts, or notifications) are forwarded to HomeActivity via the same intent (MainActivity.kt:57-65):
| Action | Destination | Notes |
|---|---|---|
sh.sar.basedbank.OPEN_TRANSFER |
R.id.nav_transfer |
Plain transfer screen |
sh.sar.basedbank.OPEN_SCAN_QR |
R.id.nav_transfer + auto_scan=true |
Opens QR scanner immediately |
sh.sar.basedbank.OPEN_PAY_WITH_CARD |
R.id.nav_pay_with_card |
Opens Cards (CardsFragment) |
sh.sar.basedbank.TAP_TO_PAY |
R.id.nav_pay_with_card + auto_tap_mode=true |
Enters Tap to Pay on the default card |
Share-to-Scan (ACTION_SEND)
When another app shares an image to the Scan to Pay activity-alias declared in AndroidManifest.xml, MainActivity.kt:47-55 decodes the bitmap on the spot using ZxingCpp (while it still holds the share URI permission) and forwards the decoded QR text as share_qr_text to HomeActivity.
NFC Entry Point
BmlTapToPayActivity (manifest-registered, NFC payment service redirect) immediately re-fires a TAP_TO_PAY intent to MainActivity and finishes — see Tap to Pay.
Main Container — HomeActivity
HomeActivity is the persistent shell containing all in-app screens. It owns:
- The
NavHostFragmentandNavController - The
DrawerLayoutandNavigationView - The
BottomNavigationView - The toolbar (lock icon + hide-amounts eye icon)
- The connectivity banner
- The autolock timer
- The MIB session keepAlive scheduler
Toolbar
| Icon | Behavior |
|---|---|
| Lock icon | Immediately locks the app → LockActivity (animated with scale + alpha) |
| Eye icon | Toggles hideAmounts in HomeViewModel; all balance displays redact to •••• |
| Bell icon | Opens NotificationsSheetFragment (Notifications). Shows ic_bell when there are unread notifications, ic_bell_read otherwise (HomeActivity.kt:640-684) |
In Circular nav mode the toolbar collapses to just the app title — the lock, eye, and bell items are all hidden (HomeActivity.kt:646-650).
Auto-refresh
On launch and after unlock HomeActivity.autoRefresh() fires parallel login refresh calls for all banks with active sessions. Each bank runs independently — a failure in one bank does not block the others.
Connectivity Banner
A persistent banner appears at the top of HomeActivity when network connectivity is lost. It disappears automatically when connectivity is restored. Per-bank connectivity errors (e.g., session expired) are surfaced via HomeViewModel.connectivityErrors.
Navigation Modes
Three modes are selectable in Settings → Appearance (NavCustomization.kt:10-12):
Drawer (default) — NAV_MODE_DRAWER
A slide-out navigation drawer containing all configurable nav items. The hamburger icon in the toolbar opens it.
Bottom Navigation — NAV_MODE_BOTTOM
A bottom bar with 3 configurable slots plus a fixed Dashboard tab (always leftmost) and a More tab (always rightmost). Tapping More opens NavMoreSheetFragment — a bottom sheet listing all items not assigned to the visible slots.
Circular — NAV_MODE_CIRCULAR
A radial wheel UI with 4 customisable wheel slots + a lock-icon centre — see Circular Nav.
Navigation Slots
NavCustomization.ALL_SWAPPABLE enumerates every reorderable destination. Quick actions and bottom-bar slots persist as individual SharedPreferences keys (NavCustomization.kt:52-93).
| Destination | Nav ID |
|---|---|
| Accounts | nav_accounts |
| Contacts | nav_contacts |
| Transfer | nav_transfer |
| PayMV QR | nav_pay_mv_qr |
| Activities | nav_activities |
| Transfer History | nav_transfer_history |
| Financing | nav_finances |
| Cards | nav_pay_with_card |
| OTP | nav_otp |
| Settings | nav_settings |
Defaults:
| Slot set | Defaults |
|---|---|
| Bottom-bar (3 slots) | Accounts, Contacts, Transfer |
| Circular wheel (4 slots) | Transfer, Cards, Contacts, Accounts |
| Quick actions (2 FAB slots on dashboard) | Transfer, PayMV QR |
Autolock
Autolock fires after a configurable period of user inactivity. Any touch event resets the timer.
| Timeout option |
|---|
| 30 seconds |
| 1 minute (default) |
| 3 minutes |
| 5 minutes |
There is no "Never" option (SettingsSecurityFragment.kt:81-86) — auto-lock cannot be disabled.
When the timeout expires a 10-second countdown warning dialog appears. If dismissed, the timer resets. If ignored, the app calls LockActivity and clears app.isUnlocked.
Global State — BasedBankApp
BasedBankApp holds all in-memory session data (BasedBankApp.kt:27-49). Nothing is stored to disk except encrypted credentials.
| Field | Description |
|---|---|
isUnlocked |
Set to true after successful lock-screen auth; guards against process-restart bypass |
accounts: List<BankAccount> |
Combined view of every visible account across all banks |
fullName: String |
Account holder name (best available across logins) |
mibSessions |
Map of MIB loginId → active session (cookies + DH key) |
mibProfilesMap |
Per-loginId list of MIB CIF profiles |
mibLoginFlows |
Active MibLoginFlow instances per login |
mibAccounts: List<BankAccount> |
MIB-only slice of accounts |
bmlSessions |
Map of BML profileId → OAuth tokens |
bmlProfilesMap |
Per-loginId list of BmlProfile |
bmlLoginFlows |
Active BmlLoginFlow instances per login (holds web session cookies for activation) |
bmlAccounts: List<BankAccount> |
BML-only slice |
fahipaySessions |
Map of Fahipay loginId → authID + session cookie |
fahipayAccounts: List<BankAccount> |
Fahipay-only slice |
mibMutex |
Coroutine mutex — serializes all MIB profile-switch + request sequences |
Profile Visibility
Each stored profile has a visibility flag. Hidden profiles are excluded from the accounts list and from all API refresh cycles until re-enabled in Settings → Logins.
MIB Session KeepAlive
MIB web sessions expire after approximately 30 seconds of inactivity. HomeActivity schedules a coroutine that calls the MIB keepAlive endpoint every 25 seconds for each active MIB session while the app is in the foreground.
← README Next → Onboarding