From 79db3c769b49f4205e46e96632a18d54345d346d Mon Sep 17 00:00:00 2001 From: Niko Date: Thu, 22 Aug 2024 15:04:03 +0200 Subject: [PATCH] feature(bank-sdk): Skonto Invoice Preview. Code refactor PP-643 --- .../bank/sdk/capture/skonto/SkontoFragment.kt | 8 ++--- .../skonto/colors/SkontoScreenColors.kt | 30 ++++++++++++------- ...t => SkontoInvoicePreviewSectionColors.kt} | 6 ++-- 3 files changed, 26 insertions(+), 18 deletions(-) rename bank-sdk/sdk/src/main/java/net/gini/android/bank/sdk/capture/skonto/colors/section/{SkontoInvoiceScanSectionColors.kt => SkontoInvoicePreviewSectionColors.kt} (92%) diff --git a/bank-sdk/sdk/src/main/java/net/gini/android/bank/sdk/capture/skonto/SkontoFragment.kt b/bank-sdk/sdk/src/main/java/net/gini/android/bank/sdk/capture/skonto/SkontoFragment.kt index 88f0aee6d..35516c0d4 100644 --- a/bank-sdk/sdk/src/main/java/net/gini/android/bank/sdk/capture/skonto/SkontoFragment.kt +++ b/bank-sdk/sdk/src/main/java/net/gini/android/bank/sdk/capture/skonto/SkontoFragment.kt @@ -78,7 +78,7 @@ import net.gini.android.bank.sdk.R import net.gini.android.bank.sdk.capture.skonto.colors.SkontoScreenColors import net.gini.android.bank.sdk.capture.skonto.colors.section.SkontoFooterSectionColors import net.gini.android.bank.sdk.capture.skonto.colors.section.SkontoInfoDialogColors -import net.gini.android.bank.sdk.capture.skonto.colors.section.SkontoInvoiceScanSectionColors +import net.gini.android.bank.sdk.capture.skonto.colors.section.SkontoInvoicePreviewSectionColors import net.gini.android.bank.sdk.capture.skonto.colors.section.SkontoSectionColors import net.gini.android.bank.sdk.capture.skonto.colors.section.WithoutSkontoSectionColors import net.gini.android.bank.sdk.capture.skonto.model.SkontoData @@ -323,7 +323,7 @@ private fun ScreenReadyState( horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.spacedBy(16.dp), ) { - YourInvoiceScanSection( + InvoicePreviewSection( modifier = Modifier .padding(top = 8.dp) .tabletMaxWidth(), @@ -417,9 +417,9 @@ private fun NavigationActionBack( } @Composable -private fun YourInvoiceScanSection( +private fun InvoicePreviewSection( modifier: Modifier = Modifier, - colorScheme: SkontoInvoiceScanSectionColors, + colorScheme: SkontoInvoicePreviewSectionColors, onClick: () -> Unit, ) { Card( diff --git a/bank-sdk/sdk/src/main/java/net/gini/android/bank/sdk/capture/skonto/colors/SkontoScreenColors.kt b/bank-sdk/sdk/src/main/java/net/gini/android/bank/sdk/capture/skonto/colors/SkontoScreenColors.kt index b0e44b5de..58b35ce4a 100644 --- a/bank-sdk/sdk/src/main/java/net/gini/android/bank/sdk/capture/skonto/colors/SkontoScreenColors.kt +++ b/bank-sdk/sdk/src/main/java/net/gini/android/bank/sdk/capture/skonto/colors/SkontoScreenColors.kt @@ -5,7 +5,7 @@ import androidx.compose.runtime.Immutable import androidx.compose.ui.graphics.Color import net.gini.android.bank.sdk.capture.skonto.colors.section.SkontoFooterSectionColors import net.gini.android.bank.sdk.capture.skonto.colors.section.SkontoInfoDialogColors -import net.gini.android.bank.sdk.capture.skonto.colors.section.SkontoInvoiceScanSectionColors +import net.gini.android.bank.sdk.capture.skonto.colors.section.SkontoInvoicePreviewSectionColors import net.gini.android.bank.sdk.capture.skonto.colors.section.SkontoSectionColors import net.gini.android.bank.sdk.capture.skonto.colors.section.WithoutSkontoSectionColors import net.gini.android.capture.ui.components.picker.date.GiniDatePickerDialogColors @@ -16,7 +16,7 @@ import net.gini.android.capture.ui.theme.GiniTheme data class SkontoScreenColors( val backgroundColor: Color, val topAppBarColors: GiniTopBarColors, - val invoiceScanSectionColors: SkontoInvoiceScanSectionColors, + val invoiceScanSectionColors: SkontoInvoicePreviewSectionColors, val skontoSectionColors: SkontoSectionColors, val withoutSkontoSectionColors: WithoutSkontoSectionColors, val footerSectionColors: SkontoFooterSectionColors, @@ -27,18 +27,26 @@ data class SkontoScreenColors( companion object { @Composable fun colors( - backgroundColor: Color = GiniTheme.colorScheme.background.primary, - topAppBarColors: GiniTopBarColors = GiniTopBarColors.colors(), - skontoInvoiceScanSectionColors: SkontoInvoiceScanSectionColors = SkontoInvoiceScanSectionColors.colors(), - discountSectionColors: SkontoSectionColors = SkontoSectionColors.colors(), - withoutSkontoSectionColors: WithoutSkontoSectionColors = WithoutSkontoSectionColors.colors(), - skontoFooterSectionColors: SkontoFooterSectionColors = SkontoFooterSectionColors.colors(), - datePickerColor: GiniDatePickerDialogColors = GiniDatePickerDialogColors.colors(), - infoDialogColors: SkontoInfoDialogColors = SkontoInfoDialogColors.colors(), + backgroundColor: Color = + GiniTheme.colorScheme.background.primary, + topAppBarColors: GiniTopBarColors = + GiniTopBarColors.colors(), + skontoInvoicePreviewSectionColors: SkontoInvoicePreviewSectionColors = + SkontoInvoicePreviewSectionColors.colors(), + discountSectionColors: SkontoSectionColors = + SkontoSectionColors.colors(), + withoutSkontoSectionColors: WithoutSkontoSectionColors = + WithoutSkontoSectionColors.colors(), + skontoFooterSectionColors: SkontoFooterSectionColors = + SkontoFooterSectionColors.colors(), + datePickerColor: GiniDatePickerDialogColors = + GiniDatePickerDialogColors.colors(), + infoDialogColors: SkontoInfoDialogColors = + SkontoInfoDialogColors.colors(), ) = SkontoScreenColors( backgroundColor = backgroundColor, topAppBarColors = topAppBarColors, - invoiceScanSectionColors = skontoInvoiceScanSectionColors, + invoiceScanSectionColors = skontoInvoicePreviewSectionColors, skontoSectionColors = discountSectionColors, withoutSkontoSectionColors = withoutSkontoSectionColors, footerSectionColors = skontoFooterSectionColors, diff --git a/bank-sdk/sdk/src/main/java/net/gini/android/bank/sdk/capture/skonto/colors/section/SkontoInvoiceScanSectionColors.kt b/bank-sdk/sdk/src/main/java/net/gini/android/bank/sdk/capture/skonto/colors/section/SkontoInvoicePreviewSectionColors.kt similarity index 92% rename from bank-sdk/sdk/src/main/java/net/gini/android/bank/sdk/capture/skonto/colors/section/SkontoInvoiceScanSectionColors.kt rename to bank-sdk/sdk/src/main/java/net/gini/android/bank/sdk/capture/skonto/colors/section/SkontoInvoicePreviewSectionColors.kt index 5ac48d32f..55c8a3aaf 100644 --- a/bank-sdk/sdk/src/main/java/net/gini/android/bank/sdk/capture/skonto/colors/section/SkontoInvoiceScanSectionColors.kt +++ b/bank-sdk/sdk/src/main/java/net/gini/android/bank/sdk/capture/skonto/colors/section/SkontoInvoicePreviewSectionColors.kt @@ -6,7 +6,7 @@ import androidx.compose.ui.graphics.Color import net.gini.android.capture.ui.theme.GiniTheme @Immutable -data class SkontoInvoiceScanSectionColors( +data class SkontoInvoicePreviewSectionColors( val cardBackgroundColor: Color, val titleTextColor: Color, val subtitleTextColor: Color, @@ -24,7 +24,7 @@ data class SkontoInvoiceScanSectionColors( iconBackgroundColor: Color = GiniTheme.colorScheme.placeholder.background, iconTint: Color = GiniTheme.colorScheme.placeholder.tint, arrowTint: Color = GiniTheme.colorScheme.icons.secondary, - ) = SkontoInvoiceScanSectionColors( + ) = SkontoInvoicePreviewSectionColors( cardBackgroundColor = cardBackgroundColor, titleTextColor = titleTextColor, subtitleTextColor = subtitleTextColor, @@ -33,4 +33,4 @@ data class SkontoInvoiceScanSectionColors( arrowTint = arrowTint, ) } -} \ No newline at end of file +}