From d6623f83493a81afee0ddbd5dd4a59ac0deb901d Mon Sep 17 00:00:00 2001 From: Sk Niyaj Ali Date: Thu, 26 Sep 2024 20:46:55 +0530 Subject: [PATCH] Feat: [:core:common] KMP Migration (#1768) * Feat: [:core:common] KMP Migration * Updated Usage Declaration --- core/common/build.gradle.kts | 17 ++++++++ .../kotlin/org/mifospay/common/DebugUtil.kt | 26 ------------- .../kotlin/org/mifospay/common/FileUtils.kt | 36 ----------------- .../kotlin/org/mifospay/common/Utils.kt | 34 ---------------- .../mifospay/core/common/FileUtils.android.kt | 5 +++ .../org/mifospay/core/common/Utils.android.kt | 17 ++++++++ .../core/network/di/CoroutineScopesModule.kt | 23 ----------- .../org/mifospay/core}/common/Constants.kt | 2 +- .../mifospay/core}/common/CreditCardUtils.kt | 2 +- .../org/mifospay/core/common/DebugUtil.kt | 23 +++++++++++ .../org/mifospay/core/common/FileUtils.kt | 39 +++++++++++++++++++ .../mifospay/core/common}/MifosDispatchers.kt | 2 +- .../mifospay/core}/common/NavArgsConstants.kt | 2 +- .../kotlin/org/mifospay/core/common/Utils.kt | 9 +++++ .../core/common}/di/DispatchersModule.kt | 10 ++++- .../org/mifospay/core/common/FileUtils.jvm.kt | 5 +++ .../org/mifospay/core/common/Utils.jvm.kt | 17 ++++++++ .../mifospay/core/common/FileUtils.native.kt | 24 ++++++++++++ .../org/mifospay/core/common/Utils.native.kt | 17 ++++++++ .../navigation/BankAccountDetailNavigation.kt | 2 +- .../mobileVerify/MobileVerificationScreen.kt | 2 +- .../MobileVerificationScreenNavigation.kt | 2 +- .../feature/auth/signup/SignupViewModel.kt | 4 +- .../socialSignup/SocialSignupMethodScreen.kt | 2 +- .../editpassword/EditPasswordViewModel.kt | 2 +- .../SpecificTransactionsViewModel.kt | 6 +-- .../detail/TransactionDetailScreen.kt | 2 +- .../org/mifospay/feature/home/HomeScreen.kt | 10 +++-- .../feature/invoices/InvoiceDetailScreen.kt | 2 +- .../feature/invoices/InvoicesViewModel.kt | 2 +- .../feature/kyc/KYCLevel2ViewModel.kt | 2 +- .../make/transfer/MakeTransferScreen.kt | 2 +- .../make/transfer/MakeTransferViewModel.kt | 4 +- .../navigation/MakeTransferNavigation.kt | 16 ++++---- .../merchants/MerchantTransferViewModel.kt | 2 +- .../feature/profile/ProfileViewModel.kt | 2 +- .../mifospay/feature/receipt/ReceiptScreen.kt | 2 +- .../feature/receipt/ReceiptViewModel.kt | 33 ++++++++++------ .../feature/request/money/GenerateQr.kt | 2 +- .../feature/savedcards/AddCardDialogSheet.kt | 2 +- .../navigation/SetupUpiPinNavigation.kt | 2 +- .../upiSetup/screens/SetUpUPiPinScreen.kt | 2 +- .../upiSetup/screens/SetUpUpiScreenContent.kt | 2 +- gradle/libs.versions.toml | 5 +++ .../main/java/org/mifospay/di/KoinModules.kt | 4 +- .../org/mifospay/navigation/LoginNavGraph.kt | 2 +- .../org/mifospay/navigation/MifosNavHost.kt | 2 +- .../org/mifospay/utils/NotificationUtils.kt | 2 +- 48 files changed, 255 insertions(+), 179 deletions(-) delete mode 100644 core/common/src/androidMain/kotlin/org/mifospay/common/DebugUtil.kt delete mode 100644 core/common/src/androidMain/kotlin/org/mifospay/common/FileUtils.kt delete mode 100644 core/common/src/androidMain/kotlin/org/mifospay/common/Utils.kt create mode 100644 core/common/src/androidMain/kotlin/org/mifospay/core/common/FileUtils.android.kt create mode 100644 core/common/src/androidMain/kotlin/org/mifospay/core/common/Utils.android.kt delete mode 100644 core/common/src/androidMain/kotlin/org/mifospay/core/network/di/CoroutineScopesModule.kt rename core/common/src/{androidMain/kotlin/org/mifospay => commonMain/kotlin/org/mifospay/core}/common/Constants.kt (99%) rename core/common/src/{androidMain/kotlin/org/mifospay => commonMain/kotlin/org/mifospay/core}/common/CreditCardUtils.kt (96%) create mode 100644 core/common/src/commonMain/kotlin/org/mifospay/core/common/DebugUtil.kt create mode 100644 core/common/src/commonMain/kotlin/org/mifospay/core/common/FileUtils.kt rename core/common/src/{androidMain/kotlin/org/mifospay/core/network => commonMain/kotlin/org/mifospay/core/common}/MifosDispatchers.kt (94%) rename core/common/src/{androidMain/kotlin/org/mifospay => commonMain/kotlin/org/mifospay/core}/common/NavArgsConstants.kt (92%) create mode 100644 core/common/src/commonMain/kotlin/org/mifospay/core/common/Utils.kt rename core/common/src/{androidMain/kotlin/org/mifospay/core/network => commonMain/kotlin/org/mifospay/core/common}/di/DispatchersModule.kt (68%) create mode 100644 core/common/src/jvmMain/kotlin/org/mifospay/core/common/FileUtils.jvm.kt create mode 100644 core/common/src/jvmMain/kotlin/org/mifospay/core/common/Utils.jvm.kt create mode 100644 core/common/src/nativeMain/kotlin/org/mifospay/core/common/FileUtils.native.kt create mode 100644 core/common/src/nativeMain/kotlin/org/mifospay/core/common/Utils.native.kt diff --git a/core/common/build.gradle.kts b/core/common/build.gradle.kts index 20720cc5f..bc93c368a 100644 --- a/core/common/build.gradle.kts +++ b/core/common/build.gradle.kts @@ -16,6 +16,18 @@ android { } kotlin { + + listOf( + iosX64(), + iosArm64(), + iosSimulatorArm64() + ).forEach { + it.binaries.framework { + isStatic = false + export(libs.kermit.simple) + } + } + sourceSets { commonMain.dependencies { implementation(libs.kotlinx.coroutines.core) @@ -23,6 +35,8 @@ kotlin { api(libs.coil.core) api(libs.coil.svg) api(libs.coil.network.ktor) + api(libs.kermit.logging) + api(libs.squareup.okio) } androidMain.dependencies { implementation(libs.kotlinx.coroutines.android) @@ -30,5 +44,8 @@ kotlin { commonTest.dependencies { implementation(libs.kotlinx.coroutines.test) } + iosMain.dependencies { + api(libs.kermit.simple) + } } } \ No newline at end of file diff --git a/core/common/src/androidMain/kotlin/org/mifospay/common/DebugUtil.kt b/core/common/src/androidMain/kotlin/org/mifospay/common/DebugUtil.kt deleted file mode 100644 index 685662541..000000000 --- a/core/common/src/androidMain/kotlin/org/mifospay/common/DebugUtil.kt +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2024 Mifos Initiative - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. - * - * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md - */ -package org.mifospay.common - -import android.util.Log - -// TODO Move into separate module -object DebugUtil { - - fun log(vararg objects: Any): Array { - var stringToPrint = "" - for (`object` in objects) { - stringToPrint += "$`object`, " - } - stringToPrint = stringToPrint.substring(0, stringToPrint.lastIndexOf(',')) - Log.d("QXZ:: ", stringToPrint) - return objects as Array - } -} diff --git a/core/common/src/androidMain/kotlin/org/mifospay/common/FileUtils.kt b/core/common/src/androidMain/kotlin/org/mifospay/common/FileUtils.kt deleted file mode 100644 index d3725d562..000000000 --- a/core/common/src/androidMain/kotlin/org/mifospay/common/FileUtils.kt +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2024 Mifos Initiative - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. - * - * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md - */ -package org.mifospay.common - -import android.util.Log -import java.io.File -import java.io.FileOutputStream -import java.io.InputStream -import java.io.OutputStream - -object FileUtils { - - fun writeInputStreamDataToFile(inputStream: InputStream, file: File?): Boolean { - return try { - val out: OutputStream = FileOutputStream(file) - val buf = ByteArray(1024) - var len: Int - while (inputStream.read(buf).also { len = it } > 0) { - out.write(buf, 0, len) - } - out.close() - inputStream.close() - true - } catch (e: Exception) { - Log.e("Message", e.message.toString()) - false - } - } -} diff --git a/core/common/src/androidMain/kotlin/org/mifospay/common/Utils.kt b/core/common/src/androidMain/kotlin/org/mifospay/common/Utils.kt deleted file mode 100644 index 5b18a303d..000000000 --- a/core/common/src/androidMain/kotlin/org/mifospay/common/Utils.kt +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2024 Mifos Initiative - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. - * - * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md - */ -package org.mifospay.common - -import java.text.NumberFormat -import java.util.Currency - -object Utils { - - @JvmStatic - fun getFormattedAccountBalance( - balance: Double?, - currencyCode: String?, - maximumFractionDigits: Int? = 0, - ): String { - val accountBalanceFormatter = NumberFormat.getCurrencyInstance() - accountBalanceFormatter.maximumFractionDigits = maximumFractionDigits ?: 0 - accountBalanceFormatter.currency = Currency.getInstance(currencyCode) - return accountBalanceFormatter.format(balance) - } - - fun List.toArrayList(): ArrayList { - val array: ArrayList = ArrayList() - for (index in this) array.add(index) - return array - } -} diff --git a/core/common/src/androidMain/kotlin/org/mifospay/core/common/FileUtils.android.kt b/core/common/src/androidMain/kotlin/org/mifospay/core/common/FileUtils.android.kt new file mode 100644 index 000000000..53d528d60 --- /dev/null +++ b/core/common/src/androidMain/kotlin/org/mifospay/core/common/FileUtils.android.kt @@ -0,0 +1,5 @@ +package org.mifospay.core.common + + +// JVM and Android implementation +actual fun createPlatformFileUtils(): FileUtils = CommonFileUtils() \ No newline at end of file diff --git a/core/common/src/androidMain/kotlin/org/mifospay/core/common/Utils.android.kt b/core/common/src/androidMain/kotlin/org/mifospay/core/common/Utils.android.kt new file mode 100644 index 000000000..9ece3cb54 --- /dev/null +++ b/core/common/src/androidMain/kotlin/org/mifospay/core/common/Utils.android.kt @@ -0,0 +1,17 @@ +package org.mifospay.core.common + +import java.text.NumberFormat +import java.util.Currency + +actual class CurrencyFormatter { + actual fun format( + balance: Double?, + currencyCode: String?, + maximumFractionDigits: Int?, + ): String { + val balanceFormatter = NumberFormat.getCurrencyInstance() + balanceFormatter.maximumFractionDigits = maximumFractionDigits ?: 0 + balanceFormatter.currency = Currency.getInstance(currencyCode) + return balanceFormatter.format(balance) + } +} \ No newline at end of file diff --git a/core/common/src/androidMain/kotlin/org/mifospay/core/network/di/CoroutineScopesModule.kt b/core/common/src/androidMain/kotlin/org/mifospay/core/network/di/CoroutineScopesModule.kt deleted file mode 100644 index 501cf3b80..000000000 --- a/core/common/src/androidMain/kotlin/org/mifospay/core/network/di/CoroutineScopesModule.kt +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright 2024 Mifos Initiative - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. - * - * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md - */ -package org.mifospay.core.network.di - -import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.SupervisorJob -import org.koin.core.qualifier.named -import org.koin.dsl.module - -val CoroutineScopesModule = module { - - single(named("ApplicationScope")) { - CoroutineScope(SupervisorJob() + Dispatchers.Default) - } -} diff --git a/core/common/src/androidMain/kotlin/org/mifospay/common/Constants.kt b/core/common/src/commonMain/kotlin/org/mifospay/core/common/Constants.kt similarity index 99% rename from core/common/src/androidMain/kotlin/org/mifospay/common/Constants.kt rename to core/common/src/commonMain/kotlin/org/mifospay/core/common/Constants.kt index 83371ea82..8dbd49a63 100644 --- a/core/common/src/androidMain/kotlin/org/mifospay/common/Constants.kt +++ b/core/common/src/commonMain/kotlin/org/mifospay/core/common/Constants.kt @@ -7,7 +7,7 @@ * * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md */ -package org.mifospay.common +package org.mifospay.core.common /** * Created by naman on 17/6/17. diff --git a/core/common/src/androidMain/kotlin/org/mifospay/common/CreditCardUtils.kt b/core/common/src/commonMain/kotlin/org/mifospay/core/common/CreditCardUtils.kt similarity index 96% rename from core/common/src/androidMain/kotlin/org/mifospay/common/CreditCardUtils.kt rename to core/common/src/commonMain/kotlin/org/mifospay/core/common/CreditCardUtils.kt index 9f114eb32..87a60bc4e 100644 --- a/core/common/src/androidMain/kotlin/org/mifospay/common/CreditCardUtils.kt +++ b/core/common/src/commonMain/kotlin/org/mifospay/core/common/CreditCardUtils.kt @@ -7,7 +7,7 @@ * * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md */ -package org.mifospay.common +package org.mifospay.core.common object CreditCardUtils { fun validateCreditCardNumber(str: String): Boolean { diff --git a/core/common/src/commonMain/kotlin/org/mifospay/core/common/DebugUtil.kt b/core/common/src/commonMain/kotlin/org/mifospay/core/common/DebugUtil.kt new file mode 100644 index 000000000..2611aab15 --- /dev/null +++ b/core/common/src/commonMain/kotlin/org/mifospay/core/common/DebugUtil.kt @@ -0,0 +1,23 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ +package org.mifospay.core.common + +import co.touchlab.kermit.Logger + +object DebugUtil { + + private val logger = Logger.withTag("QXZ") + + fun log(vararg objects: Any): Array { + val stringToPrint = objects.joinToString(", ") + logger.d { stringToPrint } + return objects + } +} diff --git a/core/common/src/commonMain/kotlin/org/mifospay/core/common/FileUtils.kt b/core/common/src/commonMain/kotlin/org/mifospay/core/common/FileUtils.kt new file mode 100644 index 000000000..1c664646e --- /dev/null +++ b/core/common/src/commonMain/kotlin/org/mifospay/core/common/FileUtils.kt @@ -0,0 +1,39 @@ +package org.mifospay.core.common + +import co.touchlab.kermit.Logger +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.withContext +import okio.FileSystem +import okio.Path.Companion.toPath +import okio.SYSTEM + + +interface FileUtils { + suspend fun writeInputStreamDataToFile(inputStream: ByteArray, filePath: String): Boolean + + companion object { + val logger = Logger.withTag("FileUtils") + } +} + +expect fun createPlatformFileUtils(): FileUtils + +class CommonFileUtils : FileUtils { + override suspend fun writeInputStreamDataToFile( + inputStream: ByteArray, + filePath: String, + ): Boolean = + withContext(Dispatchers.Default) { + try { + val path = filePath.toPath() + FileSystem.SYSTEM.write(path) { + write(inputStream) + } + + true + } catch (e: Exception) { + FileUtils.logger.e { "Error writing file: ${e.message}" } + false + } + } +} \ No newline at end of file diff --git a/core/common/src/androidMain/kotlin/org/mifospay/core/network/MifosDispatchers.kt b/core/common/src/commonMain/kotlin/org/mifospay/core/common/MifosDispatchers.kt similarity index 94% rename from core/common/src/androidMain/kotlin/org/mifospay/core/network/MifosDispatchers.kt rename to core/common/src/commonMain/kotlin/org/mifospay/core/common/MifosDispatchers.kt index 3122bf45b..c692ec1bc 100644 --- a/core/common/src/androidMain/kotlin/org/mifospay/core/network/MifosDispatchers.kt +++ b/core/common/src/commonMain/kotlin/org/mifospay/core/common/MifosDispatchers.kt @@ -7,7 +7,7 @@ * * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md */ -package org.mifospay.core.network +package org.mifospay.core.common import org.koin.core.annotation.Qualifier diff --git a/core/common/src/androidMain/kotlin/org/mifospay/common/NavArgsConstants.kt b/core/common/src/commonMain/kotlin/org/mifospay/core/common/NavArgsConstants.kt similarity index 92% rename from core/common/src/androidMain/kotlin/org/mifospay/common/NavArgsConstants.kt rename to core/common/src/commonMain/kotlin/org/mifospay/core/common/NavArgsConstants.kt index 0dcb73540..f243d5cee 100644 --- a/core/common/src/androidMain/kotlin/org/mifospay/common/NavArgsConstants.kt +++ b/core/common/src/commonMain/kotlin/org/mifospay/core/common/NavArgsConstants.kt @@ -7,7 +7,7 @@ * * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md */ -package org.mifospay.common +package org.mifospay.core.common const val PAYEE_EXTERNAL_ID_ARG = "payeeExternalId" const val TRANSFER_AMOUNT_ARG = "transferAmount" diff --git a/core/common/src/commonMain/kotlin/org/mifospay/core/common/Utils.kt b/core/common/src/commonMain/kotlin/org/mifospay/core/common/Utils.kt new file mode 100644 index 000000000..faa6d8f50 --- /dev/null +++ b/core/common/src/commonMain/kotlin/org/mifospay/core/common/Utils.kt @@ -0,0 +1,9 @@ +package org.mifospay.core.common + +expect class CurrencyFormatter { + fun format(balance: Double?, currencyCode: String?, maximumFractionDigits: Int?): String +} + +fun List.toArrayList(): ArrayList { + return ArrayList(this) +} \ No newline at end of file diff --git a/core/common/src/androidMain/kotlin/org/mifospay/core/network/di/DispatchersModule.kt b/core/common/src/commonMain/kotlin/org/mifospay/core/common/di/DispatchersModule.kt similarity index 68% rename from core/common/src/androidMain/kotlin/org/mifospay/core/network/di/DispatchersModule.kt rename to core/common/src/commonMain/kotlin/org/mifospay/core/common/di/DispatchersModule.kt index 9ad058f96..a41d60920 100644 --- a/core/common/src/androidMain/kotlin/org/mifospay/core/network/di/DispatchersModule.kt +++ b/core/common/src/commonMain/kotlin/org/mifospay/core/common/di/DispatchersModule.kt @@ -7,15 +7,21 @@ * * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md */ -package org.mifospay.core.network.di +package org.mifospay.core.common.di import kotlinx.coroutines.CoroutineDispatcher +import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.IO +import kotlinx.coroutines.SupervisorJob import org.koin.core.qualifier.named import org.koin.dsl.module -import org.mifospay.core.network.MifosDispatchers +import org.mifospay.core.common.MifosDispatchers val DispatchersModule = module { single(named(MifosDispatchers.IO.name)) { Dispatchers.IO } single(named(MifosDispatchers.Default.name)) { Dispatchers.Default } + single(named("ApplicationScope")) { + CoroutineScope(SupervisorJob() + Dispatchers.Default) + } } diff --git a/core/common/src/jvmMain/kotlin/org/mifospay/core/common/FileUtils.jvm.kt b/core/common/src/jvmMain/kotlin/org/mifospay/core/common/FileUtils.jvm.kt new file mode 100644 index 000000000..a619afac0 --- /dev/null +++ b/core/common/src/jvmMain/kotlin/org/mifospay/core/common/FileUtils.jvm.kt @@ -0,0 +1,5 @@ +package org.mifospay.core.common + +// JVM and Android implementation +actual fun createPlatformFileUtils(): FileUtils = CommonFileUtils() + diff --git a/core/common/src/jvmMain/kotlin/org/mifospay/core/common/Utils.jvm.kt b/core/common/src/jvmMain/kotlin/org/mifospay/core/common/Utils.jvm.kt new file mode 100644 index 000000000..806fd7af7 --- /dev/null +++ b/core/common/src/jvmMain/kotlin/org/mifospay/core/common/Utils.jvm.kt @@ -0,0 +1,17 @@ +package org.mifospay.core.common + +import java.text.NumberFormat +import java.util.Currency + +actual class CurrencyFormatter { + actual fun format( + balance: Double?, + currencyCode: String?, + maximumFractionDigits: Int?, + ): String { + val numberFormat = NumberFormat.getCurrencyInstance() + numberFormat.maximumFractionDigits = maximumFractionDigits ?: 0 + numberFormat.currency = Currency.getInstance(currencyCode) + return numberFormat.format(balance) + } +} \ No newline at end of file diff --git a/core/common/src/nativeMain/kotlin/org/mifospay/core/common/FileUtils.native.kt b/core/common/src/nativeMain/kotlin/org/mifospay/core/common/FileUtils.native.kt new file mode 100644 index 000000000..d60f3b49e --- /dev/null +++ b/core/common/src/nativeMain/kotlin/org/mifospay/core/common/FileUtils.native.kt @@ -0,0 +1,24 @@ +package org.mifospay.core.common + +import kotlinx.cinterop.ExperimentalForeignApi +import kotlinx.cinterop.refTo +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.withContext + +// iOS implementation +@OptIn(ExperimentalForeignApi::class) +actual fun createPlatformFileUtils(): FileUtils = object : FileUtils { + override suspend fun writeInputStreamDataToFile(inputStream: ByteArray, filePath: String): Boolean = + withContext(Dispatchers.Default) { + try { + val nsData = inputStream.toNSData() + nsData.writeToFile(filePath, true) + true + } catch (e: Exception) { + FileUtils.logger.e { "Error writing file: ${e.message}" } + false + } + } + + private fun ByteArray.toNSData(): NSData = NSData.create(bytes = this.refTo(0), length = this.size.toULong()) +} \ No newline at end of file diff --git a/core/common/src/nativeMain/kotlin/org/mifospay/core/common/Utils.native.kt b/core/common/src/nativeMain/kotlin/org/mifospay/core/common/Utils.native.kt new file mode 100644 index 000000000..a7c68ea45 --- /dev/null +++ b/core/common/src/nativeMain/kotlin/org/mifospay/core/common/Utils.native.kt @@ -0,0 +1,17 @@ +package org.mifospay.core.common + +import platform.Foundation.NSNumberFormatter + +actual class CurrencyFormatter { + actual fun format( + balance: Double?, + currencyCode: String?, + maximumFractionDigits: Int?, + ): String { + val numberFormatter = NSNumberFormatter() + numberFormatter.numberStyle = NSNumberFormatterCurrencyStyle + numberFormatter.currencyCode = currencyCode + numberFormatter.maximumFractionDigits = maximumFractionDigits ?: 0 + return numberFormatter.stringFromNumber(balance ?: 0.0) ?: "" + } +} \ No newline at end of file diff --git a/feature/accounts/src/main/kotlin/org/mifospay/feature/bank/accounts/navigation/BankAccountDetailNavigation.kt b/feature/accounts/src/main/kotlin/org/mifospay/feature/bank/accounts/navigation/BankAccountDetailNavigation.kt index 369495ee9..43c2f723b 100644 --- a/feature/accounts/src/main/kotlin/org/mifospay/feature/bank/accounts/navigation/BankAccountDetailNavigation.kt +++ b/feature/accounts/src/main/kotlin/org/mifospay/feature/bank/accounts/navigation/BankAccountDetailNavigation.kt @@ -16,7 +16,7 @@ import androidx.navigation.NavType import androidx.navigation.compose.composable import androidx.navigation.navArgument import com.mifospay.core.model.domain.BankAccountDetails -import org.mifospay.common.Constants +import org.mifospay.core.common.Constants import org.mifospay.feature.bank.accounts.details.BankAccountDetailScreen const val BANK_ACCOUNT_DETAIL_ROUTE = "bank_account_detail_route" diff --git a/feature/auth/src/main/kotlin/org/mifospay/feature/auth/mobileVerify/MobileVerificationScreen.kt b/feature/auth/src/main/kotlin/org/mifospay/feature/auth/mobileVerify/MobileVerificationScreen.kt index db9ec6611..31cc30a7d 100644 --- a/feature/auth/src/main/kotlin/org/mifospay/feature/auth/mobileVerify/MobileVerificationScreen.kt +++ b/feature/auth/src/main/kotlin/org/mifospay/feature/auth/mobileVerify/MobileVerificationScreen.kt @@ -42,7 +42,7 @@ import androidx.compose.ui.unit.dp import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.mifos.library.countrycodepicker.CountryCodePicker import org.koin.androidx.compose.koinViewModel -import org.mifospay.common.Constants +import org.mifospay.core.common.Constants import org.mifospay.core.designsystem.component.MifosButton import org.mifospay.core.designsystem.component.MifosLoadingWheel import org.mifospay.core.designsystem.component.MifosOutlinedTextField diff --git a/feature/auth/src/main/kotlin/org/mifospay/feature/auth/navigation/MobileVerificationScreenNavigation.kt b/feature/auth/src/main/kotlin/org/mifospay/feature/auth/navigation/MobileVerificationScreenNavigation.kt index 112dd145a..2eb75757b 100644 --- a/feature/auth/src/main/kotlin/org/mifospay/feature/auth/navigation/MobileVerificationScreenNavigation.kt +++ b/feature/auth/src/main/kotlin/org/mifospay/feature/auth/navigation/MobileVerificationScreenNavigation.kt @@ -16,7 +16,7 @@ import androidx.navigation.NavGraphBuilder import androidx.navigation.NavType import androidx.navigation.compose.composable import androidx.navigation.navArgument -import org.mifospay.common.Constants +import org.mifospay.core.common.Constants import org.mifospay.feature.auth.mobileVerify.MobileVerificationScreen const val MOBILE_VERIFICATION_ROUTE = "mobile_verification_route" diff --git a/feature/auth/src/main/kotlin/org/mifospay/feature/auth/signup/SignupViewModel.kt b/feature/auth/src/main/kotlin/org/mifospay/feature/auth/signup/SignupViewModel.kt index 4fd21843f..284d93cb4 100644 --- a/feature/auth/src/main/kotlin/org/mifospay/feature/auth/signup/SignupViewModel.kt +++ b/feature/auth/src/main/kotlin/org/mifospay/feature/auth/signup/SignupViewModel.kt @@ -25,8 +25,8 @@ import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.stateIn -import org.mifospay.common.Constants -import org.mifospay.common.DebugUtil +import org.mifospay.core.common.Constants +import org.mifospay.core.common.DebugUtil import org.mifospay.core.data.base.UseCase import org.mifospay.core.data.base.UseCaseHandler import org.mifospay.core.data.domain.usecase.client.CreateClient diff --git a/feature/auth/src/main/kotlin/org/mifospay/feature/auth/socialSignup/SocialSignupMethodScreen.kt b/feature/auth/src/main/kotlin/org/mifospay/feature/auth/socialSignup/SocialSignupMethodScreen.kt index f7bc19203..87c377b69 100644 --- a/feature/auth/src/main/kotlin/org/mifospay/feature/auth/socialSignup/SocialSignupMethodScreen.kt +++ b/feature/auth/src/main/kotlin/org/mifospay/feature/auth/socialSignup/SocialSignupMethodScreen.kt @@ -58,7 +58,7 @@ import com.google.android.libraries.identity.googleid.GetGoogleIdOption import com.google.android.libraries.identity.googleid.GoogleIdTokenCredential import com.google.android.libraries.identity.googleid.GoogleIdTokenParsingException import kotlinx.coroutines.launch -import org.mifospay.common.Constants +import org.mifospay.core.common.Constants import org.mifospay.core.data.util.Constants.MIFOS_CONSUMER_SAVINGS_PRODUCT_ID import org.mifospay.core.data.util.Constants.MIFOS_MERCHANT_SAVINGS_PRODUCT_ID import org.mifospay.core.designsystem.component.MifosBottomSheet diff --git a/feature/editpassword/src/main/kotlin/org/mifospay/feature/editpassword/EditPasswordViewModel.kt b/feature/editpassword/src/main/kotlin/org/mifospay/feature/editpassword/EditPasswordViewModel.kt index f905b6e28..99f780494 100644 --- a/feature/editpassword/src/main/kotlin/org/mifospay/feature/editpassword/EditPasswordViewModel.kt +++ b/feature/editpassword/src/main/kotlin/org/mifospay/feature/editpassword/EditPasswordViewModel.kt @@ -13,7 +13,7 @@ import androidx.lifecycle.ViewModel import com.mifospay.core.model.domain.user.UpdateUserEntityPassword import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.StateFlow -import org.mifospay.common.Constants +import org.mifospay.core.common.Constants import org.mifospay.core.data.base.UseCase import org.mifospay.core.data.base.UseCaseHandler import org.mifospay.core.data.domain.usecase.user.AuthenticateUser diff --git a/feature/history/src/main/kotlin/org/mifospay/feature/specific/transactions/SpecificTransactionsViewModel.kt b/feature/history/src/main/kotlin/org/mifospay/feature/specific/transactions/SpecificTransactionsViewModel.kt index ad53eef1d..d44c95e9e 100644 --- a/feature/history/src/main/kotlin/org/mifospay/feature/specific/transactions/SpecificTransactionsViewModel.kt +++ b/feature/history/src/main/kotlin/org/mifospay/feature/specific/transactions/SpecificTransactionsViewModel.kt @@ -14,11 +14,11 @@ import androidx.lifecycle.ViewModel import com.mifospay.core.model.domain.Transaction import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.asStateFlow +import org.mifospay.core.common.Constants import org.mifospay.core.data.base.TaskLooper import org.mifospay.core.data.base.UseCase import org.mifospay.core.data.base.UseCaseFactory import org.mifospay.core.data.domain.usecase.account.FetchAccountTransfer -import org.mifospay.core.data.util.Constants import org.mifospay.feature.specific.transactions.SpecificTransactionsUiState.Loading import org.mifospay.feature.specific.transactions.navigation.ACCOUNT_NUMBER_ARG import org.mifospay.feature.specific.transactions.navigation.TRANSACTIONS_ARG @@ -54,7 +54,7 @@ class SpecificTransactionsViewModel( as UseCase, values = FetchAccountTransfer.RequestValues(transferId), taskData = TaskLooper.TaskData( - org.mifospay.common.Constants.TRANSFER_DETAILS, + Constants.TRANSFER_DETAILS, i, ), ) @@ -66,7 +66,7 @@ class SpecificTransactionsViewModel( response: R, ) { when (taskData.taskName) { - org.mifospay.common.Constants.TRANSFER_DETAILS -> { + Constants.TRANSFER_DETAILS -> { val responseValue = response as FetchAccountTransfer.ResponseValue val index = taskData.taskId transactions[index].transferDetail = responseValue.transferDetail diff --git a/feature/history/src/main/kotlin/org/mifospay/feature/transaction/detail/TransactionDetailScreen.kt b/feature/history/src/main/kotlin/org/mifospay/feature/transaction/detail/TransactionDetailScreen.kt index d57010eb1..948e38205 100644 --- a/feature/history/src/main/kotlin/org/mifospay/feature/transaction/detail/TransactionDetailScreen.kt +++ b/feature/history/src/main/kotlin/org/mifospay/feature/transaction/detail/TransactionDetailScreen.kt @@ -38,7 +38,7 @@ import com.mifospay.core.model.domain.Transaction import com.mifospay.core.model.domain.TransactionType import com.mifospay.core.model.entity.accounts.savings.TransferDetail import org.koin.androidx.compose.koinViewModel -import org.mifospay.common.Constants +import org.mifospay.core.common.Constants import org.mifospay.core.designsystem.component.MfLoadingWheel import org.mifospay.core.designsystem.theme.MifosTheme import org.mifospay.core.ui.ErrorScreenContent diff --git a/feature/home/src/main/kotlin/org/mifospay/feature/home/HomeScreen.kt b/feature/home/src/main/kotlin/org/mifospay/feature/home/HomeScreen.kt index 847d509ce..717029f2e 100644 --- a/feature/home/src/main/kotlin/org/mifospay/feature/home/HomeScreen.kt +++ b/feature/home/src/main/kotlin/org/mifospay/feature/home/HomeScreen.kt @@ -51,7 +51,7 @@ import com.mifospay.core.model.domain.Currency import com.mifospay.core.model.domain.Transaction import com.mifospay.core.model.domain.TransactionType import org.koin.androidx.compose.koinViewModel -import org.mifospay.common.Utils +import org.mifospay.core.common.CurrencyFormatter import org.mifospay.core.designsystem.component.MfLoadingWheel import org.mifospay.core.designsystem.theme.border import org.mifospay.core.designsystem.theme.lightGrey @@ -174,9 +174,11 @@ private fun MifosWalletCardScreen( Spacer(modifier = Modifier.height(10.dp)) val accountBalance = if (account != null) { - Utils.getFormattedAccountBalance( - account.balance, - account.currency.code, + val currencyFormatter = CurrencyFormatter() + currencyFormatter.format( + balance = account.balance, + currencyCode = account.currency.code, + maximumFractionDigits = null, ) } else { "0" diff --git a/feature/invoices/src/main/kotlin/org/mifospay/feature/invoices/InvoiceDetailScreen.kt b/feature/invoices/src/main/kotlin/org/mifospay/feature/invoices/InvoiceDetailScreen.kt index 5655614e6..eec164824 100644 --- a/feature/invoices/src/main/kotlin/org/mifospay/feature/invoices/InvoiceDetailScreen.kt +++ b/feature/invoices/src/main/kotlin/org/mifospay/feature/invoices/InvoiceDetailScreen.kt @@ -39,7 +39,7 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.mifospay.core.model.entity.Invoice import org.mifospay.core.model.utils.DateHelper import org.koin.androidx.compose.koinViewModel -import org.mifospay.common.Constants +import org.mifospay.core.common.Constants import org.mifospay.core.designsystem.component.MfOverlayLoadingWheel import org.mifospay.core.designsystem.component.MifosScaffold import org.mifospay.core.designsystem.theme.MifosTheme diff --git a/feature/invoices/src/main/kotlin/org/mifospay/feature/invoices/InvoicesViewModel.kt b/feature/invoices/src/main/kotlin/org/mifospay/feature/invoices/InvoicesViewModel.kt index 5ef00c24c..be692fc83 100644 --- a/feature/invoices/src/main/kotlin/org/mifospay/feature/invoices/InvoicesViewModel.kt +++ b/feature/invoices/src/main/kotlin/org/mifospay/feature/invoices/InvoicesViewModel.kt @@ -14,7 +14,7 @@ import androidx.lifecycle.ViewModel import com.mifospay.core.model.entity.Invoice import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.StateFlow -import org.mifospay.common.Constants.INVOICE_DOMAIN +import org.mifospay.core.common.Constants.INVOICE_DOMAIN import org.mifospay.core.data.base.UseCase import org.mifospay.core.data.base.UseCaseHandler import org.mifospay.core.data.domain.usecase.invoice.FetchInvoices diff --git a/feature/kyc/src/main/kotlin/org/mifospay/feature/kyc/KYCLevel2ViewModel.kt b/feature/kyc/src/main/kotlin/org/mifospay/feature/kyc/KYCLevel2ViewModel.kt index 185589b27..6452e6dc0 100644 --- a/feature/kyc/src/main/kotlin/org/mifospay/feature/kyc/KYCLevel2ViewModel.kt +++ b/feature/kyc/src/main/kotlin/org/mifospay/feature/kyc/KYCLevel2ViewModel.kt @@ -16,7 +16,7 @@ import kotlinx.coroutines.flow.StateFlow import okhttp3.MediaType.Companion.toMediaTypeOrNull import okhttp3.MultipartBody import okhttp3.RequestBody.Companion.asRequestBody -import org.mifospay.common.Constants +import org.mifospay.core.common.Constants import org.mifospay.core.data.base.UseCase import org.mifospay.core.data.base.UseCaseHandler import org.mifospay.core.data.domain.usecase.kyc.UploadKYCDocs diff --git a/feature/make-transfer/src/main/kotlin/org/mifospay/feature/make/transfer/MakeTransferScreen.kt b/feature/make-transfer/src/main/kotlin/org/mifospay/feature/make/transfer/MakeTransferScreen.kt index 4a6bf03cd..361136ddf 100644 --- a/feature/make-transfer/src/main/kotlin/org/mifospay/feature/make/transfer/MakeTransferScreen.kt +++ b/feature/make-transfer/src/main/kotlin/org/mifospay/feature/make/transfer/MakeTransferScreen.kt @@ -43,7 +43,7 @@ import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import androidx.lifecycle.compose.collectAsStateWithLifecycle import org.koin.androidx.compose.koinViewModel -import org.mifospay.common.Constants +import org.mifospay.core.common.Constants import org.mifospay.core.designsystem.component.MifosButton import org.mifospay.core.designsystem.component.MifosLoadingWheel diff --git a/feature/make-transfer/src/main/kotlin/org/mifospay/feature/make/transfer/MakeTransferViewModel.kt b/feature/make-transfer/src/main/kotlin/org/mifospay/feature/make/transfer/MakeTransferViewModel.kt index 1a1ed3df1..73021510a 100644 --- a/feature/make-transfer/src/main/kotlin/org/mifospay/feature/make/transfer/MakeTransferViewModel.kt +++ b/feature/make-transfer/src/main/kotlin/org/mifospay/feature/make/transfer/MakeTransferViewModel.kt @@ -19,8 +19,8 @@ import kotlinx.coroutines.flow.asStateFlow import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.stateIn -import org.mifospay.common.PAYEE_EXTERNAL_ID_ARG -import org.mifospay.common.TRANSFER_AMOUNT_ARG +import org.mifospay.core.common.PAYEE_EXTERNAL_ID_ARG +import org.mifospay.core.common.TRANSFER_AMOUNT_ARG import org.mifospay.core.data.base.UseCase import org.mifospay.core.data.base.UseCaseHandler import org.mifospay.core.data.domain.usecase.account.TransferFunds diff --git a/feature/make-transfer/src/main/kotlin/org/mifospay/feature/make/transfer/navigation/MakeTransferNavigation.kt b/feature/make-transfer/src/main/kotlin/org/mifospay/feature/make/transfer/navigation/MakeTransferNavigation.kt index 3aa3c0b78..af079ba7b 100644 --- a/feature/make-transfer/src/main/kotlin/org/mifospay/feature/make/transfer/navigation/MakeTransferNavigation.kt +++ b/feature/make-transfer/src/main/kotlin/org/mifospay/feature/make/transfer/navigation/MakeTransferNavigation.kt @@ -15,14 +15,14 @@ import androidx.navigation.NavOptions import androidx.navigation.NavType import androidx.navigation.navArgument import com.mifos.library.material3.navigation.bottomSheet -import org.mifospay.common.PAYEE_EXTERNAL_ID_ARG -import org.mifospay.common.TRANSFER_AMOUNT_ARG +import org.mifospay.core.common.PAYEE_EXTERNAL_ID_ARG +import org.mifospay.core.common.TRANSFER_AMOUNT_ARG import org.mifospay.feature.make.transfer.MakeTransferScreenRoute const val MAKE_TRANSFER_ROUTE_BASE = "make_transfer_route" const val MAKE_TRANSFER_ROUTE = MAKE_TRANSFER_ROUTE_BASE + - "?${PAYEE_EXTERNAL_ID_ARG}={$PAYEE_EXTERNAL_ID_ARG}" + - "&${TRANSFER_AMOUNT_ARG}={$TRANSFER_AMOUNT_ARG}" + "?$PAYEE_EXTERNAL_ID_ARG={$PAYEE_EXTERNAL_ID_ARG}" + + "&$TRANSFER_AMOUNT_ARG={$TRANSFER_AMOUNT_ARG}" fun NavController.navigateToMakeTransferScreen( externalId: String? = null, @@ -30,11 +30,11 @@ fun NavController.navigateToMakeTransferScreen( navOptions: NavOptions? = null, ) { val route = MAKE_TRANSFER_ROUTE_BASE + if (transferAmount != null) { - "?${PAYEE_EXTERNAL_ID_ARG}=$externalId" + - "&${TRANSFER_AMOUNT_ARG}=$transferAmount" + "?$PAYEE_EXTERNAL_ID_ARG=$externalId" + + "&$TRANSFER_AMOUNT_ARG=$transferAmount" } else { - "?${PAYEE_EXTERNAL_ID_ARG}=$externalId" + - "&${TRANSFER_AMOUNT_ARG}=${"0.0"}" + "?$PAYEE_EXTERNAL_ID_ARG=$externalId" + + "&$TRANSFER_AMOUNT_ARG=${"0.0"}" } navigate(route, navOptions) } diff --git a/feature/merchants/src/main/kotlin/org/mifospay/feature/merchants/MerchantTransferViewModel.kt b/feature/merchants/src/main/kotlin/org/mifospay/feature/merchants/MerchantTransferViewModel.kt index 8141528ca..4407bcfe7 100644 --- a/feature/merchants/src/main/kotlin/org/mifospay/feature/merchants/MerchantTransferViewModel.kt +++ b/feature/merchants/src/main/kotlin/org/mifospay/feature/merchants/MerchantTransferViewModel.kt @@ -15,7 +15,7 @@ import com.mifospay.core.model.domain.Transaction import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.asStateFlow -import org.mifospay.common.Constants +import org.mifospay.core.common.Constants import org.mifospay.core.data.base.TaskLooper import org.mifospay.core.data.base.TaskLooper.TaskData import org.mifospay.core.data.base.UseCase diff --git a/feature/profile/src/main/kotlin/org/mifospay/feature/profile/ProfileViewModel.kt b/feature/profile/src/main/kotlin/org/mifospay/feature/profile/ProfileViewModel.kt index dd6d71855..e6c24ded3 100644 --- a/feature/profile/src/main/kotlin/org/mifospay/feature/profile/ProfileViewModel.kt +++ b/feature/profile/src/main/kotlin/org/mifospay/feature/profile/ProfileViewModel.kt @@ -17,7 +17,7 @@ import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.launch import okhttp3.ResponseBody -import org.mifospay.common.DebugUtil +import org.mifospay.core.common.DebugUtil import org.mifospay.core.data.base.UseCase import org.mifospay.core.data.base.UseCaseHandler import org.mifospay.core.data.domain.usecase.client.FetchClientImage diff --git a/feature/receipt/src/main/kotlin/org/mifospay/feature/receipt/ReceiptScreen.kt b/feature/receipt/src/main/kotlin/org/mifospay/feature/receipt/ReceiptScreen.kt index 16c18febd..faa322c2a 100644 --- a/feature/receipt/src/main/kotlin/org/mifospay/feature/receipt/ReceiptScreen.kt +++ b/feature/receipt/src/main/kotlin/org/mifospay/feature/receipt/ReceiptScreen.kt @@ -60,7 +60,7 @@ import com.mifospay.core.model.domain.TransactionType import com.mifospay.core.model.entity.accounts.savings.TransferDetail import kotlinx.coroutines.launch import org.koin.androidx.compose.koinViewModel -import org.mifospay.common.Constants +import org.mifospay.core.common.Constants import org.mifospay.core.designsystem.component.FloatingActionButtonContent import org.mifospay.core.designsystem.component.MifosOverlayLoadingWheel import org.mifospay.core.designsystem.component.MifosScaffold diff --git a/feature/receipt/src/main/kotlin/org/mifospay/feature/receipt/ReceiptViewModel.kt b/feature/receipt/src/main/kotlin/org/mifospay/feature/receipt/ReceiptViewModel.kt index 6769ac271..991bfc1c4 100644 --- a/feature/receipt/src/main/kotlin/org/mifospay/feature/receipt/ReceiptViewModel.kt +++ b/feature/receipt/src/main/kotlin/org/mifospay/feature/receipt/ReceiptViewModel.kt @@ -13,14 +13,16 @@ import android.net.Uri import android.os.Environment import androidx.lifecycle.SavedStateHandle import androidx.lifecycle.ViewModel +import androidx.lifecycle.viewModelScope import com.mifospay.core.model.domain.Transaction import com.mifospay.core.model.entity.accounts.savings.TransferDetail import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.asStateFlow +import kotlinx.coroutines.launch import okhttp3.ResponseBody -import org.mifospay.common.Constants -import org.mifospay.common.FileUtils +import org.mifospay.core.common.Constants +import org.mifospay.core.common.createPlatformFileUtils import org.mifospay.core.data.base.UseCase import org.mifospay.core.data.base.UseCaseHandler import org.mifospay.core.data.domain.usecase.account.DownloadTransactionReceipt @@ -67,16 +69,23 @@ class ReceiptViewModel( } fun writeReceiptToPDF(responseBody: ResponseBody?, filename: String) { - val mifosDirectory = File( - Environment.getExternalStorageDirectory(), - Constants.MIFOSPAY, - ) - if (!mifosDirectory.exists()) { - mifosDirectory.mkdirs() - } - val documentFile = File(mifosDirectory.path, filename) - if (FileUtils.writeInputStreamDataToFile(responseBody!!.byteStream(), documentFile)) { - mFileState.value = PassFileState(documentFile) + viewModelScope.launch { + val mifosDirectory = File( + Environment.getExternalStorageDirectory(), + Constants.MIFOSPAY, + ) + if (!mifosDirectory.exists()) { + mifosDirectory.mkdirs() + } + val documentFile = File(mifosDirectory.path, filename) + val fileUtils = createPlatformFileUtils() + val result = fileUtils.writeInputStreamDataToFile( + responseBody!!.bytes(), + documentFile.path, + ) + if (result) { + mFileState.value = PassFileState(documentFile) + } } } diff --git a/feature/request-money/src/main/kotlin/org/mifospay/feature/request/money/GenerateQr.kt b/feature/request-money/src/main/kotlin/org/mifospay/feature/request/money/GenerateQr.kt index 30457707a..67a3fa6ad 100644 --- a/feature/request-money/src/main/kotlin/org/mifospay/feature/request/money/GenerateQr.kt +++ b/feature/request-money/src/main/kotlin/org/mifospay/feature/request/money/GenerateQr.kt @@ -14,7 +14,7 @@ import com.google.zxing.BarcodeFormat import com.google.zxing.MultiFormatWriter import com.google.zxing.WriterException import com.google.zxing.common.BitMatrix -import org.mifospay.common.Constants +import org.mifospay.core.common.Constants import org.mifospay.core.data.base.UseCase import java.util.Base64 diff --git a/feature/savedcards/src/main/kotlin/org/mifospay/feature/savedcards/AddCardDialogSheet.kt b/feature/savedcards/src/main/kotlin/org/mifospay/feature/savedcards/AddCardDialogSheet.kt index 773768448..13a12ed8a 100644 --- a/feature/savedcards/src/main/kotlin/org/mifospay/feature/savedcards/AddCardDialogSheet.kt +++ b/feature/savedcards/src/main/kotlin/org/mifospay/feature/savedcards/AddCardDialogSheet.kt @@ -33,7 +33,7 @@ import androidx.compose.ui.text.input.KeyboardType import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import com.mifospay.core.model.entity.savedcards.Card -import org.mifospay.common.CreditCardUtils +import org.mifospay.core.common.CreditCardUtils import org.mifospay.core.designsystem.component.MifosBottomSheet import org.mifospay.core.designsystem.component.MifosButton import org.mifospay.core.designsystem.component.MifosOutlinedTextField diff --git a/feature/upi-setup/src/main/kotlin/org/mifospay/feature/upiSetup/navigation/SetupUpiPinNavigation.kt b/feature/upi-setup/src/main/kotlin/org/mifospay/feature/upiSetup/navigation/SetupUpiPinNavigation.kt index 132a8402f..f50648fde 100644 --- a/feature/upi-setup/src/main/kotlin/org/mifospay/feature/upiSetup/navigation/SetupUpiPinNavigation.kt +++ b/feature/upi-setup/src/main/kotlin/org/mifospay/feature/upiSetup/navigation/SetupUpiPinNavigation.kt @@ -16,7 +16,7 @@ import androidx.navigation.NavType import androidx.navigation.compose.composable import androidx.navigation.navArgument import com.mifospay.core.model.domain.BankAccountDetails -import org.mifospay.common.Constants +import org.mifospay.core.common.Constants import org.mifospay.feature.upiSetup.screens.SetupUpiPinScreenRoute const val SETUP_UPI_PIN_ROUTE = "setup_upi_pin_route" diff --git a/feature/upi-setup/src/main/kotlin/org/mifospay/feature/upiSetup/screens/SetUpUPiPinScreen.kt b/feature/upi-setup/src/main/kotlin/org/mifospay/feature/upiSetup/screens/SetUpUPiPinScreen.kt index 02e57efc5..069323459 100644 --- a/feature/upi-setup/src/main/kotlin/org/mifospay/feature/upiSetup/screens/SetUpUPiPinScreen.kt +++ b/feature/upi-setup/src/main/kotlin/org/mifospay/feature/upiSetup/screens/SetUpUPiPinScreen.kt @@ -30,7 +30,7 @@ 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 org.mifospay.common.Constants +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 diff --git a/feature/upi-setup/src/main/kotlin/org/mifospay/feature/upiSetup/screens/SetUpUpiScreenContent.kt b/feature/upi-setup/src/main/kotlin/org/mifospay/feature/upiSetup/screens/SetUpUpiScreenContent.kt index d0f331957..7cac75544 100644 --- a/feature/upi-setup/src/main/kotlin/org/mifospay/feature/upiSetup/screens/SetUpUpiScreenContent.kt +++ b/feature/upi-setup/src/main/kotlin/org/mifospay/feature/upiSetup/screens/SetUpUpiScreenContent.kt @@ -19,7 +19,7 @@ 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.mifospay.common.Constants +import org.mifospay.core.common.Constants import org.mifospay.core.designsystem.theme.MifosTheme @Composable diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 9b9c19999..1f7d9e375 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -39,6 +39,7 @@ googleOss = "17.1.0" googleOssPlugin = "0.10.6" googleidVersion = "1.1.1" junitVersion = "4.13.2" +kermit = "2.0.4" koin = "4.0.0-RC2" koinAnnotationsVersion = "1.4.0-RC4" koinComposeMultiplatform = "1.2.0-Beta4" @@ -63,6 +64,7 @@ minSdk = "24" moduleGraph = "2.5.0" multiplatformSettings = "1.2.0" okHttp3Version = "4.12.0" +okioVersion = "3.9.1" playServicesAuthVersion = "21.2.0" playServicesCodeScanner = "16.1.0" protobuf = "4.26.0" @@ -155,6 +157,8 @@ google-play-services-code-scanner = { group = "com.google.android.gms", name = " googleid = { group = "com.google.android.libraries.identity.googleid", name = "googleid", version.ref = "googleidVersion" } jetbrains-kotlin-stdlib = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib", version.ref = "kotlinStdlibVersion" } junit = { group = "junit", name = "junit", version.ref = "junitVersion" } +kermit-logging = { group = "co.touchlab", name = "kermit", version.ref = "kermit" } +kermit-simple = { group = "co.touchlab", name = "kermit-simple", version.ref = "kermit" } koin-android = { group = "io.insert-koin", name = "koin-android", version.ref = "koin" } koin-androidx-compose = { group = "io.insert-koin", name = "koin-androidx-compose", version.ref = "koin" } koin-androidx-navigation = { group = "io.insert-koin", name = "koin-androidx-navigation", version.ref = "koin" } @@ -215,6 +219,7 @@ reactivex-rxjava = { group = "io.reactivex", name = "rxjava", version.ref = "rxj reactivex-rxjava-android = { group = "io.reactivex", name = "rxandroid", version.ref = "rxandroidVersion" } retrofit-kotlin-serialization = { group = "com.jakewharton.retrofit", name = "retrofit2-kotlinx-serialization-converter", version.ref = "retrofitKotlinxSerializationJson" } room-gradlePlugin = { group = "androidx.room", name = "room-gradle-plugin", version.ref = "room" } +squareup-okio = { group = "com.squareup.okio", name = "okio", version.ref = "okioVersion" } sheets-compose-dialogs-calender = { group = "com.maxkeppeler.sheets-compose-dialogs", name = "calendar", version.ref = "sheets_compose_dialogs_core" } sheets-compose-dialogs-core = { group = "com.maxkeppeler.sheets-compose-dialogs", name = "core", version.ref = "sheets_compose_dialogs_core" } spotless-gradle = { group = "com.diffplug.spotless", name = "spotless-plugin-gradle", version.ref = "spotlessVersion" } diff --git a/mifospay/src/main/java/org/mifospay/di/KoinModules.kt b/mifospay/src/main/java/org/mifospay/di/KoinModules.kt index c3ad261cb..72e1d3422 100644 --- a/mifospay/src/main/java/org/mifospay/di/KoinModules.kt +++ b/mifospay/src/main/java/org/mifospay/di/KoinModules.kt @@ -15,8 +15,8 @@ import org.mifospay.core.analytics.di.AnalyticsModule import org.mifospay.core.data.di.DataModule import org.mifospay.core.data.di.LocalDataModule import org.mifospay.core.datastore.di.CoreDataStoreModule -import org.mifospay.core.network.di.CoroutineScopesModule -import org.mifospay.core.network.di.DispatchersModule +import org.mifospay.core.common.di.CoroutineScopesModule +import org.mifospay.core.common.di.DispatchersModule import org.mifospay.core.network.di.LocalModule import org.mifospay.core.network.di.NetworkModule import org.mifospay.feature.auth.di.AuthModule diff --git a/mifospay/src/main/java/org/mifospay/navigation/LoginNavGraph.kt b/mifospay/src/main/java/org/mifospay/navigation/LoginNavGraph.kt index c80043848..4daf2ca6b 100644 --- a/mifospay/src/main/java/org/mifospay/navigation/LoginNavGraph.kt +++ b/mifospay/src/main/java/org/mifospay/navigation/LoginNavGraph.kt @@ -13,7 +13,7 @@ import androidx.navigation.NavController import androidx.navigation.NavGraphBuilder import androidx.navigation.navigation import org.mifos.library.passcode.navigateToPasscodeScreen -import org.mifospay.common.Constants +import org.mifospay.core.common.Constants import org.mifospay.feature.auth.navigation.LOGIN_ROUTE import org.mifospay.feature.auth.navigation.loginScreen import org.mifospay.feature.auth.navigation.mobileVerificationScreen diff --git a/mifospay/src/main/java/org/mifospay/navigation/MifosNavHost.kt b/mifospay/src/main/java/org/mifospay/navigation/MifosNavHost.kt index 4b84c3e6b..dc2a4acc5 100644 --- a/mifospay/src/main/java/org/mifospay/navigation/MifosNavHost.kt +++ b/mifospay/src/main/java/org/mifospay/navigation/MifosNavHost.kt @@ -16,7 +16,7 @@ import androidx.compose.ui.Modifier import androidx.core.content.FileProvider import androidx.navigation.compose.NavHost import com.mifos.library.material3.navigation.ModalBottomSheetLayout -import org.mifospay.common.Constants +import org.mifospay.core.common.Constants import org.mifospay.core.ui.utility.TabContent import org.mifospay.feature.bank.accounts.AccountsScreen import org.mifospay.feature.bank.accounts.navigation.bankAccountDetailScreen diff --git a/mifospay/src/main/java/org/mifospay/utils/NotificationUtils.kt b/mifospay/src/main/java/org/mifospay/utils/NotificationUtils.kt index 2bdb7c4bd..0e9c596dc 100644 --- a/mifospay/src/main/java/org/mifospay/utils/NotificationUtils.kt +++ b/mifospay/src/main/java/org/mifospay/utils/NotificationUtils.kt @@ -27,7 +27,7 @@ import android.util.Log import android.util.Patterns import androidx.core.app.NotificationCompat import org.mifospay.R -import org.mifospay.common.Constants +import org.mifospay.core.common.Constants import java.io.IOException import java.net.HttpURLConnection import java.net.URL