diff --git a/docs/thijooree/00-app-overview.md b/docs/thijooree/00-app-overview.md index 958b000..0283e61 100644 --- a/docs/thijooree/00-app-overview.md +++ b/docs/thijooree/00-app-overview.md @@ -155,6 +155,15 @@ When the timeout expires a 10-second countdown warning dialog appears. If dismis 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. +### Login Order + +The user sets the order of their logins in [Settings → Logins](14-settings.md#login-order). It applies everywhere accounts are listed: + +- `HomeViewModel.accounts` and `HomeViewModel.mibCards` sort themselves by `CredentialStore.loginRank()` on every `setValue` / `postValue`, so every observer (accounts list, transfer dropdown, contact picker "My accounts", PayMV QR, BML QR pay, transfer history, BML loans in Financing) gets the same order with no per-screen sorting. The sort is stable, so accounts from the same login keep the order the bank returned them in. +- Combined MIB + BML card lists (dashboard stack, [Cards](22-cards.md)) are sorted by `CardItem.loginTag`. +- [Financing](13-financing.md) places the MIB and BML sections by whichever bank's first login ranks higher. +- The [OTP Screen](10-otp-screen.md) sorts its entries by login. + --- ## MIB Session KeepAlive diff --git a/docs/thijooree/10-otp-screen.md b/docs/thijooree/10-otp-screen.md index b602037..88bb87f 100644 --- a/docs/thijooree/10-otp-screen.md +++ b/docs/thijooree/10-otp-screen.md @@ -30,7 +30,7 @@ Standard RFC 6238 TOTP: ## Supported Banks -One card is rendered for every MIB and every BML login that has a stored OTP seed (`OtpFragment.kt:93-98`). Seeds are per-`loginId` in `CredentialStore`. +One card is rendered for every MIB and every BML login that has a stored OTP seed (`OtpFragment.kt`), sorted by the user's [login order](00-app-overview.md#login-order). Seeds are per-`loginId` in `CredentialStore`. | Bank | Seed source | Card label | |---|---|---| diff --git a/docs/thijooree/13-financing.md b/docs/thijooree/13-financing.md index f3aa32b..34adcd2 100644 --- a/docs/thijooree/13-financing.md +++ b/docs/thijooree/13-financing.md @@ -8,6 +8,8 @@ Aggregates financing products across banks — MIB promotional deals and BML loa Observes `HomeViewModel.financing` (MIB deals) and `HomeViewModel.bmlLoanDetails`. +MIB deals carry no login tag, so the two sections are ordered as blocks: MIB first if the first MIB login ranks above the first BML login in the user's [login order](00-app-overview.md#login-order), otherwise BML first. BML loans within their section follow `HomeViewModel.accounts`, which is already in login order. + --- ## MIB Deals Section diff --git a/docs/thijooree/14-settings.md b/docs/thijooree/14-settings.md index c587c5b..4be895d 100644 --- a/docs/thijooree/14-settings.md +++ b/docs/thijooree/14-settings.md @@ -33,6 +33,20 @@ Each profile entry shows: - Profile image (circular avatar) - Visibility toggle switch +### Login Order + +All logins are shown as one list, across banks. When there is more than one login, each row gets a three-line handle (`ic_reorder_lines`) on the right; press and drag it to move the login up or down (`SettingsLoginsFragment.attachDragHandle()`). Tapping the rest of the row still opens the login details. + +On drop the order is saved with `CredentialStore.setLoginOrder()`, which: +- writes the combined order to the `login_order` pref as a JSON array of login tags (`mib_`, `bml_`, `fahipay_`, `mfaisa_` — the same format as `BankAccount.loginTag`) +- rewrites each bank's own list (`mib_login_ids`, `bml_login_ids`, …) in the same relative order, so code that walks one bank's logins stays consistent + +It then calls `HomeViewModel.resortByLoginOrder()` so already-open screens re-sort immediately. + +`CredentialStore.getLoginOrder()` returns the effective order: saved tags that still exist, followed by any logins not yet ordered (e.g. newly added) in the default MIB → BML → Fahipay → M-Faisa order. `loginRank()` turns that into a sort key; unknown tags sort last. + +See [Login Order](00-app-overview.md#login-order) for where the order is applied. + ### Visibility Toggle Toggling a profile off hides it from the accounts list and excludes it from API refresh cycles. The session is kept alive — the profile can be re-enabled without re-logging in. diff --git a/docs/thijooree/21-dashboard.md b/docs/thijooree/21-dashboard.md index f6255bd..04a416b 100644 --- a/docs/thijooree/21-dashboard.md +++ b/docs/thijooree/21-dashboard.md @@ -29,6 +29,7 @@ A horizontal `RecyclerView` with `LinearSnapHelper` that paginates BML cards + M - BML cards: visible accounts with `profileType` in (`BML_PREPAID`, `BML_CREDIT`, `BML_DEBIT`) AND `statusDesc == "Active"` - MIB cards: filtered by `CardsFragment.isMibCardActive(cardStatus)` (i.e. `CHST0`) +- Cards are sorted by the user's [login order](00-app-overview.md#login-order) - The user's default card (`CredentialStore.getDefaultCardAccountNumber()`) is moved to the front - Cards hidden via `getHiddenDashboardCardNumbers()` are skipped diff --git a/docs/thijooree/22-cards.md b/docs/thijooree/22-cards.md index e0b10e8..dd374ad 100644 --- a/docs/thijooree/22-cards.md +++ b/docs/thijooree/22-cards.md @@ -29,7 +29,7 @@ A horizontal `RecyclerView` driven by `CardStackAdapter` with a `PagerSnapHelper - BML: `viewModel.accounts` filtered to `profileType in (BML_PREPAID, BML_CREDIT, BML_DEBIT)` - MIB: `viewModel.mibCards` -The combined order is `bmlActive + mibActive + bmlInactive + mibInactive`. The user's default card (`CredentialStore.getDefaultCardAccountNumber()`) is moved to position 0. Initial data is seeded from `CardsCache` so the stack appears immediately; a background `HomeActivity.triggerRefreshCards()` refreshes it. +Active cards come first, then inactive ones; within each group cards are sorted by the user's [login order](00-app-overview.md#login-order) via `CardItem.loginTag`. The user's default card (`CredentialStore.getDefaultCardAccountNumber()`) is moved to position 0. Initial data is seeded from `CardsCache` so the stack appears immediately; a background `HomeActivity.triggerRefreshCards()` refreshes it. ### Card Art diff --git a/docs/thijooree/README.md b/docs/thijooree/README.md index cc2c139..3818984 100644 --- a/docs/thijooree/README.md +++ b/docs/thijooree/README.md @@ -22,7 +22,7 @@ Documentation for app-specific logic — UI flows, routing decisions, and busine | [11 — PayMV QR Screen](11-paymv-qr-screen.md) | Generate receive-payment QR (send/scan lives in Transfer) | | [12 — BML QR Pay](12-bml-qr-pay.md) | (Stub — see Transfer Flows for the live BML QR merchant flow) | | [13 — Financing](13-financing.md) | MIB promotional deals, BML loans, BML foreign spend limits | -| [14 — Settings](14-settings.md) | Settings hub: Logins, Appearance, Privacy & Security, Notifications, Storage, About | +| [14 — Settings](14-settings.md) | Settings hub: Logins (drag to reorder), Appearance, Privacy & Security, Notifications, Storage, About | | [15 — Settings: Security](15-settings-security.md) | Change lock method, biometrics, auto-lock timeout, screenshots | | [16 — Settings: Appearance](16-settings-appearance.md) | Navigation mode, slot drag-reorder, theme, accent colour, language | | [17 — Settings: Storage](17-settings-storage.md) | Single "Clear All Caches" button |