From 6b57f1dc8bdafe15ce2171f1740505258942622e Mon Sep 17 00:00:00 2001 From: Sk Niyaj Ali Date: Mon, 4 Nov 2024 22:14:17 +0530 Subject: [PATCH] Feat: Migrated UPI Setup Module to KMP --- README.md | 2 +- feature/upi-setup/consumer-rules.pro | 0 feature/upi-setup/proguard-rules.pro | 21 -------- .../{main => androidMain}/AndroidManifest.xml | 0 .../composeResources}/values/strings.xml | 0 .../feature/upi/setup}/di/UpiSetupModule.kt | 18 +++---- .../navigation/SetupUpiPinNavigation.kt | 27 +++++++---- .../upi/setup}/screens/DebitCardScreen.kt | 10 ++-- .../setup}/screens/DebitCardScreenContent.kt | 6 +-- .../feature/upi/setup}/screens/OtpScreen.kt | 11 +++-- .../upi/setup}/screens/SetUpUPiPinScreen.kt | 48 +++++++------------ .../setup}/screens/SetUpUpiScreenContent.kt | 9 ++-- .../upi/setup}/screens/UpiPinScreen.kt | 20 ++++---- .../setup}/viewmodel/DebitCardViewModal.kt | 2 +- .../upi/setup}/viewmodel/SetUpUpiViewModal.kt | 4 +- mifospay-shared/build.gradle.kts | 1 + .../org/mifospay/shared/di/KoinModules.kt | 2 + .../shared/navigation/MifosNavHost.kt | 5 ++ 18 files changed, 81 insertions(+), 105 deletions(-) delete mode 100644 feature/upi-setup/consumer-rules.pro delete mode 100644 feature/upi-setup/proguard-rules.pro rename feature/upi-setup/src/{main => androidMain}/AndroidManifest.xml (100%) rename feature/upi-setup/src/{main/res => commonMain/composeResources}/values/strings.xml (100%) rename feature/upi-setup/src/{main/kotlin/org/mifospay/feature/upiSetup => commonMain/kotlin/org/mifospay/feature/upi/setup}/di/UpiSetupModule.kt (54%) rename feature/upi-setup/src/{main/kotlin/org/mifospay/feature/upiSetup => commonMain/kotlin/org/mifospay/feature/upi/setup}/navigation/SetupUpiPinNavigation.kt (71%) rename feature/upi-setup/src/{main/kotlin/org/mifospay/feature/upiSetup => commonMain/kotlin/org/mifospay/feature/upi/setup}/screens/DebitCardScreen.kt (94%) rename feature/upi-setup/src/{main/kotlin/org/mifospay/feature/upiSetup => commonMain/kotlin/org/mifospay/feature/upi/setup}/screens/DebitCardScreenContent.kt (97%) rename feature/upi-setup/src/{main/kotlin/org/mifospay/feature/upiSetup => commonMain/kotlin/org/mifospay/feature/upi/setup}/screens/OtpScreen.kt (88%) rename feature/upi-setup/src/{main/kotlin/org/mifospay/feature/upiSetup => commonMain/kotlin/org/mifospay/feature/upi/setup}/screens/SetUpUPiPinScreen.kt (75%) rename feature/upi-setup/src/{main/kotlin/org/mifospay/feature/upiSetup => commonMain/kotlin/org/mifospay/feature/upi/setup}/screens/SetUpUpiScreenContent.kt (94%) rename feature/upi-setup/src/{main/kotlin/org/mifospay/feature/upiSetup => commonMain/kotlin/org/mifospay/feature/upi/setup}/screens/UpiPinScreen.kt (89%) rename feature/upi-setup/src/{main/kotlin/org/mifospay/feature/upiSetup => commonMain/kotlin/org/mifospay/feature/upi/setup}/viewmodel/DebitCardViewModal.kt (97%) rename feature/upi-setup/src/{main/kotlin/org/mifospay/feature/upiSetup => commonMain/kotlin/org/mifospay/feature/upi/setup}/viewmodel/SetUpUpiViewModal.kt (86%) diff --git a/README.md b/README.md index e62e6d13a..2461e2098 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ that can be used as a dependency in any other wallet based project. It is develo | :feature:saved-cards | Done | ✅ | ✅ | ❔ | ✅ | ❔ | | :feature:send-money | Done | ✅ | ✅ | ❔ | ✅ | ❔ | | :feature:standing-instruction | Done | ✅ | ✅ | ❔ | ✅ | ❔ | -| :feature:upi-setup | Not started | ❌ | ❌ | ❌ | ❌ | ❌ | +| :feature:upi-setup | Done | ✅ | ✅ | ❔ | ✅ | ❔ | | lint | Not started | ❌ | ❌ | ❌ | ❌ | ❌ | ✅: Functioning properly diff --git a/feature/upi-setup/consumer-rules.pro b/feature/upi-setup/consumer-rules.pro deleted file mode 100644 index e69de29bb..000000000 diff --git a/feature/upi-setup/proguard-rules.pro b/feature/upi-setup/proguard-rules.pro deleted file mode 100644 index 481bb4348..000000000 --- a/feature/upi-setup/proguard-rules.pro +++ /dev/null @@ -1,21 +0,0 @@ -# Add project specific ProGuard rules here. -# You can control the set of applied configuration files using the -# proguardFiles setting in build.gradle. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} - -# Uncomment this to preserve the line number information for -# debugging stack traces. -#-keepattributes SourceFile,LineNumberTable - -# If you keep the line number information, uncomment this to -# hide the original source file name. -#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/feature/upi-setup/src/main/AndroidManifest.xml b/feature/upi-setup/src/androidMain/AndroidManifest.xml similarity index 100% rename from feature/upi-setup/src/main/AndroidManifest.xml rename to feature/upi-setup/src/androidMain/AndroidManifest.xml diff --git a/feature/upi-setup/src/main/res/values/strings.xml b/feature/upi-setup/src/commonMain/composeResources/values/strings.xml similarity index 100% rename from feature/upi-setup/src/main/res/values/strings.xml rename to feature/upi-setup/src/commonMain/composeResources/values/strings.xml diff --git a/feature/upi-setup/src/main/kotlin/org/mifospay/feature/upiSetup/di/UpiSetupModule.kt b/feature/upi-setup/src/commonMain/kotlin/org/mifospay/feature/upi/setup/di/UpiSetupModule.kt similarity index 54% rename from feature/upi-setup/src/main/kotlin/org/mifospay/feature/upiSetup/di/UpiSetupModule.kt rename to feature/upi-setup/src/commonMain/kotlin/org/mifospay/feature/upi/setup/di/UpiSetupModule.kt index 8810f7b96..afbcaa9f7 100644 --- a/feature/upi-setup/src/main/kotlin/org/mifospay/feature/upiSetup/di/UpiSetupModule.kt +++ b/feature/upi-setup/src/commonMain/kotlin/org/mifospay/feature/upi/setup/di/UpiSetupModule.kt @@ -7,20 +7,14 @@ * * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md */ -package org.mifospay.feature.upiSetup.di +package org.mifospay.feature.upi.setup.di -import org.koin.core.module.dsl.viewModel +import org.koin.core.module.dsl.viewModelOf import org.koin.dsl.module -import org.mifospay.feature.upiSetup.viewmodel.DebitCardViewModel -import org.mifospay.feature.upiSetup.viewmodel.SetUpUpiViewModal +import org.mifospay.feature.upi.setup.viewmodel.DebitCardViewModel +import org.mifospay.feature.upi.setup.viewmodel.SetUpUpiViewModal val UpiSetupModule = module { - - viewModel { - DebitCardViewModel() - } - - viewModel { - SetUpUpiViewModal() - } + viewModelOf(::DebitCardViewModel) + viewModelOf(::SetUpUpiViewModal) } diff --git a/feature/upi-setup/src/main/kotlin/org/mifospay/feature/upiSetup/navigation/SetupUpiPinNavigation.kt b/feature/upi-setup/src/commonMain/kotlin/org/mifospay/feature/upi/setup/navigation/SetupUpiPinNavigation.kt similarity index 71% rename from feature/upi-setup/src/main/kotlin/org/mifospay/feature/upiSetup/navigation/SetupUpiPinNavigation.kt rename to feature/upi-setup/src/commonMain/kotlin/org/mifospay/feature/upi/setup/navigation/SetupUpiPinNavigation.kt index f50648fde..a826c4b5f 100644 --- a/feature/upi-setup/src/main/kotlin/org/mifospay/feature/upiSetup/navigation/SetupUpiPinNavigation.kt +++ b/feature/upi-setup/src/commonMain/kotlin/org/mifospay/feature/upi/setup/navigation/SetupUpiPinNavigation.kt @@ -7,22 +7,22 @@ * * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md */ -package org.mifospay.feature.upiSetup.navigation +package org.mifospay.feature.upi.setup.navigation -import android.os.Bundle +import androidx.core.bundle.Bundle import androidx.navigation.NavController import androidx.navigation.NavGraphBuilder import androidx.navigation.NavType import androidx.navigation.compose.composable import androidx.navigation.navArgument -import com.mifospay.core.model.domain.BankAccountDetails import org.mifospay.core.common.Constants -import org.mifospay.feature.upiSetup.screens.SetupUpiPinScreenRoute +import org.mifospay.core.model.bank.BankAccountDetails +import org.mifospay.feature.upi.setup.screens.SetupUpiPinScreenRoute const val SETUP_UPI_PIN_ROUTE = "setup_upi_pin_route" fun NavGraphBuilder.setupUpiPinScreen( - onBackPress: () -> Unit, + navigateBack: () -> Unit, ) { composable( route = "$SETUP_UPI_PIN_ROUTE/{${Constants.INDEX}}/{${Constants.TYPE}}", @@ -31,9 +31,16 @@ fun NavGraphBuilder.setupUpiPinScreen( navArgument(Constants.TYPE) { type = NavType.StringType }, ), ) { backStackEntry -> - val bankAccountDetails = - backStackEntry.arguments?.getParcelable(Constants.BANK_ACCOUNT_DETAILS) - ?: BankAccountDetails("", "", "", "", "") + val bankAccountDetails = BankAccountDetails( + accountNo = "sanctus", + bankName = null, + accountHolderName = null, + branch = null, + ifsc = null, + type = null, + isUpiEnabled = false, + upiPin = null + ) val index = backStackEntry.arguments?.getInt(Constants.INDEX) ?: 0 val type = backStackEntry.arguments?.getString(Constants.TYPE) ?: "" @@ -41,7 +48,7 @@ fun NavGraphBuilder.setupUpiPinScreen( type = type, index = index, bankAccountDetails = bankAccountDetails, - onBackPress = onBackPress, + onBackPress = navigateBack, ) } } @@ -52,7 +59,7 @@ fun NavController.navigateToSetupUpiPin( type: String, ) { val bundle = Bundle().apply { - putParcelable(Constants.BANK_ACCOUNT_DETAILS, bankAccountDetails) + putString(Constants.BANK_ACCOUNT_DETAILS, bankAccountDetails.toString()) } this.navigate("$SETUP_UPI_PIN_ROUTE/$index/$type") { this.launchSingleTop = true diff --git a/feature/upi-setup/src/main/kotlin/org/mifospay/feature/upiSetup/screens/DebitCardScreen.kt b/feature/upi-setup/src/commonMain/kotlin/org/mifospay/feature/upi/setup/screens/DebitCardScreen.kt similarity index 94% rename from feature/upi-setup/src/main/kotlin/org/mifospay/feature/upiSetup/screens/DebitCardScreen.kt rename to feature/upi-setup/src/commonMain/kotlin/org/mifospay/feature/upi/setup/screens/DebitCardScreen.kt index 06c7de46a..01652616e 100644 --- a/feature/upi-setup/src/main/kotlin/org/mifospay/feature/upiSetup/screens/DebitCardScreen.kt +++ b/feature/upi-setup/src/commonMain/kotlin/org/mifospay/feature/upi/setup/screens/DebitCardScreen.kt @@ -7,7 +7,7 @@ * * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md */ -package org.mifospay.feature.upiSetup.screens +package org.mifospay.feature.upi.setup.screens import androidx.annotation.VisibleForTesting import androidx.compose.foundation.layout.Box @@ -21,15 +21,15 @@ import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier -import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import androidx.lifecycle.compose.collectAsStateWithLifecycle -import org.koin.androidx.compose.koinViewModel +import org.jetbrains.compose.ui.tooling.preview.Preview +import org.koin.compose.viewmodel.koinViewModel import org.mifospay.core.designsystem.component.MifosLoadingWheel import org.mifospay.core.designsystem.theme.MifosTheme import org.mifospay.core.ui.VerifyStepHeader -import org.mifospay.feature.upiSetup.viewmodel.DebitCardUiState -import org.mifospay.feature.upiSetup.viewmodel.DebitCardViewModel +import org.mifospay.feature.upi.setup.viewmodel.DebitCardUiState +import org.mifospay.feature.upi.setup.viewmodel.DebitCardViewModel @Composable internal fun DebitCardScreen( diff --git a/feature/upi-setup/src/main/kotlin/org/mifospay/feature/upiSetup/screens/DebitCardScreenContent.kt b/feature/upi-setup/src/commonMain/kotlin/org/mifospay/feature/upi/setup/screens/DebitCardScreenContent.kt similarity index 97% rename from feature/upi-setup/src/main/kotlin/org/mifospay/feature/upiSetup/screens/DebitCardScreenContent.kt rename to feature/upi-setup/src/commonMain/kotlin/org/mifospay/feature/upi/setup/screens/DebitCardScreenContent.kt index 9a347794f..dc43f459a 100644 --- a/feature/upi-setup/src/main/kotlin/org/mifospay/feature/upiSetup/screens/DebitCardScreenContent.kt +++ b/feature/upi-setup/src/commonMain/kotlin/org/mifospay/feature/upi/setup/screens/DebitCardScreenContent.kt @@ -7,7 +7,7 @@ * * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md */ -package org.mifospay.feature.upiSetup.screens +package org.mifospay.feature.upi.setup.screens import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Spacer @@ -34,8 +34,8 @@ import androidx.compose.ui.text.input.ImeAction import androidx.compose.ui.text.input.KeyboardType import androidx.compose.ui.text.input.OffsetMapping import androidx.compose.ui.text.input.TransformedText -import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp +import org.jetbrains.compose.ui.tooling.preview.Preview import org.mifospay.core.designsystem.theme.MifosTheme import org.mifospay.core.ui.ExpiryDateInput @@ -138,7 +138,7 @@ private fun formatCardNumber(text: AnnotatedString): TransformedText { return TransformedText(AnnotatedString(out), creditCardOffsetTranslator) } -@Preview(showBackground = true) +@Preview @Composable private fun DebitCardScreenContentsPreview() { MifosTheme { diff --git a/feature/upi-setup/src/main/kotlin/org/mifospay/feature/upiSetup/screens/OtpScreen.kt b/feature/upi-setup/src/commonMain/kotlin/org/mifospay/feature/upi/setup/screens/OtpScreen.kt similarity index 88% rename from feature/upi-setup/src/main/kotlin/org/mifospay/feature/upiSetup/screens/OtpScreen.kt rename to feature/upi-setup/src/commonMain/kotlin/org/mifospay/feature/upi/setup/screens/OtpScreen.kt index 537c8c2c6..a4c0400fc 100644 --- a/feature/upi-setup/src/main/kotlin/org/mifospay/feature/upiSetup/screens/OtpScreen.kt +++ b/feature/upi-setup/src/commonMain/kotlin/org/mifospay/feature/upi/setup/screens/OtpScreen.kt @@ -7,7 +7,7 @@ * * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md */ -package org.mifospay.feature.upiSetup.screens +package org.mifospay.feature.upi.setup.screens import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column @@ -20,14 +20,15 @@ import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier -import androidx.compose.ui.res.stringResource -import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp +import mobile_wallet.feature.upi_setup.generated.resources.Res +import mobile_wallet.feature.upi_setup.generated.resources.feature_upi_setup_enter_otp +import org.jetbrains.compose.resources.stringResource +import org.jetbrains.compose.ui.tooling.preview.Preview import org.mifospay.core.designsystem.theme.MifosTheme import org.mifospay.core.ui.OtpTextField import org.mifospay.core.ui.VerifyStepHeader -import org.mifospay.feature.upi_setup.R @Composable internal fun OtpScreen( @@ -71,7 +72,7 @@ private fun OtpScreenContent( ) { Column(modifier) { Text( - text = stringResource(id = R.string.feature_upi_setup_enter_otp), + text = stringResource(Res.string.feature_upi_setup_enter_otp), color = MaterialTheme.colorScheme.onSurface, fontSize = 18.sp, style = MaterialTheme.typography.headlineMedium, diff --git a/feature/upi-setup/src/main/kotlin/org/mifospay/feature/upiSetup/screens/SetUpUPiPinScreen.kt b/feature/upi-setup/src/commonMain/kotlin/org/mifospay/feature/upi/setup/screens/SetUpUPiPinScreen.kt similarity index 75% rename from feature/upi-setup/src/main/kotlin/org/mifospay/feature/upiSetup/screens/SetUpUPiPinScreen.kt rename to feature/upi-setup/src/commonMain/kotlin/org/mifospay/feature/upi/setup/screens/SetUpUPiPinScreen.kt index 069323459..6ae2c934d 100644 --- a/feature/upi-setup/src/main/kotlin/org/mifospay/feature/upiSetup/screens/SetUpUPiPinScreen.kt +++ b/feature/upi-setup/src/commonMain/kotlin/org/mifospay/feature/upi/setup/screens/SetUpUPiPinScreen.kt @@ -7,11 +7,8 @@ * * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md */ -package org.mifospay.feature.upiSetup.screens +package org.mifospay.feature.upi.setup.screens -import android.app.Activity -import android.content.Intent -import android.widget.Toast import androidx.annotation.VisibleForTesting import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column @@ -25,15 +22,15 @@ import androidx.compose.material3.TopAppBar import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier -import androidx.compose.ui.platform.LocalContext -import androidx.compose.ui.res.stringResource -import androidx.compose.ui.tooling.preview.Preview -import com.mifospay.core.model.domain.BankAccountDetails -import org.koin.androidx.compose.koinViewModel +import mobile_wallet.feature.upi_setup.generated.resources.Res +import mobile_wallet.feature.upi_setup.generated.resources.feature_upi_setup_back +import org.jetbrains.compose.resources.stringResource +import org.jetbrains.compose.ui.tooling.preview.Preview +import org.koin.compose.viewmodel.koinViewModel import org.mifospay.core.common.Constants import org.mifospay.core.designsystem.icon.MifosIcons -import org.mifospay.feature.upiSetup.viewmodel.SetUpUpiViewModal -import org.mifospay.feature.upi_setup.R +import org.mifospay.core.model.bank.BankAccountDetails +import org.mifospay.feature.upi.setup.viewmodel.SetUpUpiViewModal @Composable internal fun SetupUpiPinScreenRoute( @@ -69,7 +66,6 @@ internal fun SetupUpiPinScreen( onBackPress: () -> Unit, modifier: Modifier = Modifier, ) { - val context = LocalContext.current Scaffold( modifier = modifier, topBar = { @@ -90,7 +86,7 @@ internal fun SetupUpiPinScreen( ) { Icon( MifosIcons.ArrowBack, - contentDescription = stringResource(id = R.string.feature_upi_setup_back), + contentDescription = stringResource(Res.string.feature_upi_setup_back), ) } }, @@ -108,19 +104,6 @@ internal fun SetupUpiPinScreen( otpText = otpText, correctlySettingUpi = { setupUpiPin(it) - bankAccountDetails.isUpiEnabled = true - bankAccountDetails.upiPin = it - Toast.makeText( - context, - Constants.UPI_PIN_SETUP_COMPLETED_SUCCESSFULLY, - Toast.LENGTH_SHORT, - ).show() - val intent = Intent().apply { - putExtra(Constants.UPDATED_BANK_ACCOUNT, bankAccountDetails) - putExtra(Constants.INDEX, index) - } - (context as? Activity)?.setResult(Activity.RESULT_OK, intent) - (context as? Activity)?.finish() }, ) } @@ -169,10 +152,13 @@ fun PreviewForgetUpi() { fun getBankAccountDetails(): BankAccountDetails { return BankAccountDetails( - "SBI", - "Ankur Sharma", - "New Delhi", - "XXXXXXXX9990XXX " + " ", - "Savings", + accountNo = "SBI", + bankName = "Ankur Sharma", + accountHolderName = "New Delhi", + branch = "XXXXXXXX9990XXX " + " ", + ifsc = "Savings", + type = "Debit", + isUpiEnabled = false, + upiPin = "0000", ) } diff --git a/feature/upi-setup/src/main/kotlin/org/mifospay/feature/upiSetup/screens/SetUpUpiScreenContent.kt b/feature/upi-setup/src/commonMain/kotlin/org/mifospay/feature/upi/setup/screens/SetUpUpiScreenContent.kt similarity index 94% rename from feature/upi-setup/src/main/kotlin/org/mifospay/feature/upiSetup/screens/SetUpUpiScreenContent.kt rename to feature/upi-setup/src/commonMain/kotlin/org/mifospay/feature/upi/setup/screens/SetUpUpiScreenContent.kt index 7cac75544..576868b2b 100644 --- a/feature/upi-setup/src/main/kotlin/org/mifospay/feature/upiSetup/screens/SetUpUpiScreenContent.kt +++ b/feature/upi-setup/src/commonMain/kotlin/org/mifospay/feature/upi/setup/screens/SetUpUpiScreenContent.kt @@ -7,9 +7,8 @@ * * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md */ -package org.mifospay.feature.upiSetup.screens +package org.mifospay.feature.upi.setup.screens -import android.widget.Toast import androidx.compose.foundation.layout.Column import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue @@ -17,8 +16,7 @@ import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier -import androidx.compose.ui.platform.LocalContext -import androidx.compose.ui.tooling.preview.Preview +import org.jetbrains.compose.ui.tooling.preview.Preview import org.mifospay.core.common.Constants import org.mifospay.core.designsystem.theme.MifosTheme @@ -58,7 +56,6 @@ private fun SettingAndForgotUpi( var upiPinScreenVerified by rememberSaveable { mutableStateOf(false) } var realOtp by rememberSaveable { mutableStateOf("") } - val context = LocalContext.current Column(modifier) { DebitCardScreen( @@ -71,7 +68,7 @@ private fun SettingAndForgotUpi( debitCardScreenVisible = false }, onDebitCardVerificationFailed = { - Toast.makeText(context, it, Toast.LENGTH_SHORT).show() + }, ) OtpScreen( diff --git a/feature/upi-setup/src/main/kotlin/org/mifospay/feature/upiSetup/screens/UpiPinScreen.kt b/feature/upi-setup/src/commonMain/kotlin/org/mifospay/feature/upi/setup/screens/UpiPinScreen.kt similarity index 89% rename from feature/upi-setup/src/main/kotlin/org/mifospay/feature/upiSetup/screens/UpiPinScreen.kt rename to feature/upi-setup/src/commonMain/kotlin/org/mifospay/feature/upi/setup/screens/UpiPinScreen.kt index df0426284..bea6e5764 100644 --- a/feature/upi-setup/src/main/kotlin/org/mifospay/feature/upiSetup/screens/UpiPinScreen.kt +++ b/feature/upi-setup/src/commonMain/kotlin/org/mifospay/feature/upi/setup/screens/UpiPinScreen.kt @@ -7,7 +7,7 @@ * * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md */ -package org.mifospay.feature.upiSetup.screens +package org.mifospay.feature.upi.setup.screens import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column @@ -33,19 +33,23 @@ import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color -import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.input.ImeAction import androidx.compose.ui.text.input.KeyboardType import androidx.compose.ui.text.style.TextAlign -import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch +import mobile_wallet.feature.upi_setup.generated.resources.Res +import mobile_wallet.feature.upi_setup.generated.resources.feature_upi_setup_enter_upi_pin +import mobile_wallet.feature.upi_setup.generated.resources.feature_upi_setup_invalid_upi_pin +import mobile_wallet.feature.upi_setup.generated.resources.feature_upi_setup_reenter_upi +import mobile_wallet.feature.upi_setup.generated.resources.feature_upi_setup_upi_pin_setup +import org.jetbrains.compose.resources.stringResource +import org.jetbrains.compose.ui.tooling.preview.Preview import org.mifospay.core.designsystem.theme.MifosTheme import org.mifospay.core.ui.VerifyStepHeader -import org.mifospay.feature.upi_setup.R @Composable internal fun UpiPinScreen( @@ -73,7 +77,7 @@ internal fun UpiPinScreen( horizontalAlignment = Alignment.CenterHorizontally, ) { VerifyStepHeader( - stringResource(id = R.string.feature_upi_setup_upi_pin_setup), + stringResource(Res.string.feature_upi_setup_upi_pin_setup), verificationStatus, ) if (contentVisibility) UpiPinScreenContent(correctlySettingUpi) @@ -95,9 +99,9 @@ private fun UpiPinScreenContent( Text( modifier = modifier, text = if (steps1.intValue == 0) { - stringResource(id = R.string.feature_upi_setup_enter_upi_pin) + stringResource(Res.string.feature_upi_setup_enter_upi_pin) } else { - stringResource(id = R.string.feature_upi_setup_reenter_upi) + stringResource(Res.string.feature_upi_setup_reenter_upi) }, color = MaterialTheme.colorScheme.onSurface, fontSize = 18.sp, @@ -162,7 +166,7 @@ private fun UpiPinScreenContent( } else { showSnackbar( snackbarHostState, - R.string.feature_upi_setup_invalid_upi_pin.toString(), + Res.string.feature_upi_setup_invalid_upi_pin.toString(), ) } }, diff --git a/feature/upi-setup/src/main/kotlin/org/mifospay/feature/upiSetup/viewmodel/DebitCardViewModal.kt b/feature/upi-setup/src/commonMain/kotlin/org/mifospay/feature/upi/setup/viewmodel/DebitCardViewModal.kt similarity index 97% rename from feature/upi-setup/src/main/kotlin/org/mifospay/feature/upiSetup/viewmodel/DebitCardViewModal.kt rename to feature/upi-setup/src/commonMain/kotlin/org/mifospay/feature/upi/setup/viewmodel/DebitCardViewModal.kt index 5dd5bbf72..15a5b6c55 100644 --- a/feature/upi-setup/src/main/kotlin/org/mifospay/feature/upiSetup/viewmodel/DebitCardViewModal.kt +++ b/feature/upi-setup/src/commonMain/kotlin/org/mifospay/feature/upi/setup/viewmodel/DebitCardViewModal.kt @@ -7,7 +7,7 @@ * * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md */ -package org.mifospay.feature.upiSetup.viewmodel +package org.mifospay.feature.upi.setup.viewmodel import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope diff --git a/feature/upi-setup/src/main/kotlin/org/mifospay/feature/upiSetup/viewmodel/SetUpUpiViewModal.kt b/feature/upi-setup/src/commonMain/kotlin/org/mifospay/feature/upi/setup/viewmodel/SetUpUpiViewModal.kt similarity index 86% rename from feature/upi-setup/src/main/kotlin/org/mifospay/feature/upiSetup/viewmodel/SetUpUpiViewModal.kt rename to feature/upi-setup/src/commonMain/kotlin/org/mifospay/feature/upi/setup/viewmodel/SetUpUpiViewModal.kt index 1f402a00c..bfd53a7aa 100644 --- a/feature/upi-setup/src/main/kotlin/org/mifospay/feature/upiSetup/viewmodel/SetUpUpiViewModal.kt +++ b/feature/upi-setup/src/commonMain/kotlin/org/mifospay/feature/upi/setup/viewmodel/SetUpUpiViewModal.kt @@ -7,10 +7,10 @@ * * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md */ -package org.mifospay.feature.upiSetup.viewmodel +package org.mifospay.feature.upi.setup.viewmodel import androidx.lifecycle.ViewModel -import com.mifospay.core.model.domain.BankAccountDetails +import org.mifospay.core.model.bank.BankAccountDetails @Suppress("UnusedParameter") class SetUpUpiViewModal : ViewModel() { diff --git a/mifospay-shared/build.gradle.kts b/mifospay-shared/build.gradle.kts index 1f6e287bf..bddcb42d3 100644 --- a/mifospay-shared/build.gradle.kts +++ b/mifospay-shared/build.gradle.kts @@ -56,6 +56,7 @@ kotlin { api(projects.feature.makeTransfer) api(projects.feature.qr) api(projects.feature.merchants) + api(projects.feature.upiSetup) } desktopMain.dependencies { diff --git a/mifospay-shared/src/commonMain/kotlin/org/mifospay/shared/di/KoinModules.kt b/mifospay-shared/src/commonMain/kotlin/org/mifospay/shared/di/KoinModules.kt index 147fb4e14..818cb8385 100644 --- a/mifospay-shared/src/commonMain/kotlin/org/mifospay/shared/di/KoinModules.kt +++ b/mifospay-shared/src/commonMain/kotlin/org/mifospay/shared/di/KoinModules.kt @@ -41,6 +41,7 @@ import org.mifospay.feature.savedcards.di.SavedCardsModule import org.mifospay.feature.send.money.di.SendMoneyModule import org.mifospay.feature.settings.di.SettingsModule import org.mifospay.feature.standing.instruction.di.StandingInstructionModule +import org.mifospay.feature.upi.setup.di.UpiSetupModule import org.mifospay.shared.MifosPayViewModel object KoinModules { @@ -84,6 +85,7 @@ object KoinModules { MakeTransferModule, QrModule, MerchantsModule, + UpiSetupModule ) } private val LibraryModule = module { diff --git a/mifospay-shared/src/commonMain/kotlin/org/mifospay/shared/navigation/MifosNavHost.kt b/mifospay-shared/src/commonMain/kotlin/org/mifospay/shared/navigation/MifosNavHost.kt index d687a8c97..9974f9556 100644 --- a/mifospay-shared/src/commonMain/kotlin/org/mifospay/shared/navigation/MifosNavHost.kt +++ b/mifospay-shared/src/commonMain/kotlin/org/mifospay/shared/navigation/MifosNavHost.kt @@ -78,6 +78,7 @@ import org.mifospay.feature.standing.instruction.createOrUpdate.addEditSIScreen import org.mifospay.feature.standing.instruction.createOrUpdate.navigateToSIAddEdit import org.mifospay.feature.standing.instruction.details.navigateSIDetails import org.mifospay.feature.standing.instruction.details.siDetailsScreen +import org.mifospay.feature.upi.setup.navigation.setupUpiPinScreen import org.mifospay.shared.ui.MifosAppState @Composable @@ -320,5 +321,9 @@ internal fun MifosNavHost( proceedWithMakeTransferFlow = { _, _ -> }, onBackPressed = navController::navigateUp, ) + + setupUpiPinScreen( + navigateBack = navController::navigateUp + ) } }