chore: Update docs of recent transaction screen (#3090)

Co-authored-by: Sk Niyaj Ali <niyaj639@gmail.com>
This commit is contained in:
Aryan Baglane 2026-01-23 21:16:55 +05:30 committed by GitHub
parent 91b46f13ee
commit be4180422e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 62 additions and 2 deletions

View File

@ -13,6 +13,12 @@ import org.koin.core.module.dsl.viewModelOf
import org.koin.dsl.module
import org.mifos.mobile.feature.recent.transaction.viewmodel.RecentTransactionViewModel
/**
* Koin module providing dependency injection definitions for the recent transactions feature.
*
* Registers the following ViewModel for lifecycle-aware injection:
* - [RecentTransactionViewModel]: Manages state and logic for displaying recent transaction history.
*/
val recentTransactionModule = module {
viewModelOf(::RecentTransactionViewModel)
}

View File

@ -13,18 +13,34 @@ package org.mifos.mobile.feature.recent.transaction.navigation
import androidx.navigation.NavController
import androidx.navigation.NavGraphBuilder
import androidx.navigation.compose.navigation
import kotlinx.serialization.Serializable
import org.mifos.mobile.core.ui.composableWithSlideTransitions
import org.mifos.mobile.feature.recent.transaction.screen.RecentTransactionScreen
/**
* Navigation configuration for the recent transactions feature.
*
* Defines the type-safe [RecentTransactionRoute] and provides extension functions
* to handle navigation and graph registration.
*/
@Serializable
data object RecentTransactionRoute
/**
* Navigates to the [RecentTransactionRoute].
*/
fun NavController.navigateToRecentTransactionScreen() {
this.navigate(RecentTransactionRoute)
}
/**
* Adds the recent transaction destination to the [NavGraphBuilder].
*
* @param navigateBack Callback to return to the previous screen.
* @param navigateToDetails Callback to navigate to transaction details, providing
* account ID, type, and transaction ID.
*/
fun NavGraphBuilder.recentTransactionDestination(
navigateBack: () -> Unit,
navigateToDetails: (String, String, Long) -> Unit,

View File

@ -91,6 +91,14 @@ import template.core.base.designsystem.theme.KptTheme
import kotlin.collections.component1
import kotlin.collections.component2
/**
* Main entry point for the Recent Transaction screen.
* * Orchestrates state observation from [RecentTransactionViewModel], navigation
* event handling, and the visibility of modal components.
*
* @param navigateBack Callback to return to the previous screen.
* @param navigateToDetails Callback to navigate to a specific transaction detail.
*/
@OptIn(ExperimentalMaterial3Api::class)
@Composable
internal fun RecentTransactionScreen(
@ -127,6 +135,15 @@ internal fun RecentTransactionScreen(
)
}
/**
* Core UI layout for the Recent Transaction screen.
*
* Displays a grouped list of transactions with support for pull-to-refresh,
* empty/error states, and filter triggering.
*
* @param state The current [RecentTransactionUiState] to be rendered.
* @param onAction Callback to propagate UI interactions to the ViewModel.
*/
@Composable
internal fun RecentTransactionScreenContent(
state: RecentTransactionUiState,
@ -486,6 +503,13 @@ internal fun TransactionFilterSheetContent(
}
}
/**
* A specialized selection chip used for toggling filter categories.
*
* @param label The text displayed on the chip.
* @param isSelected Whether the chip is currently in the active state.
* @param onClick Triggered when the user interacts with the chip.
*/
@Composable
fun FilterOptionChip(
label: String,

View File

@ -28,6 +28,17 @@ import org.mifos.mobile.core.model.entity.accounts.savings.Transactions
import org.mifos.mobile.core.ui.utils.BaseViewModel
import org.mifos.mobile.core.ui.utils.ScreenUiState
/**
* ViewModel for managing the state and business logic of the Recent Transactions feature.
*
* Handles account fetching, transaction synchronization, and complex filtering logic
* based on transaction type (Credit/Debit) and specific savings accounts.
*
* @property accountsRepositoryImpl Accesses general account listing data.
* @property savingsAccountRepositoryImpl Fetches detailed savings associations and transactions.
* @property networkMonitor Observes real-time connectivity status.
* @property userPreferencesRepository Retrieves stored user-specific identifiers like Client ID.
*/
internal class RecentTransactionViewModel(
private val accountsRepositoryImpl: AccountsRepository,
private val savingsAccountRepositoryImpl: SavingsAccountRepository,
@ -115,6 +126,10 @@ internal class RecentTransactionViewModel(
}
}
/**
* Handles incoming [RecentTransactionAction] from the UI.
* Includes navigation requests, filter applications, and data refresh triggers.
*/
override fun handleAction(action: RecentTransactionAction) {
when (action) {
is RecentTransactionAction.OnNavigateBackClick ->
@ -442,7 +457,6 @@ internal data class RecentTransactionUiState(
* Defines all possible user interactions and internal events for the RecentTransactionScreen.
*/
sealed interface RecentTransactionAction {
// User-initiated actions
data object OnNavigateBackClick : RecentTransactionAction
data object Refresh : RecentTransactionAction
data object ToggleFilter : RecentTransactionAction