Refactor: dependencies to version catalog and remove unused files (#1717)

This commit is contained in:
Sk Niyaj Ali 2024-08-08 17:53:43 +05:30 committed by GitHub
parent bac1001012
commit 6f87da5869
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
199 changed files with 964 additions and 6656 deletions

View File

@ -26,33 +26,41 @@ plugins {
alias(libs.plugins.secrets) apply false alias(libs.plugins.secrets) apply false
alias(libs.plugins.room) apply false alias(libs.plugins.room) apply false
alias(libs.plugins.kotlin.android) apply false alias(libs.plugins.kotlin.android) apply false
id("io.gitlab.arturbosch.detekt").version("1.18.1") alias(libs.plugins.detekt)
alias(libs.plugins.detekt.compiler)
alias(libs.plugins.module.graph) apply true // Plugin applied to allow module graph generation alias(libs.plugins.module.graph) apply true // Plugin applied to allow module graph generation
} }
val detektProjectBaseline by tasks.registering(DetektCreateBaselineTask::class) { val detektFormatting = libs.detekt.formatting
description = "Overrides current baseline." val twitterComposeRules = libs.twitter.detekt.compose
ignoreFailures.set(true)
parallel.set(true) val reportMerge by tasks.registering(io.gitlab.arturbosch.detekt.report.ReportMergeTask::class) {
setSource(files(rootDir)) output.set(rootProject.layout.buildDirectory.file("reports/detekt/merge.html")) // or "reports/detekt/merge.sarif"
config.setFrom(files("$rootDir/detekt.yml"))
baseline.set(file("$rootDir/baseline.xml"))
include("**/*.kt")
include("**/*.kts")
exclude("**/resources/**")
exclude("**/build/**")
exclude("**/buildSrc/**")
exclude("**/test/**/*.kt")
} }
allprojects { subprojects {
apply(plugin = "io.gitlab.arturbosch.detekt") apply {
plugin("io.gitlab.arturbosch.detekt")
}
detekt { detekt {
config = files("$rootDir/config/detekt/detekt.yml") config.from(rootProject.files("config/detekt/detekt.yml"))
buildUponDefaultConfig = true reports.xml.required.set(true)
parallel = true }
ignoreFailures = false
tasks.withType<io.gitlab.arturbosch.detekt.Detekt>().configureEach {
finalizedBy(reportMerge)
}
reportMerge {
input.from(tasks.withType<io.gitlab.arturbosch.detekt.Detekt>().map {
it.htmlReportFile }
)
}
dependencies {
detektPlugins(detektFormatting)
detektPlugins(twitterComposeRules)
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -10,6 +10,7 @@ package org.mifospay.core.analytics
* *
* @param extras - list of parameters which supply additional context to the event. See `Param`. * @param extras - list of parameters which supply additional context to the event. See `Param`.
*/ */
@Suppress("UtilityClassWithPublicConstructor")
data class AnalyticsEvent( data class AnalyticsEvent(
val type: String, val type: String,
val extras: List<Param> = emptyList(), val extras: List<Param> = emptyList(),

View File

@ -1,7 +1,7 @@
package org.mifospay.core.analytics.di package org.mifospay.core.analytics.di
import com.google.firebase.analytics.FirebaseAnalytics import com.google.firebase.analytics.FirebaseAnalytics
import com.google.firebase.analytics.ktx.logEvent import com.google.firebase.analytics.logEvent
import org.mifospay.core.analytics.AnalyticsEvent import org.mifospay.core.analytics.AnalyticsEvent
import org.mifospay.core.analytics.AnalyticsHelper import org.mifospay.core.analytics.AnalyticsHelper
import javax.inject.Inject import javax.inject.Inject

View File

@ -1,9 +1,8 @@
package org.mifospay.mobilewallet.mifospay.analytics package org.mifospay.mobilewallet.mifospay.analytics
import org.junit.Assert.assertEquals
import org.junit.Test import org.junit.Test
import org.junit.Assert.*
/** /**
* Example local unit test, which will execute on the development machine (host). * Example local unit test, which will execute on the development machine (host).
* *
@ -14,4 +13,4 @@ class ExampleUnitTest {
fun addition_isCorrect() { fun addition_isCorrect() {
assertEquals(4, 2 + 2) assertEquals(4, 2 + 2)
} }
} }

View File

@ -2,27 +2,23 @@ package org.mifospay.common
object CreditCardUtils { object CreditCardUtils {
fun validateCreditCardNumber(str: String): Boolean { fun validateCreditCardNumber(str: String): Boolean {
val u = 2 if (str.isEmpty()) {
if (u - 2 == 0) {
return true // for backend testing. remove after testing.
}
if (str.length == 0) {
return false return false
} }
val ints = IntArray(str.length) val ints = IntArray(str.length)
for (i in 0 until str.length) { for (i in str.indices) {
ints[i] = str.substring(i, i + 1).toInt() ints[i] = str.substring(i, i + 1).toInt()
} }
run { run {
var i = ints.size - 2 var i = ints.size - 2
while (i >= 0) { while (i >= 0) {
var j = ints[i] var j = ints[i]
j = j * 2 j *= 2
if (j > 9) { if (j > 9) {
j = j % 10 + 1 j = j % 10 + 1
} }
ints[i] = j ints[i] = j
i = i - 2 i -= 2
} }
} }
var sum = 0 var sum = 0

View File

@ -1,5 +1,6 @@
package org.mifospay.common package org.mifospay.common
import android.util.Log
import java.io.File import java.io.File
import java.io.FileOutputStream import java.io.FileOutputStream
import java.io.InputStream import java.io.InputStream
@ -7,18 +8,19 @@ import java.io.OutputStream
object FileUtils { object FileUtils {
fun writeInputStreamDataToFile(`in`: InputStream, file: File?): Boolean { fun writeInputStreamDataToFile(inputStream: InputStream, file: File?): Boolean {
return try { return try {
val out: OutputStream = FileOutputStream(file) val out: OutputStream = FileOutputStream(file)
val buf = ByteArray(1024) val buf = ByteArray(1024)
var len: Int var len: Int
while (`in`.read(buf).also { len = it } > 0) { while (inputStream.read(buf).also { len = it } > 0) {
out.write(buf, 0, len) out.write(buf, 0, len)
} }
out.close() out.close()
`in`.close() inputStream.close()
true true
} catch (e: Exception) { } catch (e: Exception) {
Log.e("Message",e.message.toString())
false false
} }
} }

View File

@ -1,9 +1,8 @@
package org.mifospay.common package org.mifospay.common
import org.junit.Assert.assertEquals
import org.junit.Test import org.junit.Test
import org.junit.Assert.*
/** /**
* Example local unit test, which will execute on the development machine (host). * Example local unit test, which will execute on the development machine (host).
* *

View File

@ -39,5 +39,5 @@ dependencies {
implementation(libs.jetbrains.kotlin.jdk7) implementation(libs.jetbrains.kotlin.jdk7)
testImplementation(libs.junit) testImplementation(libs.junit)
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1") androidTestImplementation(libs.espresso.core)
} }

View File

@ -1,23 +1,24 @@
package org.mifospay.core.data.domain.usecase.account package org.mifospay.core.data.domain.usecase.account
import okhttp3.ResponseBody import com.mifospay.core.model.entity.TPTResponse
import org.mifospay.core.data.base.UseCase import com.mifospay.core.model.entity.accounts.savings.SavingAccount
import org.mifospay.core.data.fineract.repository.FineractRepository
import com.mifospay.core.model.entity.beneficary.Beneficiary import com.mifospay.core.model.entity.beneficary.Beneficiary
import com.mifospay.core.model.entity.beneficary.BeneficiaryPayload import com.mifospay.core.model.entity.beneficary.BeneficiaryPayload
import com.mifospay.core.model.entity.beneficary.BeneficiaryUpdatePayload import com.mifospay.core.model.entity.beneficary.BeneficiaryUpdatePayload
import com.mifospay.core.model.entity.payload.TransferPayload
import com.mifospay.core.model.entity.TPTResponse
import com.mifospay.core.model.entity.accounts.savings.SavingAccount
import com.mifospay.core.model.entity.client.Client import com.mifospay.core.model.entity.client.Client
import com.mifospay.core.model.entity.client.ClientAccounts import com.mifospay.core.model.entity.client.ClientAccounts
import com.mifospay.core.model.entity.payload.TransferPayload
import com.mifospay.core.model.utils.DateHelper import com.mifospay.core.model.utils.DateHelper
import okhttp3.ResponseBody
import org.mifospay.core.data.base.UseCase
import org.mifospay.core.data.fineract.repository.FineractRepository
import org.mifospay.core.data.util.Constants import org.mifospay.core.data.util.Constants
import rx.Subscriber import rx.Subscriber
import rx.android.schedulers.AndroidSchedulers import rx.android.schedulers.AndroidSchedulers
import rx.schedulers.Schedulers import rx.schedulers.Schedulers
import javax.inject.Inject import javax.inject.Inject
@Suppress("UnusedPrivateMember")
class TransferFunds @Inject constructor( private val apiRepository: FineractRepository) : class TransferFunds @Inject constructor( private val apiRepository: FineractRepository) :
UseCase<TransferFunds.RequestValues, TransferFunds.ResponseValue>() { UseCase<TransferFunds.RequestValues, TransferFunds.ResponseValue>() {

View File

@ -30,7 +30,7 @@ class CreateClient @Inject constructor(private val apiRepository: FineractReposi
message = (e as HttpException).response()?.errorBody()?.string().toString() message = (e as HttpException).response()?.errorBody()?.string().toString()
message = getUserMessage(message) message = getUserMessage(message)
} catch (e1: Exception) { } catch (e1: Exception) {
message = "Error" message = e1.message.toString()
} }
useCaseCallback.onError(message) useCaseCallback.onError(message)
} }

View File

@ -33,7 +33,7 @@ class UpdateClient @Inject constructor(private val fineractRepository: FineractR
message = (e as HttpException).response()?.errorBody()?.string().toString() message = (e as HttpException).response()?.errorBody()?.string().toString()
message = getUserMessage(message) message = getUserMessage(message)
} catch (e1: Exception) { } catch (e1: Exception) {
message = "Error" message = e1.message.toString()
} }
useCaseCallback.onError(message) useCaseCallback.onError(message)
} }

View File

@ -1,8 +1,9 @@
package org.mifospay.core.data.domain.usecase.invoice package org.mifospay.core.data.domain.usecase.invoice
import android.net.Uri import android.net.Uri
import org.mifospay.core.data.base.UseCase import android.util.Log
import com.mifospay.core.model.entity.Invoice import com.mifospay.core.model.entity.Invoice
import org.mifospay.core.data.base.UseCase
import org.mifospay.core.data.fineract.repository.FineractRepository import org.mifospay.core.data.fineract.repository.FineractRepository
import org.mifospay.core.data.util.Constants import org.mifospay.core.data.util.Constants
import rx.Subscriber import rx.Subscriber
@ -51,6 +52,7 @@ class FetchInvoice @Inject constructor(private val mFineractRepository: Fineract
} }
} catch (e: IndexOutOfBoundsException) { } catch (e: IndexOutOfBoundsException) {
Log.e("Error", e.message.toString())
useCaseCallback.onError("Invalid link used to open the App") useCaseCallback.onError("Invalid link used to open the App")
} }
} }

View File

@ -23,12 +23,12 @@ class CreateUser @Inject constructor(private val apiRepository: FineractReposito
override fun onCompleted() {} override fun onCompleted() {}
override fun onError(e: Throwable) { override fun onError(e: Throwable) {
getUserMessage(e) getUserMessage(e)
var message = "Error" var message: String
try { try {
message = (e as HttpException).response()!!.errorBody()!!.string() message = (e as HttpException).response()!!.errorBody()!!.string()
message = getUserMessage(message) message = getUserMessage(message)
} catch (e1: Exception) { } catch (e1: Exception) {
message = "Error" message = e1.message.toString()
} }
useCaseCallback.onError(message) useCaseCallback.onError(message)
} }

View File

@ -23,12 +23,12 @@ class UpdateUser @Inject constructor(
.subscribe(object : Subscriber<GenericResponse>() { .subscribe(object : Subscriber<GenericResponse>() {
override fun onCompleted() {} override fun onCompleted() {}
override fun onError(e: Throwable) { override fun onError(e: Throwable) {
var message = "Error" var message: String
try { try {
message = (e as HttpException).response()!!.errorBody()!!.string() message = (e as HttpException).response()!!.errorBody()!!.string()
message = getUserMessage(message) message = getUserMessage(message)
} catch (e1: Exception) { } catch (e1: Exception) {
message = "Error" message = e1.message.toString()
} }
useCaseCallback.onError(message) useCaseCallback.onError(message)
} }

View File

@ -43,6 +43,7 @@ import javax.inject.Singleton
@Singleton @Singleton
@Suppress("TooManyFunctions")
class FineractRepository @Inject constructor( class FineractRepository @Inject constructor(
private val fineractApiManager: FineractApiManager, private val fineractApiManager: FineractApiManager,
private val selfApiManager: SelfServiceApiManager private val selfApiManager: SelfServiceApiManager

View File

@ -9,7 +9,7 @@ import kotlinx.coroutines.flow.flow
import kotlinx.coroutines.flow.flowOn import kotlinx.coroutines.flow.flowOn
import org.mifospay.core.network.Dispatcher import org.mifospay.core.network.Dispatcher
import org.mifospay.core.network.MifosDispatchers import org.mifospay.core.network.MifosDispatchers
import org.mifospay.core.network.local_assets.MifosLocalAssetDataSource import org.mifospay.core.network.localAssets.MifosLocalAssetDataSource
import javax.inject.Inject import javax.inject.Inject
/** /**

View File

@ -18,12 +18,12 @@ object ErrorJsonMessageHelper {
@JvmStatic @JvmStatic
fun getUserMessage(e: Throwable): String? { fun getUserMessage(e: Throwable): String? {
var message: String? = "Error" var message: String?
try { try {
message = (e as HttpException).response()?.errorBody()?.string().toString() message = (e as HttpException).response()?.errorBody()?.string().toString()
message = getUserMessage(message) message = getUserMessage(message)
} catch (e1: Exception) { } catch (e1: Exception) {
message = "Error" message = e1.message.toString()
} }
return message return message
} }

View File

@ -1,9 +1,8 @@
package org.mifospay.core.datastore package org.mifospay.core.datastore
import org.junit.Assert.assertEquals
import org.junit.Test import org.junit.Test
import org.junit.Assert.*
/** /**
* Example local unit test, which will execute on the development machine (host). * Example local unit test, which will execute on the development machine (host).
* *

View File

@ -23,6 +23,6 @@ dependencies {
api(libs.androidx.compose.ui.util) api(libs.androidx.compose.ui.util)
api(libs.androidx.activity.compose) api(libs.androidx.activity.compose)
//testImplementation(libs.androidx.compose.ui.test) testImplementation(libs.androidx.compose.ui.test)
//androidTestImplementation(libs.androidx.compose.ui.test) androidTestImplementation(libs.androidx.compose.ui.test)
} }

View File

@ -23,7 +23,8 @@ import kotlinx.coroutines.launch
@Composable @Composable
fun MifosBottomSheet( fun MifosBottomSheet(
content: @Composable () -> Unit, content: @Composable () -> Unit,
onDismiss: () -> Unit onDismiss: () -> Unit,
modifier: Modifier = Modifier,
) { ) {
val coroutineScope = rememberCoroutineScope() val coroutineScope = rememberCoroutineScope()
val modalSheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true) val modalSheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true)
@ -50,7 +51,8 @@ fun MifosBottomSheet(
showBottomSheet = false showBottomSheet = false
dismissSheet() dismissSheet()
}, },
sheetState = modalSheetState sheetState = modalSheetState,
modifier = modifier,
) { ) {
content() content()
} }

View File

@ -288,6 +288,7 @@ fun MifosButtonLeadingIconPreview() {
/** /**
* Mifos Wallet button default values. * Mifos Wallet button default values.
*/ */
@Suppress("ForbiddenComment")
object MifosButtonDefaults { object MifosButtonDefaults {
// TODO: File bug // TODO: File bug
// OutlinedButton border color doesn't respect disabled state by default // OutlinedButton border color doesn't respect disabled state by default

View File

@ -7,12 +7,6 @@ import androidx.compose.material3.Scaffold
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color
data class FloatingActionButtonContent(
val onClick: (() -> Unit),
val contentColor: Color,
val content: (@Composable () -> Unit)
)
@Composable @Composable
fun MifosScaffold( fun MifosScaffold(
topBarTitle: Int? = null, topBarTitle: Int? = null,
@ -44,4 +38,10 @@ fun MifosScaffold(
snackbarHost = snackbarHost, snackbarHost = snackbarHost,
content = scaffoldContent, content = scaffoldContent,
) )
} }
data class FloatingActionButtonContent(
val onClick: (() -> Unit),
val contentColor: Color,
val content: (@Composable () -> Unit)
)

View File

@ -20,6 +20,7 @@ import androidx.core.content.ContextCompat
import androidx.lifecycle.Lifecycle import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleEventObserver import androidx.lifecycle.LifecycleEventObserver
@Suppress("LongMethod", "CyclomaticComplexMethod")
@Composable @Composable
fun PermissionBox( fun PermissionBox(
requiredPermissions: List<String>, requiredPermissions: List<String>,
@ -57,9 +58,9 @@ fun PermissionBox(
} }
val decideCurrentPermissionStatus: (Boolean, Boolean) -> String = val decideCurrentPermissionStatus: (Boolean, Boolean) -> String =
{ permissionGranted, shouldShowPermissionRationale -> { granted, rationale ->
if (permissionGranted) "Granted" if (granted) "Granted"
else if (shouldShowPermissionRationale) "Rejected" else if (rationale) "Rejected"
else "Denied" else "Denied"
} }

View File

@ -73,6 +73,7 @@ private val DarkDefaultColorScheme = darkColorScheme(
scrim = md_theme_dark_scrim, scrim = md_theme_dark_scrim,
) )
@Suppress("UnusedParameter")
@Composable @Composable
fun MifosTheme( fun MifosTheme(
darkTheme: Boolean = isSystemInDarkTheme(), darkTheme: Boolean = isSystemInDarkTheme(),

View File

@ -5,6 +5,7 @@ import androidx.compose.ui.text.input.OffsetMapping
import androidx.compose.ui.text.input.TransformedText import androidx.compose.ui.text.input.TransformedText
import androidx.compose.ui.text.input.VisualTransformation import androidx.compose.ui.text.input.VisualTransformation
@Suppress("ReturnCount")
class ExpirationDateMask : VisualTransformation { class ExpirationDateMask : VisualTransformation {
override fun filter(text: AnnotatedString): TransformedText { override fun filter(text: AnnotatedString): TransformedText {
return makeExpirationFilter(text) return makeExpirationFilter(text)

View File

@ -1,9 +1,8 @@
package com.mifos.mobilewallet.model package com.mifos.mobilewallet.model
import org.junit.Assert.assertEquals
import org.junit.Test import org.junit.Test
import org.junit.Assert.*
/** /**
* Example local unit test, which will execute on the development machine (host). * Example local unit test, which will execute on the development machine (host).
* *

View File

@ -1,7 +1,7 @@
package org.mifospay.core.network package org.mifospay.core.network
import androidx.annotation.VisibleForTesting import androidx.annotation.VisibleForTesting
import org.mifospay.core.network.local_assets.LocalAssetManager import org.mifospay.core.network.localAssets.LocalAssetManager
import java.io.File import java.io.File
import java.io.InputStream import java.io.InputStream
import java.util.Properties import java.util.Properties

View File

@ -4,8 +4,8 @@ import dagger.Binds
import dagger.Module import dagger.Module
import dagger.hilt.InstallIn import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent import dagger.hilt.components.SingletonComponent
import org.mifospay.core.network.local_assets.LocalAssetDataSource import org.mifospay.core.network.localAssets.LocalAssetDataSource
import org.mifospay.core.network.local_assets.MifosLocalAssetDataSource import org.mifospay.core.network.localAssets.MifosLocalAssetDataSource
@Module @Module
@InstallIn(SingletonComponent::class) @InstallIn(SingletonComponent::class)

View File

@ -12,7 +12,7 @@ import org.mifospay.core.network.BaseURL
import org.mifospay.core.network.FineractApiManager import org.mifospay.core.network.FineractApiManager
import org.mifospay.core.network.MifosWalletOkHttpClient import org.mifospay.core.network.MifosWalletOkHttpClient
import org.mifospay.core.network.SelfServiceApiManager import org.mifospay.core.network.SelfServiceApiManager
import org.mifospay.core.network.local_assets.LocalAssetManager import org.mifospay.core.network.localAssets.LocalAssetManager
import org.mifospay.core.network.services.AccountTransfersService import org.mifospay.core.network.services.AccountTransfersService
import org.mifospay.core.network.services.AuthenticationService import org.mifospay.core.network.services.AuthenticationService
import org.mifospay.core.network.services.BeneficiaryService import org.mifospay.core.network.services.BeneficiaryService
@ -38,6 +38,7 @@ import javax.inject.Singleton
@Module @Module
@InstallIn(SingletonComponent::class) @InstallIn(SingletonComponent::class)
@Suppress("TooManyFunctions")
class NetworkModule { class NetworkModule {
@Provides @Provides

View File

@ -1,4 +1,4 @@
package org.mifospay.core.network.local_assets package org.mifospay.core.network.localAssets
import com.mifospay.core.model.City import com.mifospay.core.model.City
import com.mifospay.core.model.Country import com.mifospay.core.model.Country

View File

@ -1,4 +1,4 @@
package org.mifospay.core.network.local_assets package org.mifospay.core.network.localAssets
import java.io.InputStream import java.io.InputStream

View File

@ -1,5 +1,6 @@
package org.mifospay.core.network.local_assets package org.mifospay.core.network.localAssets
import android.annotation.SuppressLint
import com.mifospay.core.model.City import com.mifospay.core.model.City
import com.mifospay.core.model.Country import com.mifospay.core.model.Country
import com.mifospay.core.model.State import com.mifospay.core.model.State
@ -16,6 +17,7 @@ import javax.inject.Inject
class MifosLocalAssetDataSource @Inject constructor( class MifosLocalAssetDataSource @Inject constructor(
@Dispatcher(MifosDispatchers.IO) private val ioDispatcher: CoroutineDispatcher, @Dispatcher(MifosDispatchers.IO) private val ioDispatcher: CoroutineDispatcher,
private val networkJson: Json, private val networkJson: Json,
@SuppressLint("VisibleForTests")
private val assets: LocalAssetManager = JvmLocalAssetManager, private val assets: LocalAssetManager = JvmLocalAssetManager,
) : LocalAssetDataSource { ) : LocalAssetDataSource {
@ -47,6 +49,7 @@ class MifosLocalAssetDataSource @Inject constructor(
} }
} }
@Suppress("UnusedPrivateProperty")
companion object { companion object {
private const val COUNTRIES_ASSET = "countries.json" private const val COUNTRIES_ASSET = "countries.json"
private const val STATES_ASSET = "states.json" private const val STATES_ASSET = "states.json"

View File

@ -9,6 +9,7 @@ import rx.Observable
/** /**
* Created by ankur on 06/June/2018 * Created by ankur on 06/June/2018
*/ */
@Suppress("FunctionParameterNaming")
interface RunReportService { interface RunReportService {
@GET(ApiEndPoints.RUN_REPORT + "/Savings Transaction Receipt") @GET(ApiEndPoints.RUN_REPORT + "/Savings Transaction Receipt")
fun getTransactionReceipt( fun getTransactionReceipt(

View File

@ -1,9 +1,8 @@
package org.mifospay.mobilewallet.mifospay.network package org.mifospay.mobilewallet.mifospay.network
import org.junit.Assert.assertEquals
import org.junit.Test import org.junit.Test
import org.junit.Assert.*
/** /**
* Example local unit test, which will execute on the development machine (host). * Example local unit test, which will execute on the development machine (host).
* *

View File

@ -1,4 +1,4 @@
package org.mifos.mobilewallet.mifospay.ui package org.mifospay.core.ui
import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Row

View File

@ -1,9 +1,8 @@
package org.mifospay.mobilewallet.mifospay.ui package org.mifospay.mobilewallet.mifospay.ui
import org.junit.Assert.assertEquals
import org.junit.Test import org.junit.Test
import org.junit.Assert.*
/** /**
* Example local unit test, which will execute on the development machine (host). * Example local unit test, which will execute on the development machine (host).
* *

View File

@ -9,7 +9,7 @@ android {
dependencies { dependencies {
implementation(projects.core.data) implementation(projects.core.data)
// TODO:: this should be removed
implementation(libs.compose.material) implementation(libs.compose.material)
implementation(libs.androidx.appcompat)
implementation(projects.feature.upiSetup) implementation(projects.feature.upiSetup)
} }

View File

@ -1,6 +1,6 @@
package org.mifospay.feature.bank.accounts.choose.sim package org.mifospay.feature.bank.accounts.choose.sim
import android.widget.Toast import androidx.compose.animation.AnimatedVisibility
import androidx.compose.foundation.Image import androidx.compose.foundation.Image
import androidx.compose.foundation.clickable import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Arrangement
@ -14,22 +14,26 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width import androidx.compose.foundation.layout.width
import androidx.compose.material3.MaterialTheme import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.material3.Text import androidx.compose.material3.Text
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableIntStateOf import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.painter.Painter import androidx.compose.ui.graphics.painter.Painter
import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import kotlinx.coroutines.delay
import org.mifospay.core.designsystem.component.MifosBottomSheet import org.mifospay.core.designsystem.component.MifosBottomSheet
import org.mifospay.core.designsystem.component.MifosButton import org.mifospay.core.designsystem.component.MifosButton
import org.mifospay.core.designsystem.theme.MifosTheme import org.mifospay.core.designsystem.theme.MifosTheme
@ -37,15 +41,20 @@ import org.mifospay.feature.bank.accounts.R
@Composable @Composable
fun ChooseSimDialogSheet( fun ChooseSimDialogSheet(
onSimSelected: (Int) -> Unit onSimSelected: (Int) -> Unit,
modifier: Modifier = Modifier,
) { ) {
MifosBottomSheet(content = { MifosBottomSheet(
ChooseSimDialogSheetContent { selectedSim -> content = {
onSimSelected.invoke(selectedSim) ChooseSimDialogSheetContent(
} onSimSelected = onSimSelected
}, onDismiss = { )
onSimSelected.invoke(-1) },
}) onDismiss = {
onSimSelected.invoke(-1)
},
modifier = modifier,
)
} }
/** /**
@ -53,12 +62,25 @@ fun ChooseSimDialogSheet(
* show both of them and implement send SMS after select and confirm. * show both of them and implement send SMS after select and confirm.
*/ */
@Composable @Composable
fun ChooseSimDialogSheetContent(onSimSelected: (Int) -> Unit) { @Suppress("LongMethod")
val context = LocalContext.current fun ChooseSimDialogSheetContent(
onSimSelected: (Int) -> Unit,
modifier: Modifier = Modifier,
) {
var selectedSim by rememberSaveable { mutableIntStateOf(-1) } var selectedSim by rememberSaveable { mutableIntStateOf(-1) }
var showMessage by remember { mutableStateOf(false) }
val message = stringResource(id = R.string.feature_accounts_choose_a_sim)
LaunchedEffect(key1 = showMessage) {
if (showMessage) {
delay(5000)
showMessage = false
}
}
Column( Column(
horizontalAlignment = Alignment.CenterHorizontally, horizontalAlignment = Alignment.CenterHorizontally,
modifier = Modifier modifier = modifier
.fillMaxSize() .fillMaxSize()
.padding(8.dp) .padding(8.dp)
) { ) {
@ -95,8 +117,10 @@ fun ChooseSimDialogSheetContent(onSimSelected: (Int) -> Unit) {
) )
Spacer(modifier = Modifier.width(24.dp)) Spacer(modifier = Modifier.width(24.dp))
Text(text = stringResource(id = R.string.feature_accounts_or), Text(
color = MaterialTheme.colorScheme.onSurface) text = stringResource(id = R.string.feature_accounts_or),
color = MaterialTheme.colorScheme.onSurface
)
Spacer(modifier = Modifier.width(24.dp)) Spacer(modifier = Modifier.width(24.dp))
SimCard( SimCard(
simNumber = 2, simNumber = 2,
@ -110,17 +134,25 @@ fun ChooseSimDialogSheetContent(onSimSelected: (Int) -> Unit) {
color = MaterialTheme.colorScheme.onSurface, color = MaterialTheme.colorScheme.onSurface,
style = MaterialTheme.typography.bodySmall style = MaterialTheme.typography.bodySmall
) )
AnimatedVisibility(
visible = showMessage
) {
Text(
text = message,
color = MaterialTheme.colorScheme.error,
style = MaterialTheme.typography.bodySmall,
modifier = Modifier.padding(vertical = 4.dp)
)
}
MifosButton( MifosButton(
modifier = Modifier modifier = Modifier
.width(200.dp) .width(200.dp)
.padding(top = 16.dp), .padding(top = 16.dp),
onClick = { onClick = {
if (selectedSim == -1) { if (selectedSim == -1) {
Toast.makeText( showMessage = true
context,
context.getString(R.string.feature_accounts_choose_a_sim),
Toast.LENGTH_SHORT
).show()
} else { } else {
onSimSelected(selectedSim) onSimSelected(selectedSim)
} }
@ -134,17 +166,21 @@ fun ChooseSimDialogSheetContent(onSimSelected: (Int) -> Unit) {
@Composable @Composable
fun SimCard( fun SimCard(
simNumber: Int, isSelected: Boolean, onSimSelected: () -> Unit simNumber: Int,
isSelected: Boolean,
onSimSelected: () -> Unit,
modifier: Modifier = Modifier,
) { ) {
val drawable: Painter = painterResource( val drawable: Painter = painterResource(
id = if (isSelected) { id = if (isSelected) {
R.drawable.feature_accounts_sim_card_selected R.drawable.feature_accounts_sim_card_selected
} else R.drawable.feature_accounts_sim_card_unselected } else R.drawable.feature_accounts_sim_card_unselected
) )
Image(painter = drawable, Image(
painter = drawable,
contentDescription = "SIM Card $simNumber", contentDescription = "SIM Card $simNumber",
contentScale = ContentScale.Fit, contentScale = ContentScale.Fit,
modifier = Modifier modifier = modifier
.size(50.dp) .size(50.dp)
.clickable { onSimSelected() } .clickable { onSimSelected() }
) )
@ -154,6 +190,10 @@ fun SimCard(
@Composable @Composable
fun SimSelectionPreview() { fun SimSelectionPreview() {
MifosTheme { MifosTheme {
ChooseSimDialogSheetContent(onSimSelected = {}) Surface {
ChooseSimDialogSheetContent(
onSimSelected = {}
)
}
} }
} }

View File

@ -69,16 +69,18 @@ fun LinkBankAccountRoute(
var showOverlyProgressBar by rememberSaveable { mutableStateOf(false) } var showOverlyProgressBar by rememberSaveable { mutableStateOf(false) }
if (showSimBottomSheet) { if (showSimBottomSheet) {
ChooseSimDialogSheet { selectedSim -> ChooseSimDialogSheet(
showSimBottomSheet = false onSimSelected = { selectedSim ->
if (selectedSim != -1) { showSimBottomSheet = false
showOverlyProgressBar = true if (selectedSim != -1) {
viewModel.fetchBankAccountDetails { showOverlyProgressBar = true
showOverlyProgressBar = false viewModel.fetchBankAccountDetails {
onBackClick() showOverlyProgressBar = false
onBackClick()
}
} }
} }
} )
} }
LinkBankAccountScreen( LinkBankAccountScreen(
@ -175,7 +177,10 @@ fun BankListScreenContent(
Spacer(modifier = Modifier.height(24.dp)) Spacer(modifier = Modifier.height(24.dp))
Text( Text(
text = stringResource(id = R.string.feature_accounts_popular_banks), text = stringResource(id = R.string.feature_accounts_popular_banks),
style = TextStyle(MaterialTheme.colorScheme.onSurface, fontWeight = FontWeight.Medium), style = TextStyle(
MaterialTheme.colorScheme.onSurface,
fontWeight = FontWeight.Medium
),
modifier = Modifier.padding(start = 16.dp) modifier = Modifier.padding(start = 16.dp)
) )
Spacer(modifier = Modifier.height(12.dp)) Spacer(modifier = Modifier.height(12.dp))
@ -186,7 +191,10 @@ fun BankListScreenContent(
Spacer(modifier = Modifier.height(24.dp)) Spacer(modifier = Modifier.height(24.dp))
Text( Text(
text = stringResource(id = R.string.feature_accounts_other_banks), text = stringResource(id = R.string.feature_accounts_other_banks),
style = TextStyle(MaterialTheme.colorScheme.onSurface, fontWeight = FontWeight.Medium), style = TextStyle(
MaterialTheme.colorScheme.onSurface,
fontWeight = FontWeight.Medium
),
modifier = Modifier.padding(start = 16.dp) modifier = Modifier.padding(start = 16.dp)
) )
Spacer(modifier = Modifier.height(12.dp)) Spacer(modifier = Modifier.height(12.dp))

View File

@ -1,9 +1,8 @@
package org.mifospay.feature.bank.accounts package org.mifospay.feature.bank.accounts
import org.junit.Assert.assertEquals
import org.junit.Test import org.junit.Test
import org.junit.Assert.*
/** /**
* Example local unit test, which will execute on the development machine (host). * Example local unit test, which will execute on the development machine (host).
* *

View File

@ -17,21 +17,19 @@ dependencies {
implementation(projects.feature.passcode) implementation(projects.feature.passcode)
implementation(libs.compose.country.code.picker) implementation(libs.compose.country.code.picker)
// TODO:: this should be removed
implementation(libs.compose.material)
// Credentials Manager // Credentials Manager
implementation("androidx.credentials:credentials:1.2.1") implementation(libs.androidx.credentials)
// optional - needed for credentials support from play services, for devices running // optional - needed for credentials support from play services, for devices running
// Android 13 and below. // Android 13 and below.
implementation("androidx.credentials:credentials-play-services-auth:1.2.1") implementation(libs.androidx.credentials.play.services.auth)
implementation("com.google.android.libraries.identity.googleid:googleid:1.1.0") implementation(libs.googleid)
implementation("com.mifos.mobile:mifos-passcode:0.3.0") implementation(libs.mifosPasscode)
implementation("com.google.android.gms:play-services-auth:20.7.0") implementation(libs.play.services.auth)
// we need it for country picker library
implementation("androidx.compose.material:material:1.6.0")
implementation(libs.compose.country.code.picker) // remove after moving auth code to module
implementation(libs.androidx.core.ktx) implementation(libs.androidx.core.ktx)
implementation(libs.androidx.appcompat) implementation(libs.androidx.appcompat)

View File

@ -31,7 +31,6 @@ import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.input.PasswordVisualTransformation import androidx.compose.ui.text.input.PasswordVisualTransformation
@ -48,11 +47,9 @@ import org.mifospay.core.designsystem.component.MfOverlayLoadingWheel
import org.mifospay.core.designsystem.component.MifosOutlinedTextField import org.mifospay.core.designsystem.component.MifosOutlinedTextField
import org.mifospay.core.designsystem.theme.MifosTheme import org.mifospay.core.designsystem.theme.MifosTheme
import org.mifospay.core.designsystem.theme.grey import org.mifospay.core.designsystem.theme.grey
import org.mifospay.core.designsystem.theme.styleMedium16sp
import org.mifospay.core.designsystem.theme.styleMedium30sp
import org.mifospay.core.designsystem.theme.styleNormal18sp import org.mifospay.core.designsystem.theme.styleNormal18sp
import org.mifospay.feature.auth.R import org.mifospay.feature.auth.R
import org.mifospay.feature.auth.social_signup.SocialSignupMethodContentScreen import org.mifospay.feature.auth.socialSignup.SocialSignupMethodContentScreen
import org.mifospay.feature.passcode.PassCodeActivity import org.mifospay.feature.passcode.PassCodeActivity
@Composable @Composable
@ -86,6 +83,7 @@ fun LoginScreen(
} }
@Composable @Composable
@Suppress("LongMethod")
fun LoginScreenContent( fun LoginScreenContent(
showProgress: Boolean, showProgress: Boolean,
login: (username: String, password: String) -> Unit, login: (username: String, password: String) -> Unit,

View File

@ -1,4 +1,4 @@
package org.mifospay.feature.auth.mobile_verify package org.mifospay.feature.auth.mobileVerify
import android.widget.Toast import android.widget.Toast
import androidx.compose.foundation.background import androidx.compose.foundation.background

View File

@ -1,4 +1,4 @@
package org.mifospay.feature.auth.mobile_verify package org.mifospay.feature.auth.mobileVerify
import androidx.compose.runtime.getValue import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.mutableStateOf
@ -17,6 +17,7 @@ import org.mifospay.core.data.domain.usecase.client.SearchClient
import javax.inject.Inject import javax.inject.Inject
@HiltViewModel @HiltViewModel
@Suppress("UnusedParameter")
class MobileVerificationViewModel @Inject constructor( class MobileVerificationViewModel @Inject constructor(
private val mUseCaseHandler: UseCaseHandler, private val mUseCaseHandler: UseCaseHandler,
private val searchClientUseCase: SearchClient private val searchClientUseCase: SearchClient
@ -32,7 +33,8 @@ class MobileVerificationViewModel @Inject constructor(
* Verify Mobile number that it already exist or not then request otp * Verify Mobile number that it already exist or not then request otp
*/ */
fun verifyMobileAndRequestOtp( fun verifyMobileAndRequestOtp(
fullNumber: String, mobileNo: String, fullNumber: String,
mobileNo: String,
onError: (String?) -> Unit onError: (String?) -> Unit
) { ) {
showProgress = true showProgress = true

View File

@ -7,6 +7,7 @@ import org.mifospay.feature.auth.login.LoginScreen
const val LOGIN_ROUTE = "login_route" const val LOGIN_ROUTE = "login_route"
@Suppress("UnusedParameter")
fun NavGraphBuilder.loginScreen( fun NavGraphBuilder.loginScreen(
onDismissSignUp: () -> Unit, onDismissSignUp: () -> Unit,
onNavigateToMobileVerificationScreen:(Int,String,String,String,String,) -> Unit onNavigateToMobileVerificationScreen:(Int,String,String,String,String,) -> Unit

View File

@ -8,7 +8,7 @@ import androidx.navigation.NavType
import androidx.navigation.compose.composable import androidx.navigation.compose.composable
import androidx.navigation.navArgument import androidx.navigation.navArgument
import org.mifospay.common.Constants import org.mifospay.common.Constants
import org.mifospay.feature.auth.mobile_verify.MobileVerificationScreen import org.mifospay.feature.auth.mobileVerify.MobileVerificationScreen
const val MOBILE_VERIFICATION_ROUTE = "mobile_verification_route" const val MOBILE_VERIFICATION_ROUTE = "mobile_verification_route"

View File

@ -11,6 +11,7 @@ import org.mifospay.feature.auth.signup.SignupScreen
const val SIGNUP_ROUTE = "signup_route" const val SIGNUP_ROUTE = "signup_route"
@Suppress("UnusedParameter")
fun NavGraphBuilder.signupScreen( fun NavGraphBuilder.signupScreen(
onLoginSuccess: () -> Unit, onLoginSuccess: () -> Unit,
onRegisterSuccess: () -> Unit onRegisterSuccess: () -> Unit
@ -57,9 +58,14 @@ fun NavController.navigateToSignup(
lastName: String = "", lastName: String = "",
businessName: String = "" businessName: String = ""
) { ) {
this.navigate("$SIGNUP_ROUTE?savingProductId=$savingProductId&mobileNumber=$mobileNumber&country=$country&email=$email&firstName=$firstName&lastName=$lastName&businessName=$businessName") this.navigate(
"$SIGNUP_ROUTE?savingProductId=$savingProductId" +
"&mobileNumber=$mobileNumber&country=$country&email=$email" +
"&firstName=$firstName&lastName=$lastName&businessName=$businessName"
)
} }
@Suppress("UnusedParameter")
fun onRegisterSuccess(s: String?) { fun onRegisterSuccess(s: String?) {
// registered but unable to login or user not updated with client // registered but unable to login or user not updated with client
// TODO :: Consider this case // TODO :: Consider this case

View File

@ -83,7 +83,7 @@ fun SignupScreen(
} }
} }
SignupScreen( SignupScreenContent(
showProgressState = viewModel.showProgress, showProgressState = viewModel.showProgress,
data = viewModel.signupData, data = viewModel.signupData,
stateList = stateList, stateList = stateList,
@ -96,7 +96,8 @@ fun SignupScreen(
} }
@Composable @Composable
fun SignupScreen( @Suppress("LongMethod", "CyclomaticComplexMethod")
fun SignupScreenContent(
showProgressState: Boolean = false, showProgressState: Boolean = false,
data: SignupData, data: SignupData,
stateList: List<State>, stateList: List<State>,
@ -469,7 +470,7 @@ private fun getPasswordStrengthColor(password: String): Color {
@Preview @Preview
@Composable @Composable
fun SignupScreenPreview() { fun SignupScreenPreview() {
SignupScreen( SignupScreenContent(
showProgressState = false, showProgressState = false,
data = SignupData(), data = SignupData(),
stateList = listOf(), stateList = listOf(),

View File

@ -17,6 +17,8 @@ import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.stateIn import kotlinx.coroutines.flow.stateIn
import org.mifospay.common.Constants
import org.mifospay.common.DebugUtil
import org.mifospay.core.data.base.UseCase import org.mifospay.core.data.base.UseCase
import org.mifospay.core.data.base.UseCaseHandler import org.mifospay.core.data.base.UseCaseHandler
import org.mifospay.core.data.domain.usecase.client.CreateClient import org.mifospay.core.data.domain.usecase.client.CreateClient
@ -28,8 +30,6 @@ import org.mifospay.core.data.domain.usecase.user.DeleteUser
import org.mifospay.core.data.domain.usecase.user.FetchUserDetails import org.mifospay.core.data.domain.usecase.user.FetchUserDetails
import org.mifospay.core.data.domain.usecase.user.UpdateUser import org.mifospay.core.data.domain.usecase.user.UpdateUser
import org.mifospay.core.data.repository.local.LocalAssetRepository import org.mifospay.core.data.repository.local.LocalAssetRepository
import org.mifospay.common.Constants
import org.mifospay.common.DebugUtil
import org.mifospay.core.datastore.PreferencesHelper import org.mifospay.core.datastore.PreferencesHelper
import javax.inject.Inject import javax.inject.Inject
@ -187,9 +187,9 @@ class SignupViewModel @Inject constructor(
useCaseHandler.execute(authenticateUserUseCase, requestValue, useCaseHandler.execute(authenticateUserUseCase, requestValue,
object : UseCase.UseCaseCallback<AuthenticateUser.ResponseValue> { object : UseCase.UseCaseCallback<AuthenticateUser.ResponseValue> {
override fun onSuccess(response: AuthenticateUser.ResponseValue) { override fun onSuccess(response: AuthenticateUser.ResponseValue) {
response?.user?.let { createAuthenticatedService(it) } createAuthenticatedService(response.user)
fetchClientData(showToastMessage) fetchClientData(showToastMessage)
response?.user?.let { fetchUserDetails(it) } fetchUserDetails(response.user)
} }
override fun onError(message: String) { override fun onError(message: String) {

View File

@ -1,6 +1,6 @@
@file:Suppress("MaxLineLength") @file:Suppress("MaxLineLength")
package org.mifospay.feature.auth.social_signup package org.mifospay.feature.auth.socialSignup
import android.content.Context import android.content.Context
import android.util.Log import android.util.Log
@ -68,6 +68,7 @@ fun SocialSignupMethodContentScreen(
} }
@Composable @Composable
@Suppress("NestedBlockDepth")
fun SocialSignupMethodScreen( fun SocialSignupMethodScreen(
onDismissSignUp: () -> Unit onDismissSignUp: () -> Unit
) { ) {
@ -180,6 +181,7 @@ fun SocialSignupMethodScreen(
} }
@Composable @Composable
@Suppress("LongMethod")
fun SignupMethodContentScreen( fun SignupMethodContentScreen(
showProgress: Boolean, showProgress: Boolean,
onSignUpAsMerchant: (Boolean) -> Unit, onSignUpAsMerchant: (Boolean) -> Unit,
@ -293,6 +295,7 @@ fun SignupMethodContentScreen(
} }
} }
@Suppress("UnusedParameter")
fun GoogleIdTokenCredential?.signUpWithMifos( fun GoogleIdTokenCredential?.signUpWithMifos(
context: Context, context: Context,
mifosSavingsProductId: Int, mifosSavingsProductId: Int,

View File

@ -1,9 +1,8 @@
package org.mifospay.mobilewallet.mifospay.auth package org.mifospay.mobilewallet.mifospay.auth
import org.junit.Assert.assertEquals
import org.junit.Test import org.junit.Test
import org.junit.Assert.*
/** /**
* Example local unit test, which will execute on the development machine (host). * Example local unit test, which will execute on the development machine (host).
* *

View File

@ -103,11 +103,11 @@ fun EditPasswordScreen(
}, },
backPress = onBackPress, backPress = onBackPress,
scaffoldContent = { it -> scaffoldContent = { paddingValues ->
Column( Column(
modifier = Modifier modifier = Modifier
.fillMaxSize() .fillMaxSize()
.padding(it) .padding(paddingValues)
) { ) {
MfPasswordTextField( MfPasswordTextField(
modifier = Modifier modifier = Modifier

View File

@ -14,6 +14,7 @@ import org.mifospay.core.datastore.PreferencesHelper
import javax.inject.Inject import javax.inject.Inject
@HiltViewModel @HiltViewModel
@Suppress("NestedBlockDepth")
class EditPasswordViewModel @Inject constructor( class EditPasswordViewModel @Inject constructor(
private val mUseCaseHandler: UseCaseHandler, private val mUseCaseHandler: UseCaseHandler,
private val mPreferencesHelper: PreferencesHelper, private val mPreferencesHelper: PreferencesHelper,

View File

@ -1,9 +1,8 @@
package org.mifospay.feature.editpassword package org.mifospay.feature.editpassword
import org.junit.Assert.assertEquals
import org.junit.Test import org.junit.Test
import org.junit.Assert.*
/** /**
* Example local unit test, which will execute on the development machine (host). * Example local unit test, which will execute on the development machine (host).
* *

View File

@ -4,9 +4,9 @@ plugins {
} }
android { android {
namespace = "com.example.faq" namespace = "org.mifospay.feature.faq"
} }
dependencies { dependencies {
implementation(libs.androidx.appcompat)
} }

View File

@ -1,7 +1,6 @@
package org.mifospay.feature.faq package org.mifospay.feature.faq
import androidx.lifecycle.ViewModel import androidx.lifecycle.ViewModel
import com.example.faq.R
import dagger.hilt.android.lifecycle.HiltViewModel import dagger.hilt.android.lifecycle.HiltViewModel
import javax.inject.Inject import javax.inject.Inject

View File

@ -10,7 +10,6 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.tooling.preview.Preview
import androidx.hilt.navigation.compose.hiltViewModel import androidx.hilt.navigation.compose.hiltViewModel
import com.example.faq.R
import org.mifospay.core.designsystem.component.MifosTopBar import org.mifospay.core.designsystem.component.MifosTopBar
import org.mifospay.core.ui.FaqItemScreen import org.mifospay.core.ui.FaqItemScreen

View File

@ -1,9 +1,8 @@
package com.example.faq package com.example.faq
import org.junit.Assert.assertEquals
import org.junit.Test import org.junit.Test
import org.junit.Assert.*
/** /**
* Example local unit test, which will execute on the development machine (host). * Example local unit test, which will execute on the development machine (host).
* *

View File

@ -2,10 +2,10 @@ package org.mifospay.feature.finance
import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxSize
import com.google.accompanist.pager.rememberPagerState
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.tooling.preview.Preview
import com.google.accompanist.pager.rememberPagerState
import com.mifospay.core.model.domain.BankAccountDetails import com.mifospay.core.model.domain.BankAccountDetails
import org.mifospay.core.ui.MifosScrollableTabRow import org.mifospay.core.ui.MifosScrollableTabRow
import org.mifospay.core.ui.utility.TabContent import org.mifospay.core.ui.utility.TabContent
@ -14,6 +14,7 @@ import org.mifospay.feature.kyc.KYCScreen
import org.mifospay.feature.merchants.ui.MerchantScreen import org.mifospay.feature.merchants.ui.MerchantScreen
import org.mifospay.feature.savedcards.CardsScreen import org.mifospay.feature.savedcards.CardsScreen
@Suppress("UnusedParameter")
@Composable @Composable
fun FinanceRoute( fun FinanceRoute(
onAddBtn: () -> Unit, onAddBtn: () -> Unit,

View File

@ -1,9 +1,8 @@
package org.mifospay.feature.finance package org.mifospay.feature.finance
import org.junit.Assert.assertEquals
import org.junit.Test import org.junit.Test
import org.junit.Assert.*
/** /**
* Example local unit test, which will execute on the development machine (host). * Example local unit test, which will execute on the development machine (host).
* *

View File

@ -1,14 +1,15 @@
package org.mifospay.feature package org.mifospay.feature
import com.mifospay.core.model.domain.Transaction
import org.mifospay.core.data.base.TaskLooper import org.mifospay.core.data.base.TaskLooper
import org.mifospay.core.data.base.UseCase.UseCaseCallback import org.mifospay.core.data.base.UseCase.UseCaseCallback
import org.mifospay.core.data.base.UseCaseFactory import org.mifospay.core.data.base.UseCaseFactory
import com.mifospay.core.model.domain.Transaction
import org.mifospay.core.data.base.UseCaseHandler import org.mifospay.core.data.base.UseCaseHandler
import org.mifospay.core.data.domain.usecase.account.FetchAccount import org.mifospay.core.data.domain.usecase.account.FetchAccount
import org.mifospay.core.data.domain.usecase.account.FetchAccountTransactions import org.mifospay.core.data.domain.usecase.account.FetchAccountTransactions
import javax.inject.Inject import javax.inject.Inject
@Suppress("UnusedPrivateProperty")
class TransactionsHistory @Inject constructor( class TransactionsHistory @Inject constructor(
private val mUsecaseHandler: UseCaseHandler, private val mUsecaseHandler: UseCaseHandler,
private val fetchAccountTransactionsUseCase: FetchAccountTransactions, private val fetchAccountTransactionsUseCase: FetchAccountTransactions,

View File

@ -25,7 +25,6 @@ import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.tooling.preview.Preview
@ -38,10 +37,8 @@ import com.mifospay.core.model.domain.Currency
import com.mifospay.core.model.domain.Transaction import com.mifospay.core.model.domain.Transaction
import com.mifospay.core.model.domain.TransactionType import com.mifospay.core.model.domain.TransactionType
import com.mifospay.core.model.entity.accounts.savings.TransferDetail import com.mifospay.core.model.entity.accounts.savings.TransferDetail
import org.mifospay.core.designsystem.component.MifosBottomSheet import org.mifospay.core.designsystem.component.MifosBottomSheet
import org.mifospay.core.designsystem.component.MifosLoadingWheel import org.mifospay.core.designsystem.component.MifosLoadingWheel
import org.mifospay.core.designsystem.theme.chipSelectedColor
import org.mifospay.core.designsystem.theme.lightGrey import org.mifospay.core.designsystem.theme.lightGrey
import org.mifospay.core.ui.EmptyContentScreen import org.mifospay.core.ui.EmptyContentScreen
import org.mifospay.core.ui.TransactionItemScreen import org.mifospay.core.ui.TransactionItemScreen
@ -166,15 +163,19 @@ fun HistoryScreen(
} }
@Composable @Composable
fun Chip(selected: Boolean, onClick: () -> Unit, label: String) { fun Chip(
selected: Boolean,
onClick: () -> Unit,
label: String
) {
val context = LocalContext.current val context = LocalContext.current
val backgroundColor = if (selected) chipSelectedColor else lightGrey val backgroundColor = if (selected) MaterialTheme.colorScheme.primary else lightGrey
Button( Button(
onClick = { onClick = {
onClick() onClick()
Toast.makeText(context, label, Toast.LENGTH_SHORT).show() Toast.makeText(context, label, Toast.LENGTH_SHORT).show()
}, },
colors = ButtonDefaults.buttonColors(if (selected) MaterialTheme.colorScheme.primary else lightGrey) colors = ButtonDefaults.buttonColors(backgroundColor)
) { ) {
Text( Text(
modifier = Modifier.padding(top = 4.dp, bottom = 4.dp, start = 16.dp, end = 16.dp), modifier = Modifier.padding(top = 4.dp, bottom = 4.dp, start = 16.dp, end = 16.dp),

View File

@ -1,9 +1,8 @@
package org.mifospay.history package org.mifospay.history
import org.junit.Assert.assertEquals
import org.junit.Test import org.junit.Test
import org.junit.Assert.*
/** /**
* Example local unit test, which will execute on the development machine (host). * Example local unit test, which will execute on the development machine (host).
* *

View File

@ -1,9 +1,8 @@
package org.mifospay.feature.home package org.mifospay.feature.home
import org.junit.Assert.assertEquals
import org.junit.Test import org.junit.Test
import org.junit.Assert.*
/** /**
* Example local unit test, which will execute on the development machine (host). * Example local unit test, which will execute on the development machine (host).
* *

View File

@ -10,5 +10,4 @@ android {
dependencies { dependencies {
implementation(projects.core.data) implementation(projects.core.data)
implementation(projects.feature.receipt) implementation(projects.feature.receipt)
implementation(libs.androidx.appcompat)
} }

View File

@ -21,7 +21,6 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color
import androidx.compose.ui.input.pointer.pointerInput import androidx.compose.ui.input.pointer.pointerInput
import androidx.compose.ui.platform.LocalClipboardManager import androidx.compose.ui.platform.LocalClipboardManager
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.AnnotatedString import androidx.compose.ui.text.AnnotatedString
import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.font.FontWeight
@ -99,6 +98,7 @@ fun InvoiceDetailScreen(
} }
@Composable @Composable
@Suppress("LongMethod")
fun InvoiceDetailsContent( fun InvoiceDetailsContent(
invoice: Invoice?, invoice: Invoice?,
merchantId: String?, merchantId: String?,
@ -112,7 +112,6 @@ fun InvoiceDetailsContent(
.fillMaxWidth() .fillMaxWidth()
.padding(horizontal = 16.dp) .padding(horizontal = 16.dp)
) { ) {
val context = LocalContext.current
Text( Text(
text = stringResource(R.string.feature_invoices_invoice_details), text = stringResource(R.string.feature_invoices_invoice_details),
modifier = Modifier.padding(top = 16.dp) modifier = Modifier.padding(top = 16.dp)

View File

@ -1,9 +1,8 @@
package org.mifospay.invoices package org.mifospay.invoices
import org.junit.Assert.assertEquals
import org.junit.Test import org.junit.Test
import org.junit.Assert.*
/** /**
* Example local unit test, which will execute on the development machine (host). * Example local unit test, which will execute on the development machine (host).
* *

View File

@ -13,5 +13,6 @@ dependencies {
implementation(libs.sheets.compose.dialogs.core) implementation(libs.sheets.compose.dialogs.core)
implementation(libs.sheets.compose.dialogs.calender) implementation(libs.sheets.compose.dialogs.calender)
implementation(libs.compose.country.code.picker) implementation(libs.compose.country.code.picker)
// TODO:: this should be removed
implementation(libs.squareup.okhttp) implementation(libs.squareup.okhttp)
} }

View File

@ -117,6 +117,7 @@ fun KYCLevel2Screen(
} }
@Suppress("LongMethod", "CyclomaticComplexMethod")
@Composable @Composable
fun Kyc2Form( fun Kyc2Form(
modifier: Modifier, modifier: Modifier,

View File

@ -9,6 +9,7 @@ import org.mifospay.core.data.repository.local.LocalRepository
import javax.inject.Inject import javax.inject.Inject
@HiltViewModel @HiltViewModel
@Suppress("UnusedPrivateProperty")
class KYCLevel3ViewModel @Inject constructor( class KYCLevel3ViewModel @Inject constructor(
private val mUseCaseHandler: UseCaseHandler, private val mUseCaseHandler: UseCaseHandler,
private val mLocalRepository: LocalRepository private val mLocalRepository: LocalRepository

View File

@ -1,9 +1,8 @@
package org.mifospay.kyc package org.mifospay.kyc
import org.junit.Assert.assertEquals
import org.junit.Test import org.junit.Test
import org.junit.Assert.*
/** /**
* Example local unit test, which will execute on the development machine (host). * Example local unit test, which will execute on the development machine (host).
* *

View File

@ -1,9 +1,8 @@
package org.mifospay.feature.make.transfer package org.mifospay.feature.make.transfer
import org.junit.Assert.assertEquals
import org.junit.Test import org.junit.Test
import org.junit.Assert.*
/** /**
* Example local unit test, which will execute on the development machine (host). * Example local unit test, which will execute on the development machine (host).
* *

View File

@ -1,9 +1,8 @@
package org.mifospay.feature.merchants package org.mifospay.feature.merchants
import org.junit.Assert.assertEquals
import org.junit.Test import org.junit.Test
import org.junit.Assert.*
/** /**
* Example local unit test, which will execute on the development machine (host). * Example local unit test, which will execute on the development machine (host).
* *

View File

@ -1,9 +1,8 @@
package org.mifospay.notification package org.mifospay.notification
import org.junit.Assert.assertEquals
import org.junit.Test import org.junit.Test
import org.junit.Assert.*
/** /**
* Example local unit test, which will execute on the development machine (host). * Example local unit test, which will execute on the development machine (host).
* *

View File

@ -1,9 +1,8 @@
package org.mifospay.mobilewallet.mifospay.feature.passcode package org.mifospay.mobilewallet.mifospay.feature.passcode
import org.junit.Assert.assertEquals
import org.junit.Test import org.junit.Test
import org.junit.Assert.*
/** /**
* Example local unit test, which will execute on the development machine (host). * Example local unit test, which will execute on the development machine (host).
* *

View File

@ -1,9 +1,8 @@
package org.mifospay.payments package org.mifospay.payments
import org.junit.Assert.assertEquals
import org.junit.Test import org.junit.Test
import org.junit.Assert.*
/** /**
* Example local unit test, which will execute on the development machine (host). * Example local unit test, which will execute on the development machine (host).
* *

View File

@ -14,9 +14,8 @@ android {
dependencies { dependencies {
implementation(projects.core.data) implementation(projects.core.data)
implementation(libs.squareup.okhttp)
implementation(libs.compose.country.code.picker) implementation(libs.compose.country.code.picker)
// TODO:: this should be removed
implementation(libs.compose.material) implementation(libs.compose.material)
implementation(libs.coil.kt.compose) implementation(libs.coil.kt.compose)
implementation(libs.androidx.appcompat)
} }

View File

@ -1,9 +1,8 @@
package org.mifospay.profile package org.mifospay.profile
import org.junit.Assert.assertEquals
import org.junit.Test import org.junit.Test
import org.junit.Assert.*
/** /**
* Example local unit test, which will execute on the development machine (host). * Example local unit test, which will execute on the development machine (host).
* *

View File

@ -8,14 +8,10 @@ android {
} }
dependencies { dependencies {
//Todo: Remove these after migration implementation(libs.zxing)
implementation("com.jakewharton:butterknife-annotations:10.2.3") implementation(projects.core.data)
implementation("com.jakewharton:butterknife:10.2.3@aar")
implementation("me.dm7.barcodescanner:zxing:1.9.13")
implementation("com.journeyapps:zxing-android-embedded:4.2.0")
implementation(project(":core:data"))
implementation(libs.androidx.camera.view) implementation(libs.androidx.camera.view)
implementation(libs.androidx.camera.lifecycle) implementation(libs.androidx.camera.lifecycle)
// TODO:: this should be removed
implementation("com.google.guava:guava:27.0.1-android") implementation("com.google.guava:guava:27.0.1-android")
} }

View File

@ -6,6 +6,7 @@ import android.graphics.Bitmap
import android.graphics.BitmapFactory import android.graphics.BitmapFactory
import android.net.Uri import android.net.Uri
import android.os.Build import android.os.Build
import android.util.Log
import android.util.Size import android.util.Size
import androidx.activity.compose.rememberLauncherForActivityResult import androidx.activity.compose.rememberLauncherForActivityResult
import androidx.activity.result.contract.ActivityResultContracts import androidx.activity.result.contract.ActivityResultContracts
@ -32,7 +33,6 @@ import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalLifecycleOwner import androidx.compose.ui.platform.LocalLifecycleOwner
import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.stringResource
@ -201,7 +201,7 @@ fun loadBitmapFromUri(context: Context, uri: Uri): Bitmap? {
val stream = context.contentResolver.openInputStream(uri) val stream = context.contentResolver.openInputStream(uri)
BitmapFactory.decodeStream(stream) BitmapFactory.decodeStream(stream)
} catch (e: Exception) { } catch (e: Exception) {
e.printStackTrace() Log.e("Error", e.message.toString())
null null
} }
} }

View File

@ -1,6 +1,7 @@
package org.mifospay.feature.read.qr.utils package org.mifospay.feature.read.qr.utils
import android.graphics.ImageFormat import android.graphics.ImageFormat
import android.util.Log
import androidx.camera.core.ImageAnalysis import androidx.camera.core.ImageAnalysis
import androidx.camera.core.ImageProxy import androidx.camera.core.ImageProxy
import com.google.zxing.BarcodeFormat import com.google.zxing.BarcodeFormat
@ -47,7 +48,7 @@ class QrCodeAnalyzer(
}.decode(binaryBmp) }.decode(binaryBmp)
onQrCodeScanned(result.text) onQrCodeScanned(result.text)
} catch (e: Exception) { } catch (e: Exception) {
e.printStackTrace() Log.e("Error", e.message.toString())
} finally { } finally {
image.close() image.close()
} }

View File

@ -1,9 +1,8 @@
package org.mifospay.feature.qr package org.mifospay.feature.qr
import org.junit.Assert.assertEquals
import org.junit.Test import org.junit.Test
import org.junit.Assert.*
/** /**
* Example local unit test, which will execute on the development machine (host). * Example local unit test, which will execute on the development machine (host).
* *

View File

@ -8,9 +8,7 @@ android {
} }
dependencies { dependencies {
// TODO:: this should be removed
implementation(libs.squareup.okhttp) implementation(libs.squareup.okhttp)
implementation(projects.core.data) implementation(projects.core.data)
implementation(libs.androidx.appcompat)
implementation(projects.feature.passcode)
implementation(libs.mifosPasscode)
} }

View File

@ -67,6 +67,7 @@ import java.io.File
* PR link : https://github.com/openMF/mobile-wallet/pull/1618 * PR link : https://github.com/openMF/mobile-wallet/pull/1618
*/ */
@Composable @Composable
@Suppress("UnusedParameter")
fun ReceiptScreenRoute( fun ReceiptScreenRoute(
uri: Uri?, uri: Uri?,
viewModel: ReceiptViewModel = hiltViewModel(), viewModel: ReceiptViewModel = hiltViewModel(),

View File

@ -1,9 +1,8 @@
package org.mifospay.receipt package org.mifospay.receipt
import org.junit.Assert.assertEquals
import org.junit.Test import org.junit.Test
import org.junit.Assert.*
/** /**
* Example local unit test, which will execute on the development machine (host). * Example local unit test, which will execute on the development machine (host).
* *

View File

@ -14,6 +14,5 @@ dependencies {
implementation(projects.core.data) implementation(projects.core.data)
implementation(libs.zxing) implementation(libs.zxing)
implementation(libs.zxing.android.embedded)
implementation(libs.coil.kt.compose) implementation(libs.coil.kt.compose)
} }

View File

@ -94,6 +94,7 @@ fun PayVpsMobileScreen() {
} }
} }
@Suppress("CyclomaticComplexMethod")
@Composable @Composable
fun rememberQrBitmapPainter( fun rememberQrBitmapPainter(
content: String, content: String,

View File

@ -34,7 +34,7 @@ import org.mifospay.core.designsystem.component.MifosCustomDialog
import org.mifospay.core.designsystem.component.MifosOutlinedButton import org.mifospay.core.designsystem.component.MifosOutlinedButton
import org.mifospay.core.designsystem.icon.MifosIcons import org.mifospay.core.designsystem.icon.MifosIcons
@Suppress("MaxLineLength") @Suppress("MaxLineLength", "ReturnCount")
@Composable @Composable
fun SetAmountDialog( fun SetAmountDialog(
dismissDialog: () -> Unit, dismissDialog: () -> Unit,

View File

@ -20,6 +20,7 @@ import coil.compose.AsyncImage
import org.mifospay.core.designsystem.component.MifosButton import org.mifospay.core.designsystem.component.MifosButton
@Composable @Composable
@Suppress("ImplicitDefaultLocale")
fun ShowQrContent( fun ShowQrContent(
qrDataBitmap: Bitmap, qrDataBitmap: Bitmap,
amount: String?, amount: String?,

View File

@ -3,6 +3,7 @@ package org.mifospay.feature.request.money.util
import android.content.Context import android.content.Context
import android.graphics.Bitmap import android.graphics.Bitmap
import android.net.Uri import android.net.Uri
import android.util.Log
import androidx.core.content.FileProvider import androidx.core.content.FileProvider
import org.mifospay.feature.request.money.BuildConfig import org.mifospay.feature.request.money.BuildConfig
import java.io.File import java.io.File
@ -25,7 +26,7 @@ object ImageUtils {
BuildConfig.LIBRARY_PACKAGE_NAME+ ".provider", file BuildConfig.LIBRARY_PACKAGE_NAME+ ".provider", file
) )
} catch (e: IOException) { } catch (e: IOException) {
e.printStackTrace() Log.d("Error", e.message.toString())
} }
return uri return uri
} }

View File

@ -51,7 +51,7 @@ fun AddCardDialogSheet(
) )
} }
@Suppress("MaxLineLength") @Suppress("MaxLineLength", "CyclomaticComplexMethod", "ReturnCount")
@Composable @Composable
fun AddCardDialogSheetContent( fun AddCardDialogSheetContent(
cancelClicked: () -> Unit, cancelClicked: () -> Unit,

View File

@ -50,10 +50,6 @@ import org.mifospay.core.ui.EmptyContentScreen
import org.mifospay.core.ui.utility.AddCardChip import org.mifospay.core.ui.utility.AddCardChip
import org.mifospay.savedcards.R import org.mifospay.savedcards.R
enum class CardMenuAction {
EDIT, DELETE, CANCEL
}
@Composable @Composable
fun CardsScreen( fun CardsScreen(
viewModel: CardsScreenViewModel = hiltViewModel(), viewModel: CardsScreenViewModel = hiltViewModel(),
@ -111,6 +107,10 @@ fun CardsScreen(
) )
} }
enum class CardMenuAction {
EDIT, DELETE, CANCEL
}
@Composable @Composable
fun CardsScreen( fun CardsScreen(
cardState: CardsUiState, cardState: CardsUiState,

View File

@ -1,9 +1,8 @@
package org.mifospay.savedcards package org.mifospay.savedcards
import org.junit.Assert.assertEquals
import org.junit.Test import org.junit.Test
import org.junit.Assert.*
/** /**
* Example local unit test, which will execute on the development machine (host). * Example local unit test, which will execute on the development machine (host).
* *

View File

@ -11,7 +11,7 @@ dependencies {
implementation(projects.core.data) implementation(projects.core.data)
// we need it for country picker library // we need it for country picker library
implementation("androidx.compose.material:material:1.6.0") implementation(libs.compose.material)
implementation(libs.compose.country.code.picker) // remove after moving auth code to module implementation(libs.compose.country.code.picker) // remove after moving auth code to module
// Google Bar code scanner // Google Bar code scanner

View File

@ -5,8 +5,6 @@ import android.net.Uri
import android.provider.ContactsContract import android.provider.ContactsContract
import android.util.Log import android.util.Log
import android.widget.Toast import android.widget.Toast
import androidx.activity.compose.rememberLauncherForActivityResult
import androidx.activity.result.contract.ActivityResultContracts
import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.PaddingValues
@ -58,11 +56,6 @@ import org.mifospay.core.designsystem.component.MifosNavigationTopAppBar
import org.mifospay.core.designsystem.theme.styleMedium16sp import org.mifospay.core.designsystem.theme.styleMedium16sp
import org.mifospay.core.designsystem.theme.styleNormal18sp import org.mifospay.core.designsystem.theme.styleNormal18sp
enum class SendMethodType {
VPA, MOBILE
}
@Composable @Composable
fun SendScreenRoute( fun SendScreenRoute(
viewModel: SendPaymentViewModel = hiltViewModel(), viewModel: SendPaymentViewModel = hiltViewModel(),
@ -98,7 +91,10 @@ fun SendScreenRoute(
showToast(context.getString(it)) showToast(context.getString(it))
}, },
proceedWithTransferFlow = { externalId, transferAmount -> proceedWithTransferFlow = { externalId, transferAmount ->
proceedWithMakeTransferFlow.invoke(externalIdOrMobile, transferAmount.toString()) proceedWithMakeTransferFlow.invoke(
externalIdOrMobile,
transferAmount.toString()
)
} }
) )
} else { } else {
@ -108,14 +104,18 @@ fun SendScreenRoute(
) )
} }
enum class SendMethodType {
VPA, MOBILE
}
@Composable @Composable
@Suppress("LongMethod", "CyclomaticComplexMethod")
fun SendMoneyScreen( fun SendMoneyScreen(
showToolBar: Boolean, showToolBar: Boolean,
showProgress: Boolean, showProgress: Boolean,
onSubmit: (String, String, SendMethodType) -> Unit, onSubmit: (String, String, SendMethodType) -> Unit,
onBackClick: () -> Unit, onBackClick: () -> Unit,
) { ) {
val context = LocalContext.current val context = LocalContext.current
var amount by rememberSaveable { mutableStateOf("") } var amount by rememberSaveable { mutableStateOf("") }
@ -136,29 +136,12 @@ fun SendMoneyScreen(
} }
} }
val contactLauncher = rememberLauncherForActivityResult(
contract = ActivityResultContracts.PickContact()
) { uri: Uri? ->
uri?.let { contactUri = uri }
}
LaunchedEffect(key1 = contactUri) { LaunchedEffect(key1 = contactUri) {
contactUri?.let { contactUri?.let {
mobileNumber = getContactPhoneNumber(it, context) mobileNumber = getContactPhoneNumber(it, context)
} }
} }
val permissionLauncher = rememberLauncherForActivityResult(
contract = ActivityResultContracts.RequestPermission(),
onResult = { isGranted: Boolean ->
if (isGranted) {
contactLauncher.launch(null)
} else {
// Handle permission denial
}
}
)
val options = GmsBarcodeScannerOptions.Builder() val options = GmsBarcodeScannerOptions.Builder()
.setBarcodeFormats( .setBarcodeFormats(
Barcode.FORMAT_QR_CODE, Barcode.FORMAT_QR_CODE,

View File

@ -1,9 +1,8 @@
package org.mifospay.feature.send.money package org.mifospay.feature.send.money
import org.junit.Assert.assertEquals
import org.junit.Test import org.junit.Test
import org.junit.Assert.*
/** /**
* Example local unit test, which will execute on the development machine (host). * Example local unit test, which will execute on the development machine (host).
* *

Some files were not shown because too many files have changed in this diff Show More