Files
android/docs/thijooree/05-account-history.md
2026-06-13 21:30:12 +05:00

75 lines
2.3 KiB
Markdown

# Account History
Displays the transaction history for a single account. Opened by tapping an account row in the accounts list.
---
## Fragment — `AccountHistoryFragment`
Receives the selected `BankAccount` via `AccountHistoryFragment.newInstance(account)`.
---
## Data Loading
On open, the fragment calls the appropriate bank API to fetch the first page of transactions:
| Bank | API |
|---|---|
| MIB | MIB transaction history endpoint (Blowfish-encrypted) |
| BML | BML transaction history endpoint (OAuth Bearer) |
| Fahipay | Fahipay wallet transaction list |
Results are mapped to a common display model and shown in a `RecyclerView`.
---
## Infinite Scroll
The list supports **infinite scroll** (pagination) with a page size of 10. When the user scrolls near the bottom of the loaded items, the next page is automatically fetched and appended. A loading spinner appears at the bottom while a page is in flight.
Page state (current page, total pages) is tracked in the fragment's `ViewModel`. If the last page has been reached the spinner is hidden and no further requests are made.
For MIB accounts a per-account encrypted disk cache (`util/mibapi/TransactionCache`) seeds the first page from local storage, so reopening an account history is instant while the live fetch refreshes in the background.
---
## Search / Filter
A search bar at the top of the screen filters the loaded transaction list by:
- Description / narrative text
- Amount string
Filtering is performed locally on already-loaded pages — it does not trigger a new API call. Clearing the search bar restores the full list.
---
## Transaction Rows
Each row shows:
- Transaction date and time
- Description / merchant name
- Debit or credit indicator
- Amount (hidden as `••••` when hide-amounts is active)
- Running balance (where available from the bank API)
---
## Image Loading
Some MIB transaction entries include merchant logo URLs. These are loaded asynchronously into the row's image view with a generic fallback icon. Images are cached in memory for the session.
---
## Empty State
If no transactions exist (new account or API returned empty list) an empty-state message is shown.
---
 
---
[← Accounts](04-accounts.md)     **Next →** [Transfer History](06-transfer-history.md)