Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ import org.koin.core.module.dsl.viewModelOf
import org.koin.dsl.module
import org.mifos.mobile.feature.third.party.transfer.thirdPartyTransfer.TptViewModel

/**
* Koin module for the Third Party Transfer feature.
*/
val ThirdPartyTransferModule = module {
viewModelOf(::TptViewModel)
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,48 @@ import org.mifos.mobile.core.model.entity.payload.ReviewTransferPayload
import org.mifos.mobile.feature.third.party.transfer.thirdPartyTransfer.TptScreenRoute
import org.mifos.mobile.feature.third.party.transfer.thirdPartyTransfer.tptScreenDestination

/**
* Sealed class representing the possible navigation destinations within the Third Party Transfer feature.
*/
sealed class TptNavigationDestination {
// Add more as needed
/** Represents the notification screen. */
object Notification : TptNavigationDestination()

/** Represents the transfer process screen, carrying a [ReviewTransferPayload]. */
class TransferProcess(val payload: ReviewTransferPayload) : TptNavigationDestination()

/** Represents the add beneficiary screen. */
object AddBeneficiaryScreen : TptNavigationDestination()
}

/**
* Type alias for a navigator function that handles [TptNavigationDestination].
*/
typealias TptNavigator = (TptNavigationDestination) -> Unit

/**
* Serializable data object representing the root route for the Third Party Transfer navigation graph.
*/
@Serializable
data object ThirdPartyTransferNavGraphRoute

/**
* Navigates to the Third Party Transfer navigation graph.
*
* @param navOptions Optional navigation options for the graph.
*/
fun NavController.navigateToTptGraph(navOptions: NavOptions? = null) {
this.navigate(
ThirdPartyTransferNavGraphRoute,
navOptions = navOptions,
)
}

/**
* Builds the navigation graph for the Third Party Transfer feature.
*
* @param onNavigate A [TptNavigator] function to handle navigation events within the graph.
*/
fun NavGraphBuilder.tptGraphDestination(
onNavigate: TptNavigator,
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ import org.mifos.mobile.core.ui.utils.ScreenUiState
import org.mifos.mobile.feature.third.party.transfer.navigation.TptNavigationDestination
import org.mifos.mobile.feature.third.party.transfer.navigation.TptNavigator

/**
* Composable function for the Third Party Transfer screen.
*
* @param onNavigate A [TptNavigator] function to handle navigation events from this screen.
* @param viewModel The view model for the Third Party Transfer screen, defaulting to a Koin view model.
* */
@Composable
internal fun TptScreen(
onNavigate: TptNavigator,
Expand Down Expand Up @@ -99,6 +105,12 @@ internal fun TptScreen(
)
}

/**
* Composable function for the Third Party Transfer dialog.
*
* @param dialogState The dialog state for the Third Party Transfer screen.
* @param onAction A [TptAction] function to handle actions from this dialog.
* */
@Composable
internal fun TptDialog(
dialogState: TptState.DialogState?,
Expand All @@ -118,6 +130,14 @@ internal fun TptDialog(
}
}

/**
* Composable function for the main content of the Third Party Transfer screen.
* It handles displaying the loading indicator, error messages, and the main form.
*
* @param state The current state of the Third Party Transfer screen.
* @param onAction A function to handle actions from this composable.
* @param modifier The modifier to apply to this composable.
*/
@Composable
internal fun TprContent(
state: TptState,
Expand Down Expand Up @@ -177,6 +197,13 @@ internal fun TprContent(
}
}

/**
* Composable function for the Third Party Transfer form.
*
* @param state The state for the Third Party Transfer screen.
* @param onAction A [TptAction] function to handle actions from this form.
* @param modifier The modifier to apply to this composable.
* */
@Composable
internal fun TptForm(
state: TptState,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,26 @@ import kotlinx.serialization.Serializable
import org.mifos.mobile.core.ui.composableWithSlideTransitions
import org.mifos.mobile.feature.third.party.transfer.navigation.TptNavigator

/**
* Serializable data object representing the route for the Third Party Transfer screen.
*/
@Serializable
data object TptScreenRoute

/**
* Navigates to the Third Party Transfer screen.
*
* @param navOptions Optional navigation options.
*/
fun NavController.navigateToTptScreen(navOptions: NavOptions? = null) {
this.navigate(TptScreenRoute, navOptions)
}

/**
* Defines the destination for the Third Party Transfer screen within the navigation graph.
*
* @param onNavigate A [TptNavigator] function to handle navigation events from this screen.
*/
fun NavGraphBuilder.tptScreenDestination(
onNavigate: TptNavigator,
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ internal class TptViewModel(

private var validationJob: Job? = null

/*
/**
* Functions related to UI State and Dialogs
*/

Expand Down
Loading