Skip to content

Commit

Permalink
feat(bank-sdk): Add help screen to Skonto
Browse files Browse the repository at this point in the history
PP-626
  • Loading branch information
abolfazlimahdi committed Aug 12, 2024
1 parent 2bc2f35 commit 6d597d6
Show file tree
Hide file tree
Showing 13 changed files with 659 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,9 @@ class SkontoFragment : Fragment() {
navigateBack = {
findNavController()
.navigate(SkontoFragmentDirections.toCaptureFragment())
},
navigateToHelp = {
findNavController().navigate(SkontoFragmentDirections.toSkontoHelpFragment())
}
)
}
Expand All @@ -166,6 +169,7 @@ class SkontoFragment : Fragment() {
@Composable
private fun ScreenContent(
navigateBack: () -> Unit,
navigateToHelp: () -> Unit,
viewModel: SkontoFragmentViewModel,
modifier: Modifier = Modifier,
screenColorScheme: SkontoScreenColors = SkontoScreenColors.colors(),
Expand All @@ -186,6 +190,7 @@ private fun ScreenContent(
onFullAmountChange = viewModel::onFullAmountFieldChanged,
isBottomNavigationBarEnabled = isBottomNavigationBarEnabled,
onBackClicked = navigateBack,
onHelpClicked = navigateToHelp,
customBottomNavBarAdapter = customBottomNavBarAdapter,
onProceedClicked = { viewModel.onProceedClicked() },
onInfoBannerClicked = viewModel::onInfoBannerClicked,
Expand All @@ -201,6 +206,7 @@ private fun ScreenStateContent(
onFullAmountChange: (BigDecimal) -> Unit,
onDueDateChanged: (LocalDate) -> Unit,
onBackClicked: () -> Unit,
onHelpClicked: () -> Unit,
onProceedClicked: () -> Unit,
isBottomNavigationBarEnabled: Boolean,
customBottomNavBarAdapter: InjectedViewAdapterInstance<SkontoNavigationBarBottomAdapter>?,
Expand All @@ -219,6 +225,7 @@ private fun ScreenStateContent(
onDueDateChanged = onDueDateChanged,
onFullAmountChange = onFullAmountChange,
onBackClicked = onBackClicked,
onHelpClicked = onHelpClicked,
isBottomNavigationBarEnabled = isBottomNavigationBarEnabled,
customBottomNavBarAdapter = customBottomNavBarAdapter,
onProceedClicked = onProceedClicked,
Expand All @@ -232,6 +239,7 @@ private fun ScreenStateContent(
@Composable
private fun ScreenReadyState(
onBackClicked: () -> Unit,
onHelpClicked: () -> Unit,
onProceedClicked: () -> Unit,
state: SkontoFragmentContract.State.Ready,
onDiscountSectionActiveChange: (Boolean) -> Unit,
Expand All @@ -254,6 +262,7 @@ private fun ScreenReadyState(
isBottomNavigationBarEnabled = isBottomNavigationBarEnabled,
colors = screenColorScheme.topAppBarColors,
onBackClicked = onBackClicked,
onHelpClicked = onHelpClicked
)
},
bottomBar = {
Expand All @@ -263,6 +272,7 @@ private fun ScreenReadyState(
totalAmount = state.totalAmount,
isBottomNavigationBarEnabled = isBottomNavigationBarEnabled,
onBackClicked = onBackClicked,
onHelpClicked = onHelpClicked,
customBottomNavBarAdapter = customBottomNavBarAdapter,
onProceedClicked = onProceedClicked,
isSkontoSectionActive = state.isSkontoSectionActive,
Expand Down Expand Up @@ -335,6 +345,7 @@ private fun ScreenReadyState(
@Composable
private fun TopAppBar(
onBackClicked: () -> Unit,
onHelpClicked: () -> Unit,
modifier: Modifier = Modifier,
isBottomNavigationBarEnabled: Boolean,
colors: GiniTopBarColors,
Expand All @@ -347,9 +358,29 @@ private fun TopAppBar(
AnimatedVisibility(visible = !isBottomNavigationBarEnabled) {
NavigationActionBack(onClick = onBackClicked)
}
},
actions = {
NavigationActionHelp(onClick = onHelpClicked)

})
}

@Composable
private fun NavigationActionHelp(
onClick: () -> Unit,
modifier: Modifier = Modifier,
) {
IconButton(
modifier = modifier,
onClick = onClick
) {
Icon(
painter = painterResource(R.drawable.gbs_help_question_icon),
contentDescription = null,
)
}
}

@Composable
private fun NavigationActionBack(
onClick: () -> Unit,
Expand Down Expand Up @@ -762,6 +793,7 @@ private fun FooterSection(
isBottomNavigationBarEnabled: Boolean,
isSkontoSectionActive: Boolean,
onBackClicked: () -> Unit,
onHelpClicked: () -> Unit,
onProceedClicked: () -> Unit,
modifier: Modifier = Modifier,
customBottomNavBarAdapter: InjectedViewAdapterInstance<SkontoNavigationBarBottomAdapter>?,
Expand Down Expand Up @@ -927,6 +959,7 @@ private fun ScreenReadyStatePreview() {
onDueDateChanged = {},
onFullAmountChange = {},
onBackClicked = {},
onHelpClicked = {},
isBottomNavigationBarEnabled = true,
onProceedClicked = {},
customBottomNavBarAdapter = null,
Expand Down
Loading

0 comments on commit 6d597d6

Please sign in to comment.