mirror of
https://github.com/openMF/mobile-wallet.git
synced 2026-02-06 09:37:24 +00:00
Refactor: dependencies to version catalog and remove unused files (#1717)
This commit is contained in:
parent
bac1001012
commit
6f87da5869
@ -26,33 +26,41 @@ plugins {
|
||||
alias(libs.plugins.secrets) apply false
|
||||
alias(libs.plugins.room) 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
|
||||
}
|
||||
|
||||
val detektProjectBaseline by tasks.registering(DetektCreateBaselineTask::class) {
|
||||
description = "Overrides current baseline."
|
||||
ignoreFailures.set(true)
|
||||
parallel.set(true)
|
||||
setSource(files(rootDir))
|
||||
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")
|
||||
val detektFormatting = libs.detekt.formatting
|
||||
val twitterComposeRules = libs.twitter.detekt.compose
|
||||
|
||||
val reportMerge by tasks.registering(io.gitlab.arturbosch.detekt.report.ReportMergeTask::class) {
|
||||
output.set(rootProject.layout.buildDirectory.file("reports/detekt/merge.html")) // or "reports/detekt/merge.sarif"
|
||||
}
|
||||
|
||||
allprojects {
|
||||
apply(plugin = "io.gitlab.arturbosch.detekt")
|
||||
subprojects {
|
||||
apply {
|
||||
plugin("io.gitlab.arturbosch.detekt")
|
||||
}
|
||||
|
||||
detekt {
|
||||
config = files("$rootDir/config/detekt/detekt.yml")
|
||||
buildUponDefaultConfig = true
|
||||
parallel = true
|
||||
ignoreFailures = false
|
||||
config.from(rootProject.files("config/detekt/detekt.yml"))
|
||||
reports.xml.required.set(true)
|
||||
}
|
||||
|
||||
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
@ -10,6 +10,7 @@ package org.mifospay.core.analytics
|
||||
*
|
||||
* @param extras - list of parameters which supply additional context to the event. See `Param`.
|
||||
*/
|
||||
@Suppress("UtilityClassWithPublicConstructor")
|
||||
data class AnalyticsEvent(
|
||||
val type: String,
|
||||
val extras: List<Param> = emptyList(),
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
package org.mifospay.core.analytics.di
|
||||
|
||||
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.AnalyticsHelper
|
||||
import javax.inject.Inject
|
||||
|
||||
@ -1,9 +1,8 @@
|
||||
package org.mifospay.mobilewallet.mifospay.analytics
|
||||
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Test
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
@ -14,4 +13,4 @@ class ExampleUnitTest {
|
||||
fun addition_isCorrect() {
|
||||
assertEquals(4, 2 + 2)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,27 +2,23 @@ package org.mifospay.common
|
||||
|
||||
object CreditCardUtils {
|
||||
fun validateCreditCardNumber(str: String): Boolean {
|
||||
val u = 2
|
||||
if (u - 2 == 0) {
|
||||
return true // for backend testing. remove after testing.
|
||||
}
|
||||
if (str.length == 0) {
|
||||
if (str.isEmpty()) {
|
||||
return false
|
||||
}
|
||||
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()
|
||||
}
|
||||
run {
|
||||
var i = ints.size - 2
|
||||
while (i >= 0) {
|
||||
var j = ints[i]
|
||||
j = j * 2
|
||||
j *= 2
|
||||
if (j > 9) {
|
||||
j = j % 10 + 1
|
||||
}
|
||||
ints[i] = j
|
||||
i = i - 2
|
||||
i -= 2
|
||||
}
|
||||
}
|
||||
var sum = 0
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package org.mifospay.common
|
||||
|
||||
import android.util.Log
|
||||
import java.io.File
|
||||
import java.io.FileOutputStream
|
||||
import java.io.InputStream
|
||||
@ -7,18 +8,19 @@ import java.io.OutputStream
|
||||
|
||||
object FileUtils {
|
||||
|
||||
fun writeInputStreamDataToFile(`in`: InputStream, file: File?): Boolean {
|
||||
fun writeInputStreamDataToFile(inputStream: InputStream, file: File?): Boolean {
|
||||
return try {
|
||||
val out: OutputStream = FileOutputStream(file)
|
||||
val buf = ByteArray(1024)
|
||||
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.close()
|
||||
`in`.close()
|
||||
inputStream.close()
|
||||
true
|
||||
} catch (e: Exception) {
|
||||
Log.e("Message",e.message.toString())
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,9 +1,8 @@
|
||||
package org.mifospay.common
|
||||
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Test
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
|
||||
@ -39,5 +39,5 @@ dependencies {
|
||||
implementation(libs.jetbrains.kotlin.jdk7)
|
||||
|
||||
testImplementation(libs.junit)
|
||||
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
|
||||
androidTestImplementation(libs.espresso.core)
|
||||
}
|
||||
|
||||
@ -1,23 +1,24 @@
|
||||
package org.mifospay.core.data.domain.usecase.account
|
||||
|
||||
import okhttp3.ResponseBody
|
||||
import org.mifospay.core.data.base.UseCase
|
||||
import org.mifospay.core.data.fineract.repository.FineractRepository
|
||||
import com.mifospay.core.model.entity.TPTResponse
|
||||
import com.mifospay.core.model.entity.accounts.savings.SavingAccount
|
||||
import com.mifospay.core.model.entity.beneficary.Beneficiary
|
||||
import com.mifospay.core.model.entity.beneficary.BeneficiaryPayload
|
||||
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.ClientAccounts
|
||||
import com.mifospay.core.model.entity.payload.TransferPayload
|
||||
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 rx.Subscriber
|
||||
import rx.android.schedulers.AndroidSchedulers
|
||||
import rx.schedulers.Schedulers
|
||||
import javax.inject.Inject
|
||||
|
||||
@Suppress("UnusedPrivateMember")
|
||||
class TransferFunds @Inject constructor( private val apiRepository: FineractRepository) :
|
||||
UseCase<TransferFunds.RequestValues, TransferFunds.ResponseValue>() {
|
||||
|
||||
|
||||
@ -30,7 +30,7 @@ class CreateClient @Inject constructor(private val apiRepository: FineractReposi
|
||||
message = (e as HttpException).response()?.errorBody()?.string().toString()
|
||||
message = getUserMessage(message)
|
||||
} catch (e1: Exception) {
|
||||
message = "Error"
|
||||
message = e1.message.toString()
|
||||
}
|
||||
useCaseCallback.onError(message)
|
||||
}
|
||||
|
||||
@ -33,7 +33,7 @@ class UpdateClient @Inject constructor(private val fineractRepository: FineractR
|
||||
message = (e as HttpException).response()?.errorBody()?.string().toString()
|
||||
message = getUserMessage(message)
|
||||
} catch (e1: Exception) {
|
||||
message = "Error"
|
||||
message = e1.message.toString()
|
||||
}
|
||||
useCaseCallback.onError(message)
|
||||
}
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
package org.mifospay.core.data.domain.usecase.invoice
|
||||
|
||||
import android.net.Uri
|
||||
import org.mifospay.core.data.base.UseCase
|
||||
import android.util.Log
|
||||
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.util.Constants
|
||||
import rx.Subscriber
|
||||
@ -51,6 +52,7 @@ class FetchInvoice @Inject constructor(private val mFineractRepository: Fineract
|
||||
|
||||
}
|
||||
} catch (e: IndexOutOfBoundsException) {
|
||||
Log.e("Error", e.message.toString())
|
||||
useCaseCallback.onError("Invalid link used to open the App")
|
||||
}
|
||||
}
|
||||
|
||||
@ -23,12 +23,12 @@ class CreateUser @Inject constructor(private val apiRepository: FineractReposito
|
||||
override fun onCompleted() {}
|
||||
override fun onError(e: Throwable) {
|
||||
getUserMessage(e)
|
||||
var message = "Error"
|
||||
var message: String
|
||||
try {
|
||||
message = (e as HttpException).response()!!.errorBody()!!.string()
|
||||
message = getUserMessage(message)
|
||||
} catch (e1: Exception) {
|
||||
message = "Error"
|
||||
message = e1.message.toString()
|
||||
}
|
||||
useCaseCallback.onError(message)
|
||||
}
|
||||
|
||||
@ -23,12 +23,12 @@ class UpdateUser @Inject constructor(
|
||||
.subscribe(object : Subscriber<GenericResponse>() {
|
||||
override fun onCompleted() {}
|
||||
override fun onError(e: Throwable) {
|
||||
var message = "Error"
|
||||
var message: String
|
||||
try {
|
||||
message = (e as HttpException).response()!!.errorBody()!!.string()
|
||||
message = getUserMessage(message)
|
||||
} catch (e1: Exception) {
|
||||
message = "Error"
|
||||
message = e1.message.toString()
|
||||
}
|
||||
useCaseCallback.onError(message)
|
||||
}
|
||||
|
||||
@ -43,6 +43,7 @@ import javax.inject.Singleton
|
||||
|
||||
|
||||
@Singleton
|
||||
@Suppress("TooManyFunctions")
|
||||
class FineractRepository @Inject constructor(
|
||||
private val fineractApiManager: FineractApiManager,
|
||||
private val selfApiManager: SelfServiceApiManager
|
||||
|
||||
@ -9,7 +9,7 @@ import kotlinx.coroutines.flow.flow
|
||||
import kotlinx.coroutines.flow.flowOn
|
||||
import org.mifospay.core.network.Dispatcher
|
||||
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
|
||||
|
||||
/**
|
||||
|
||||
@ -18,12 +18,12 @@ object ErrorJsonMessageHelper {
|
||||
|
||||
@JvmStatic
|
||||
fun getUserMessage(e: Throwable): String? {
|
||||
var message: String? = "Error"
|
||||
var message: String?
|
||||
try {
|
||||
message = (e as HttpException).response()?.errorBody()?.string().toString()
|
||||
message = getUserMessage(message)
|
||||
} catch (e1: Exception) {
|
||||
message = "Error"
|
||||
message = e1.message.toString()
|
||||
}
|
||||
return message
|
||||
}
|
||||
|
||||
@ -1,9 +1,8 @@
|
||||
package org.mifospay.core.datastore
|
||||
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Test
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
|
||||
@ -23,6 +23,6 @@ dependencies {
|
||||
api(libs.androidx.compose.ui.util)
|
||||
api(libs.androidx.activity.compose)
|
||||
|
||||
//testImplementation(libs.androidx.compose.ui.test)
|
||||
//androidTestImplementation(libs.androidx.compose.ui.test)
|
||||
testImplementation(libs.androidx.compose.ui.test)
|
||||
androidTestImplementation(libs.androidx.compose.ui.test)
|
||||
}
|
||||
@ -23,7 +23,8 @@ import kotlinx.coroutines.launch
|
||||
@Composable
|
||||
fun MifosBottomSheet(
|
||||
content: @Composable () -> Unit,
|
||||
onDismiss: () -> Unit
|
||||
onDismiss: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
val coroutineScope = rememberCoroutineScope()
|
||||
val modalSheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true)
|
||||
@ -50,7 +51,8 @@ fun MifosBottomSheet(
|
||||
showBottomSheet = false
|
||||
dismissSheet()
|
||||
},
|
||||
sheetState = modalSheetState
|
||||
sheetState = modalSheetState,
|
||||
modifier = modifier,
|
||||
) {
|
||||
content()
|
||||
}
|
||||
|
||||
@ -288,6 +288,7 @@ fun MifosButtonLeadingIconPreview() {
|
||||
/**
|
||||
* Mifos Wallet button default values.
|
||||
*/
|
||||
@Suppress("ForbiddenComment")
|
||||
object MifosButtonDefaults {
|
||||
// TODO: File bug
|
||||
// OutlinedButton border color doesn't respect disabled state by default
|
||||
|
||||
@ -7,12 +7,6 @@ import androidx.compose.material3.Scaffold
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.graphics.Color
|
||||
|
||||
data class FloatingActionButtonContent(
|
||||
val onClick: (() -> Unit),
|
||||
val contentColor: Color,
|
||||
val content: (@Composable () -> Unit)
|
||||
)
|
||||
|
||||
@Composable
|
||||
fun MifosScaffold(
|
||||
topBarTitle: Int? = null,
|
||||
@ -44,4 +38,10 @@ fun MifosScaffold(
|
||||
snackbarHost = snackbarHost,
|
||||
content = scaffoldContent,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
data class FloatingActionButtonContent(
|
||||
val onClick: (() -> Unit),
|
||||
val contentColor: Color,
|
||||
val content: (@Composable () -> Unit)
|
||||
)
|
||||
|
||||
@ -20,6 +20,7 @@ import androidx.core.content.ContextCompat
|
||||
import androidx.lifecycle.Lifecycle
|
||||
import androidx.lifecycle.LifecycleEventObserver
|
||||
|
||||
@Suppress("LongMethod", "CyclomaticComplexMethod")
|
||||
@Composable
|
||||
fun PermissionBox(
|
||||
requiredPermissions: List<String>,
|
||||
@ -57,9 +58,9 @@ fun PermissionBox(
|
||||
}
|
||||
|
||||
val decideCurrentPermissionStatus: (Boolean, Boolean) -> String =
|
||||
{ permissionGranted, shouldShowPermissionRationale ->
|
||||
if (permissionGranted) "Granted"
|
||||
else if (shouldShowPermissionRationale) "Rejected"
|
||||
{ granted, rationale ->
|
||||
if (granted) "Granted"
|
||||
else if (rationale) "Rejected"
|
||||
else "Denied"
|
||||
}
|
||||
|
||||
|
||||
@ -73,6 +73,7 @@ private val DarkDefaultColorScheme = darkColorScheme(
|
||||
scrim = md_theme_dark_scrim,
|
||||
)
|
||||
|
||||
@Suppress("UnusedParameter")
|
||||
@Composable
|
||||
fun MifosTheme(
|
||||
darkTheme: Boolean = isSystemInDarkTheme(),
|
||||
|
||||
@ -5,6 +5,7 @@ import androidx.compose.ui.text.input.OffsetMapping
|
||||
import androidx.compose.ui.text.input.TransformedText
|
||||
import androidx.compose.ui.text.input.VisualTransformation
|
||||
|
||||
@Suppress("ReturnCount")
|
||||
class ExpirationDateMask : VisualTransformation {
|
||||
override fun filter(text: AnnotatedString): TransformedText {
|
||||
return makeExpirationFilter(text)
|
||||
|
||||
@ -1,9 +1,8 @@
|
||||
package com.mifos.mobilewallet.model
|
||||
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Test
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
package org.mifospay.core.network
|
||||
|
||||
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.InputStream
|
||||
import java.util.Properties
|
||||
|
||||
@ -4,8 +4,8 @@ import dagger.Binds
|
||||
import dagger.Module
|
||||
import dagger.hilt.InstallIn
|
||||
import dagger.hilt.components.SingletonComponent
|
||||
import org.mifospay.core.network.local_assets.LocalAssetDataSource
|
||||
import org.mifospay.core.network.local_assets.MifosLocalAssetDataSource
|
||||
import org.mifospay.core.network.localAssets.LocalAssetDataSource
|
||||
import org.mifospay.core.network.localAssets.MifosLocalAssetDataSource
|
||||
|
||||
@Module
|
||||
@InstallIn(SingletonComponent::class)
|
||||
|
||||
@ -12,7 +12,7 @@ import org.mifospay.core.network.BaseURL
|
||||
import org.mifospay.core.network.FineractApiManager
|
||||
import org.mifospay.core.network.MifosWalletOkHttpClient
|
||||
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.AuthenticationService
|
||||
import org.mifospay.core.network.services.BeneficiaryService
|
||||
@ -38,6 +38,7 @@ import javax.inject.Singleton
|
||||
|
||||
@Module
|
||||
@InstallIn(SingletonComponent::class)
|
||||
@Suppress("TooManyFunctions")
|
||||
class NetworkModule {
|
||||
|
||||
@Provides
|
||||
|
||||
@ -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.Country
|
||||
@ -1,4 +1,4 @@
|
||||
package org.mifospay.core.network.local_assets
|
||||
package org.mifospay.core.network.localAssets
|
||||
|
||||
import java.io.InputStream
|
||||
|
||||
@ -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.Country
|
||||
import com.mifospay.core.model.State
|
||||
@ -16,6 +17,7 @@ import javax.inject.Inject
|
||||
class MifosLocalAssetDataSource @Inject constructor(
|
||||
@Dispatcher(MifosDispatchers.IO) private val ioDispatcher: CoroutineDispatcher,
|
||||
private val networkJson: Json,
|
||||
@SuppressLint("VisibleForTests")
|
||||
private val assets: LocalAssetManager = JvmLocalAssetManager,
|
||||
) : LocalAssetDataSource {
|
||||
|
||||
@ -47,6 +49,7 @@ class MifosLocalAssetDataSource @Inject constructor(
|
||||
}
|
||||
}
|
||||
|
||||
@Suppress("UnusedPrivateProperty")
|
||||
companion object {
|
||||
private const val COUNTRIES_ASSET = "countries.json"
|
||||
private const val STATES_ASSET = "states.json"
|
||||
@ -9,6 +9,7 @@ import rx.Observable
|
||||
/**
|
||||
* Created by ankur on 06/June/2018
|
||||
*/
|
||||
@Suppress("FunctionParameterNaming")
|
||||
interface RunReportService {
|
||||
@GET(ApiEndPoints.RUN_REPORT + "/Savings Transaction Receipt")
|
||||
fun getTransactionReceipt(
|
||||
|
||||
@ -1,9 +1,8 @@
|
||||
package org.mifospay.mobilewallet.mifospay.network
|
||||
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Test
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
|
||||
@ -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.Row
|
||||
|
||||
@ -1,9 +1,8 @@
|
||||
package org.mifospay.mobilewallet.mifospay.ui
|
||||
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Test
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
|
||||
@ -9,7 +9,7 @@ android {
|
||||
|
||||
dependencies {
|
||||
implementation(projects.core.data)
|
||||
// TODO:: this should be removed
|
||||
implementation(libs.compose.material)
|
||||
implementation(libs.androidx.appcompat)
|
||||
implementation(projects.feature.upiSetup)
|
||||
}
|
||||
@ -1,6 +1,6 @@
|
||||
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.clickable
|
||||
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.width
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Surface
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.getValue
|
||||
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.setValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.painter.Painter
|
||||
import androidx.compose.ui.layout.ContentScale
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import kotlinx.coroutines.delay
|
||||
import org.mifospay.core.designsystem.component.MifosBottomSheet
|
||||
import org.mifospay.core.designsystem.component.MifosButton
|
||||
import org.mifospay.core.designsystem.theme.MifosTheme
|
||||
@ -37,15 +41,20 @@ import org.mifospay.feature.bank.accounts.R
|
||||
|
||||
@Composable
|
||||
fun ChooseSimDialogSheet(
|
||||
onSimSelected: (Int) -> Unit
|
||||
onSimSelected: (Int) -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
MifosBottomSheet(content = {
|
||||
ChooseSimDialogSheetContent { selectedSim ->
|
||||
onSimSelected.invoke(selectedSim)
|
||||
}
|
||||
}, onDismiss = {
|
||||
onSimSelected.invoke(-1)
|
||||
})
|
||||
MifosBottomSheet(
|
||||
content = {
|
||||
ChooseSimDialogSheetContent(
|
||||
onSimSelected = onSimSelected
|
||||
)
|
||||
},
|
||||
onDismiss = {
|
||||
onSimSelected.invoke(-1)
|
||||
},
|
||||
modifier = modifier,
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
@ -53,12 +62,25 @@ fun ChooseSimDialogSheet(
|
||||
* show both of them and implement send SMS after select and confirm.
|
||||
*/
|
||||
@Composable
|
||||
fun ChooseSimDialogSheetContent(onSimSelected: (Int) -> Unit) {
|
||||
val context = LocalContext.current
|
||||
@Suppress("LongMethod")
|
||||
fun ChooseSimDialogSheetContent(
|
||||
onSimSelected: (Int) -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
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(
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
modifier = Modifier
|
||||
modifier = modifier
|
||||
.fillMaxSize()
|
||||
.padding(8.dp)
|
||||
) {
|
||||
@ -95,8 +117,10 @@ fun ChooseSimDialogSheetContent(onSimSelected: (Int) -> Unit) {
|
||||
)
|
||||
|
||||
Spacer(modifier = Modifier.width(24.dp))
|
||||
Text(text = stringResource(id = R.string.feature_accounts_or),
|
||||
color = MaterialTheme.colorScheme.onSurface)
|
||||
Text(
|
||||
text = stringResource(id = R.string.feature_accounts_or),
|
||||
color = MaterialTheme.colorScheme.onSurface
|
||||
)
|
||||
Spacer(modifier = Modifier.width(24.dp))
|
||||
SimCard(
|
||||
simNumber = 2,
|
||||
@ -110,17 +134,25 @@ fun ChooseSimDialogSheetContent(onSimSelected: (Int) -> Unit) {
|
||||
color = MaterialTheme.colorScheme.onSurface,
|
||||
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(
|
||||
modifier = Modifier
|
||||
.width(200.dp)
|
||||
.padding(top = 16.dp),
|
||||
onClick = {
|
||||
if (selectedSim == -1) {
|
||||
Toast.makeText(
|
||||
context,
|
||||
context.getString(R.string.feature_accounts_choose_a_sim),
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
showMessage = true
|
||||
} else {
|
||||
onSimSelected(selectedSim)
|
||||
}
|
||||
@ -134,17 +166,21 @@ fun ChooseSimDialogSheetContent(onSimSelected: (Int) -> Unit) {
|
||||
|
||||
@Composable
|
||||
fun SimCard(
|
||||
simNumber: Int, isSelected: Boolean, onSimSelected: () -> Unit
|
||||
simNumber: Int,
|
||||
isSelected: Boolean,
|
||||
onSimSelected: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
val drawable: Painter = painterResource(
|
||||
id = if (isSelected) {
|
||||
R.drawable.feature_accounts_sim_card_selected
|
||||
} else R.drawable.feature_accounts_sim_card_unselected
|
||||
)
|
||||
Image(painter = drawable,
|
||||
Image(
|
||||
painter = drawable,
|
||||
contentDescription = "SIM Card $simNumber",
|
||||
contentScale = ContentScale.Fit,
|
||||
modifier = Modifier
|
||||
modifier = modifier
|
||||
.size(50.dp)
|
||||
.clickable { onSimSelected() }
|
||||
)
|
||||
@ -154,6 +190,10 @@ fun SimCard(
|
||||
@Composable
|
||||
fun SimSelectionPreview() {
|
||||
MifosTheme {
|
||||
ChooseSimDialogSheetContent(onSimSelected = {})
|
||||
Surface {
|
||||
ChooseSimDialogSheetContent(
|
||||
onSimSelected = {}
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -69,16 +69,18 @@ fun LinkBankAccountRoute(
|
||||
var showOverlyProgressBar by rememberSaveable { mutableStateOf(false) }
|
||||
|
||||
if (showSimBottomSheet) {
|
||||
ChooseSimDialogSheet { selectedSim ->
|
||||
showSimBottomSheet = false
|
||||
if (selectedSim != -1) {
|
||||
showOverlyProgressBar = true
|
||||
viewModel.fetchBankAccountDetails {
|
||||
showOverlyProgressBar = false
|
||||
onBackClick()
|
||||
ChooseSimDialogSheet(
|
||||
onSimSelected = { selectedSim ->
|
||||
showSimBottomSheet = false
|
||||
if (selectedSim != -1) {
|
||||
showOverlyProgressBar = true
|
||||
viewModel.fetchBankAccountDetails {
|
||||
showOverlyProgressBar = false
|
||||
onBackClick()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
LinkBankAccountScreen(
|
||||
@ -175,7 +177,10 @@ fun BankListScreenContent(
|
||||
Spacer(modifier = Modifier.height(24.dp))
|
||||
Text(
|
||||
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)
|
||||
)
|
||||
Spacer(modifier = Modifier.height(12.dp))
|
||||
@ -186,7 +191,10 @@ fun BankListScreenContent(
|
||||
Spacer(modifier = Modifier.height(24.dp))
|
||||
Text(
|
||||
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)
|
||||
)
|
||||
Spacer(modifier = Modifier.height(12.dp))
|
||||
|
||||
@ -1,9 +1,8 @@
|
||||
package org.mifospay.feature.bank.accounts
|
||||
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Test
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
|
||||
@ -17,21 +17,19 @@ dependencies {
|
||||
implementation(projects.feature.passcode)
|
||||
|
||||
implementation(libs.compose.country.code.picker)
|
||||
// TODO:: this should be removed
|
||||
implementation(libs.compose.material)
|
||||
|
||||
// Credentials Manager
|
||||
implementation("androidx.credentials:credentials:1.2.1")
|
||||
implementation(libs.androidx.credentials)
|
||||
// optional - needed for credentials support from play services, for devices running
|
||||
// Android 13 and below.
|
||||
implementation("androidx.credentials:credentials-play-services-auth:1.2.1")
|
||||
implementation("com.google.android.libraries.identity.googleid:googleid:1.1.0")
|
||||
implementation(libs.androidx.credentials.play.services.auth)
|
||||
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")
|
||||
|
||||
// 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.play.services.auth)
|
||||
|
||||
implementation(libs.androidx.core.ktx)
|
||||
implementation(libs.androidx.appcompat)
|
||||
|
||||
@ -31,7 +31,6 @@ import androidx.compose.runtime.saveable.rememberSaveable
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.res.stringResource
|
||||
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.theme.MifosTheme
|
||||
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.feature.auth.R
|
||||
import org.mifospay.feature.auth.social_signup.SocialSignupMethodContentScreen
|
||||
import org.mifospay.feature.auth.socialSignup.SocialSignupMethodContentScreen
|
||||
import org.mifospay.feature.passcode.PassCodeActivity
|
||||
|
||||
@Composable
|
||||
@ -86,6 +83,7 @@ fun LoginScreen(
|
||||
}
|
||||
|
||||
@Composable
|
||||
@Suppress("LongMethod")
|
||||
fun LoginScreenContent(
|
||||
showProgress: Boolean,
|
||||
login: (username: String, password: String) -> Unit,
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
package org.mifospay.feature.auth.mobile_verify
|
||||
package org.mifospay.feature.auth.mobileVerify
|
||||
|
||||
import android.widget.Toast
|
||||
import androidx.compose.foundation.background
|
||||
@ -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.mutableStateOf
|
||||
@ -17,6 +17,7 @@ import org.mifospay.core.data.domain.usecase.client.SearchClient
|
||||
import javax.inject.Inject
|
||||
|
||||
@HiltViewModel
|
||||
@Suppress("UnusedParameter")
|
||||
class MobileVerificationViewModel @Inject constructor(
|
||||
private val mUseCaseHandler: UseCaseHandler,
|
||||
private val searchClientUseCase: SearchClient
|
||||
@ -32,7 +33,8 @@ class MobileVerificationViewModel @Inject constructor(
|
||||
* Verify Mobile number that it already exist or not then request otp
|
||||
*/
|
||||
fun verifyMobileAndRequestOtp(
|
||||
fullNumber: String, mobileNo: String,
|
||||
fullNumber: String,
|
||||
mobileNo: String,
|
||||
onError: (String?) -> Unit
|
||||
) {
|
||||
showProgress = true
|
||||
@ -7,6 +7,7 @@ import org.mifospay.feature.auth.login.LoginScreen
|
||||
|
||||
const val LOGIN_ROUTE = "login_route"
|
||||
|
||||
@Suppress("UnusedParameter")
|
||||
fun NavGraphBuilder.loginScreen(
|
||||
onDismissSignUp: () -> Unit,
|
||||
onNavigateToMobileVerificationScreen:(Int,String,String,String,String,) -> Unit
|
||||
|
||||
@ -8,7 +8,7 @@ import androidx.navigation.NavType
|
||||
import androidx.navigation.compose.composable
|
||||
import androidx.navigation.navArgument
|
||||
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"
|
||||
|
||||
|
||||
@ -11,6 +11,7 @@ import org.mifospay.feature.auth.signup.SignupScreen
|
||||
|
||||
const val SIGNUP_ROUTE = "signup_route"
|
||||
|
||||
@Suppress("UnusedParameter")
|
||||
fun NavGraphBuilder.signupScreen(
|
||||
onLoginSuccess: () -> Unit,
|
||||
onRegisterSuccess: () -> Unit
|
||||
@ -57,9 +58,14 @@ fun NavController.navigateToSignup(
|
||||
lastName: 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?) {
|
||||
// registered but unable to login or user not updated with client
|
||||
// TODO :: Consider this case
|
||||
|
||||
@ -83,7 +83,7 @@ fun SignupScreen(
|
||||
}
|
||||
}
|
||||
|
||||
SignupScreen(
|
||||
SignupScreenContent(
|
||||
showProgressState = viewModel.showProgress,
|
||||
data = viewModel.signupData,
|
||||
stateList = stateList,
|
||||
@ -96,7 +96,8 @@ fun SignupScreen(
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun SignupScreen(
|
||||
@Suppress("LongMethod", "CyclomaticComplexMethod")
|
||||
fun SignupScreenContent(
|
||||
showProgressState: Boolean = false,
|
||||
data: SignupData,
|
||||
stateList: List<State>,
|
||||
@ -469,7 +470,7 @@ private fun getPasswordStrengthColor(password: String): Color {
|
||||
@Preview
|
||||
@Composable
|
||||
fun SignupScreenPreview() {
|
||||
SignupScreen(
|
||||
SignupScreenContent(
|
||||
showProgressState = false,
|
||||
data = SignupData(),
|
||||
stateList = listOf(),
|
||||
|
||||
@ -17,6 +17,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.data.base.UseCase
|
||||
import org.mifospay.core.data.base.UseCaseHandler
|
||||
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.UpdateUser
|
||||
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 javax.inject.Inject
|
||||
|
||||
@ -187,9 +187,9 @@ class SignupViewModel @Inject constructor(
|
||||
useCaseHandler.execute(authenticateUserUseCase, requestValue,
|
||||
object : UseCase.UseCaseCallback<AuthenticateUser.ResponseValue> {
|
||||
override fun onSuccess(response: AuthenticateUser.ResponseValue) {
|
||||
response?.user?.let { createAuthenticatedService(it) }
|
||||
createAuthenticatedService(response.user)
|
||||
fetchClientData(showToastMessage)
|
||||
response?.user?.let { fetchUserDetails(it) }
|
||||
fetchUserDetails(response.user)
|
||||
}
|
||||
|
||||
override fun onError(message: String) {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
@file:Suppress("MaxLineLength")
|
||||
|
||||
package org.mifospay.feature.auth.social_signup
|
||||
package org.mifospay.feature.auth.socialSignup
|
||||
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
@ -68,6 +68,7 @@ fun SocialSignupMethodContentScreen(
|
||||
}
|
||||
|
||||
@Composable
|
||||
@Suppress("NestedBlockDepth")
|
||||
fun SocialSignupMethodScreen(
|
||||
onDismissSignUp: () -> Unit
|
||||
) {
|
||||
@ -180,6 +181,7 @@ fun SocialSignupMethodScreen(
|
||||
}
|
||||
|
||||
@Composable
|
||||
@Suppress("LongMethod")
|
||||
fun SignupMethodContentScreen(
|
||||
showProgress: Boolean,
|
||||
onSignUpAsMerchant: (Boolean) -> Unit,
|
||||
@ -293,6 +295,7 @@ fun SignupMethodContentScreen(
|
||||
}
|
||||
}
|
||||
|
||||
@Suppress("UnusedParameter")
|
||||
fun GoogleIdTokenCredential?.signUpWithMifos(
|
||||
context: Context,
|
||||
mifosSavingsProductId: Int,
|
||||
@ -1,9 +1,8 @@
|
||||
package org.mifospay.mobilewallet.mifospay.auth
|
||||
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Test
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
|
||||
@ -103,11 +103,11 @@ fun EditPasswordScreen(
|
||||
},
|
||||
backPress = onBackPress,
|
||||
|
||||
scaffoldContent = { it ->
|
||||
scaffoldContent = { paddingValues ->
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.padding(it)
|
||||
.padding(paddingValues)
|
||||
) {
|
||||
MfPasswordTextField(
|
||||
modifier = Modifier
|
||||
|
||||
@ -14,6 +14,7 @@ import org.mifospay.core.datastore.PreferencesHelper
|
||||
import javax.inject.Inject
|
||||
|
||||
@HiltViewModel
|
||||
@Suppress("NestedBlockDepth")
|
||||
class EditPasswordViewModel @Inject constructor(
|
||||
private val mUseCaseHandler: UseCaseHandler,
|
||||
private val mPreferencesHelper: PreferencesHelper,
|
||||
|
||||
@ -1,9 +1,8 @@
|
||||
package org.mifospay.feature.editpassword
|
||||
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Test
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
|
||||
@ -4,9 +4,9 @@ plugins {
|
||||
}
|
||||
|
||||
android {
|
||||
namespace = "com.example.faq"
|
||||
namespace = "org.mifospay.feature.faq"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(libs.androidx.appcompat)
|
||||
|
||||
}
|
||||
@ -1,7 +1,6 @@
|
||||
package org.mifospay.feature.faq
|
||||
|
||||
import androidx.lifecycle.ViewModel
|
||||
import com.example.faq.R
|
||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||
import javax.inject.Inject
|
||||
|
||||
|
||||
@ -10,7 +10,6 @@ import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.hilt.navigation.compose.hiltViewModel
|
||||
import com.example.faq.R
|
||||
import org.mifospay.core.designsystem.component.MifosTopBar
|
||||
import org.mifospay.core.ui.FaqItemScreen
|
||||
|
||||
|
||||
@ -1,9 +1,8 @@
|
||||
package com.example.faq
|
||||
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Test
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
|
||||
@ -2,10 +2,10 @@ package org.mifospay.feature.finance
|
||||
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import com.google.accompanist.pager.rememberPagerState
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import com.google.accompanist.pager.rememberPagerState
|
||||
import com.mifospay.core.model.domain.BankAccountDetails
|
||||
import org.mifospay.core.ui.MifosScrollableTabRow
|
||||
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.savedcards.CardsScreen
|
||||
|
||||
@Suppress("UnusedParameter")
|
||||
@Composable
|
||||
fun FinanceRoute(
|
||||
onAddBtn: () -> Unit,
|
||||
|
||||
@ -1,9 +1,8 @@
|
||||
package org.mifospay.feature.finance
|
||||
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Test
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
|
||||
@ -1,14 +1,15 @@
|
||||
package org.mifospay.feature
|
||||
|
||||
import com.mifospay.core.model.domain.Transaction
|
||||
import org.mifospay.core.data.base.TaskLooper
|
||||
import org.mifospay.core.data.base.UseCase.UseCaseCallback
|
||||
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.domain.usecase.account.FetchAccount
|
||||
import org.mifospay.core.data.domain.usecase.account.FetchAccountTransactions
|
||||
import javax.inject.Inject
|
||||
|
||||
@Suppress("UnusedPrivateProperty")
|
||||
class TransactionsHistory @Inject constructor(
|
||||
private val mUsecaseHandler: UseCaseHandler,
|
||||
private val fetchAccountTransactionsUseCase: FetchAccountTransactions,
|
||||
|
||||
@ -25,7 +25,6 @@ import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.res.stringResource
|
||||
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.TransactionType
|
||||
import com.mifospay.core.model.entity.accounts.savings.TransferDetail
|
||||
|
||||
import org.mifospay.core.designsystem.component.MifosBottomSheet
|
||||
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.ui.EmptyContentScreen
|
||||
import org.mifospay.core.ui.TransactionItemScreen
|
||||
@ -166,15 +163,19 @@ fun HistoryScreen(
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun Chip(selected: Boolean, onClick: () -> Unit, label: String) {
|
||||
fun Chip(
|
||||
selected: Boolean,
|
||||
onClick: () -> Unit,
|
||||
label: String
|
||||
) {
|
||||
val context = LocalContext.current
|
||||
val backgroundColor = if (selected) chipSelectedColor else lightGrey
|
||||
val backgroundColor = if (selected) MaterialTheme.colorScheme.primary else lightGrey
|
||||
Button(
|
||||
onClick = {
|
||||
onClick()
|
||||
Toast.makeText(context, label, Toast.LENGTH_SHORT).show()
|
||||
},
|
||||
colors = ButtonDefaults.buttonColors(if (selected) MaterialTheme.colorScheme.primary else lightGrey)
|
||||
colors = ButtonDefaults.buttonColors(backgroundColor)
|
||||
) {
|
||||
Text(
|
||||
modifier = Modifier.padding(top = 4.dp, bottom = 4.dp, start = 16.dp, end = 16.dp),
|
||||
|
||||
@ -1,9 +1,8 @@
|
||||
package org.mifospay.history
|
||||
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Test
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
|
||||
@ -1,9 +1,8 @@
|
||||
package org.mifospay.feature.home
|
||||
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Test
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
|
||||
@ -10,5 +10,4 @@ android {
|
||||
dependencies {
|
||||
implementation(projects.core.data)
|
||||
implementation(projects.feature.receipt)
|
||||
implementation(libs.androidx.appcompat)
|
||||
}
|
||||
@ -21,7 +21,6 @@ import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.input.pointer.pointerInput
|
||||
import androidx.compose.ui.platform.LocalClipboardManager
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.AnnotatedString
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
@ -99,6 +98,7 @@ fun InvoiceDetailScreen(
|
||||
}
|
||||
|
||||
@Composable
|
||||
@Suppress("LongMethod")
|
||||
fun InvoiceDetailsContent(
|
||||
invoice: Invoice?,
|
||||
merchantId: String?,
|
||||
@ -112,7 +112,6 @@ fun InvoiceDetailsContent(
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = 16.dp)
|
||||
) {
|
||||
val context = LocalContext.current
|
||||
Text(
|
||||
text = stringResource(R.string.feature_invoices_invoice_details),
|
||||
modifier = Modifier.padding(top = 16.dp)
|
||||
|
||||
@ -1,9 +1,8 @@
|
||||
package org.mifospay.invoices
|
||||
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Test
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
|
||||
@ -13,5 +13,6 @@ dependencies {
|
||||
implementation(libs.sheets.compose.dialogs.core)
|
||||
implementation(libs.sheets.compose.dialogs.calender)
|
||||
implementation(libs.compose.country.code.picker)
|
||||
// TODO:: this should be removed
|
||||
implementation(libs.squareup.okhttp)
|
||||
}
|
||||
@ -117,6 +117,7 @@ fun KYCLevel2Screen(
|
||||
|
||||
}
|
||||
|
||||
@Suppress("LongMethod", "CyclomaticComplexMethod")
|
||||
@Composable
|
||||
fun Kyc2Form(
|
||||
modifier: Modifier,
|
||||
|
||||
@ -9,6 +9,7 @@ import org.mifospay.core.data.repository.local.LocalRepository
|
||||
import javax.inject.Inject
|
||||
|
||||
@HiltViewModel
|
||||
@Suppress("UnusedPrivateProperty")
|
||||
class KYCLevel3ViewModel @Inject constructor(
|
||||
private val mUseCaseHandler: UseCaseHandler,
|
||||
private val mLocalRepository: LocalRepository
|
||||
|
||||
@ -1,9 +1,8 @@
|
||||
package org.mifospay.kyc
|
||||
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Test
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
|
||||
@ -1,9 +1,8 @@
|
||||
package org.mifospay.feature.make.transfer
|
||||
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Test
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
|
||||
@ -1,9 +1,8 @@
|
||||
package org.mifospay.feature.merchants
|
||||
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Test
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
|
||||
@ -1,9 +1,8 @@
|
||||
package org.mifospay.notification
|
||||
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Test
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
|
||||
@ -1,9 +1,8 @@
|
||||
package org.mifospay.mobilewallet.mifospay.feature.passcode
|
||||
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Test
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
|
||||
@ -1,9 +1,8 @@
|
||||
package org.mifospay.payments
|
||||
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Test
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
|
||||
@ -14,9 +14,8 @@ android {
|
||||
|
||||
dependencies {
|
||||
implementation(projects.core.data)
|
||||
implementation(libs.squareup.okhttp)
|
||||
implementation(libs.compose.country.code.picker)
|
||||
// TODO:: this should be removed
|
||||
implementation(libs.compose.material)
|
||||
implementation(libs.coil.kt.compose)
|
||||
implementation(libs.androidx.appcompat)
|
||||
}
|
||||
@ -1,9 +1,8 @@
|
||||
package org.mifospay.profile
|
||||
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Test
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
|
||||
@ -8,14 +8,10 @@ android {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
//Todo: Remove these after migration
|
||||
implementation("com.jakewharton:butterknife-annotations:10.2.3")
|
||||
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.zxing)
|
||||
implementation(projects.core.data)
|
||||
implementation(libs.androidx.camera.view)
|
||||
implementation(libs.androidx.camera.lifecycle)
|
||||
|
||||
// TODO:: this should be removed
|
||||
implementation("com.google.guava:guava:27.0.1-android")
|
||||
}
|
||||
@ -6,6 +6,7 @@ import android.graphics.Bitmap
|
||||
import android.graphics.BitmapFactory
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
import android.util.Log
|
||||
import android.util.Size
|
||||
import androidx.activity.compose.rememberLauncherForActivityResult
|
||||
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.setValue
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.platform.LocalLifecycleOwner
|
||||
import androidx.compose.ui.res.stringResource
|
||||
@ -201,7 +201,7 @@ fun loadBitmapFromUri(context: Context, uri: Uri): Bitmap? {
|
||||
val stream = context.contentResolver.openInputStream(uri)
|
||||
BitmapFactory.decodeStream(stream)
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
Log.e("Error", e.message.toString())
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package org.mifospay.feature.read.qr.utils
|
||||
|
||||
import android.graphics.ImageFormat
|
||||
import android.util.Log
|
||||
import androidx.camera.core.ImageAnalysis
|
||||
import androidx.camera.core.ImageProxy
|
||||
import com.google.zxing.BarcodeFormat
|
||||
@ -47,7 +48,7 @@ class QrCodeAnalyzer(
|
||||
}.decode(binaryBmp)
|
||||
onQrCodeScanned(result.text)
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
Log.e("Error", e.message.toString())
|
||||
} finally {
|
||||
image.close()
|
||||
}
|
||||
|
||||
@ -1,9 +1,8 @@
|
||||
package org.mifospay.feature.qr
|
||||
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Test
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
|
||||
@ -8,9 +8,7 @@ android {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
// TODO:: this should be removed
|
||||
implementation(libs.squareup.okhttp)
|
||||
implementation(projects.core.data)
|
||||
implementation(libs.androidx.appcompat)
|
||||
implementation(projects.feature.passcode)
|
||||
implementation(libs.mifosPasscode)
|
||||
}
|
||||
@ -67,6 +67,7 @@ import java.io.File
|
||||
* PR link : https://github.com/openMF/mobile-wallet/pull/1618
|
||||
*/
|
||||
@Composable
|
||||
@Suppress("UnusedParameter")
|
||||
fun ReceiptScreenRoute(
|
||||
uri: Uri?,
|
||||
viewModel: ReceiptViewModel = hiltViewModel(),
|
||||
|
||||
@ -1,9 +1,8 @@
|
||||
package org.mifospay.receipt
|
||||
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Test
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
|
||||
@ -14,6 +14,5 @@ dependencies {
|
||||
implementation(projects.core.data)
|
||||
|
||||
implementation(libs.zxing)
|
||||
implementation(libs.zxing.android.embedded)
|
||||
implementation(libs.coil.kt.compose)
|
||||
}
|
||||
@ -94,6 +94,7 @@ fun PayVpsMobileScreen() {
|
||||
}
|
||||
}
|
||||
|
||||
@Suppress("CyclomaticComplexMethod")
|
||||
@Composable
|
||||
fun rememberQrBitmapPainter(
|
||||
content: String,
|
||||
|
||||
@ -34,7 +34,7 @@ import org.mifospay.core.designsystem.component.MifosCustomDialog
|
||||
import org.mifospay.core.designsystem.component.MifosOutlinedButton
|
||||
import org.mifospay.core.designsystem.icon.MifosIcons
|
||||
|
||||
@Suppress("MaxLineLength")
|
||||
@Suppress("MaxLineLength", "ReturnCount")
|
||||
@Composable
|
||||
fun SetAmountDialog(
|
||||
dismissDialog: () -> Unit,
|
||||
|
||||
@ -20,6 +20,7 @@ import coil.compose.AsyncImage
|
||||
import org.mifospay.core.designsystem.component.MifosButton
|
||||
|
||||
@Composable
|
||||
@Suppress("ImplicitDefaultLocale")
|
||||
fun ShowQrContent(
|
||||
qrDataBitmap: Bitmap,
|
||||
amount: String?,
|
||||
|
||||
@ -3,6 +3,7 @@ package org.mifospay.feature.request.money.util
|
||||
import android.content.Context
|
||||
import android.graphics.Bitmap
|
||||
import android.net.Uri
|
||||
import android.util.Log
|
||||
import androidx.core.content.FileProvider
|
||||
import org.mifospay.feature.request.money.BuildConfig
|
||||
import java.io.File
|
||||
@ -25,7 +26,7 @@ object ImageUtils {
|
||||
BuildConfig.LIBRARY_PACKAGE_NAME+ ".provider", file
|
||||
)
|
||||
} catch (e: IOException) {
|
||||
e.printStackTrace()
|
||||
Log.d("Error", e.message.toString())
|
||||
}
|
||||
return uri
|
||||
}
|
||||
|
||||
@ -51,7 +51,7 @@ fun AddCardDialogSheet(
|
||||
)
|
||||
}
|
||||
|
||||
@Suppress("MaxLineLength")
|
||||
@Suppress("MaxLineLength", "CyclomaticComplexMethod", "ReturnCount")
|
||||
@Composable
|
||||
fun AddCardDialogSheetContent(
|
||||
cancelClicked: () -> Unit,
|
||||
|
||||
@ -50,10 +50,6 @@ import org.mifospay.core.ui.EmptyContentScreen
|
||||
import org.mifospay.core.ui.utility.AddCardChip
|
||||
import org.mifospay.savedcards.R
|
||||
|
||||
enum class CardMenuAction {
|
||||
EDIT, DELETE, CANCEL
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun CardsScreen(
|
||||
viewModel: CardsScreenViewModel = hiltViewModel(),
|
||||
@ -111,6 +107,10 @@ fun CardsScreen(
|
||||
)
|
||||
}
|
||||
|
||||
enum class CardMenuAction {
|
||||
EDIT, DELETE, CANCEL
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun CardsScreen(
|
||||
cardState: CardsUiState,
|
||||
|
||||
@ -1,9 +1,8 @@
|
||||
package org.mifospay.savedcards
|
||||
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Test
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
|
||||
@ -11,7 +11,7 @@ dependencies {
|
||||
implementation(projects.core.data)
|
||||
|
||||
// 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
|
||||
|
||||
// Google Bar code scanner
|
||||
|
||||
@ -5,8 +5,6 @@ import android.net.Uri
|
||||
import android.provider.ContactsContract
|
||||
import android.util.Log
|
||||
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.Column
|
||||
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.styleNormal18sp
|
||||
|
||||
|
||||
enum class SendMethodType {
|
||||
VPA, MOBILE
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun SendScreenRoute(
|
||||
viewModel: SendPaymentViewModel = hiltViewModel(),
|
||||
@ -98,7 +91,10 @@ fun SendScreenRoute(
|
||||
showToast(context.getString(it))
|
||||
},
|
||||
proceedWithTransferFlow = { externalId, transferAmount ->
|
||||
proceedWithMakeTransferFlow.invoke(externalIdOrMobile, transferAmount.toString())
|
||||
proceedWithMakeTransferFlow.invoke(
|
||||
externalIdOrMobile,
|
||||
transferAmount.toString()
|
||||
)
|
||||
}
|
||||
)
|
||||
} else {
|
||||
@ -108,14 +104,18 @@ fun SendScreenRoute(
|
||||
)
|
||||
}
|
||||
|
||||
enum class SendMethodType {
|
||||
VPA, MOBILE
|
||||
}
|
||||
|
||||
@Composable
|
||||
@Suppress("LongMethod", "CyclomaticComplexMethod")
|
||||
fun SendMoneyScreen(
|
||||
showToolBar: Boolean,
|
||||
showProgress: Boolean,
|
||||
onSubmit: (String, String, SendMethodType) -> Unit,
|
||||
onBackClick: () -> Unit,
|
||||
) {
|
||||
|
||||
val context = LocalContext.current
|
||||
|
||||
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) {
|
||||
contactUri?.let {
|
||||
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()
|
||||
.setBarcodeFormats(
|
||||
Barcode.FORMAT_QR_CODE,
|
||||
|
||||
@ -1,9 +1,8 @@
|
||||
package org.mifospay.feature.send.money
|
||||
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Test
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* 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
Loading…
Reference in New Issue
Block a user