diff --git a/.github/workflows/master_dev_ci.yml b/.github/workflows/master_dev_ci.yml index e227cb438..3c98cf461 100644 --- a/.github/workflows/master_dev_ci.yml +++ b/.github/workflows/master_dev_ci.yml @@ -29,17 +29,18 @@ jobs: - name: Change gradlew Permission run: chmod +x gradlew - - name: Check Dependency Guard - id: dependencyguard_verify - continue-on-error: true - run: ./gradlew dependencyGuard - - - name: Prevent updating Dependency Guard baselines if this is a fork - id: checkfork_dependencyguard - continue-on-error: false - if: steps.dependencyguard_verify.outcome == 'failure' && github.event.pull_request.head.repo.full_name != github.repository - run: | - echo "::error::Dependency Guard failed, please update baselines with: ./gradlew dependencyGuardBaseline" && exit 1 +# Turing off detekt check until migration finished +# - name: Check Dependency Guard +# id: dependencyguard_verify +# continue-on-error: true +# run: ./gradlew dependencyGuard +# +# - name: Prevent updating Dependency Guard baselines if this is a fork +# id: checkfork_dependencyguard +# continue-on-error: false +# if: steps.dependencyguard_verify.outcome == 'failure' && github.event.pull_request.head.repo.full_name != github.repository +# run: | +# echo "::error::Dependency Guard failed, please update baselines with: ./gradlew dependencyGuardBaseline" && exit 1 # Build App - name: Build with Gradle diff --git a/config/detekt/detekt.yml b/config/detekt/detekt.yml index 9288db671..1f88dfb7e 100644 --- a/config/detekt/detekt.yml +++ b/config/detekt/detekt.yml @@ -940,7 +940,7 @@ style: TwitterCompose: CompositionLocalAllowlist: - active: true + active: false # You can optionally define a list of CompositionLocals that are allowed here # allowedCompositionLocals: LocalSomething,LocalSomethingElse CompositionLocalNaming: diff --git a/core/analytics/build.gradle.kts b/core/analytics/build.gradle.kts index b3e6224f9..31c708758 100644 --- a/core/analytics/build.gradle.kts +++ b/core/analytics/build.gradle.kts @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ plugins { alias(libs.plugins.mifospay.android.library) alias(libs.plugins.mifospay.android.library.compose) diff --git a/core/analytics/src/main/AndroidManifest.xml b/core/analytics/src/main/AndroidManifest.xml index a5918e68a..961389810 100644 --- a/core/analytics/src/main/AndroidManifest.xml +++ b/core/analytics/src/main/AndroidManifest.xml @@ -1,4 +1,13 @@ + \ No newline at end of file diff --git a/core/analytics/src/main/kotlin/org/mifospay/core/analytics/AnalyticsEvent.kt b/core/analytics/src/main/kotlin/org/mifospay/core/analytics/AnalyticsEvent.kt index fcc9e9d44..a8bba44f3 100644 --- a/core/analytics/src/main/kotlin/org/mifospay/core/analytics/AnalyticsEvent.kt +++ b/core/analytics/src/main/kotlin/org/mifospay/core/analytics/AnalyticsEvent.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.analytics /** diff --git a/core/analytics/src/main/kotlin/org/mifospay/core/analytics/AnalyticsHelper.kt b/core/analytics/src/main/kotlin/org/mifospay/core/analytics/AnalyticsHelper.kt index e0104341d..0f254bd5c 100644 --- a/core/analytics/src/main/kotlin/org/mifospay/core/analytics/AnalyticsHelper.kt +++ b/core/analytics/src/main/kotlin/org/mifospay/core/analytics/AnalyticsHelper.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.analytics /** diff --git a/core/analytics/src/main/kotlin/org/mifospay/core/analytics/NoOpAnalyticsHelper.kt b/core/analytics/src/main/kotlin/org/mifospay/core/analytics/NoOpAnalyticsHelper.kt index c06e3d6d9..305dee8ca 100644 --- a/core/analytics/src/main/kotlin/org/mifospay/core/analytics/NoOpAnalyticsHelper.kt +++ b/core/analytics/src/main/kotlin/org/mifospay/core/analytics/NoOpAnalyticsHelper.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.analytics /** diff --git a/core/analytics/src/main/kotlin/org/mifospay/core/analytics/StubAnalyticsHelper.kt b/core/analytics/src/main/kotlin/org/mifospay/core/analytics/StubAnalyticsHelper.kt index 890d19344..6cbc75920 100644 --- a/core/analytics/src/main/kotlin/org/mifospay/core/analytics/StubAnalyticsHelper.kt +++ b/core/analytics/src/main/kotlin/org/mifospay/core/analytics/StubAnalyticsHelper.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.analytics import android.util.Log diff --git a/core/analytics/src/main/kotlin/org/mifospay/core/analytics/UiHelpers.kt b/core/analytics/src/main/kotlin/org/mifospay/core/analytics/UiHelpers.kt index 6e0a80a6a..210497b9d 100644 --- a/core/analytics/src/main/kotlin/org/mifospay/core/analytics/UiHelpers.kt +++ b/core/analytics/src/main/kotlin/org/mifospay/core/analytics/UiHelpers.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.analytics import androidx.compose.runtime.staticCompositionLocalOf @@ -5,6 +14,7 @@ import androidx.compose.runtime.staticCompositionLocalOf /** * Global key used to obtain access to the AnalyticsHelper through a CompositionLocal. */ +@Suppress("CompositionLocalAllowlist") val LocalAnalyticsHelper = staticCompositionLocalOf { // Provide a default AnalyticsHelper which does nothing. This is so that tests and previews // do not have to provide one. For real app builds provide a different implementation. diff --git a/core/analytics/src/main/kotlin/org/mifospay/core/analytics/di/AnalyticsModule.kt b/core/analytics/src/main/kotlin/org/mifospay/core/analytics/di/AnalyticsModule.kt index 85767cbd2..dcd9ece82 100644 --- a/core/analytics/src/main/kotlin/org/mifospay/core/analytics/di/AnalyticsModule.kt +++ b/core/analytics/src/main/kotlin/org/mifospay/core/analytics/di/AnalyticsModule.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.analytics.di import com.google.firebase.analytics.FirebaseAnalytics diff --git a/core/analytics/src/main/kotlin/org/mifospay/core/analytics/di/FirebaseAnalyticsHelper.kt b/core/analytics/src/main/kotlin/org/mifospay/core/analytics/di/FirebaseAnalyticsHelper.kt index 3c0dc003d..f3e5aae63 100644 --- a/core/analytics/src/main/kotlin/org/mifospay/core/analytics/di/FirebaseAnalyticsHelper.kt +++ b/core/analytics/src/main/kotlin/org/mifospay/core/analytics/di/FirebaseAnalyticsHelper.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.analytics.di import com.google.firebase.analytics.FirebaseAnalytics diff --git a/core/analytics/src/test/java/org/mifospay/mobilewallet/mifospay/analytics/ExampleUnitTest.kt b/core/analytics/src/test/java/org/mifospay/mobilewallet/mifospay/analytics/ExampleUnitTest.kt deleted file mode 100644 index e7c0b88cf..000000000 --- a/core/analytics/src/test/java/org/mifospay/mobilewallet/mifospay/analytics/ExampleUnitTest.kt +++ /dev/null @@ -1,16 +0,0 @@ -package org.mifospay.mobilewallet.mifospay.analytics - -import org.junit.Assert.assertEquals -import org.junit.Test - -/** - * Example local unit test, which will execute on the development machine (host). - * - * See [testing documentation](http://d.android.com/tools/testing). - */ -class ExampleUnitTest { - @Test - fun addition_isCorrect() { - assertEquals(4, 2 + 2) - } -} diff --git a/core/common/build.gradle.kts b/core/common/build.gradle.kts index f081e4321..1caad01ab 100644 --- a/core/common/build.gradle.kts +++ b/core/common/build.gradle.kts @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ plugins { alias(libs.plugins.mifospay.android.library) alias(libs.plugins.mifospay.android.hilt) diff --git a/core/common/src/main/AndroidManifest.xml b/core/common/src/main/AndroidManifest.xml index a5918e68a..961389810 100644 --- a/core/common/src/main/AndroidManifest.xml +++ b/core/common/src/main/AndroidManifest.xml @@ -1,4 +1,13 @@ + \ No newline at end of file diff --git a/core/common/src/main/kotlin/org/mifospay/common/Constants.kt b/core/common/src/main/kotlin/org/mifospay/common/Constants.kt index 4c34922a8..83371ea82 100644 --- a/core/common/src/main/kotlin/org/mifospay/common/Constants.kt +++ b/core/common/src/main/kotlin/org/mifospay/common/Constants.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.common /** @@ -166,8 +175,9 @@ object Constants { const val TAP_TO_REVEAL = "Tap to Reveal" const val NAME = "Name : " const val ERROR_FETCHING_TRANSACTION_DETAILS = "Error fetching details" - // const val WHITE_BACK_BUTTON = R.drawable.ic_arrow_back_white_24dp - // const val BLACK_BACK_BUTTON = R.drawable.ic_arrow_back_black_24dp + + // const val WHITE_BACK_BUTTON = R.drawable.ic_arrow_back_white_24dp + // const val BLACK_BACK_BUTTON = R.drawable.ic_arrow_back_black_24dp const val VIEW = "View" const val CURRENT_PASSCODE = "current passcode" const val UPDATE_PASSCODE = "update passcode" diff --git a/core/common/src/main/kotlin/org/mifospay/common/CreditCardUtils.kt b/core/common/src/main/kotlin/org/mifospay/common/CreditCardUtils.kt index 77937e93b..9f114eb32 100644 --- a/core/common/src/main/kotlin/org/mifospay/common/CreditCardUtils.kt +++ b/core/common/src/main/kotlin/org/mifospay/common/CreditCardUtils.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.common object CreditCardUtils { @@ -27,4 +36,4 @@ object CreditCardUtils { } return sum % 10 == 0 } -} \ No newline at end of file +} diff --git a/core/common/src/main/kotlin/org/mifospay/common/DebugUtil.kt b/core/common/src/main/kotlin/org/mifospay/common/DebugUtil.kt index bac8d0b70..685662541 100644 --- a/core/common/src/main/kotlin/org/mifospay/common/DebugUtil.kt +++ b/core/common/src/main/kotlin/org/mifospay/common/DebugUtil.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.common import android.util.Log diff --git a/core/common/src/main/kotlin/org/mifospay/common/FileUtils.kt b/core/common/src/main/kotlin/org/mifospay/common/FileUtils.kt index 9c7068177..d3725d562 100644 --- a/core/common/src/main/kotlin/org/mifospay/common/FileUtils.kt +++ b/core/common/src/main/kotlin/org/mifospay/common/FileUtils.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.common import android.util.Log @@ -20,8 +29,8 @@ object FileUtils { inputStream.close() true } catch (e: Exception) { - Log.e("Message",e.message.toString()) + Log.e("Message", e.message.toString()) false } } -} \ No newline at end of file +} diff --git a/core/common/src/main/kotlin/org/mifospay/common/NavArgsConstants.kt b/core/common/src/main/kotlin/org/mifospay/common/NavArgsConstants.kt index 45c53c100..0dcb73540 100644 --- a/core/common/src/main/kotlin/org/mifospay/common/NavArgsConstants.kt +++ b/core/common/src/main/kotlin/org/mifospay/common/NavArgsConstants.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.common const val PAYEE_EXTERNAL_ID_ARG = "payeeExternalId" diff --git a/core/common/src/main/kotlin/org/mifospay/common/Utils.kt b/core/common/src/main/kotlin/org/mifospay/common/Utils.kt index af939741d..5e95d0e62 100644 --- a/core/common/src/main/kotlin/org/mifospay/common/Utils.kt +++ b/core/common/src/main/kotlin/org/mifospay/common/Utils.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.common import android.app.Activity @@ -13,7 +22,7 @@ object Utils { fun hideSoftKeyboard(activity: Activity) { val view = activity.currentFocus val inputMethodManager = - activity.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager + activity.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager inputMethodManager.hideSoftInputFromWindow(view?.windowToken, 0) } @@ -36,5 +45,4 @@ object Utils { for (index in this) array.add(index) return array } - -} \ No newline at end of file +} diff --git a/core/common/src/main/kotlin/org/mifospay/core/network/MifosDispatchers.kt b/core/common/src/main/kotlin/org/mifospay/core/network/MifosDispatchers.kt index 1224be7e7..234708415 100644 --- a/core/common/src/main/kotlin/org/mifospay/core/network/MifosDispatchers.kt +++ b/core/common/src/main/kotlin/org/mifospay/core/network/MifosDispatchers.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.network import javax.inject.Qualifier diff --git a/core/common/src/main/kotlin/org/mifospay/core/network/di/CoroutineScopesModule.kt b/core/common/src/main/kotlin/org/mifospay/core/network/di/CoroutineScopesModule.kt index 07f52c2a2..025c12a65 100644 --- a/core/common/src/main/kotlin/org/mifospay/core/network/di/CoroutineScopesModule.kt +++ b/core/common/src/main/kotlin/org/mifospay/core/network/di/CoroutineScopesModule.kt @@ -1,7 +1,14 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.network.di -import org.mifospay.core.network.Dispatcher -import org.mifospay.core.network.MifosDispatchers.Default import dagger.Module import dagger.Provides import dagger.hilt.InstallIn @@ -9,6 +16,8 @@ import dagger.hilt.components.SingletonComponent import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.SupervisorJob +import org.mifospay.core.network.Dispatcher +import org.mifospay.core.network.MifosDispatchers.Default import javax.inject.Qualifier import javax.inject.Singleton diff --git a/core/common/src/main/kotlin/org/mifospay/core/network/di/DispatchersModule.kt b/core/common/src/main/kotlin/org/mifospay/core/network/di/DispatchersModule.kt index 3218268b9..98b34f703 100644 --- a/core/common/src/main/kotlin/org/mifospay/core/network/di/DispatchersModule.kt +++ b/core/common/src/main/kotlin/org/mifospay/core/network/di/DispatchersModule.kt @@ -1,14 +1,23 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.network.di -import org.mifospay.core.network.Dispatcher -import org.mifospay.core.network.MifosDispatchers.Default -import org.mifospay.core.network.MifosDispatchers.IO import dagger.Module import dagger.Provides import dagger.hilt.InstallIn import dagger.hilt.components.SingletonComponent import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.Dispatchers +import org.mifospay.core.network.Dispatcher +import org.mifospay.core.network.MifosDispatchers.Default +import org.mifospay.core.network.MifosDispatchers.IO @Module @InstallIn(SingletonComponent::class) diff --git a/core/common/src/test/java/org/mifospay/common/ExampleUnitTest.kt b/core/common/src/test/java/org/mifospay/common/ExampleUnitTest.kt deleted file mode 100644 index 2ea33e12f..000000000 --- a/core/common/src/test/java/org/mifospay/common/ExampleUnitTest.kt +++ /dev/null @@ -1,16 +0,0 @@ -package org.mifospay.common - -import org.junit.Assert.assertEquals -import org.junit.Test - -/** - * Example local unit test, which will execute on the development machine (host). - * - * See [testing documentation](http://d.android.com/tools/testing). - */ -class ExampleUnitTest { - @Test - fun addition_isCorrect() { - assertEquals(4, 2 + 2) - } -} \ No newline at end of file diff --git a/core/data/build.gradle.kts b/core/data/build.gradle.kts index 15398df7b..b53e1ef90 100644 --- a/core/data/build.gradle.kts +++ b/core/data/build.gradle.kts @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ plugins { alias(libs.plugins.mifospay.android.library) alias(libs.plugins.mifospay.android.hilt) @@ -36,8 +45,6 @@ dependencies { implementation(libs.reactivex.rxjava.android) implementation(libs.reactivex.rxjava) - implementation(libs.jetbrains.kotlin.jdk7) - testImplementation(libs.junit) androidTestImplementation(libs.espresso.core) } diff --git a/core/data/src/main/AndroidManifest.xml b/core/data/src/main/AndroidManifest.xml index d7546021b..536b54a77 100644 --- a/core/data/src/main/AndroidManifest.xml +++ b/core/data/src/main/AndroidManifest.xml @@ -1,3 +1,13 @@ + + diff --git a/core/data/src/main/java/org/mifospay/core/data/base/TaskLooper.kt b/core/data/src/main/java/org/mifospay/core/data/base/TaskLooper.kt index b1c0faa31..175b2da3a 100644 --- a/core/data/src/main/java/org/mifospay/core/data/base/TaskLooper.kt +++ b/core/data/src/main/java/org/mifospay/core/data/base/TaskLooper.kt @@ -1,27 +1,33 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.data.base import org.mifospay.core.data.base.UseCase.UseCaseCallback import javax.inject.Inject -/** - * Created by ankur on 17/June/2018 - */ -class TaskLooper @Inject constructor(private val mUseCaseHandler: UseCaseHandler) { +class TaskLooper @Inject constructor( + private val mUseCaseHandler: UseCaseHandler, +) { var isFailed = false - var tasks: List> private var tasksPending: Long = 0 private var listener: Listener? = null - init { - tasks = ArrayList() - } - fun addTask( - useCase: UseCase, values: T, taskData: TaskData, + useCase: UseCase, + values: T, + taskData: TaskData, ) { tasksPending++ mUseCaseHandler.execute( - useCase, values, + useCase, + values, object : UseCaseCallback { override fun onSuccess(response: R) { if (isFailed) return @@ -41,7 +47,7 @@ class TaskLooper @Inject constructor(private val mUseCaseHandler: UseCaseHandler } private val isCompleted: Boolean - private get() = tasksPending == 0L + get() = tasksPending == 0L fun listen(listener: Listener?) { this.listener = listener diff --git a/core/data/src/main/java/org/mifospay/core/data/base/ThreadPoolQueue.kt b/core/data/src/main/java/org/mifospay/core/data/base/ThreadPoolQueue.kt index 703cb8eba..083de6576 100644 --- a/core/data/src/main/java/org/mifospay/core/data/base/ThreadPoolQueue.kt +++ b/core/data/src/main/java/org/mifospay/core/data/base/ThreadPoolQueue.kt @@ -1,10 +1,16 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.data.base import java.util.concurrent.ArrayBlockingQueue -/** - * Created by shivansh on 14/July/2019 - */ class ThreadPoolQueue(capacity: Int) : ArrayBlockingQueue(capacity) { override fun offer(e: Runnable?): Boolean { diff --git a/core/data/src/main/java/org/mifospay/core/data/base/UseCase.kt b/core/data/src/main/java/org/mifospay/core/data/base/UseCase.kt index e3c6b3f0f..2784fd0a8 100644 --- a/core/data/src/main/java/org/mifospay/core/data/base/UseCase.kt +++ b/core/data/src/main/java/org/mifospay/core/data/base/UseCase.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.data.base /** @@ -9,6 +18,7 @@ package org.mifospay.core.data.base abstract class UseCase { lateinit var walletRequestValues: Q lateinit var useCaseCallback: UseCaseCallback

+ fun setRequestValues(requestValues: Q) { this.walletRequestValues = requestValues } diff --git a/core/data/src/main/java/org/mifospay/core/data/base/UseCaseFactory.kt b/core/data/src/main/java/org/mifospay/core/data/base/UseCaseFactory.kt index f37ef91a5..ea1eb6bb7 100644 --- a/core/data/src/main/java/org/mifospay/core/data/base/UseCaseFactory.kt +++ b/core/data/src/main/java/org/mifospay/core/data/base/UseCaseFactory.kt @@ -1,25 +1,33 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.data.base -import org.mifospay.core.data.fineract.repository.FineractRepository import org.mifospay.core.data.domain.usecase.account.FetchAccountTransfer import org.mifospay.core.data.domain.usecase.client.FetchClientDetails +import org.mifospay.core.data.fineract.repository.FineractRepository import org.mifospay.core.data.util.Constants import javax.inject.Inject -/** - * Created by ankur on 17/June/2018 - */ class UseCaseFactory @Inject constructor( - private val mFineractRepository: FineractRepository + private val mFineractRepository: FineractRepository, ) { fun getUseCase(useCase: String): UseCase<*, *>? { - return when(useCase) { + return when (useCase) { Constants.FETCH_ACCOUNT_TRANSFER_USECASE -> { FetchAccountTransfer(mFineractRepository) } + Constants.FETCH_CLIENT_DETAILS_USE_CASE -> { FetchClientDetails(mFineractRepository) } + else -> null } } diff --git a/core/data/src/main/java/org/mifospay/core/data/base/UseCaseHandler.kt b/core/data/src/main/java/org/mifospay/core/data/base/UseCaseHandler.kt index cc0159af2..9fe654b62 100644 --- a/core/data/src/main/java/org/mifospay/core/data/base/UseCaseHandler.kt +++ b/core/data/src/main/java/org/mifospay/core/data/base/UseCaseHandler.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.data.base import org.mifospay.core.data.base.UseCase.UseCaseCallback @@ -7,30 +16,32 @@ import org.mifospay.core.data.base.UseCase.UseCaseCallback */ class UseCaseHandler(private val mUseCaseScheduler: UseCaseScheduler) { fun execute( - useCase: UseCase, values: T?, callback: UseCaseCallback + useCase: UseCase, + values: T?, + callback: UseCaseCallback, ) { - values?.let { useCase.walletRequestValues = values } + values?.let { useCase.walletRequestValues = values } useCase.useCaseCallback = UiCallbackWrapper(callback, this) mUseCaseScheduler.execute { useCase.run() } } fun notifyResponse( response: V, - useCaseCallback: UseCaseCallback? + useCaseCallback: UseCaseCallback?, ) { mUseCaseScheduler.notifyResponse(response, useCaseCallback) } private fun notifyError( message: String?, - useCaseCallback: UseCaseCallback? + useCaseCallback: UseCaseCallback?, ) { mUseCaseScheduler.onError(message, useCaseCallback) } private class UiCallbackWrapper( private val mCallback: UseCaseCallback?, - private val mUseCaseHandler: UseCaseHandler + private val mUseCaseHandler: UseCaseHandler, ) : UseCaseCallback { override fun onSuccess(response: V) { mUseCaseHandler.notifyResponse(response, mCallback) diff --git a/core/data/src/main/java/org/mifospay/core/data/base/UseCaseScheduler.kt b/core/data/src/main/java/org/mifospay/core/data/base/UseCaseScheduler.kt index cb388b8d1..bff30b7e4 100644 --- a/core/data/src/main/java/org/mifospay/core/data/base/UseCaseScheduler.kt +++ b/core/data/src/main/java/org/mifospay/core/data/base/UseCaseScheduler.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.data.base import org.mifospay.core.data.base.UseCase.UseCaseCallback @@ -8,10 +17,12 @@ import org.mifospay.core.data.base.UseCase.UseCaseCallback interface UseCaseScheduler { fun execute(runnable: Runnable?) fun notifyResponse( - response: V, useCaseCallback: UseCaseCallback? + response: V, + useCaseCallback: UseCaseCallback?, ) fun onError( - message: String?, useCaseCallback: UseCaseCallback? + message: String?, + useCaseCallback: UseCaseCallback?, ) } diff --git a/core/data/src/main/java/org/mifospay/core/data/base/UseCaseThreadPoolScheduler.kt b/core/data/src/main/java/org/mifospay/core/data/base/UseCaseThreadPoolScheduler.kt index 681435f6e..2066f1faa 100644 --- a/core/data/src/main/java/org/mifospay/core/data/base/UseCaseThreadPoolScheduler.kt +++ b/core/data/src/main/java/org/mifospay/core/data/base/UseCaseThreadPoolScheduler.kt @@ -1,6 +1,16 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.data.base import android.os.Handler +import android.os.Looper import org.mifospay.core.data.base.UseCase.UseCaseCallback import java.util.concurrent.ThreadPoolExecutor import java.util.concurrent.TimeUnit @@ -9,20 +19,19 @@ import java.util.concurrent.TimeUnit * Executes asynchronous tasks using a [ThreadPoolExecutor]. * * - * See also [Executors] for a list of factory methods to create common + * See also [ThreadPoolExecutor] for a list of factory methods to create common * [java.util.concurrent.ExecutorService]s for different scenarios. */ class UseCaseThreadPoolScheduler : UseCaseScheduler { - private val mHandler = Handler() - var mThreadPoolExecutor: ThreadPoolExecutor - - init { - mThreadPoolExecutor = ThreadPoolExecutor( - POOL_SIZE, MAX_POOL_SIZE, TIMEOUT.toLong(), - TimeUnit.SECONDS, ThreadPoolQueue(MAX_POOL_SIZE) - ) - } + private val mHandler = Handler(Looper.getMainLooper()) + private var mThreadPoolExecutor: ThreadPoolExecutor = ThreadPoolExecutor( + POOL_SIZE, + MAX_POOL_SIZE, + TIMEOUT.toLong(), + TimeUnit.SECONDS, + ThreadPoolQueue(MAX_POOL_SIZE), + ) override fun execute(runnable: Runnable?) { mThreadPoolExecutor.execute(runnable) @@ -30,14 +39,14 @@ class UseCaseThreadPoolScheduler : UseCaseScheduler { override fun notifyResponse( response: V, - useCaseCallback: UseCaseCallback? + useCaseCallback: UseCaseCallback?, ) { mHandler.post { useCaseCallback!!.onSuccess(response) } } override fun onError( message: String?, - useCaseCallback: UseCaseCallback? + useCaseCallback: UseCaseCallback?, ) { mHandler.post { useCaseCallback!!.onError(message!!) } } diff --git a/core/data/src/main/java/org/mifospay/core/data/di/DataModule.kt b/core/data/src/main/java/org/mifospay/core/data/di/DataModule.kt index 604bb014e..53faaa865 100644 --- a/core/data/src/main/java/org/mifospay/core/data/di/DataModule.kt +++ b/core/data/src/main/java/org/mifospay/core/data/di/DataModule.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.data.di import dagger.Module @@ -26,7 +35,7 @@ class DataModule { @Provides fun providesFineractRepository( fineractApiManager: FineractApiManager, - selfServiceApiManager: SelfServiceApiManager + selfServiceApiManager: SelfServiceApiManager, ): FineractRepository { return FineractRepository(fineractApiManager, selfServiceApiManager) } diff --git a/core/data/src/main/java/org/mifospay/core/data/di/LocalDataModule.kt b/core/data/src/main/java/org/mifospay/core/data/di/LocalDataModule.kt index 972ec7529..9b477903d 100644 --- a/core/data/src/main/java/org/mifospay/core/data/di/LocalDataModule.kt +++ b/core/data/src/main/java/org/mifospay/core/data/di/LocalDataModule.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.data.di import dagger.Binds diff --git a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/account/BlockUnblockCommand.kt b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/account/BlockUnblockCommand.kt index fab98a4a9..85951cd10 100644 --- a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/account/BlockUnblockCommand.kt +++ b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/account/BlockUnblockCommand.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.data.domain.usecase.account import org.mifospay.core.data.base.UseCase @@ -8,27 +17,28 @@ import rx.android.schedulers.AndroidSchedulers import rx.schedulers.Schedulers import javax.inject.Inject -/** - * Created by ankur on 29/June/2018 - */ -class BlockUnblockCommand @Inject constructor(private val mFineractRepository: FineractRepository) : - UseCase() { - protected override fun executeUseCase(requestValues: RequestValues) { +class BlockUnblockCommand @Inject constructor( + private val mFineractRepository: FineractRepository, +) : UseCase() { + + override fun executeUseCase(requestValues: RequestValues) { mFineractRepository.blockUnblockAccount(requestValues.accountId, requestValues.command) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) - .subscribe(object : Subscriber() { - override fun onCompleted() {} - override fun onError(e: Throwable) { - useCaseCallback.onError( - "Error " + requestValues.command + "ing account" - ) - } + .subscribe( + object : Subscriber() { + override fun onCompleted() {} + override fun onError(e: Throwable) { + useCaseCallback.onError( + "Error " + requestValues.command + "ing account", + ) + } - override fun onNext(genericResponse: GenericResponse) { - useCaseCallback.onSuccess(ResponseValue) - } - }) + override fun onNext(genericResponse: GenericResponse) { + useCaseCallback.onSuccess(ResponseValue) + } + }, + ) } data class RequestValues(val accountId: Long, val command: String) : UseCase.RequestValues diff --git a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/account/DownloadTransactionReceipt.kt b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/account/DownloadTransactionReceipt.kt index fad50a0d6..f6bc1058f 100644 --- a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/account/DownloadTransactionReceipt.kt +++ b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/account/DownloadTransactionReceipt.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.data.domain.usecase.account import okhttp3.ResponseBody @@ -9,30 +18,29 @@ import rx.android.schedulers.AndroidSchedulers import rx.schedulers.Schedulers import javax.inject.Inject -/** - * Created by ankur on 06/June/2018 - */ -class DownloadTransactionReceipt @Inject constructor(private val mFineractRepository: FineractRepository) : - UseCase() { - override fun executeUseCase(requestValues: RequestValues) { - requestValues.transactionId?.let { - mFineractRepository.getTransactionReceipt(Constants.PDF, it) - .observeOn(AndroidSchedulers.mainThread()) - .subscribeOn(Schedulers.io()) - .subscribe(object : Subscriber() { - override fun onCompleted() {} - override fun onError(e: Throwable) { - useCaseCallback.onError(e.toString()) - } +class DownloadTransactionReceipt @Inject constructor( + private val mFineractRepository: FineractRepository, +) : UseCase() { + override fun executeUseCase(requestValues: RequestValues) { + requestValues.transactionId?.let { + mFineractRepository.getTransactionReceipt(Constants.PDF, it) + .observeOn(AndroidSchedulers.mainThread()) + .subscribeOn(Schedulers.io()) + .subscribe( + object : Subscriber() { + override fun onCompleted() {} + override fun onError(e: Throwable) { + useCaseCallback.onError(e.toString()) + } - override fun onNext(t: ResponseBody) { - val responseBody = t - useCaseCallback.onSuccess(ResponseValue(responseBody)) - } - }) - } + override fun onNext(t: ResponseBody) { + useCaseCallback.onSuccess(ResponseValue(t)) + } + }, + ) + } } - data class RequestValues( val transactionId: String?) : UseCase.RequestValues + data class RequestValues(val transactionId: String?) : UseCase.RequestValues data class ResponseValue(val responseBody: ResponseBody) : UseCase.ResponseValue } diff --git a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/account/FetchAccount.kt b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/account/FetchAccount.kt index 7c65629d6..314e4deff 100644 --- a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/account/FetchAccount.kt +++ b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/account/FetchAccount.kt @@ -1,58 +1,67 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.data.domain.usecase.account - +import com.mifospay.core.model.domain.Account +import com.mifospay.core.model.entity.client.ClientAccounts import org.mifospay.core.data.base.UseCase import org.mifospay.core.data.fineract.entity.mapper.AccountMapper import org.mifospay.core.data.fineract.repository.FineractRepository -import com.mifospay.core.model.domain.Account -import com.mifospay.core.model.entity.client.ClientAccounts import org.mifospay.core.data.util.Constants import rx.Subscriber import rx.android.schedulers.AndroidSchedulers import rx.schedulers.Schedulers - import javax.inject.Inject -class FetchAccount @Inject constructor(private val fineractRepository: FineractRepository) : - UseCase() { - - @Inject - lateinit var accountMapper: AccountMapper +class FetchAccount @Inject constructor( + private val fineractRepository: FineractRepository, + private val accountMapper: AccountMapper, +) : UseCase() { override fun executeUseCase(requestValues: RequestValues) { fineractRepository.getSelfAccounts(requestValues.clientId) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) - .subscribe(object : Subscriber() { - override fun onCompleted() {} - - override fun onError(e: Throwable) { - useCaseCallback.onError(Constants.ERROR_FETCHING_ACCOUNTS) - } - - override fun onNext(clientAccounts: ClientAccounts) { - val accounts = accountMapper.transform(clientAccounts) - if (!accounts.isNullOrEmpty()) { - var walletAccount: Account? = null - for (account in accounts) { - if (account.productId.toInt() == Constants.WALLET_ACCOUNT_SAVINGS_PRODUCT_ID) { - walletAccount = account - break + .subscribe( + object : Subscriber() { + override fun onCompleted() {} + + override fun onError(e: Throwable) { + useCaseCallback.onError(Constants.ERROR_FETCHING_ACCOUNTS) + } + + override fun onNext(clientAccounts: ClientAccounts) { + val accounts = accountMapper.transform(clientAccounts) + + if (accounts.isNotEmpty()) { + var walletAccount: Account? = null + for (account in accounts) { + if (account.productId.toInt() == Constants.WALLET_ACCOUNT_SAVINGS_PRODUCT_ID) { + walletAccount = account + break + } + } + if (walletAccount != null) { + useCaseCallback.onSuccess(ResponseValue(walletAccount)) + } else { + useCaseCallback.onError(Constants.NO_ACCOUNT_FOUND) } - } - if (walletAccount != null) { - useCaseCallback.onSuccess(ResponseValue(walletAccount)) } else { - useCaseCallback.onError(Constants.NO_ACCOUNT_FOUND) + useCaseCallback.onError(Constants.NO_ACCOUNTS_FOUND) } - } else { - useCaseCallback.onError(Constants.NO_ACCOUNTS_FOUND) } - } - }) + }, + ) } - data class RequestValues(val clientId: Long) : UseCase.RequestValues + data class RequestValues(val clientId: Long) : UseCase.RequestValues data class ResponseValue(val account: Account) : UseCase.ResponseValue } diff --git a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/account/FetchAccountTransaction.kt b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/account/FetchAccountTransaction.kt index b84c25a4e..196604e4e 100644 --- a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/account/FetchAccountTransaction.kt +++ b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/account/FetchAccountTransaction.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.data.domain.usecase.account import com.mifospay.core.model.domain.Transaction @@ -11,49 +20,44 @@ import rx.android.schedulers.AndroidSchedulers import rx.schedulers.Schedulers import javax.inject.Inject -/** - * Created by Shivansh on 15/6/19. - */ class FetchAccountTransaction @Inject constructor( - val fineractRepository: FineractRepository, - val transactionMapper: TransactionMapper + private val fineractRepository: FineractRepository, + private val transactionMapper: TransactionMapper, ) : UseCase() { override fun executeUseCase(requestValues: RequestValues) { fineractRepository.getSelfAccountTransactionFromId( requestValues.accountId, - requestValues.transactionId + requestValues.transactionId, ) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) - .subscribe(object : Observer { - override fun onCompleted() {} - override fun onError(e: Throwable) { - if (e.message == "HTTP 401 Unauthorized") { - useCaseCallback.onError(Constants.UNAUTHORIZED_ERROR) - } else { - useCaseCallback.onError( - Constants.ERROR_FETCHING_REMOTE_ACCOUNT_TRANSACTIONS - ) + .subscribe( + object : Observer { + override fun onCompleted() {} + override fun onError(e: Throwable) { + if (e.message == "HTTP 401 Unauthorized") { + useCaseCallback.onError(Constants.UNAUTHORIZED_ERROR) + } else { + useCaseCallback.onError( + Constants.ERROR_FETCHING_REMOTE_ACCOUNT_TRANSACTIONS, + ) + } } - } - override fun onNext(transaction: Transactions?) { - useCaseCallback.onSuccess( - ResponseValue( - transactionMapper - .transformInvoice(transaction) + override fun onNext(transaction: Transactions?) { + useCaseCallback.onSuccess( + ResponseValue(transactionMapper.transformInvoice(transaction)), ) - ) - } - }) + } + }, + ) } data class RequestValues( val accountId: Long, - val transactionId: Long + val transactionId: Long, ) : UseCase.RequestValues - data class ResponseValue(val transaction: Transaction) : UseCase.ResponseValue } diff --git a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/account/FetchAccountTransactions.kt b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/account/FetchAccountTransactions.kt index 53a7a7507..5a2a5c318 100644 --- a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/account/FetchAccountTransactions.kt +++ b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/account/FetchAccountTransactions.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.data.domain.usecase.account import com.mifospay.core.model.domain.Transaction @@ -11,34 +20,33 @@ import rx.android.schedulers.AndroidSchedulers import rx.schedulers.Schedulers import javax.inject.Inject -/** - * Created by naman on 11/7/17. - */ class FetchAccountTransactions @Inject constructor( private val fineractRepository: FineractRepository, - private val transactionMapper: TransactionMapper + private val transactionMapper: TransactionMapper, ) : UseCase() { - protected override fun executeUseCase(requestValues: RequestValues) { + override fun executeUseCase(requestValues: RequestValues) { fineractRepository.getSelfAccountTransactions(requestValues.accountId) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) - .subscribe(object : Subscriber() { - override fun onCompleted() {} - override fun onError(e: Throwable) { - useCaseCallback.onError( - Constants.ERROR_FETCHING_REMOTE_ACCOUNT_TRANSACTIONS - ) - } + .subscribe( + object : Subscriber() { + override fun onCompleted() {} + override fun onError(e: Throwable) { + useCaseCallback.onError( + Constants.ERROR_FETCHING_REMOTE_ACCOUNT_TRANSACTIONS, + ) + } - override fun onNext(transactions: SavingsWithAssociations) { - useCaseCallback.onSuccess( - ResponseValue( - transactionMapper.transformTransactionList(transactions) + override fun onNext(transactions: SavingsWithAssociations) { + useCaseCallback.onSuccess( + ResponseValue( + transactionMapper.transformTransactionList(transactions), + ), ) - ) - } - }) + } + }, + ) } data class RequestValues(var accountId: Long) : UseCase.RequestValues diff --git a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/account/FetchAccountTransfer.kt b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/account/FetchAccountTransfer.kt index dcb413760..05890a5b3 100644 --- a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/account/FetchAccountTransfer.kt +++ b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/account/FetchAccountTransfer.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.data.domain.usecase.account import com.mifospay.core.model.entity.accounts.savings.TransferDetail @@ -8,11 +17,8 @@ import rx.android.schedulers.AndroidSchedulers import rx.schedulers.Schedulers import javax.inject.Inject -/** - * Created by ankur on 05/June/2018 - */ class FetchAccountTransfer @Inject constructor( - private val mFineractRepository: FineractRepository + private val mFineractRepository: FineractRepository, ) : UseCase() { override fun executeUseCase(requestValues: RequestValues) { mFineractRepository.getAccountTransfer(requestValues.transferId) diff --git a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/account/FetchAccounts.kt b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/account/FetchAccounts.kt index 9e29c8ace..60895b71d 100644 --- a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/account/FetchAccounts.kt +++ b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/account/FetchAccounts.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.data.domain.usecase.account import com.mifospay.core.model.domain.Account @@ -11,37 +20,35 @@ import rx.android.schedulers.AndroidSchedulers import rx.schedulers.Schedulers import javax.inject.Inject -/** - * Created by naman on 11/7/17. - */ class FetchAccounts @Inject constructor( private val fineractRepository: FineractRepository, - val accountMapper: AccountMapper) : - UseCase() { - + private val accountMapper: AccountMapper, +) : UseCase() { + override fun executeUseCase(requestValues: RequestValues) { fineractRepository.getAccounts(requestValues.clientId) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) - .subscribe(object : Subscriber() { - override fun onCompleted() {} - override fun onError(e: Throwable) { - useCaseCallback.onError(Constants.ERROR_FETCHING_ACCOUNTS) - } + .subscribe( + object : Subscriber() { + override fun onCompleted() {} + override fun onError(e: Throwable) { + useCaseCallback.onError(Constants.ERROR_FETCHING_ACCOUNTS) + } - override fun onNext(t: ClientAccounts?) { - val accounts = t - if (accounts != null) { - useCaseCallback.onSuccess( - ResponseValue( - accountMapper!!.transform(accounts) + override fun onNext(t: ClientAccounts?) { + if (t != null) { + useCaseCallback.onSuccess( + ResponseValue( + accountMapper.transform(t), + ), ) - ) - } else { - useCaseCallback.onError(Constants.NO_ACCOUNTS_FOUND) + } else { + useCaseCallback.onError(Constants.NO_ACCOUNTS_FOUND) + } } - } - }) + }, + ) } data class RequestValues(val clientId: Long) : UseCase.RequestValues diff --git a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/account/FetchMerchants.kt b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/account/FetchMerchants.kt index ae00bc663..a1da35556 100644 --- a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/account/FetchMerchants.kt +++ b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/account/FetchMerchants.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.data.domain.usecase.account import com.mifospay.core.model.entity.Page @@ -11,35 +20,37 @@ import rx.schedulers.Schedulers import javax.inject.Inject class FetchMerchants @Inject constructor( - private val mFineractRepository: FineractRepository + private val mFineractRepository: FineractRepository, ) : UseCase() { override fun executeUseCase(requestValues: RequestValues) { mFineractRepository.savingsAccounts .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) - .subscribe(object : Subscriber>() { - override fun onCompleted() {} - override fun onError(e: Throwable) { - e.message?.let { useCaseCallback.onError(it) } - } + .subscribe( + object : Subscriber>() { + override fun onCompleted() {} + override fun onError(e: Throwable) { + e.message?.let { useCaseCallback.onError(it) } + } - override fun onNext(savingsWithAssociationsPage: Page) { - val savingsWithAssociationsList = savingsWithAssociationsPage.pageItems - val merchantsList: MutableList = ArrayList() - for (i in savingsWithAssociationsList.indices) { - if (savingsWithAssociationsList[i].savingsProductId == - Constants.MIFOS_MERCHANT_SAVINGS_PRODUCT_ID - ) { - merchantsList.add(savingsWithAssociationsList[i]) + override fun onNext(savingsWithAssociationsPage: Page) { + val savingsWithAssociationsList = savingsWithAssociationsPage.pageItems + val merchantsList: MutableList = ArrayList() + for (i in savingsWithAssociationsList.indices) { + if (savingsWithAssociationsList[i].savingsProductId == + Constants.MIFOS_MERCHANT_SAVINGS_PRODUCT_ID + ) { + merchantsList.add(savingsWithAssociationsList[i]) + } } + useCaseCallback.onSuccess(ResponseValue(merchantsList)) } - useCaseCallback.onSuccess(ResponseValue(merchantsList)) - } - }) + }, + ) } class RequestValues : UseCase.RequestValues data class ResponseValue( - val savingsWithAssociationsList: List + val savingsWithAssociationsList: List, ) : UseCase.ResponseValue } diff --git a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/account/PayFunds.kt b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/account/PayFunds.kt deleted file mode 100644 index 0b1fe53b0..000000000 --- a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/account/PayFunds.kt +++ /dev/null @@ -1,3 +0,0 @@ -package org.mifospay.core.data.domain.usecase.account - -class PayFunds \ No newline at end of file diff --git a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/account/TransferFunds.kt b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/account/TransferFunds.kt index b8b38c903..fdb32c9b2 100644 --- a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/account/TransferFunds.kt +++ b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/account/TransferFunds.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.data.domain.usecase.account import com.mifospay.core.model.entity.TPTResponse @@ -19,10 +28,11 @@ import rx.schedulers.Schedulers import javax.inject.Inject @Suppress("UnusedPrivateMember") -class TransferFunds @Inject constructor( private val apiRepository: FineractRepository) : - UseCase() { +class TransferFunds @Inject constructor( + private val apiRepository: FineractRepository, +) : UseCase() { - // override var requestValues: RequestValues + // override var requestValues: RequestValues private lateinit var fromClient: Client private lateinit var toClient: Client private lateinit var fromAccount: SavingAccount @@ -33,135 +43,145 @@ class TransferFunds @Inject constructor( private val apiRepository: FineractRepo apiRepository.getSelfClientDetails(requestValues.fromClientId) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) - .subscribe(object : Subscriber() { - override fun onCompleted() {} - - override fun onError(e: Throwable) { - useCaseCallback.onError(Constants.ERROR_FETCHING_CLIENT_DATA) - } - - override fun onNext(client: Client) { - fromClient = client - fetchToClientDetails() - } - }) + .subscribe( + object : Subscriber() { + override fun onCompleted() {} + + override fun onError(e: Throwable) { + useCaseCallback.onError(Constants.ERROR_FETCHING_CLIENT_DATA) + } + + override fun onNext(client: Client) { + fromClient = client + fetchToClientDetails() + } + }, + ) } private fun fetchToClientDetails() { apiRepository.getClientDetails(walletRequestValues.toClientId) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) - .subscribe(object : Subscriber() { - override fun onCompleted() {} - - override fun onError(e: Throwable) { - useCaseCallback.onError(Constants.ERROR_FETCHING_CLIENT_DATA) - } - - override fun onNext(client: Client) { - toClient = client - fetchFromAccountDetails() - } - }) + .subscribe( + object : Subscriber() { + override fun onCompleted() {} + + override fun onError(e: Throwable) { + useCaseCallback.onError(Constants.ERROR_FETCHING_CLIENT_DATA) + } + + override fun onNext(client: Client) { + toClient = client + fetchFromAccountDetails() + } + }, + ) } private fun fetchFromAccountDetails() { apiRepository.getSelfAccounts(walletRequestValues.fromClientId) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) - .subscribe(object : Subscriber() { - override fun onCompleted() {} - - override fun onError(e: Throwable) { - useCaseCallback.onError(Constants.ERROR_FETCHING_FROM_ACCOUNT) - } - - override fun onNext(clientAccounts: ClientAccounts) { - val accounts = clientAccounts.savingsAccounts - if (accounts != null && accounts.isNotEmpty()) { - var walletAccount: SavingAccount? = null - for (account in accounts) { - if (account.productId == Constants.WALLET_ACCOUNT_SAVINGS_PRODUCT_ID) { - walletAccount = account - break + .subscribe( + object : Subscriber() { + override fun onCompleted() {} + + override fun onError(e: Throwable) { + useCaseCallback.onError(Constants.ERROR_FETCHING_FROM_ACCOUNT) + } + + override fun onNext(clientAccounts: ClientAccounts) { + val accounts = clientAccounts.savingsAccounts + if (accounts.isNotEmpty()) { + var walletAccount: SavingAccount? = null + for (account in accounts) { + if (account.productId == Constants.WALLET_ACCOUNT_SAVINGS_PRODUCT_ID) { + walletAccount = account + break + } + } + if (walletAccount != null) { + fromAccount = walletAccount + fetchToAccountDetails() + } else { + useCaseCallback.onError(Constants.NO_WALLET_FOUND) } - } - if (walletAccount != null) { - fromAccount = walletAccount - fetchToAccountDetails() } else { - useCaseCallback.onError(Constants.NO_WALLET_FOUND) + useCaseCallback.onError(Constants.ERROR_FETCHING_FROM_ACCOUNT) } - } else { - useCaseCallback.onError(Constants.ERROR_FETCHING_FROM_ACCOUNT) } - } - }) + }, + ) } private fun fetchToAccountDetails() { apiRepository.getAccounts(walletRequestValues.toClientId) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) - .subscribe(object : Subscriber() { - override fun onCompleted() {} - - override fun onError(e: Throwable) { - useCaseCallback.onError(Constants.ERROR_FETCHING_TO_ACCOUNT) - } - - override fun onNext(clientAccounts: ClientAccounts) { - val accounts = clientAccounts.savingsAccounts - if (!accounts.isNullOrEmpty()) { - var walletAccount: SavingAccount? = null - for (account in accounts) { - if (account.productId == Constants.WALLET_ACCOUNT_SAVINGS_PRODUCT_ID) { - walletAccount = account - break + .subscribe( + object : Subscriber() { + override fun onCompleted() {} + + override fun onError(e: Throwable) { + useCaseCallback.onError(Constants.ERROR_FETCHING_TO_ACCOUNT) + } + + override fun onNext(clientAccounts: ClientAccounts) { + val accounts = clientAccounts.savingsAccounts + if (accounts.isNotEmpty()) { + var walletAccount: SavingAccount? = null + for (account in accounts) { + if (account.productId == Constants.WALLET_ACCOUNT_SAVINGS_PRODUCT_ID) { + walletAccount = account + break + } + } + if (walletAccount != null) { + toAccount = walletAccount + makeTransfer() + } else { + useCaseCallback.onError(Constants.NO_WALLET_FOUND) } - } - if (walletAccount != null) { - toAccount = walletAccount - makeTransfer() } else { - useCaseCallback.onError(Constants.NO_WALLET_FOUND) + useCaseCallback.onError(Constants.ERROR_FETCHING_TO_ACCOUNT) } - } else { - useCaseCallback.onError(Constants.ERROR_FETCHING_TO_ACCOUNT) } - } - }) + }, + ) } private fun checkBeneficiary() { apiRepository.beneficiaryList .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) - .subscribe(object : Subscriber>() { - override fun onCompleted() {} - - override fun onError(e: Throwable) { - useCaseCallback.onError(Constants.ERROR_FETCHING_BENEFICIARIES) - } - - override fun onNext(beneficiaries: List) { - var exists = false - beneficiaries.forEach { beneficiary -> - if (beneficiary.accountNumber == toAccount.accountNo) { - exists = true - if (beneficiary.transferLimit >= walletRequestValues.amount) { - makeTransfer() - } else { - updateTransferLimit(beneficiary.id?.toLong()!!) + .subscribe( + object : Subscriber>() { + override fun onCompleted() {} + + override fun onError(e: Throwable) { + useCaseCallback.onError(Constants.ERROR_FETCHING_BENEFICIARIES) + } + + override fun onNext(beneficiaries: List) { + var exists = false + beneficiaries.forEach { beneficiary -> + if (beneficiary.accountNumber == toAccount.accountNo) { + exists = true + if (beneficiary.transferLimit >= walletRequestValues.amount) { + makeTransfer() + } else { + updateTransferLimit(beneficiary.id?.toLong()!!) + } + return@forEach } - return@forEach + } + if (!exists) { + addBeneficiary() } } - if (!exists) { - addBeneficiary() - } - } - }) + }, + ) } private fun addBeneficiary() { @@ -176,17 +196,19 @@ class TransferFunds @Inject constructor( private val apiRepository: FineractRepo apiRepository.createBeneficiary(payload) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) - .subscribe(object : Subscriber() { - override fun onCompleted() {} + .subscribe( + object : Subscriber() { + override fun onCompleted() {} - override fun onError(e: Throwable) { - useCaseCallback.onError(Constants.ERROR_ADDING_BENEFICIARY) - } + override fun onError(e: Throwable) { + useCaseCallback.onError(Constants.ERROR_ADDING_BENEFICIARY) + } - override fun onNext(responseBody: ResponseBody) { - makeTransfer() - } - }) + override fun onNext(responseBody: ResponseBody) { + makeTransfer() + } + }, + ) } private fun updateTransferLimit(beneficiaryId: Long) { @@ -196,17 +218,19 @@ class TransferFunds @Inject constructor( private val apiRepository: FineractRepo apiRepository.updateBeneficiary(beneficiaryId, updatePayload) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) - .subscribe(object : Subscriber() { - override fun onCompleted() {} + .subscribe( + object : Subscriber() { + override fun onCompleted() {} - override fun onError(e: Throwable) { - useCaseCallback.onError(Constants.ERROR_ADDING_BENEFICIARY) - } + override fun onError(e: Throwable) { + useCaseCallback.onError(Constants.ERROR_ADDING_BENEFICIARY) + } - override fun onNext(responseBody: ResponseBody) { - makeTransfer() - } - }) + override fun onNext(responseBody: ResponseBody) { + makeTransfer() + } + }, + ) } private fun makeTransfer() { @@ -227,23 +251,25 @@ class TransferFunds @Inject constructor( private val apiRepository: FineractRepo apiRepository.makeThirdPartyTransfer(transferPayload) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) - .subscribe(object : Subscriber() { - override fun onCompleted() {} + .subscribe( + object : Subscriber() { + override fun onCompleted() {} - override fun onError(e: Throwable) { - useCaseCallback.onError(Constants.ERROR_MAKING_TRANSFER) - } + override fun onError(e: Throwable) { + useCaseCallback.onError(Constants.ERROR_MAKING_TRANSFER) + } - override fun onNext(responseBody: TPTResponse) { - useCaseCallback.onSuccess(ResponseValue()) - } - }) + override fun onNext(responseBody: TPTResponse) { + useCaseCallback.onSuccess(ResponseValue()) + } + }, + ) } data class RequestValues( val fromClientId: Long, val toClientId: Long, - val amount: Double + val amount: Double, ) : UseCase.RequestValues class ResponseValue : UseCase.ResponseValue diff --git a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/client/CreateClient.kt b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/client/CreateClient.kt index 234e1bc11..64246586f 100644 --- a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/client/CreateClient.kt +++ b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/client/CreateClient.kt @@ -1,5 +1,15 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.data.domain.usecase.client +import com.mifospay.core.model.domain.client.NewClient import org.mifospay.core.data.base.UseCase import org.mifospay.core.data.fineract.repository.FineractRepository import org.mifospay.core.data.util.ErrorJsonMessageHelper.getUserMessage @@ -9,35 +19,37 @@ import rx.android.schedulers.AndroidSchedulers import rx.schedulers.Schedulers import javax.inject.Inject -/** - * Created by naman on 20/8/17. - */ -class CreateClient @Inject constructor(private val apiRepository: FineractRepository) : - UseCase() { +class CreateClient @Inject constructor( + private val apiRepository: FineractRepository, +) : UseCase() { + + data class RequestValues(val client: NewClient) : UseCase.RequestValues - data class RequestValues(val client: com.mifospay.core.model.domain.client.NewClient) : UseCase.RequestValues data class ResponseValue(val clientId: Int) : UseCase.ResponseValue override fun executeUseCase(requestValues: RequestValues) { apiRepository.createClient(requestValues.client) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) - .subscribe(object : Subscriber() { - override fun onCompleted() {} - override fun onError(e: Throwable) { - var message: String - try { - message = (e as HttpException).response()?.errorBody()?.string().toString() - message = getUserMessage(message) - } catch (e1: Exception) { - message = e1.message.toString() + .subscribe( + object : Subscriber() { + override fun onCompleted() {} + override fun onError(e: Throwable) { + var message: String + try { + message = + (e as HttpException).response()?.errorBody()?.string().toString() + message = getUserMessage(message) + } catch (e1: Exception) { + message = e1.message.toString() + } + useCaseCallback.onError(message) } - useCaseCallback.onError(message) - } - override fun onNext(genericResponse: ResponseValue) { - useCaseCallback.onSuccess(genericResponse) - } - }) + override fun onNext(genericResponse: ResponseValue) { + useCaseCallback.onSuccess(genericResponse) + } + }, + ) } } diff --git a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/client/FetchClientData.kt b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/client/FetchClientData.kt index d13fef6df..2d74601ce 100644 --- a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/client/FetchClientData.kt +++ b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/client/FetchClientData.kt @@ -1,8 +1,17 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.data.domain.usecase.client -import org.mifospay.core.data.base.UseCase import com.mifospay.core.model.entity.Page import com.mifospay.core.model.entity.client.Client +import org.mifospay.core.data.base.UseCase import org.mifospay.core.data.fineract.entity.mapper.ClientDetailsMapper import org.mifospay.core.data.fineract.repository.FineractRepository import org.mifospay.core.data.util.Constants @@ -11,8 +20,9 @@ import rx.android.schedulers.AndroidSchedulers import rx.schedulers.Schedulers import javax.inject.Inject -class FetchClientData @Inject constructor(private val fineractRepository: FineractRepository) : - UseCase() { +class FetchClientData @Inject constructor( + private val fineractRepository: FineractRepository, +) : UseCase() { @Inject lateinit var clientDetailsMapper: ClientDetailsMapper @@ -22,43 +32,47 @@ class FetchClientData @Inject constructor(private val fineractRepository: Finera fineractRepository.getSelfClientDetails(clientId) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) - .subscribe(object : Subscriber() { - override fun onCompleted() {} - override fun onError(e: Throwable) { - useCaseCallback.onError(Constants.ERROR_FETCHING_CLIENT_DATA) - } + .subscribe( + object : Subscriber() { + override fun onCompleted() {} + override fun onError(e: Throwable) { + useCaseCallback.onError(Constants.ERROR_FETCHING_CLIENT_DATA) + } - override fun onNext(client: Client) { - useCaseCallback.onSuccess( - ResponseValue(clientDetailsMapper.transform(client)) - ) - } - }) + override fun onNext(client: Client) { + useCaseCallback.onSuccess( + ResponseValue(clientDetailsMapper.transform(client)), + ) + } + }, + ) } ?: run { fineractRepository.selfClientDetails .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) - .subscribe(object : Subscriber>() { - override fun onCompleted() {} - override fun onError(e: Throwable) { - useCaseCallback.onError(Constants.ERROR_FETCHING_CLIENT_DATA) - } + .subscribe( + object : Subscriber>() { + override fun onCompleted() {} + override fun onError(e: Throwable) { + useCaseCallback.onError(Constants.ERROR_FETCHING_CLIENT_DATA) + } - override fun onNext(client: Page) { - if (client.pageItems.size != 0) { - useCaseCallback.onSuccess( - ResponseValue(clientDetailsMapper.transform(client.pageItems[0])) - ) - } else { - useCaseCallback.onError(Constants.NO_CLIENT_FOUND) + override fun onNext(client: Page) { + if (client.pageItems.size != 0) { + useCaseCallback.onSuccess( + ResponseValue(clientDetailsMapper.transform(client.pageItems[0])), + ) + } else { + useCaseCallback.onError(Constants.NO_CLIENT_FOUND) + } } - } - }) + }, + ) } } data class RequestValues(val clientId: Long?) : UseCase.RequestValues data class ResponseValue( - val clientDetails: com.mifospay.core.model.domain.client.Client + val clientDetails: com.mifospay.core.model.domain.client.Client, ) : UseCase.ResponseValue } diff --git a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/client/FetchClientDetails.kt b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/client/FetchClientDetails.kt index 98c528aa7..7728aeee4 100644 --- a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/client/FetchClientDetails.kt +++ b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/client/FetchClientDetails.kt @@ -1,7 +1,16 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.data.domain.usecase.client -import org.mifospay.core.data.base.UseCase import com.mifospay.core.model.entity.client.Client +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 @@ -9,11 +18,9 @@ import rx.android.schedulers.AndroidSchedulers import rx.schedulers.Schedulers import javax.inject.Inject -/** - * Created by ankur on 24/July/2018 - */ -class FetchClientDetails @Inject constructor(private val mFineractRepository: FineractRepository) : - UseCase() { +class FetchClientDetails @Inject constructor( + private val mFineractRepository: FineractRepository, +) : UseCase() { data class RequestValues(val clientId: Long) : UseCase.RequestValues data class ResponseValue(val client: Client) : UseCase.ResponseValue @@ -22,15 +29,17 @@ class FetchClientDetails @Inject constructor(private val mFineractRepository: Fi mFineractRepository.getClientDetails(requestValues.clientId) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) - .subscribe(object : Subscriber() { - override fun onCompleted() {} - override fun onError(e: Throwable) { - useCaseCallback.onError(Constants.ERROR_FETCHING_CLIENT_DATA) - } + .subscribe( + object : Subscriber() { + override fun onCompleted() {} + override fun onError(e: Throwable) { + useCaseCallback.onError(Constants.ERROR_FETCHING_CLIENT_DATA) + } - override fun onNext(client: Client) { - useCaseCallback.onSuccess(ResponseValue(client)) - } - }) + override fun onNext(client: Client) { + useCaseCallback.onSuccess(ResponseValue(client)) + } + }, + ) } } diff --git a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/client/FetchClientImage.kt b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/client/FetchClientImage.kt index f8f4f8e00..db51bf3fe 100644 --- a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/client/FetchClientImage.kt +++ b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/client/FetchClientImage.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.data.domain.usecase.client import okhttp3.ResponseBody @@ -9,25 +18,29 @@ import rx.android.schedulers.AndroidSchedulers import rx.schedulers.Schedulers import javax.inject.Inject -class FetchClientImage @Inject constructor(private val mFineractRepository: FineractRepository) : +class FetchClientImage @Inject constructor( + private val mFineractRepository: FineractRepository, +) : UseCase() { - data class RequestValues(val clientid: Long) : UseCase.RequestValues + data class RequestValues(val clientId: Long) : UseCase.RequestValues data class ResponseValue(val responseBody: ResponseBody) : UseCase.ResponseValue override fun executeUseCase(requestValues: RequestValues) { - mFineractRepository.getClientImage(requestValues.clientid) + mFineractRepository.getClientImage(requestValues.clientId) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) - .subscribe(object : Subscriber() { - override fun onCompleted() {} - override fun onError(e: Throwable) { - getUserMessage(e)?.let { useCaseCallback.onError(it) } - } + .subscribe( + object : Subscriber() { + override fun onCompleted() {} + override fun onError(e: Throwable) { + getUserMessage(e)?.let { useCaseCallback.onError(it) } + } - override fun onNext(responseBody: ResponseBody) { - useCaseCallback.onSuccess(ResponseValue(responseBody)) - } - }) + override fun onNext(responseBody: ResponseBody) { + useCaseCallback.onSuccess(ResponseValue(responseBody)) + } + }, + ) } } diff --git a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/client/SearchClient.kt b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/client/SearchClient.kt index a986a010c..4cf55ef81 100644 --- a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/client/SearchClient.kt +++ b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/client/SearchClient.kt @@ -1,21 +1,28 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.data.domain.usecase.client -import org.mifospay.core.data.base.UseCase +import com.mifospay.core.model.domain.SearchResult import com.mifospay.core.model.entity.SearchedEntity +import org.mifospay.core.data.base.UseCase import org.mifospay.core.data.fineract.entity.mapper.SearchedEntitiesMapper import org.mifospay.core.data.fineract.repository.FineractRepository -import com.mifospay.core.model.domain.SearchResult import org.mifospay.core.data.util.Constants import rx.Subscriber import rx.android.schedulers.AndroidSchedulers import rx.schedulers.Schedulers import javax.inject.Inject -/** - * Created by naman on 19/8/17. - */ -class SearchClient @Inject constructor(private val apiRepository: FineractRepository) : - UseCase() { +class SearchClient @Inject constructor( + private val apiRepository: FineractRepository, +) : UseCase() { @Inject lateinit var searchedEntitiesMapper: SearchedEntitiesMapper @@ -27,23 +34,25 @@ class SearchClient @Inject constructor(private val apiRepository: FineractReposi apiRepository.searchResources(requestValues.externalId, Constants.CLIENTS, false) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) - .subscribe(object : Subscriber>() { - override fun onCompleted() {} - override fun onError(e: Throwable) { - useCaseCallback.onError(Constants.ERROR_SEARCHING_CLIENTS) - } + .subscribe( + object : Subscriber>() { + override fun onCompleted() {} + override fun onError(e: Throwable) { + useCaseCallback.onError(Constants.ERROR_SEARCHING_CLIENTS) + } - override fun onNext(results: List) { - if (results.isNotEmpty()) { - useCaseCallback.onSuccess( - ResponseValue( - searchedEntitiesMapper.transformList(results) + override fun onNext(results: List) { + if (results.isNotEmpty()) { + useCaseCallback.onSuccess( + ResponseValue( + searchedEntitiesMapper.transformList(results), + ), ) - ) - } else { - useCaseCallback.onError(Constants.NO_CLIENTS_FOUND) + } else { + useCaseCallback.onError(Constants.NO_CLIENTS_FOUND) + } } - } - }) + }, + ) } } diff --git a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/client/UpdateClient.kt b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/client/UpdateClient.kt index 2a6ffe270..c6d533071 100644 --- a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/client/UpdateClient.kt +++ b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/client/UpdateClient.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.data.domain.usecase.client import okhttp3.ResponseBody @@ -10,11 +19,9 @@ import rx.android.schedulers.AndroidSchedulers import rx.schedulers.Schedulers import javax.inject.Inject -/** - * Created by naman on 19/8/17. - */ -class UpdateClient @Inject constructor(private val fineractRepository: FineractRepository) : - UseCase() { +class UpdateClient @Inject constructor( + private val fineractRepository: FineractRepository, +) : UseCase() { data class RequestValues(val updateClientEntity: Any, val clientId: Long) : UseCase.RequestValues @@ -25,22 +32,25 @@ class UpdateClient @Inject constructor(private val fineractRepository: FineractR fineractRepository.updateClient(requestValues.clientId, requestValues.updateClientEntity) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) - .subscribe(object : Subscriber() { - override fun onCompleted() {} - override fun onError(e: Throwable) { - var message: String - try { - message = (e as HttpException).response()?.errorBody()?.string().toString() - message = getUserMessage(message) - } catch (e1: Exception) { - message = e1.message.toString() + .subscribe( + object : Subscriber() { + override fun onCompleted() {} + override fun onError(e: Throwable) { + var message: String + try { + message = + (e as HttpException).response()?.errorBody()?.string().toString() + message = getUserMessage(message) + } catch (e1: Exception) { + message = e1.message.toString() + } + useCaseCallback.onError(message) } - useCaseCallback.onError(message) - } - override fun onNext(responseBody: ResponseBody) { - useCaseCallback.onSuccess(ResponseValue(responseBody)) - } - }) + override fun onNext(responseBody: ResponseBody) { + useCaseCallback.onSuccess(ResponseValue(responseBody)) + } + }, + ) } -} \ No newline at end of file +} diff --git a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/invoice/FetchInvoice.kt b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/invoice/FetchInvoice.kt index 3ed07e2f7..bfdcfb24e 100644 --- a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/invoice/FetchInvoice.kt +++ b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/invoice/FetchInvoice.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.data.domain.usecase.invoice import android.net.Uri @@ -11,21 +20,17 @@ import rx.android.schedulers.AndroidSchedulers import rx.schedulers.Schedulers import javax.inject.Inject -/** - * Created by ankur on 07/June/2018 - */ -class FetchInvoice @Inject constructor(private val mFineractRepository: FineractRepository) : - UseCase() { +class FetchInvoice @Inject constructor( + private val mFineractRepository: FineractRepository, +) : UseCase() { class RequestValues(val uniquePaymentLink: Uri?) : UseCase.RequestValues class ResponseValue( - val invoices: List + val invoices: List, ) : UseCase.ResponseValue override fun executeUseCase(requestValues: RequestValues) { val paymentLink = requestValues.uniquePaymentLink - val scheme = paymentLink?.scheme // "https" - val host = paymentLink?.host // "invoice.mifospay.com" try { val params = paymentLink?.pathSegments val clientId = params?.get(0) // "clientId" @@ -34,21 +39,22 @@ class FetchInvoice @Inject constructor(private val mFineractRepository: Fineract mFineractRepository.fetchInvoice(clientId, invoiceId) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) - .subscribe(object : Subscriber?>() { - override fun onCompleted() {} - override fun onError(e: Throwable) { - useCaseCallback.onError(Constants.INVALID_UPL) - } - - override fun onNext(invoices: List?) { - if (invoices?.isNotEmpty() == true) { - useCaseCallback.onSuccess(ResponseValue(invoices)) - } else { - useCaseCallback.onError(Constants.INVOICE_DOES_NOT_EXIST) + .subscribe( + object : Subscriber?>() { + override fun onCompleted() {} + override fun onError(e: Throwable) { + useCaseCallback.onError(Constants.INVALID_UPL) } - } - }) + override fun onNext(invoices: List?) { + if (invoices?.isNotEmpty() == true) { + useCaseCallback.onSuccess(ResponseValue(invoices)) + } else { + useCaseCallback.onError(Constants.INVOICE_DOES_NOT_EXIST) + } + } + }, + ) } } catch (e: IndexOutOfBoundsException) { Log.e("Error", e.message.toString()) diff --git a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/invoice/FetchInvoices.kt b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/invoice/FetchInvoices.kt index e6fe0500e..50caac4f2 100644 --- a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/invoice/FetchInvoices.kt +++ b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/invoice/FetchInvoices.kt @@ -1,40 +1,49 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.data.domain.usecase.invoice import android.util.Log -import org.mifospay.core.data.base.UseCase import com.mifospay.core.model.entity.Invoice +import org.mifospay.core.data.base.UseCase import org.mifospay.core.data.fineract.repository.FineractRepository import rx.Subscriber import rx.android.schedulers.AndroidSchedulers import rx.schedulers.Schedulers import javax.inject.Inject -/** - * Created by ankur on 11/June/2018 - */ -class FetchInvoices @Inject constructor(private val mFineractRepository: FineractRepository) : +class FetchInvoices @Inject constructor( + private val mFineractRepository: FineractRepository, +) : UseCase() { class RequestValues(val clientId: String) : UseCase.RequestValues class ResponseValue( - val invoiceList: List + val invoiceList: List, ) : UseCase.ResponseValue override fun executeUseCase(requestValues: RequestValues) { mFineractRepository.fetchInvoices(requestValues.clientId) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) - .subscribe(object : Subscriber>() { - override fun onCompleted() {} - override fun onError(e: Throwable) { - Log.e("Invoices", e.message.toString()) - useCaseCallback.onError(e.toString()) - } - - override fun onNext(invoices: List) { - useCaseCallback.onSuccess(ResponseValue(invoices)) - } - }) + .subscribe( + object : Subscriber>() { + override fun onCompleted() {} + override fun onError(e: Throwable) { + Log.e("Invoices", e.message.toString()) + useCaseCallback.onError(e.toString()) + } + override fun onNext(invoices: List) { + useCaseCallback.onSuccess(ResponseValue(invoices)) + } + }, + ) } } diff --git a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/kyc/FetchKYCLevel1Details.kt b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/kyc/FetchKYCLevel1Details.kt index f36b6c20c..2cf235a3d 100644 --- a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/kyc/FetchKYCLevel1Details.kt +++ b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/kyc/FetchKYCLevel1Details.kt @@ -1,40 +1,48 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.data.domain.usecase.kyc -import org.mifospay.core.data.base.UseCase import com.mifospay.core.model.entity.kyc.KYCLevel1Details +import org.mifospay.core.data.base.UseCase import org.mifospay.core.data.fineract.repository.FineractRepository import rx.Subscriber import rx.android.schedulers.AndroidSchedulers import rx.schedulers.Schedulers import javax.inject.Inject -/** - * Created by ankur on 24/May/2018 - */ -class FetchKYCLevel1Details @Inject constructor(private val mFineractRepository: FineractRepository) : - UseCase() { +class FetchKYCLevel1Details @Inject constructor( + private val mFineractRepository: FineractRepository, +) : UseCase() { class RequestValues(val clientId: Int) : UseCase.RequestValues class ResponseValue( - val kycLevel1DetailsList: List + val kycLevel1DetailsList: List, ) : UseCase.ResponseValue override fun executeUseCase(requestValues: RequestValues) { mFineractRepository.fetchKYCLevel1Details(requestValues.clientId) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) - .subscribe(object : Subscriber>() { - override fun onCompleted() {} - override fun onError(e: Throwable) { - useCaseCallback.onError(e.toString()) - } - - override fun onNext(kycLevel1Details: List) { - useCaseCallback.onSuccess( - ResponseValue(kycLevel1Details) - ) - } - }) + .subscribe( + object : Subscriber>() { + override fun onCompleted() {} + override fun onError(e: Throwable) { + useCaseCallback.onError(e.toString()) + } + override fun onNext(kycLevel1Details: List) { + useCaseCallback.onSuccess( + ResponseValue(kycLevel1Details), + ) + } + }, + ) } } diff --git a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/kyc/UpdateKYCLevel1Details.kt b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/kyc/UpdateKYCLevel1Details.kt index d4d178d8f..90b1c0d4a 100644 --- a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/kyc/UpdateKYCLevel1Details.kt +++ b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/kyc/UpdateKYCLevel1Details.kt @@ -1,7 +1,16 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.data.domain.usecase.kyc -import org.mifospay.core.data.base.UseCase import com.mifospay.core.model.entity.kyc.KYCLevel1Details +import org.mifospay.core.data.base.UseCase import org.mifospay.core.data.fineract.repository.FineractRepository import org.mifospay.core.network.GenericResponse import rx.Subscriber @@ -9,15 +18,13 @@ import rx.android.schedulers.AndroidSchedulers import rx.schedulers.Schedulers import javax.inject.Inject -/** - * Created by ankur on 25/May/2018 - */ -class UpdateKYCLevel1Details @Inject constructor(private val mFineractRepository: FineractRepository) : - UseCase() { +class UpdateKYCLevel1Details @Inject constructor( + private val mFineractRepository: FineractRepository, +) : UseCase() { class RequestValues( val clientId: Int, - val kycLevel1Details: KYCLevel1Details + val kycLevel1Details: KYCLevel1Details, ) : UseCase.RequestValues class ResponseValue : UseCase.ResponseValue @@ -25,21 +32,21 @@ class UpdateKYCLevel1Details @Inject constructor(private val mFineractRepository override fun executeUseCase(requestValues: RequestValues) { mFineractRepository.updateKYCLevel1Details( requestValues.clientId, - requestValues.kycLevel1Details + requestValues.kycLevel1Details, ) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) - .subscribe(object : Subscriber() { - override fun onCompleted() {} - override fun onError(e: Throwable) { - useCaseCallback.onError(e.toString()) - } - - override fun onNext(t: GenericResponse) { - useCaseCallback.onSuccess(ResponseValue()) - } - - }) - + .subscribe( + object : Subscriber() { + override fun onCompleted() {} + override fun onError(e: Throwable) { + useCaseCallback.onError(e.toString()) + } + + override fun onNext(t: GenericResponse) { + useCaseCallback.onSuccess(ResponseValue()) + } + }, + ) } } diff --git a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/kyc/UploadKYCDocs.kt b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/kyc/UploadKYCDocs.kt index f4238e713..c62971778 100644 --- a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/kyc/UploadKYCDocs.kt +++ b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/kyc/UploadKYCDocs.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.data.domain.usecase.kyc import okhttp3.MultipartBody @@ -9,36 +18,41 @@ import rx.android.schedulers.AndroidSchedulers import rx.schedulers.Schedulers import javax.inject.Inject -/** - * Created by ankur on 16/May/2018 - */ -class UploadKYCDocs @Inject constructor(private val apiRepository: FineractRepository) : - UseCase() { +class UploadKYCDocs @Inject constructor( + private val apiRepository: FineractRepository, +) : UseCase() { class RequestValues( - val entitytype: String, val clientId: Long, val docname: String, - val identityType: String, val file: MultipartBody.Part + val entityType: String, + val clientId: Long, + val docname: String, + val identityType: String, + val file: MultipartBody.Part, ) : UseCase.RequestValues class ResponseValue : UseCase.ResponseValue override fun executeUseCase(requestValues: RequestValues) { apiRepository.uploadKYCDocs( - requestValues.entitytype, requestValues.clientId, - requestValues.docname, requestValues.identityType, requestValues.file + requestValues.entityType, + requestValues.clientId, + requestValues.docname, + requestValues.identityType, + requestValues.file, ) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) - .subscribe(object : Subscriber() { - override fun onCompleted() {} - override fun onError(e: Throwable) { - useCaseCallback.onError(e.toString()) - } - - override fun onNext(t: GenericResponse) { - useCaseCallback.onSuccess(ResponseValue()) - } - }) + .subscribe( + object : Subscriber() { + override fun onCompleted() {} + override fun onError(e: Throwable) { + useCaseCallback.onError(e.toString()) + } + override fun onNext(t: GenericResponse) { + useCaseCallback.onSuccess(ResponseValue()) + } + }, + ) } } diff --git a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/kyc/UploadKYCLevel1Details.kt b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/kyc/UploadKYCLevel1Details.kt index 93a92ddcc..cf8627e6b 100644 --- a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/kyc/UploadKYCLevel1Details.kt +++ b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/kyc/UploadKYCLevel1Details.kt @@ -1,7 +1,16 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.data.domain.usecase.kyc -import org.mifospay.core.data.base.UseCase import com.mifospay.core.model.entity.kyc.KYCLevel1Details +import org.mifospay.core.data.base.UseCase import org.mifospay.core.data.fineract.repository.FineractRepository import org.mifospay.core.network.GenericResponse import rx.Subscriber @@ -9,14 +18,12 @@ import rx.android.schedulers.AndroidSchedulers import rx.schedulers.Schedulers import javax.inject.Inject -/** - * Created by ankur on 24/May/2018 - */ -class UploadKYCLevel1Details @Inject constructor(var mFineractRepository: FineractRepository) : - UseCase() { +class UploadKYCLevel1Details @Inject constructor( + var mFineractRepository: FineractRepository, +) : UseCase() { class RequestValues( val clientId: Int, - val mKYCLevel1Details: KYCLevel1Details + val mKYCLevel1Details: KYCLevel1Details, ) : UseCase.RequestValues class ResponseValue : UseCase.ResponseValue @@ -24,20 +31,21 @@ class UploadKYCLevel1Details @Inject constructor(var mFineractRepository: Finera override fun executeUseCase(requestValues: RequestValues) { mFineractRepository.uploadKYCLevel1Details( requestValues.clientId, - requestValues.mKYCLevel1Details + requestValues.mKYCLevel1Details, ) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) - .subscribe(object : Subscriber() { - override fun onCompleted() {} - override fun onError(e: Throwable) { - useCaseCallback.onError(e.toString()) - } - - override fun onNext(t: GenericResponse) { - useCaseCallback.onSuccess(ResponseValue()) - } - }) + .subscribe( + object : Subscriber() { + override fun onCompleted() {} + override fun onError(e: Throwable) { + useCaseCallback.onError(e.toString()) + } + override fun onNext(t: GenericResponse) { + useCaseCallback.onSuccess(ResponseValue()) + } + }, + ) } } diff --git a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/notification/FetchNotifications.kt b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/notification/FetchNotifications.kt index ea37ac6e4..7aef23b3b 100644 --- a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/notification/FetchNotifications.kt +++ b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/notification/FetchNotifications.kt @@ -1,40 +1,47 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.data.domain.usecase.notification +import com.mifospay.core.model.domain.NotificationPayload import org.mifospay.core.data.base.UseCase import org.mifospay.core.data.fineract.repository.FineractRepository -import com.mifospay.core.model.domain.NotificationPayload import org.mifospay.core.data.util.Constants import rx.Subscriber import rx.android.schedulers.AndroidSchedulers import rx.schedulers.Schedulers import javax.inject.Inject -/** - * Created by ankur on 24/July/2018 - */ -class FetchNotifications @Inject constructor(private val mFineractRepository: FineractRepository) : - UseCase() { +class FetchNotifications @Inject constructor( + private val mFineractRepository: FineractRepository, +) : UseCase() { class RequestValues(val clientId: Long) : UseCase.RequestValues class ResponseValue( - val notificationPayloadList: List? + val notificationPayloadList: List?, ) : UseCase.ResponseValue override fun executeUseCase(requestValues: RequestValues) { - mFineractRepository.fetchNotifications(requestValues.clientId) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) - .subscribe(object : Subscriber>() { - override fun onCompleted() {} - override fun onError(e: Throwable) { - useCaseCallback.onError(Constants.ERROR_FETCHING_NOTIFICATIONS) - } - - override fun onNext(notificationPayloads: List) { - useCaseCallback.onSuccess(ResponseValue(notificationPayloads)) - } - }) + .subscribe( + object : Subscriber>() { + override fun onCompleted() {} + override fun onError(e: Throwable) { + useCaseCallback.onError(Constants.ERROR_FETCHING_NOTIFICATIONS) + } + override fun onNext(notificationPayloads: List) { + useCaseCallback.onSuccess(ResponseValue(notificationPayloads)) + } + }, + ) } } diff --git a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/savedcards/AddCard.kt b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/savedcards/AddCard.kt index ac6f93363..85b01ae6e 100644 --- a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/savedcards/AddCard.kt +++ b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/savedcards/AddCard.kt @@ -1,7 +1,16 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.data.domain.usecase.savedcards -import org.mifospay.core.data.base.UseCase import com.mifospay.core.model.entity.savedcards.Card +import org.mifospay.core.data.base.UseCase import org.mifospay.core.data.fineract.repository.FineractRepository import org.mifospay.core.network.GenericResponse import rx.Subscriber @@ -9,11 +18,9 @@ import rx.android.schedulers.AndroidSchedulers import rx.schedulers.Schedulers import javax.inject.Inject -/** - * Created by ankur on 21/May/2018 - */ -class AddCard @Inject constructor(private val mFineractRepository: FineractRepository) : - UseCase() { +class AddCard @Inject constructor( + private val mFineractRepository: FineractRepository, +) : UseCase() { class RequestValues(val clientId: Long, val card: Card) : UseCase.RequestValues class ResponseValue : UseCase.ResponseValue @@ -21,16 +28,17 @@ class AddCard @Inject constructor(private val mFineractRepository: FineractRepos mFineractRepository.addSavedCards(requestValues.clientId, requestValues.card) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) - .subscribe(object : Subscriber() { - override fun onCompleted() {} - override fun onError(e: Throwable) { - useCaseCallback.onError(e.toString()) - } - - override fun onNext(t: GenericResponse?) { - useCaseCallback.onSuccess(ResponseValue()) - } - }) + .subscribe( + object : Subscriber() { + override fun onCompleted() {} + override fun onError(e: Throwable) { + useCaseCallback.onError(e.toString()) + } + override fun onNext(t: GenericResponse?) { + useCaseCallback.onSuccess(ResponseValue()) + } + }, + ) } -} \ No newline at end of file +} diff --git a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/savedcards/DeleteCard.kt b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/savedcards/DeleteCard.kt index b4161120b..d143d1ea4 100644 --- a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/savedcards/DeleteCard.kt +++ b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/savedcards/DeleteCard.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.data.domain.usecase.savedcards import org.mifospay.core.data.base.UseCase @@ -8,11 +17,9 @@ import rx.android.schedulers.AndroidSchedulers import rx.schedulers.Schedulers import javax.inject.Inject -/** - * Created by ankur on 22/May/2018 - */ -class DeleteCard @Inject constructor(private val mFineractRepository: FineractRepository) : - UseCase() { +class DeleteCard @Inject constructor( + private val mFineractRepository: FineractRepository, +) : UseCase() { class RequestValues(val clientId: Int, val cardId: Int) : UseCase.RequestValues class ResponseValue : UseCase.ResponseValue @@ -21,16 +28,17 @@ class DeleteCard @Inject constructor(private val mFineractRepository: FineractRe mFineractRepository.deleteSavedCard(requestValues.clientId, requestValues.cardId) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) - .subscribe(object : Subscriber() { - override fun onCompleted() {} - override fun onError(e: Throwable) { - useCaseCallback.onError(e.toString()) - } - - override fun onNext(t: GenericResponse?) { - useCaseCallback.onSuccess(ResponseValue()) - } - }) + .subscribe( + object : Subscriber() { + override fun onCompleted() {} + override fun onError(e: Throwable) { + useCaseCallback.onError(e.toString()) + } + override fun onNext(t: GenericResponse?) { + useCaseCallback.onSuccess(ResponseValue()) + } + }, + ) } } diff --git a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/savedcards/EditCard.kt b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/savedcards/EditCard.kt index f96a1db3a..b27627897 100644 --- a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/savedcards/EditCard.kt +++ b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/savedcards/EditCard.kt @@ -1,7 +1,16 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.data.domain.usecase.savedcards -import org.mifospay.core.data.base.UseCase import com.mifospay.core.model.entity.savedcards.Card +import org.mifospay.core.data.base.UseCase import org.mifospay.core.data.fineract.repository.FineractRepository import org.mifospay.core.network.GenericResponse import rx.Subscriber @@ -9,11 +18,9 @@ import rx.android.schedulers.AndroidSchedulers import rx.schedulers.Schedulers import javax.inject.Inject -/** - * Created by ankur on 22/May/2018 - */ -class EditCard @Inject constructor(private val mFineractRepository: FineractRepository) : - UseCase() { +class EditCard @Inject constructor( + private val mFineractRepository: FineractRepository, +) : UseCase() { class RequestValues(val clientId: Int, val card: Card) : UseCase.RequestValues class ResponseValue : UseCase.ResponseValue @@ -22,16 +29,17 @@ class EditCard @Inject constructor(private val mFineractRepository: FineractRepo mFineractRepository.editSavedCard(requestValues.clientId, requestValues.card) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) - .subscribe(object : Subscriber() { - override fun onCompleted() {} - override fun onError(e: Throwable) { - useCaseCallback.onError(e.toString()) - } - - override fun onNext(t: GenericResponse?) { - useCaseCallback.onSuccess(ResponseValue()) - } - }) + .subscribe( + object : Subscriber() { + override fun onCompleted() {} + override fun onError(e: Throwable) { + useCaseCallback.onError(e.toString()) + } + override fun onNext(t: GenericResponse?) { + useCaseCallback.onSuccess(ResponseValue()) + } + }, + ) } } diff --git a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/savedcards/FetchSavedCards.kt b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/savedcards/FetchSavedCards.kt index 994351885..6400ae78d 100644 --- a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/savedcards/FetchSavedCards.kt +++ b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/savedcards/FetchSavedCards.kt @@ -1,7 +1,16 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.data.domain.usecase.savedcards -import org.mifospay.core.data.base.UseCase import com.mifospay.core.model.entity.savedcards.Card +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 @@ -9,11 +18,9 @@ import rx.android.schedulers.AndroidSchedulers import rx.schedulers.Schedulers import javax.inject.Inject -/** - * Created by ankur on 21/May/2018 - */ -class FetchSavedCards @Inject constructor(private val mFineractRepository: FineractRepository) : - UseCase() { +class FetchSavedCards @Inject constructor( + private val mFineractRepository: FineractRepository, +) : UseCase() { class RequestValues(val clientId: Long) : UseCase.RequestValues class ResponseValue(val cardList: List) : UseCase.ResponseValue @@ -22,20 +29,21 @@ class FetchSavedCards @Inject constructor(private val mFineractRepository: Finer mFineractRepository.fetchSavedCards(requestValues.clientId) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) - .subscribe(object : Subscriber>() { - override fun onCompleted() {} - override fun onError(e: Throwable) { - useCaseCallback.onError(e.toString()) - } - - override fun onNext(cards: List) { - if (cards.isNotEmpty()) { - useCaseCallback.onSuccess(ResponseValue(cards)) - } else { - useCaseCallback.onError(Constants.NO_SAVED_CARDS) + .subscribe( + object : Subscriber>() { + override fun onCompleted() {} + override fun onError(e: Throwable) { + useCaseCallback.onError(e.toString()) } - } - }) + override fun onNext(cards: List) { + if (cards.isNotEmpty()) { + useCaseCallback.onSuccess(ResponseValue(cards)) + } else { + useCaseCallback.onError(Constants.NO_SAVED_CARDS) + } + } + }, + ) } } diff --git a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/standinginstruction/CreateStandingTransaction.kt b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/standinginstruction/CreateStandingTransaction.kt index 5a11f2612..690651c9a 100644 --- a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/standinginstruction/CreateStandingTransaction.kt +++ b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/standinginstruction/CreateStandingTransaction.kt @@ -1,11 +1,20 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.data.domain.usecase.standinginstruction -import org.mifospay.core.data.base.UseCase 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.standinginstruction.SDIResponse import com.mifospay.core.model.entity.payload.StandingInstructionPayload +import com.mifospay.core.model.entity.standinginstruction.SDIResponse +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 @@ -13,9 +22,9 @@ import rx.android.schedulers.AndroidSchedulers import rx.schedulers.Schedulers import javax.inject.Inject - -class CreateStandingTransaction @Inject constructor(private val apiRepository: FineractRepository) : - UseCase() { +class CreateStandingTransaction @Inject constructor( + private val apiRepository: FineractRepository, +) : UseCase() { lateinit var fromClient: Client lateinit var toClient: Client @@ -24,12 +33,12 @@ class CreateStandingTransaction @Inject constructor(private val apiRepository: F override fun executeUseCase(requestValues: RequestValues) { apiRepository.getSelfClientDetails(requestValues.fromClientId) - .observeOn(AndroidSchedulers.mainThread()) - .subscribeOn(Schedulers.io()) - .subscribe(object : Subscriber() { + .observeOn(AndroidSchedulers.mainThread()) + .subscribeOn(Schedulers.io()) + .subscribe( + object : Subscriber() { override fun onCompleted() { - } override fun onError(e: Throwable) { @@ -40,17 +49,18 @@ class CreateStandingTransaction @Inject constructor(private val apiRepository: F fromClient = client fetchToClientData() } - }) + }, + ) } private fun fetchToClientData() { apiRepository.getClientDetails(walletRequestValues.toClientId) - .observeOn(AndroidSchedulers.mainThread()) - .subscribeOn(Schedulers.io()) - .subscribe(object : Subscriber() { + .observeOn(AndroidSchedulers.mainThread()) + .subscribeOn(Schedulers.io()) + .subscribe( + object : Subscriber() { override fun onCompleted() { - } override fun onError(e: Throwable) { @@ -61,16 +71,17 @@ class CreateStandingTransaction @Inject constructor(private val apiRepository: F toClient = client fetchFromAccountDetails() } - }) + }, + ) } private fun fetchFromAccountDetails() { apiRepository.getSelfAccounts(walletRequestValues.fromClientId) - .observeOn(AndroidSchedulers.mainThread()) - .subscribeOn(Schedulers.io()) - .subscribe(object : Subscriber() { + .observeOn(AndroidSchedulers.mainThread()) + .subscribeOn(Schedulers.io()) + .subscribe( + object : Subscriber() { override fun onCompleted() { - } override fun onError(e: Throwable) { @@ -79,32 +90,34 @@ class CreateStandingTransaction @Inject constructor(private val apiRepository: F override fun onNext(clientAccounts: ClientAccounts) { val accounts = clientAccounts.savingsAccounts - if (accounts != null && accounts.size != 0) { + if (accounts.isNotEmpty()) { var walletAccount: SavingAccount? = null for (account in accounts) { if (account.productId == - Constants.WALLET_ACCOUNT_SAVINGS_PRODUCT_ID) { + Constants.WALLET_ACCOUNT_SAVINGS_PRODUCT_ID + ) { walletAccount = account break } } - walletAccount?.let{ + walletAccount?.let { fromAccount = walletAccount fetchToAccountDetails() - }?: useCaseCallback.onError(Constants.NO_WALLET_FOUND) - + } ?: useCaseCallback.onError(Constants.NO_WALLET_FOUND) } else { useCaseCallback.onError(Constants.ERROR_FETCHING_FROM_ACCOUNT) } } - }) + }, + ) } private fun fetchToAccountDetails() { apiRepository.getAccounts(walletRequestValues.toClientId) - .observeOn(AndroidSchedulers.mainThread()) - .subscribeOn(Schedulers.io()) - .subscribe(object : Subscriber() { + .observeOn(AndroidSchedulers.mainThread()) + .subscribeOn(Schedulers.io()) + .subscribe( + object : Subscriber() { override fun onCompleted() {} override fun onError(e: Throwable) { useCaseCallback.onError(Constants.ERROR_FETCHING_TO_ACCOUNT) @@ -112,60 +125,61 @@ class CreateStandingTransaction @Inject constructor(private val apiRepository: F override fun onNext(clientAccounts: ClientAccounts) { val accounts = clientAccounts.savingsAccounts - if (accounts != null && accounts.size != 0) { + if (accounts.isNotEmpty()) { var walletAccount: SavingAccount? = null for (account in accounts) { if (account.productId == - Constants.WALLET_ACCOUNT_SAVINGS_PRODUCT_ID) { + Constants.WALLET_ACCOUNT_SAVINGS_PRODUCT_ID + ) { walletAccount = account break } } - walletAccount?.let{ + walletAccount?.let { toAccount = walletAccount createNewStandingInstruction() - }?: useCaseCallback.onError(Constants.NO_WALLET_FOUND) - + } ?: useCaseCallback.onError(Constants.NO_WALLET_FOUND) } else { useCaseCallback.onError(Constants.ERROR_FETCHING_TO_ACCOUNT) } } - }) + }, + ) } private fun createNewStandingInstruction() { - val standingInstructionPayload = StandingInstructionPayload( - fromClient.officeId, - fromClient.id, - 2, - "wallet standing transaction", - 1, - 2, - 1, - fromAccount.id, - toClient.officeId, - toClient.id, - 2, - toAccount.id, - 1, - walletRequestValues.amount, - walletRequestValues.validFrom, - 1, - walletRequestValues.recurrenceInterval, - 2, - "en", - "dd MM yyyy", - walletRequestValues.validTill, - walletRequestValues.recurrenceOnDayMonth, - "dd MM") + fromClient.officeId, + fromClient.id, + 2, + "wallet standing transaction", + 1, + 2, + 1, + fromAccount.id, + toClient.officeId, + toClient.id, + 2, + toAccount.id, + 1, + walletRequestValues.amount, + walletRequestValues.validFrom, + 1, + walletRequestValues.recurrenceInterval, + 2, + "en", + "dd MM yyyy", + walletRequestValues.validTill, + walletRequestValues.recurrenceOnDayMonth, + "dd MM", + ) apiRepository.createStandingInstruction(standingInstructionPayload) - .observeOn(AndroidSchedulers.mainThread()) - .subscribeOn(Schedulers.io()) - .subscribe(object : Subscriber() { + .observeOn(AndroidSchedulers.mainThread()) + .subscribeOn(Schedulers.io()) + .subscribe( + object : Subscriber() { override fun onCompleted() { - } override fun onError(e: Throwable) { @@ -175,17 +189,19 @@ class CreateStandingTransaction @Inject constructor(private val apiRepository: F override fun onNext(sdiResponse: SDIResponse) { useCaseCallback.onSuccess(ResponseValue()) } - }) + }, + ) } - class RequestValues(val validTill: String, - val validFrom: String, - val recurrenceInterval: Int, - val recurrenceOnDayMonth: String, - val fromClientId: Long, - val toClientId: Long, - val amount: Double ) : UseCase.RequestValues + class RequestValues( + val validTill: String, + val validFrom: String, + val recurrenceInterval: Int, + val recurrenceOnDayMonth: String, + val fromClientId: Long, + val toClientId: Long, + val amount: Double, + ) : UseCase.RequestValues class ResponseValue : UseCase.ResponseValue - -} \ No newline at end of file +} diff --git a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/standinginstruction/DeleteStandingInstruction.kt b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/standinginstruction/DeleteStandingInstruction.kt index 7ab5ee612..dea053f75 100644 --- a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/standinginstruction/DeleteStandingInstruction.kt +++ b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/standinginstruction/DeleteStandingInstruction.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.data.domain.usecase.standinginstruction import org.mifospay.core.data.base.UseCase @@ -8,36 +17,32 @@ import rx.android.schedulers.AndroidSchedulers import rx.schedulers.Schedulers import javax.inject.Inject -/** - * Created by Devansh on 09/06/2020 - */ class DeleteStandingInstruction @Inject constructor( - private val apiRepository: FineractRepository) : - UseCase() { + private val apiRepository: FineractRepository, +) : UseCase() { override fun executeUseCase(requestValues: RequestValues) { apiRepository.deleteStandingInstruction(requestValues.standingInstructionId) - .observeOn(AndroidSchedulers.mainThread()) - .subscribeOn(Schedulers.io()) - .subscribe(object : Subscriber() { + .observeOn(AndroidSchedulers.mainThread()) + .subscribeOn(Schedulers.io()) + .subscribe( + object : Subscriber() { override fun onCompleted() { - } override fun onError(e: Throwable) { e.message?.let { useCaseCallback.onError(it) } } - override fun onNext(genericResponse: GenericResponse) - = useCaseCallback.onSuccess(ResponseValue()) - }) + override fun onNext(genericResponse: GenericResponse) = + useCaseCallback.onSuccess(ResponseValue()) + }, + ) } class RequestValues(val standingInstructionId: Long) : - UseCase.RequestValues + UseCase.RequestValues class ResponseValue : UseCase.ResponseValue - -} \ No newline at end of file +} diff --git a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/standinginstruction/FetchStandingInstruction.kt b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/standinginstruction/FetchStandingInstruction.kt index 7dfd32a4b..c14f2815d 100644 --- a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/standinginstruction/FetchStandingInstruction.kt +++ b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/standinginstruction/FetchStandingInstruction.kt @@ -1,17 +1,22 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.data.domain.usecase.standinginstruction -import org.mifospay.core.data.base.UseCase import com.mifospay.core.model.entity.standinginstruction.StandingInstruction +import org.mifospay.core.data.base.UseCase import org.mifospay.core.data.fineract.repository.FineractRepository import rx.Subscriber import rx.android.schedulers.AndroidSchedulers import rx.schedulers.Schedulers import javax.inject.Inject -/** - * Created by Devansh on 09/06/2020 - */ - class FetchStandingInstruction @Inject constructor( private val apiRepository: FineractRepository, ) : UseCase() { @@ -24,14 +29,12 @@ class FetchStandingInstruction @Inject constructor( object : Subscriber() { override fun onCompleted() { - } override fun onError(e: Throwable) { e.message?.let { useCaseCallback.onError(it) } } - override fun onNext(standingInstruction: StandingInstruction) = useCaseCallback.onSuccess(ResponseValue(standingInstruction)) }, @@ -41,5 +44,4 @@ class FetchStandingInstruction @Inject constructor( class RequestValues(val standingInstructionId: Long) : UseCase.RequestValues class ResponseValue(val standingInstruction: StandingInstruction) : UseCase.ResponseValue - -} \ No newline at end of file +} diff --git a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/standinginstruction/GetAllStandingInstructions.kt b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/standinginstruction/GetAllStandingInstructions.kt index c33d74a16..cd715c479 100644 --- a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/standinginstruction/GetAllStandingInstructions.kt +++ b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/standinginstruction/GetAllStandingInstructions.kt @@ -1,46 +1,52 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.data.domain.usecase.standinginstruction -import org.mifospay.core.data.base.UseCase import com.mifospay.core.model.entity.Page import com.mifospay.core.model.entity.standinginstruction.StandingInstruction +import org.mifospay.core.data.base.UseCase import org.mifospay.core.data.fineract.repository.FineractRepository import rx.Subscriber import rx.android.schedulers.AndroidSchedulers import rx.schedulers.Schedulers import javax.inject.Inject -/** - * Created by Devansh 08/06/2020 - */ - -class GetAllStandingInstructions @Inject constructor(private val apiRepository: FineractRepository) : - UseCase() { - +class GetAllStandingInstructions @Inject constructor( + private val apiRepository: FineractRepository, +) : UseCase() { override fun executeUseCase(requestValues: RequestValues) { apiRepository.getAllStandingInstructions(requestValues.clientId) - .observeOn(AndroidSchedulers.mainThread()) - .subscribeOn(Schedulers.io()) - .subscribe(object : Subscriber>() { + .observeOn(AndroidSchedulers.mainThread()) + .subscribeOn(Schedulers.io()) + .subscribe( + object : Subscriber>() { override fun onCompleted() { - } override fun onError(e: Throwable) { e.message?.let { useCaseCallback.onError(it) } } - - override fun onNext(standingInstructionPage: Page) - = useCaseCallback.onSuccess(ResponseValue(standingInstructionPage.pageItems)) - - }) + override fun onNext(standingInstructionPage: Page) { + return useCaseCallback.onSuccess( + ResponseValue(standingInstructionPage.pageItems), + ) + } + }, + ) } class RequestValues(val clientId: Long) : UseCase.RequestValues - class ResponseValue(val standingInstructionsList: List) - : UseCase.ResponseValue - -} \ No newline at end of file + class ResponseValue(val standingInstructionsList: List) : + UseCase.ResponseValue +} diff --git a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/standinginstruction/UpdateStandingInstruction.kt b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/standinginstruction/UpdateStandingInstruction.kt index 6542220d8..81bfc27e2 100644 --- a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/standinginstruction/UpdateStandingInstruction.kt +++ b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/standinginstruction/UpdateStandingInstruction.kt @@ -1,8 +1,17 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.data.domain.usecase.standinginstruction -import org.mifospay.core.data.base.UseCase import com.mifospay.core.model.entity.payload.StandingInstructionPayload import com.mifospay.core.model.entity.standinginstruction.StandingInstruction +import org.mifospay.core.data.base.UseCase import org.mifospay.core.data.fineract.repository.FineractRepository import org.mifospay.core.network.GenericResponse import rx.Subscriber @@ -10,26 +19,19 @@ import rx.android.schedulers.AndroidSchedulers import rx.schedulers.Schedulers import javax.inject.Inject -/** - * Created by Devansh on 09/06/2020 - */ class UpdateStandingInstruction @Inject constructor( private val apiRepository: FineractRepository, -) : - UseCase< - UpdateStandingInstruction.RequestValues, - UpdateStandingInstruction.ResponseValue, - >() { +) : UseCase() { override fun executeUseCase(requestValues: RequestValues) { val validTillString = "${requestValues.standingInstruction.validTill?.get(2)} " + - "${requestValues.standingInstruction.validTill?.get(1)} " + - "${requestValues.standingInstruction.validTill?.get(0)}" + "${requestValues.standingInstruction.validTill?.get(1)} " + + "${requestValues.standingInstruction.validTill?.get(0)}" val validFromString = "${requestValues.standingInstruction.validFrom[2]} " + - "${requestValues.standingInstruction.validFrom[1]} " + - "${requestValues.standingInstruction.validFrom[0]}" + "${requestValues.standingInstruction.validFrom[1]} " + + "${requestValues.standingInstruction.validFrom[0]}" val recurrenceOnMonthDayString = "${requestValues.standingInstruction.validFrom[2]} " + - "${requestValues.standingInstruction.validFrom[1]}" + "${requestValues.standingInstruction.validFrom[1]}" val standingInstructionPayload = StandingInstructionPayload( requestValues.standingInstruction.fromClient.officeId, @@ -67,7 +69,6 @@ class UpdateStandingInstruction @Inject constructor( object : Subscriber() { override fun onCompleted() { - } override fun onError(e: Throwable) { @@ -86,5 +87,4 @@ class UpdateStandingInstruction @Inject constructor( ) : UseCase.RequestValues class ResponseValue : UseCase.ResponseValue - -} \ No newline at end of file +} diff --git a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/twofactor/FetchDeliveryMethods.kt b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/twofactor/FetchDeliveryMethods.kt index 699be8f9b..4698b3934 100644 --- a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/twofactor/FetchDeliveryMethods.kt +++ b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/twofactor/FetchDeliveryMethods.kt @@ -1,38 +1,46 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.data.domain.usecase.twofactor +import com.mifospay.core.model.domain.twofactor.DeliveryMethod import org.mifospay.core.data.base.UseCase import org.mifospay.core.data.fineract.repository.FineractRepository -import com.mifospay.core.model.domain.twofactor.DeliveryMethod import rx.Subscriber import rx.android.schedulers.AndroidSchedulers import rx.schedulers.Schedulers import javax.inject.Inject -/** - * Created by ankur on 01/June/2018 - */ -class FetchDeliveryMethods @Inject constructor(private val mFineractRepository: FineractRepository) : - UseCase() { +class FetchDeliveryMethods @Inject constructor( + private val mFineractRepository: FineractRepository, +) : UseCase() { class RequestValues : UseCase.RequestValues class ResponseValue( - val deliveryMethodList: List + val deliveryMethodList: List, ) : UseCase.ResponseValue override fun executeUseCase(requestValues: RequestValues) { mFineractRepository.deliveryMethods .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) - .subscribe(object : Subscriber>() { - override fun onCompleted() {} - override fun onError(e: Throwable) { - useCaseCallback.onError(e.toString()) - } - - override fun onNext(deliveryMethods: List) { - useCaseCallback.onSuccess(ResponseValue(deliveryMethods)) - } + .subscribe( + object : Subscriber>() { + override fun onCompleted() {} + override fun onError(e: Throwable) { + useCaseCallback.onError(e.toString()) + } - }) + override fun onNext(deliveryMethods: List) { + useCaseCallback.onSuccess(ResponseValue(deliveryMethods)) + } + }, + ) } } diff --git a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/twofactor/RequestOTP.kt b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/twofactor/RequestOTP.kt index c22c9784a..d2f9dc829 100644 --- a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/twofactor/RequestOTP.kt +++ b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/twofactor/RequestOTP.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.data.domain.usecase.twofactor import org.mifospay.core.data.base.UseCase @@ -7,11 +16,9 @@ import rx.android.schedulers.AndroidSchedulers import rx.schedulers.Schedulers import javax.inject.Inject -/** - * Created by ankur on 01/June/2018 - */ -class RequestOTP @Inject constructor(private val mFineractRepository: FineractRepository) : - UseCase() { +class RequestOTP @Inject constructor( + private val mFineractRepository: FineractRepository, +) : UseCase() { class RequestValues(val deliveryMethod: String) : UseCase.RequestValues class ResponseValue(val response: String) : UseCase.ResponseValue @@ -20,16 +27,17 @@ class RequestOTP @Inject constructor(private val mFineractRepository: FineractRe mFineractRepository.requestOTP(requestValues.deliveryMethod) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) - .subscribe(object : Subscriber() { - override fun onCompleted() {} - override fun onError(e: Throwable) { - useCaseCallback.onError(e.toString()) - } - - override fun onNext(response: String) { - useCaseCallback.onSuccess(ResponseValue(response)) - } - }) + .subscribe( + object : Subscriber() { + override fun onCompleted() {} + override fun onError(e: Throwable) { + useCaseCallback.onError(e.toString()) + } + override fun onNext(response: String) { + useCaseCallback.onSuccess(ResponseValue(response)) + } + }, + ) } } diff --git a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/twofactor/ValidateOTP.kt b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/twofactor/ValidateOTP.kt index a60baf165..76ddc75ba 100644 --- a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/twofactor/ValidateOTP.kt +++ b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/twofactor/ValidateOTP.kt @@ -1,18 +1,25 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.data.domain.usecase.twofactor +import com.mifospay.core.model.domain.twofactor.AccessToken import org.mifospay.core.data.base.UseCase import org.mifospay.core.data.fineract.repository.FineractRepository -import com.mifospay.core.model.domain.twofactor.AccessToken import rx.Subscriber import rx.android.schedulers.AndroidSchedulers import rx.schedulers.Schedulers import javax.inject.Inject -/** - * Created by ankur on 01/June/2018 - */ -class ValidateOTP @Inject constructor(private val mFineractRepository: FineractRepository) : - UseCase() { +class ValidateOTP @Inject constructor( + private val mFineractRepository: FineractRepository, +) : UseCase() { class RequestValues(val token: String) : UseCase.RequestValues class ResponseValue(val accessToken: AccessToken) : UseCase.ResponseValue @@ -21,16 +28,17 @@ class ValidateOTP @Inject constructor(private val mFineractRepository: FineractR mFineractRepository.validateToken(requestValues.token) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) - .subscribe(object : Subscriber() { - override fun onCompleted() {} - override fun onError(e: Throwable) { - useCaseCallback.onError(e.toString()) - } - - override fun onNext(accessToken: AccessToken) { - useCaseCallback.onSuccess(ResponseValue(accessToken)) - } - }) + .subscribe( + object : Subscriber() { + override fun onCompleted() {} + override fun onError(e: Throwable) { + useCaseCallback.onError(e.toString()) + } + override fun onNext(accessToken: AccessToken) { + useCaseCallback.onSuccess(ResponseValue(accessToken)) + } + }, + ) } } diff --git a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/user/AuthenticateUser.kt b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/user/AuthenticateUser.kt index c009d6543..2bb822304 100644 --- a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/user/AuthenticateUser.kt +++ b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/user/AuthenticateUser.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.data.domain.usecase.user import com.mifospay.core.model.domain.user.User @@ -11,7 +20,7 @@ import rx.schedulers.Schedulers import javax.inject.Inject class AuthenticateUser @Inject constructor( - private val apiRepository: FineractRepository + private val apiRepository: FineractRepository, ) : UseCase() { override fun executeUseCase(requestValues: RequestValues) { diff --git a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/user/CreateUser.kt b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/user/CreateUser.kt index 9a4821550..7cbfc079b 100644 --- a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/user/CreateUser.kt +++ b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/user/CreateUser.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.data.domain.usecase.user import com.mifospay.core.model.domain.user.NewUser @@ -10,33 +19,32 @@ import rx.android.schedulers.AndroidSchedulers import rx.schedulers.Schedulers import javax.inject.Inject -/** - * Created by naman on 17/6/17. - */ class CreateUser @Inject constructor(private val apiRepository: FineractRepository) : UseCase() { override fun executeUseCase(requestValues: RequestValues) { apiRepository.createUser(requestValues.user) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) - .subscribe(object : Subscriber() { - override fun onCompleted() {} - override fun onError(e: Throwable) { - getUserMessage(e) - var message: String - try { - message = (e as HttpException).response()!!.errorBody()!!.string() - message = getUserMessage(message) - } catch (e1: Exception) { - message = e1.message.toString() + .subscribe( + object : Subscriber() { + override fun onCompleted() {} + override fun onError(e: Throwable) { + getUserMessage(e) + var message: String + try { + message = (e as HttpException).response()!!.errorBody()!!.string() + message = getUserMessage(message) + } catch (e1: Exception) { + message = e1.message.toString() + } + useCaseCallback.onError(message) } - useCaseCallback.onError(message) - } - override fun onNext(genericResponse: ResponseValue) { - useCaseCallback.onSuccess(genericResponse) - } - }) + override fun onNext(genericResponse: ResponseValue) { + useCaseCallback.onSuccess(genericResponse) + } + }, + ) } class RequestValues(val user: NewUser) : UseCase.RequestValues diff --git a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/user/DeleteUser.kt b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/user/DeleteUser.kt index 00483dc36..8bf1177c8 100644 --- a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/user/DeleteUser.kt +++ b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/user/DeleteUser.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.data.domain.usecase.user import org.mifospay.core.data.base.UseCase @@ -8,25 +17,25 @@ import rx.android.schedulers.AndroidSchedulers import rx.schedulers.Schedulers import javax.inject.Inject -/** - * Created by ankur on 26/June/2018 - */ -class DeleteUser @Inject constructor(private val mFineractRepository: FineractRepository) : - UseCase() { +class DeleteUser @Inject constructor( + private val mFineractRepository: FineractRepository, +) : UseCase() { override fun executeUseCase(requestValues: RequestValues) { mFineractRepository.deleteUser(requestValues.userId) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) - .subscribe(object : Subscriber() { - override fun onCompleted() {} - override fun onError(e: Throwable) { - e.message?.let { useCaseCallback.onError(it) } - } + .subscribe( + object : Subscriber() { + override fun onCompleted() {} + override fun onError(e: Throwable) { + e.message?.let { useCaseCallback.onError(it) } + } - override fun onNext(genericResponse: GenericResponse) { - useCaseCallback.onSuccess(ResponseValue()) - } - }) + override fun onNext(genericResponse: GenericResponse) { + useCaseCallback.onSuccess(ResponseValue()) + } + }, + ) } class RequestValues(val userId: Int) : UseCase.RequestValues diff --git a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/user/FetchUserDetails.kt b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/user/FetchUserDetails.kt index 513ede86e..c019540f5 100644 --- a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/user/FetchUserDetails.kt +++ b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/user/FetchUserDetails.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.data.domain.usecase.user import com.mifospay.core.model.entity.UserWithRole @@ -8,25 +17,25 @@ import rx.android.schedulers.AndroidSchedulers import rx.schedulers.Schedulers import javax.inject.Inject -/** - * Created by ankur on 09/July/2018 - */ -class FetchUserDetails @Inject constructor(private val mFineractRepository: FineractRepository) : - UseCase() { +class FetchUserDetails @Inject constructor( + private val mFineractRepository: FineractRepository, +) : UseCase() { override fun executeUseCase(requestValues: RequestValues) { mFineractRepository.getUser() .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) - .subscribe(object : Subscriber() { - override fun onCompleted() {} - override fun onError(e: Throwable) { - e.message?.let { useCaseCallback.onError(it) } - } + .subscribe( + object : Subscriber() { + override fun onCompleted() {} + override fun onError(e: Throwable) { + e.message?.let { useCaseCallback.onError(it) } + } - override fun onNext(userWithRole: UserWithRole) { - useCaseCallback.onSuccess(ResponseValue(userWithRole)) - } - }) + override fun onNext(userWithRole: UserWithRole) { + useCaseCallback.onSuccess(ResponseValue(userWithRole)) + } + }, + ) } class RequestValues(val userId: Long) : UseCase.RequestValues diff --git a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/user/FetchUsers.kt b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/user/FetchUsers.kt index 97938f9ab..b2813e61e 100644 --- a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/user/FetchUsers.kt +++ b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/user/FetchUsers.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.data.domain.usecase.user import com.mifospay.core.model.entity.UserWithRole @@ -10,7 +19,7 @@ import rx.schedulers.Schedulers import javax.inject.Inject class FetchUsers @Inject constructor( - private val mFineractRepository: FineractRepository + private val mFineractRepository: FineractRepository, ) : UseCase() { override fun executeUseCase(requestValues: RequestValues) { diff --git a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/user/RegisterUser.kt b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/user/RegisterUser.kt index 6be2a3dbc..3eaed68e2 100644 --- a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/user/RegisterUser.kt +++ b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/user/RegisterUser.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.data.domain.usecase.user import com.mifospay.core.model.entity.register.RegisterPayload @@ -10,25 +19,26 @@ import rx.android.schedulers.AndroidSchedulers import rx.schedulers.Schedulers import javax.inject.Inject -/** - * Created by naman on 17/8/17. - */ -class RegisterUser @Inject constructor(private val apiRepository: FineractRepository) : - UseCase() { - protected override fun executeUseCase(requestValues: RequestValues) { +class RegisterUser @Inject constructor( + private val apiRepository: FineractRepository, +) : UseCase() { + + override fun executeUseCase(requestValues: RequestValues) { apiRepository.registerUser(requestValues.registerPayload) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) - .subscribe(object : Subscriber() { - override fun onCompleted() {} - override fun onError(e: Throwable) { - useCaseCallback.onError(Constants.ERROR_REGISTERING_USER) - } + .subscribe( + object : Subscriber() { + override fun onCompleted() {} + override fun onError(e: Throwable) { + useCaseCallback.onError(Constants.ERROR_REGISTERING_USER) + } - override fun onNext(t: ResponseBody?) { - useCaseCallback.onSuccess(ResponseValue()) - } - }) + override fun onNext(t: ResponseBody?) { + useCaseCallback.onSuccess(ResponseValue()) + } + }, + ) } data class RequestValues(val registerPayload: RegisterPayload) : UseCase.RequestValues diff --git a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/user/UpdateUser.kt b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/user/UpdateUser.kt index 5cb280f7b..a53f16fda 100644 --- a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/user/UpdateUser.kt +++ b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/user/UpdateUser.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.data.domain.usecase.user import org.mifospay.core.data.base.UseCase @@ -10,33 +19,32 @@ import rx.android.schedulers.AndroidSchedulers import rx.schedulers.Schedulers import javax.inject.Inject -/** - * Created by ankur on 25/June/2018 - */ class UpdateUser @Inject constructor( - private val mFineractRepository: FineractRepository + private val mFineractRepository: FineractRepository, ) : UseCase() { override fun executeUseCase(requestValues: RequestValues) { mFineractRepository.updateUser(requestValues.updateUserEntity, requestValues.userId) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) - .subscribe(object : Subscriber() { - override fun onCompleted() {} - override fun onError(e: Throwable) { - var message: String - try { - message = (e as HttpException).response()!!.errorBody()!!.string() - message = getUserMessage(message) - } catch (e1: Exception) { - message = e1.message.toString() + .subscribe( + object : Subscriber() { + override fun onCompleted() {} + override fun onError(e: Throwable) { + var message: String + try { + message = (e as HttpException).response()!!.errorBody()!!.string() + message = getUserMessage(message) + } catch (e1: Exception) { + message = e1.message.toString() + } + useCaseCallback.onError(message) } - useCaseCallback.onError(message) - } - override fun onNext(genericResponse: GenericResponse?) { - useCaseCallback.onSuccess(ResponseValue()) - } - }) + override fun onNext(genericResponse: GenericResponse?) { + useCaseCallback.onSuccess(ResponseValue()) + } + }, + ) } class RequestValues(val updateUserEntity: Any, val userId: Int) : UseCase.RequestValues diff --git a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/user/VerifyUser.kt b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/user/VerifyUser.kt index b3be9fbc3..cd68fbb97 100644 --- a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/user/VerifyUser.kt +++ b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/user/VerifyUser.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.data.domain.usecase.user import com.mifospay.core.model.entity.register.UserVerify @@ -10,27 +19,27 @@ import rx.android.schedulers.AndroidSchedulers import rx.schedulers.Schedulers import javax.inject.Inject -/** - * Created by naman on 17/8/17. - */ -class VerifyUser @Inject constructor(private val apiRepository: FineractRepository) : - UseCase() { - override fun executeUseCase(requestValues: RequestValues) { +class VerifyUser @Inject constructor( + private val apiRepository: FineractRepository, +) : UseCase() { + override fun executeUseCase(requestValues: RequestValues) { apiRepository.verifyUser(requestValues.userVerify) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) - .subscribe(object : Subscriber() { - override fun onCompleted() {} - override fun onError(e: Throwable) { - useCaseCallback.onError(Constants.ERROR_VERIFYING_USER) - } + .subscribe( + object : Subscriber() { + override fun onCompleted() {} + override fun onError(e: Throwable) { + useCaseCallback.onError(Constants.ERROR_VERIFYING_USER) + } - override fun onNext(t: ResponseBody?) { - useCaseCallback.onSuccess(ResponseValue()) - } - }) + override fun onNext(t: ResponseBody?) { + useCaseCallback.onSuccess(ResponseValue()) + } + }, + ) } - class RequestValues( val userVerify: UserVerify) : UseCase.RequestValues + class RequestValues(val userVerify: UserVerify) : UseCase.RequestValues class ResponseValue : UseCase.ResponseValue } diff --git a/core/data/src/main/java/org/mifospay/core/data/fineract/entity/mapper/AccountMapper.kt b/core/data/src/main/java/org/mifospay/core/data/fineract/entity/mapper/AccountMapper.kt index 7fcd21127..64f21ba33 100644 --- a/core/data/src/main/java/org/mifospay/core/data/fineract/entity/mapper/AccountMapper.kt +++ b/core/data/src/main/java/org/mifospay/core/data/fineract/entity/mapper/AccountMapper.kt @@ -1,10 +1,21 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.data.fineract.entity.mapper -import com.mifospay.core.model.entity.client.ClientAccounts import com.mifospay.core.model.domain.Account +import com.mifospay.core.model.entity.client.ClientAccounts import javax.inject.Inject -class AccountMapper @Inject constructor(private val currencyMapper: CurrencyMapper) { +class AccountMapper @Inject constructor( + private val currencyMapper: CurrencyMapper, +) { fun transform(clientAccounts: ClientAccounts?): List { val accountList = mutableListOf() diff --git a/core/data/src/main/java/org/mifospay/core/data/fineract/entity/mapper/ClientDetailsMapper.kt b/core/data/src/main/java/org/mifospay/core/data/fineract/entity/mapper/ClientDetailsMapper.kt index 5cb38667c..8c96d6542 100644 --- a/core/data/src/main/java/org/mifospay/core/data/fineract/entity/mapper/ClientDetailsMapper.kt +++ b/core/data/src/main/java/org/mifospay/core/data/fineract/entity/mapper/ClientDetailsMapper.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.data.fineract.entity.mapper import com.mifospay.core.model.entity.client.Client diff --git a/core/data/src/main/java/org/mifospay/core/data/fineract/entity/mapper/CurrencyMapper.kt b/core/data/src/main/java/org/mifospay/core/data/fineract/entity/mapper/CurrencyMapper.kt index 6a873d845..a96dc6802 100644 --- a/core/data/src/main/java/org/mifospay/core/data/fineract/entity/mapper/CurrencyMapper.kt +++ b/core/data/src/main/java/org/mifospay/core/data/fineract/entity/mapper/CurrencyMapper.kt @@ -1,10 +1,18 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.data.fineract.entity.mapper import com.mifospay.core.model.entity.accounts.savings.Currency import javax.inject.Inject import com.mifospay.core.model.domain.Currency as DomainCurrency - class CurrencyMapper @Inject internal constructor() { fun transform(savingsCurrency: Currency): DomainCurrency { val currency: DomainCurrency = diff --git a/core/data/src/main/java/org/mifospay/core/data/fineract/entity/mapper/FetchAccount.kt b/core/data/src/main/java/org/mifospay/core/data/fineract/entity/mapper/FetchAccount.kt index 37d156b07..4073c72ef 100644 --- a/core/data/src/main/java/org/mifospay/core/data/fineract/entity/mapper/FetchAccount.kt +++ b/core/data/src/main/java/org/mifospay/core/data/fineract/entity/mapper/FetchAccount.kt @@ -1,19 +1,27 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.data.fineract.entity.mapper -import org.mifospay.core.data.base.UseCase -import org.mifospay.core.data.fineract.repository.FineractRepository import com.mifospay.core.model.domain.Account import com.mifospay.core.model.entity.client.ClientAccounts +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 class FetchAccount @Inject constructor( private val fineractRepository: FineractRepository, - private val accountMapper: AccountMapper + private val accountMapper: AccountMapper, ) : UseCase() { override fun executeUseCase(requestValues: RequestValues) { diff --git a/core/data/src/main/java/org/mifospay/core/data/fineract/entity/mapper/SearchedEntitiesMapper.kt b/core/data/src/main/java/org/mifospay/core/data/fineract/entity/mapper/SearchedEntitiesMapper.kt index 61a4ac134..4f9b58ea1 100644 --- a/core/data/src/main/java/org/mifospay/core/data/fineract/entity/mapper/SearchedEntitiesMapper.kt +++ b/core/data/src/main/java/org/mifospay/core/data/fineract/entity/mapper/SearchedEntitiesMapper.kt @@ -1,12 +1,18 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.data.fineract.entity.mapper import com.mifospay.core.model.domain.SearchResult import com.mifospay.core.model.entity.SearchedEntity import javax.inject.Inject -/** - * Created by naman on 19/8/17. - */ class SearchedEntitiesMapper @Inject internal constructor() { fun transformList(searchedEntities: List?): List { val searchResults: MutableList = ArrayList() diff --git a/core/data/src/main/java/org/mifospay/core/data/fineract/entity/mapper/TransactionMapper.kt b/core/data/src/main/java/org/mifospay/core/data/fineract/entity/mapper/TransactionMapper.kt index 34bf9ad28..9f2c09513 100644 --- a/core/data/src/main/java/org/mifospay/core/data/fineract/entity/mapper/TransactionMapper.kt +++ b/core/data/src/main/java/org/mifospay/core/data/fineract/entity/mapper/TransactionMapper.kt @@ -1,13 +1,24 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.data.fineract.entity.mapper -import com.mifospay.core.model.entity.accounts.savings.SavingsWithAssociations -import com.mifospay.core.model.entity.accounts.savings.Transactions import com.mifospay.core.model.domain.Transaction import com.mifospay.core.model.domain.TransactionType +import com.mifospay.core.model.entity.accounts.savings.SavingsWithAssociations +import com.mifospay.core.model.entity.accounts.savings.Transactions import com.mifospay.core.model.utils.DateHelper import javax.inject.Inject -class TransactionMapper @Inject constructor(private val currencyMapper: CurrencyMapper) { +class TransactionMapper @Inject constructor( + private val currencyMapper: CurrencyMapper, +) { fun transformTransactionList(savingsWithAssociations: SavingsWithAssociations?): List { val transactionList = ArrayList() @@ -18,7 +29,7 @@ class TransactionMapper @Inject constructor(private val currencyMapper: Currency return transactionList } - fun transformInvoice(transactions: Transactions?): Transaction { + fun transformInvoice(transactions: Transactions?): Transaction { val transaction = Transaction() if (transactions != null) { @@ -27,7 +38,7 @@ class TransactionMapper @Inject constructor(private val currencyMapper: Currency transaction.receiptId = it.receiptNumber } transaction.amount = transactions.amount - transactions.submittedOnDate?.let { + transactions.submittedOnDate.let { transaction.date = DateHelper.getDateAsString(it) } transaction.currency = currencyMapper.transform(transactions.currency) @@ -41,7 +52,7 @@ class TransactionMapper @Inject constructor(private val currencyMapper: Currency transaction.transactionType = TransactionType.DEBIT } - transactions.transfer?.let { + transactions.transfer.let { transaction.transferId = it.id } } diff --git a/core/data/src/main/java/org/mifospay/core/data/fineract/repository/FineractRepository.kt b/core/data/src/main/java/org/mifospay/core/data/fineract/repository/FineractRepository.kt index 7d7ec21af..4e2a4577a 100644 --- a/core/data/src/main/java/org/mifospay/core/data/fineract/repository/FineractRepository.kt +++ b/core/data/src/main/java/org/mifospay/core/data/fineract/repository/FineractRepository.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.data.fineract.repository import com.mifospay.core.model.domain.NewAccount @@ -41,12 +50,11 @@ import rx.Observable import javax.inject.Inject import javax.inject.Singleton - @Singleton @Suppress("TooManyFunctions") class FineractRepository @Inject constructor( private val fineractApiManager: FineractApiManager, - private val selfApiManager: SelfServiceApiManager + private val selfApiManager: SelfServiceApiManager, ) { fun createClient(newClient: NewClient): Observable { return fineractApiManager.clientsApi.createClient(newClient) @@ -73,8 +81,9 @@ class FineractRepository @Inject constructor( } fun searchResources( - query: String, resources: String, - exactMatch: Boolean + query: String, + resources: String, + exactMatch: Boolean, ): Observable> { return fineractApiManager.searchApi.searchResources(query, resources, exactMatch) } @@ -98,7 +107,7 @@ class FineractRepository @Inject constructor( fun blockUnblockAccount(accountId: Long, command: String?): Observable { return fineractApiManager.savingsAccountsApi.blockUnblockAccount( accountId, - command + command, ) } @@ -112,7 +121,7 @@ class FineractRepository @Inject constructor( fun addSavedCards( clientId: Long, - card: Card + card: Card, ): Observable { return fineractApiManager.savedCardApi.addSavedCard(clientId.toInt(), card) } @@ -130,12 +139,18 @@ class FineractRepository @Inject constructor( } fun uploadKYCDocs( - entityType: String, entityId: Long, name: String, - desc: String, file: MultipartBody.Part + entityType: String, + entityId: Long, + name: String, + desc: String, + file: MultipartBody.Part, ): Observable { return fineractApiManager.documentApi.createDocument( - entityType, entityId, name, desc, - file + entityType, + entityId, + name, + desc, + file, ) } @@ -145,11 +160,11 @@ class FineractRepository @Inject constructor( fun uploadKYCLevel1Details( clientId: Int, - kycLevel1Details: KYCLevel1Details + kycLevel1Details: KYCLevel1Details, ): Observable { return fineractApiManager.kycLevel1Api.addKYCLevel1Details( clientId, - kycLevel1Details + kycLevel1Details, ) } @@ -159,11 +174,11 @@ class FineractRepository @Inject constructor( fun updateKYCLevel1Details( clientId: Int, - kycLevel1Details: KYCLevel1Details + kycLevel1Details: KYCLevel1Details, ): Observable { return fineractApiManager.kycLevel1Api.updateKYCLevel1Details( clientId, - kycLevel1Details + kycLevel1Details, ) } @@ -184,11 +199,11 @@ class FineractRepository @Inject constructor( fun getTransactionReceipt( outputType: String, - transactionId: String + transactionId: String, ): Observable { return fineractApiManager.runReportApi.getTransactionReceipt( outputType, - transactionId + transactionId, ) } @@ -224,7 +239,7 @@ class FineractRepository @Inject constructor( } fun createStandingInstruction( - standingInstructionPayload: StandingInstructionPayload + standingInstructionPayload: StandingInstructionPayload, ): Observable { return fineractApiManager.standingInstructionApi .createStandingInstruction(standingInstructionPayload) @@ -241,20 +256,23 @@ class FineractRepository @Inject constructor( fun updateStandingInstruction( standingInstructionId: Long, - data: StandingInstructionPayload + data: StandingInstructionPayload, ): Observable { return fineractApiManager.standingInstructionApi.updateStandingInstruction( - standingInstructionId, data, "update" + standingInstructionId, + data, + "update", ) } fun deleteStandingInstruction(standingInstruction: Long): Observable { return fineractApiManager.standingInstructionApi.deleteStandingInstruction( - standingInstruction, "delete" + standingInstruction, + "delete", ) } - //self user apis + // self user apis fun loginSelf(payload: AuthenticationPayload): Observable { return selfApiManager.authenticationApi.authenticate(payload) } @@ -269,17 +287,17 @@ class FineractRepository @Inject constructor( fun getSelfAccountTransactions(accountId: Long): Observable { return selfApiManager.savingAccountsListApi.getSavingsWithAssociations( accountId, - Constants.TRANSACTIONS + Constants.TRANSACTIONS, ) } fun getSelfAccountTransactionFromId( accountId: Long, - transactionId: Long + transactionId: Long, ): Observable { return selfApiManager.savingAccountsListApi.getSavingAccountTransaction( accountId, - transactionId + transactionId, ) } @@ -296,7 +314,7 @@ class FineractRepository @Inject constructor( fun updateBeneficiary( beneficiaryId: Long, - payload: BeneficiaryUpdatePayload + payload: BeneficiaryUpdatePayload, ): Observable { return selfApiManager.beneficiaryApi.updateBeneficiary(beneficiaryId, payload) } diff --git a/core/data/src/main/java/org/mifospay/core/data/repository/auth/AuthenticationUserRepository.kt b/core/data/src/main/java/org/mifospay/core/data/repository/auth/AuthenticationUserRepository.kt index abc54553a..0f5774a03 100644 --- a/core/data/src/main/java/org/mifospay/core/data/repository/auth/AuthenticationUserRepository.kt +++ b/core/data/src/main/java/org/mifospay/core/data/repository/auth/AuthenticationUserRepository.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.data.repository.auth import com.mifospay.core.model.UserData @@ -6,9 +15,8 @@ import kotlinx.coroutines.flow.flow import org.mifospay.core.datastore.PreferencesHelper import javax.inject.Inject - class AuthenticationUserRepository @Inject constructor( - preferencesHelper: PreferencesHelper + preferencesHelper: PreferencesHelper, ) : UserDataRepository { override val userData: Flow = flow { @@ -16,9 +24,9 @@ class AuthenticationUserRepository @Inject constructor( UserData( isAuthenticated = !preferencesHelper.token.isNullOrBlank(), userName = preferencesHelper.username, - // user = preferencesHelper.user, - clientId = preferencesHelper.clientId - ) + // user = preferencesHelper.user, + clientId = preferencesHelper.clientId, + ), ) } -} \ No newline at end of file +} diff --git a/core/data/src/main/java/org/mifospay/core/data/repository/auth/UserDataRepository.kt b/core/data/src/main/java/org/mifospay/core/data/repository/auth/UserDataRepository.kt index aeaed4912..96fc5ad3a 100644 --- a/core/data/src/main/java/org/mifospay/core/data/repository/auth/UserDataRepository.kt +++ b/core/data/src/main/java/org/mifospay/core/data/repository/auth/UserDataRepository.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.data.repository.auth import com.mifospay.core.model.UserData diff --git a/core/data/src/main/java/org/mifospay/core/data/repository/local/LocalAssetRepository.kt b/core/data/src/main/java/org/mifospay/core/data/repository/local/LocalAssetRepository.kt index 2444d476a..4ed5c49d0 100644 --- a/core/data/src/main/java/org/mifospay/core/data/repository/local/LocalAssetRepository.kt +++ b/core/data/src/main/java/org/mifospay/core/data/repository/local/LocalAssetRepository.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.data.repository.local import com.mifospay.core.model.City diff --git a/core/data/src/main/java/org/mifospay/core/data/repository/local/LocalRepository.kt b/core/data/src/main/java/org/mifospay/core/data/repository/local/LocalRepository.kt index ae922af1f..d6554c5e4 100644 --- a/core/data/src/main/java/org/mifospay/core/data/repository/local/LocalRepository.kt +++ b/core/data/src/main/java/org/mifospay/core/data/repository/local/LocalRepository.kt @@ -1,12 +1,23 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.data.repository.local -import org.mifospay.core.datastore.PreferencesHelper import com.mifospay.core.model.domain.client.Client +import org.mifospay.core.datastore.PreferencesHelper import javax.inject.Inject import javax.inject.Singleton @Singleton -class LocalRepository @Inject constructor(val preferencesHelper: PreferencesHelper) { +class LocalRepository @Inject constructor( + val preferencesHelper: PreferencesHelper, +) { val clientDetails: Client get() { diff --git a/core/data/src/main/java/org/mifospay/core/data/repository/local/MifosLocalAssetRepository.kt b/core/data/src/main/java/org/mifospay/core/data/repository/local/MifosLocalAssetRepository.kt index ccb0413f5..d2d5062b5 100644 --- a/core/data/src/main/java/org/mifospay/core/data/repository/local/MifosLocalAssetRepository.kt +++ b/core/data/src/main/java/org/mifospay/core/data/repository/local/MifosLocalAssetRepository.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.data.repository.local import com.mifospay.core.model.City diff --git a/core/data/src/main/java/org/mifospay/core/data/util/ConnectivityManagerNetworkMonitor.kt b/core/data/src/main/java/org/mifospay/core/data/util/ConnectivityManagerNetworkMonitor.kt index 3c8504137..1f7f15bd4 100644 --- a/core/data/src/main/java/org/mifospay/core/data/util/ConnectivityManagerNetworkMonitor.kt +++ b/core/data/src/main/java/org/mifospay/core/data/util/ConnectivityManagerNetworkMonitor.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.data.util import android.content.Context diff --git a/core/data/src/main/java/org/mifospay/core/data/util/Constants.kt b/core/data/src/main/java/org/mifospay/core/data/util/Constants.kt index 18c99760e..758c1fb23 100644 --- a/core/data/src/main/java/org/mifospay/core/data/util/Constants.kt +++ b/core/data/src/main/java/org/mifospay/core/data/util/Constants.kt @@ -1,11 +1,17 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.data.util import java.util.Arrays import java.util.Collections -/** - * Created by naman on 17/6/17. - */ object Constants { const val BASIC = "Basic " const val SAVINGS = "savingsAccounts" @@ -15,9 +21,10 @@ object Constants { const val MIFOS_CONSUMER_SAVINGS_PRODUCT_ID = 165 // 373 private const val MOBILE_WALLET_ROLE_ID = 471 private const val SUPER_USER_ROLE_ID = 1 + @JvmField val NEW_USER_ROLE_IDS: Collection = Collections.unmodifiableList( - Arrays.asList(MOBILE_WALLET_ROLE_ID, SUPER_USER_ROLE_ID) + Arrays.asList(MOBILE_WALLET_ROLE_ID, SUPER_USER_ROLE_ID), ) const val ENTITY_TYPE_CLIENTS = "clients" const val FETCH_ACCOUNT_TRANSFER_USECASE = "FetchAccountTransfer" diff --git a/core/data/src/main/java/org/mifospay/core/data/util/ErrorJsonMessageHelper.kt b/core/data/src/main/java/org/mifospay/core/data/util/ErrorJsonMessageHelper.kt index 5c8c282cd..db17053e7 100644 --- a/core/data/src/main/java/org/mifospay/core/data/util/ErrorJsonMessageHelper.kt +++ b/core/data/src/main/java/org/mifospay/core/data/util/ErrorJsonMessageHelper.kt @@ -1,12 +1,18 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.data.util import org.json.JSONException import org.json.JSONObject import retrofit2.HttpException -/** - * Created by ankur on 26/June/2018 - */ object ErrorJsonMessageHelper { @JvmStatic @Throws(JSONException::class) diff --git a/core/data/src/main/java/org/mifospay/core/data/util/NetworkMonitor.kt b/core/data/src/main/java/org/mifospay/core/data/util/NetworkMonitor.kt index 757b87931..d857f454d 100644 --- a/core/data/src/main/java/org/mifospay/core/data/util/NetworkMonitor.kt +++ b/core/data/src/main/java/org/mifospay/core/data/util/NetworkMonitor.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.data.util import kotlinx.coroutines.flow.Flow diff --git a/core/data/src/main/java/org/mifospay/core/data/util/TimeZoneMonitor.kt b/core/data/src/main/java/org/mifospay/core/data/util/TimeZoneMonitor.kt index bbbbd6202..c32ef6808 100644 --- a/core/data/src/main/java/org/mifospay/core/data/util/TimeZoneMonitor.kt +++ b/core/data/src/main/java/org/mifospay/core/data/util/TimeZoneMonitor.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.data.util import android.content.BroadcastReceiver diff --git a/core/data/src/main/res/values/strings.xml b/core/data/src/main/res/values/strings.xml index 854200555..76ab9b173 100644 --- a/core/data/src/main/res/values/strings.xml +++ b/core/data/src/main/res/values/strings.xml @@ -1,2 +1,12 @@ + + diff --git a/core/data/src/test/java/org/mifospay/mobilewallet/core/ExampleUnitTest.kt b/core/data/src/test/java/org/mifospay/mobilewallet/core/ExampleUnitTest.kt index ee178ee9a..abad7a3e6 100644 --- a/core/data/src/test/java/org/mifospay/mobilewallet/core/ExampleUnitTest.kt +++ b/core/data/src/test/java/org/mifospay/mobilewallet/core/ExampleUnitTest.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.mobilewallet.core import org.junit.Assert @@ -14,4 +23,4 @@ class ExampleUnitTest { fun additionIsCorrect() { Assert.assertEquals(4, (2 + 2).toLong()) } -} \ No newline at end of file +} diff --git a/core/datastore-proto/build.gradle.kts b/core/datastore-proto/build.gradle.kts index 9c95ef6a3..b579ecfba 100644 --- a/core/datastore-proto/build.gradle.kts +++ b/core/datastore-proto/build.gradle.kts @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ plugins { alias(libs.plugins.mifospay.android.library) alias(libs.plugins.protobuf) diff --git a/core/datastore-proto/src/main/AndroidManifest.xml b/core/datastore-proto/src/main/AndroidManifest.xml index a5918e68a..961389810 100644 --- a/core/datastore-proto/src/main/AndroidManifest.xml +++ b/core/datastore-proto/src/main/AndroidManifest.xml @@ -1,4 +1,13 @@ + \ No newline at end of file diff --git a/core/datastore/build.gradle.kts b/core/datastore/build.gradle.kts index 2ba8e3e58..82d3b0c2a 100644 --- a/core/datastore/build.gradle.kts +++ b/core/datastore/build.gradle.kts @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ plugins { alias(libs.plugins.mifospay.android.library) alias(libs.plugins.mifospay.android.hilt) diff --git a/core/datastore/src/main/AndroidManifest.xml b/core/datastore/src/main/AndroidManifest.xml index a5918e68a..961389810 100644 --- a/core/datastore/src/main/AndroidManifest.xml +++ b/core/datastore/src/main/AndroidManifest.xml @@ -1,4 +1,13 @@ + \ No newline at end of file diff --git a/core/datastore/src/main/java/org/mifospay/core/datastore/PreferencesHelper.kt b/core/datastore/src/main/java/org/mifospay/core/datastore/PreferencesHelper.kt index 867aab098..b3fba0ce4 100644 --- a/core/datastore/src/main/java/org/mifospay/core/datastore/PreferencesHelper.kt +++ b/core/datastore/src/main/java/org/mifospay/core/datastore/PreferencesHelper.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.datastore import android.content.Context @@ -113,7 +122,7 @@ class PreferencesHelper @Inject constructor(@ApplicationContext context: Context var user: User get() = Gson().fromJson( getString(PREF_USER, Gson().toJson(User::class.java)), - User::class.java + User::class.java, ) set(user) { putString(PREF_USER, Gson().toJson(user)) @@ -122,7 +131,7 @@ class PreferencesHelper @Inject constructor(@ApplicationContext context: Context var client: Client get() = Gson().fromJson( getString(PREF_CLIENT, Gson().toJson(Client::class.java)), - Client::class.java + Client::class.java, ) set(client) { putString(PREF_USER, Gson().toJson(client)) @@ -142,4 +151,4 @@ class PreferencesHelper @Inject constructor(@ApplicationContext context: Context private const val FIREBASE_REG_ID = "preferences_firebase_reg_id" private const val ACCOUNT_ID = "preferences_account_id" } -} \ No newline at end of file +} diff --git a/core/datastore/src/main/java/org/mifospay/core/datastore/di/DataStoreModule.kt b/core/datastore/src/main/java/org/mifospay/core/datastore/di/DataStoreModule.kt index 76492909f..986a08b89 100644 --- a/core/datastore/src/main/java/org/mifospay/core/datastore/di/DataStoreModule.kt +++ b/core/datastore/src/main/java/org/mifospay/core/datastore/di/DataStoreModule.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.datastore.di import android.content.Context @@ -18,4 +27,4 @@ object DataStoreModule { fun prefManager(@ApplicationContext context: Context): PreferencesHelper { return PreferencesHelper(context) } -} \ No newline at end of file +} diff --git a/core/datastore/src/test/java/org/mifospay/core/datastore/ExampleUnitTest.kt b/core/datastore/src/test/java/org/mifospay/core/datastore/ExampleUnitTest.kt index 6b793648c..e4d40ddc7 100644 --- a/core/datastore/src/test/java/org/mifospay/core/datastore/ExampleUnitTest.kt +++ b/core/datastore/src/test/java/org/mifospay/core/datastore/ExampleUnitTest.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.datastore import org.junit.Assert.assertEquals @@ -13,4 +22,4 @@ class ExampleUnitTest { fun addition_isCorrect() { assertEquals(4, 2 + 2) } -} \ No newline at end of file +} diff --git a/core/designsystem/build.gradle.kts b/core/designsystem/build.gradle.kts index 2430b822f..30159c048 100644 --- a/core/designsystem/build.gradle.kts +++ b/core/designsystem/build.gradle.kts @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ plugins { alias(libs.plugins.mifospay.android.library) alias(libs.plugins.mifospay.android.library.compose) diff --git a/core/designsystem/src/main/AndroidManifest.xml b/core/designsystem/src/main/AndroidManifest.xml index a5918e68a..961389810 100644 --- a/core/designsystem/src/main/AndroidManifest.xml +++ b/core/designsystem/src/main/AndroidManifest.xml @@ -1,4 +1,13 @@ + \ No newline at end of file diff --git a/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/AlertDialog.kt b/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/AlertDialog.kt index 785f30c66..76268649d 100644 --- a/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/AlertDialog.kt +++ b/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/AlertDialog.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.designsystem.component import androidx.compose.material3.AlertDialog @@ -61,4 +70,3 @@ fun MifosCustomDialog( modifier = modifier, ) } - diff --git a/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/Background.kt b/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/Background.kt index 932640564..a4fb548ca 100644 --- a/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/Background.kt +++ b/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/Background.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.designsystem.component import android.content.res.Configuration diff --git a/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/BottomSheet.kt b/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/BottomSheet.kt index 9e69f8a0e..7270d4b22 100644 --- a/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/BottomSheet.kt +++ b/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/BottomSheet.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.designsystem.component import androidx.activity.compose.BackHandler @@ -30,7 +39,6 @@ fun MifosBottomSheet( val modalSheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true) var showBottomSheet by remember { mutableStateOf(true) } - fun dismissSheet() { coroutineScope.launch { modalSheetState.hide() }.invokeOnCompletion { if (!modalSheetState.isVisible) { @@ -67,4 +75,4 @@ fun MifosBottomSheetPreview() { Modifier.height(100.dp) } }, {}) -} \ No newline at end of file +} diff --git a/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/Button.kt b/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/Button.kt index ab841c5ae..023de3031 100644 --- a/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/Button.kt +++ b/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/Button.kt @@ -1,8 +1,18 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.designsystem.component import androidx.compose.foundation.BorderStroke import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.PaddingValues +import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.RowScope import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size @@ -39,13 +49,13 @@ fun MifosButton( enabled: Boolean = true, contentPadding: PaddingValues = ButtonDefaults.ContentPadding, color: Color = MaterialTheme.colorScheme.primary, - content: @Composable RowScope.() -> Unit, + content: @Composable RowScope.() -> Unit = {}, ) { Button( onClick = onClick, modifier = modifier, enabled = enabled, - colors = ButtonDefaults.buttonColors(containerColor = color,), + colors = ButtonDefaults.buttonColors(containerColor = color), contentPadding = contentPadding, content = content, ) @@ -63,11 +73,11 @@ fun MifosButton( */ @Composable fun MifosButton( + text: @Composable () -> Unit, onClick: () -> Unit, modifier: Modifier = Modifier, enabled: Boolean = true, color: Color = MaterialTheme.colorScheme.onBackground, - text: @Composable () -> Unit, leadingIcon: @Composable (() -> Unit)? = null, ) { MifosButton( @@ -105,7 +115,7 @@ fun MifosOutlinedButton( modifier: Modifier = Modifier, enabled: Boolean = true, contentPadding: PaddingValues = ButtonDefaults.ContentPadding, - content: @Composable RowScope.() -> Unit, + content: @Composable RowScope.() -> Unit = {}, ) { OutlinedButton( onClick = onClick, @@ -142,9 +152,9 @@ fun MifosOutlinedButton( @Composable fun MifosOutlinedButton( onClick: () -> Unit, + text: @Composable () -> Unit, modifier: Modifier = Modifier, enabled: Boolean = true, - text: @Composable () -> Unit, leadingIcon: @Composable (() -> Unit)? = null, ) { MifosOutlinedButton( @@ -178,7 +188,7 @@ fun MifosTextButton( onClick: () -> Unit, modifier: Modifier = Modifier, enabled: Boolean = true, - content: @Composable RowScope.() -> Unit, + content: @Composable RowScope.() -> Unit = {}, ) { TextButton( onClick = onClick, @@ -203,10 +213,10 @@ fun MifosTextButton( */ @Composable fun MifosTextButton( + text: @Composable () -> Unit, onClick: () -> Unit, modifier: Modifier = Modifier, enabled: Boolean = true, - text: @Composable () -> Unit, leadingIcon: @Composable (() -> Unit)? = null, ) { MifosTextButton( @@ -230,24 +240,27 @@ fun MifosTextButton( @Composable private fun MifosButtonContent( text: @Composable () -> Unit, + modifier: Modifier = Modifier, leadingIcon: @Composable (() -> Unit)? = null, ) { - if (leadingIcon != null) { - Box(Modifier.sizeIn(maxHeight = ButtonDefaults.IconSize)) { - leadingIcon() + Row(modifier) { + if (leadingIcon != null) { + Box(Modifier.sizeIn(maxHeight = ButtonDefaults.IconSize)) { + leadingIcon() + } + } + Box( + Modifier + .padding( + start = if (leadingIcon != null) { + ButtonDefaults.IconSpacing + } else { + 0.dp + }, + ), + ) { + text() } - } - Box( - Modifier - .padding( - start = if (leadingIcon != null) { - ButtonDefaults.IconSpacing - } else { - 0.dp - }, - ), - ) { - text() } } @@ -256,7 +269,7 @@ private fun MifosButtonContent( fun MifosButtonPreview() { MifosTheme { MifosBackground(modifier = Modifier.size(150.dp, 50.dp)) { - MifosButton(onClick = {}, text = { Text("Test button") }) + MifosButton(text = { Text("Test button") }, onClick = {}) } } } @@ -277,8 +290,8 @@ fun MifosButtonLeadingIconPreview() { MifosTheme { MifosBackground(modifier = Modifier.size(150.dp, 50.dp)) { MifosButton( - onClick = {}, text = { Text("Test button") }, + onClick = {}, leadingIcon = { Icon(imageVector = MifosIcons.Add, contentDescription = null) }, ) } diff --git a/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/Card.kt b/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/Card.kt index d0609c628..8d1a9968d 100644 --- a/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/Card.kt +++ b/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/Card.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.designsystem.component import androidx.compose.foundation.clickable @@ -20,7 +29,7 @@ fun MifosCard( elevation: Dp = 1.dp, onClick: (() -> Unit)? = null, colors: CardColors = CardDefaults.cardColors(), - content: @Composable ColumnScope.() -> Unit + content: @Composable ColumnScope.() -> Unit, ) { Card( shape = shape, @@ -28,9 +37,9 @@ fun MifosCard( .fillMaxWidth() .then(if (onClick != null) Modifier.clickable(onClick = onClick) else Modifier), elevation = CardDefaults.cardElevation( - defaultElevation = elevation + defaultElevation = elevation, ), colors = colors, - content = content + content = content, ) -} \ No newline at end of file +} diff --git a/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/LoadingWheel.kt b/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/LoadingWheel.kt index f4b926c23..9d35fac24 100644 --- a/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/LoadingWheel.kt +++ b/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/LoadingWheel.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.designsystem.component import androidx.compose.animation.animateColor @@ -142,36 +151,40 @@ fun MifosOverlayLoadingWheel( } @Composable -fun MfOverlayLoadingWheel(contentDesc: String = "Loading") { +fun MfOverlayLoadingWheel( + modifier: Modifier = Modifier, + contentDesc: String = "Loading", +) { Box( - modifier = Modifier + modifier = modifier .fillMaxSize() .background(color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.6f)) .focusable(), - contentAlignment = Alignment.Center + contentAlignment = Alignment.Center, ) { MifosOverlayLoadingWheel( modifier = Modifier.wrapContentSize(), - contentDesc = contentDesc + contentDesc = contentDesc, ) } } @Composable fun MfLoadingWheel( + modifier: Modifier = Modifier, contentDesc: String = "Loading", - backgroundColor: Color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.6f) + backgroundColor: Color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.6f), ) { Box( - modifier = Modifier + modifier = modifier .fillMaxSize() .background(color = backgroundColor) .focusable(), - contentAlignment = Alignment.Center + contentAlignment = Alignment.Center, ) { MifosLoadingWheel( modifier = Modifier.wrapContentSize(), - contentDesc = contentDesc + contentDesc = contentDesc, ) } } diff --git a/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/MifosScaffold.kt b/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/MifosScaffold.kt index f67dcd55d..bdcb53837 100644 --- a/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/MifosScaffold.kt +++ b/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/MifosScaffold.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.designsystem.component import androidx.compose.foundation.layout.PaddingValues @@ -15,7 +24,7 @@ fun MifosScaffold( topBarTitle: Int? = null, floatingActionButtonContent: FloatingActionButtonContent? = null, snackbarHost: @Composable () -> Unit = {}, - scaffoldContent: @Composable (PaddingValues) -> Unit, + scaffoldContent: @Composable (PaddingValues) -> Unit = {}, actions: @Composable RowScope.() -> Unit = {}, ) { Scaffold( diff --git a/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/MifosTopBar.kt b/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/MifosTopBar.kt index d14f1e49e..da6ff044e 100644 --- a/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/MifosTopBar.kt +++ b/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/MifosTopBar.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.designsystem.component import androidx.compose.foundation.layout.RowScope @@ -11,24 +20,23 @@ import androidx.compose.material3.Text import androidx.compose.material3.TopAppBar import androidx.compose.material3.TopAppBarDefaults import androidx.compose.runtime.Composable -import androidx.compose.ui.graphics.Color +import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource -import org.mifospay.core.designsystem.theme.mifosText -import org.mifospay.core.designsystem.theme.styleMifosTopBar @OptIn(ExperimentalMaterial3Api::class) @Composable fun MifosTopBar( topBarTitle: Int, - actions: @Composable RowScope.() -> Unit = {}, backPress: () -> Unit, + modifier: Modifier = Modifier, + actions: @Composable RowScope.() -> Unit = {}, ) { TopAppBar( title = { Text( text = stringResource(id = topBarTitle), style = MaterialTheme.typography.titleLarge, - color = MaterialTheme.colorScheme.onSurface + color = MaterialTheme.colorScheme.onSurface, ) }, navigationIcon = { @@ -36,11 +44,15 @@ fun MifosTopBar( Icon( imageVector = Icons.Filled.ArrowBack, contentDescription = "Back", - tint = MaterialTheme.colorScheme.onSurface + tint = MaterialTheme.colorScheme.onSurface, ) } }, - colors = TopAppBarDefaults.mediumTopAppBarColors(containerColor = MaterialTheme.colorScheme.surface), - actions = actions + colors = + TopAppBarDefaults.mediumTopAppBarColors( + containerColor = MaterialTheme.colorScheme.surface, + ), + actions = actions, + modifier = modifier, ) -} \ No newline at end of file +} diff --git a/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/Navigation.kt b/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/Navigation.kt index ba08ed614..1e722d189 100644 --- a/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/Navigation.kt +++ b/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/Navigation.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.designsystem.component import androidx.compose.foundation.layout.ColumnScope @@ -37,10 +46,10 @@ import org.mifospay.core.designsystem.theme.MifosTheme fun RowScope.MifosNavigationBarItem( selected: Boolean, onClick: () -> Unit, + icon: @Composable () -> Unit, modifier: Modifier = Modifier, enabled: Boolean = true, alwaysShowLabel: Boolean = true, - icon: @Composable () -> Unit, selectedIcon: @Composable () -> Unit = icon, label: @Composable (() -> Unit)? = null, ) { @@ -52,7 +61,8 @@ fun RowScope.MifosNavigationBarItem( enabled = enabled, label = label, alwaysShowLabel = alwaysShowLabel, - colors = NavigationBarItemDefaults.colors( + colors = + NavigationBarItemDefaults.colors( selectedIconColor = MifosNavigationDefaults.navigationSelectedItemColor(), unselectedIconColor = MifosNavigationDefaults.navigationContentColor(), selectedTextColor = MifosNavigationDefaults.navigationSelectedItemColor(), @@ -101,10 +111,10 @@ fun MifosNavigationBar( fun MifosNavigationRailItem( selected: Boolean, onClick: () -> Unit, + icon: @Composable () -> Unit, modifier: Modifier = Modifier, enabled: Boolean = true, alwaysShowLabel: Boolean = true, - icon: @Composable () -> Unit, selectedIcon: @Composable () -> Unit = icon, label: @Composable (() -> Unit)? = null, ) { @@ -116,7 +126,8 @@ fun MifosNavigationRailItem( enabled = enabled, label = label, alwaysShowLabel = alwaysShowLabel, - colors = NavigationRailItemDefaults.colors( + colors = + NavigationRailItemDefaults.colors( selectedIconColor = MifosNavigationDefaults.navigationSelectedItemColor(), unselectedIconColor = MifosNavigationDefaults.navigationContentColor(), selectedTextColor = MifosNavigationDefaults.navigationSelectedItemColor(), @@ -153,23 +164,27 @@ fun MifosNavigationRail( @Composable fun MifosNavigationBarPreview() { val items = listOf("Home", "Payments", "Finance", "Profile") - val icons = listOf( - MifosIcons.Home, - MifosIcons.Payment, - MifosIcons.Finance, - MifosIcons.Profile, - ) - val selectedIcons = listOf( - MifosIcons.HomeBoarder, - MifosIcons.Payment, - MifosIcons.Finance, - MifosIcons.ProfileBoarder, - ) + val icons = + listOf( + MifosIcons.Home, + MifosIcons.Payment, + MifosIcons.Finance, + MifosIcons.Profile, + ) + val selectedIcons = + listOf( + MifosIcons.HomeBoarder, + MifosIcons.Payment, + MifosIcons.Finance, + MifosIcons.ProfileBoarder, + ) MifosTheme { MifosNavigationBar { items.forEachIndexed { index, item -> MifosNavigationBarItem( + selected = index == 0, + onClick = { }, icon = { Icon( imageVector = icons[index], @@ -183,8 +198,6 @@ fun MifosNavigationBarPreview() { ) }, label = { Text(item) }, - selected = index == 0, - onClick = { }, ) } } @@ -195,23 +208,27 @@ fun MifosNavigationBarPreview() { @Composable fun MifosNavigationRailPreview() { val items = listOf("Home", "Payments", "Finance", "Profile") - val icons = listOf( - MifosIcons.Home, - MifosIcons.Payment, - MifosIcons.Finance, - MifosIcons.Profile, - ) - val selectedIcons = listOf( - MifosIcons.HomeBoarder, - MifosIcons.Payment, - MifosIcons.Finance, - MifosIcons.ProfileBoarder, - ) + val icons = + listOf( + MifosIcons.Home, + MifosIcons.Payment, + MifosIcons.Finance, + MifosIcons.Profile, + ) + val selectedIcons = + listOf( + MifosIcons.HomeBoarder, + MifosIcons.Payment, + MifosIcons.Finance, + MifosIcons.ProfileBoarder, + ) MifosTheme { MifosNavigationRail { items.forEachIndexed { index, item -> MifosNavigationRailItem( + selected = index == 0, + onClick = { }, icon = { Icon( imageVector = icons[index], @@ -225,8 +242,6 @@ fun MifosNavigationRailPreview() { ) }, label = { Text(item) }, - selected = index == 0, - onClick = { }, ) } } diff --git a/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/OutlineTextField.kt b/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/OutlineTextField.kt index 3377fc81c..360cc1484 100644 --- a/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/OutlineTextField.kt +++ b/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/OutlineTextField.kt @@ -1,7 +1,15 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.designsystem.component import androidx.compose.foundation.Image -import androidx.compose.foundation.isSystemInDarkTheme import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.material3.MaterialTheme import androidx.compose.material3.OutlinedTextField @@ -9,7 +17,6 @@ import androidx.compose.material3.OutlinedTextFieldDefaults import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier -import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.ColorFilter import androidx.compose.ui.platform.LocalDensity import androidx.compose.ui.res.painterResource @@ -21,47 +28,52 @@ import androidx.compose.ui.unit.sp @Composable fun MifosOutlinedTextField( + label: Int, value: String, onValueChange: (String) -> Unit, + modifier: Modifier = Modifier, maxLines: Int = 1, - modifier: Modifier, singleLine: Boolean = true, icon: Int? = null, - label: Int, + error: Boolean = false, visualTransformation: VisualTransformation = VisualTransformation.None, trailingIcon: @Composable (() -> Unit)? = null, - error: Boolean = false, - keyboardOptions: KeyboardOptions = KeyboardOptions(imeAction = ImeAction.Next) + keyboardOptions: KeyboardOptions = KeyboardOptions(imeAction = ImeAction.Next), ) { - OutlinedTextField( value = value, onValueChange = onValueChange, label = { Text(stringResource(id = label)) }, modifier = modifier, - leadingIcon = if (icon != null) { + leadingIcon = + if (icon != null) { { Image( painter = painterResource(id = icon), contentDescription = null, - colorFilter = ColorFilter.tint( - MaterialTheme.colorScheme.onSurface - ) + colorFilter = + ColorFilter.tint( + MaterialTheme.colorScheme.onSurface, + ), ) } - } else null, + } else { + null + }, trailingIcon = trailingIcon, maxLines = maxLines, singleLine = singleLine, - colors = OutlinedTextFieldDefaults.colors( + colors = + OutlinedTextFieldDefaults.colors( focusedBorderColor = MaterialTheme.colorScheme.onSurface, - focusedLabelColor = MaterialTheme.colorScheme.onSurface + focusedLabelColor = MaterialTheme.colorScheme.onSurface, ), - textStyle = LocalDensity.current.run { + textStyle = + LocalDensity.current.run { TextStyle(fontSize = 18.sp, color = MaterialTheme.colorScheme.onSurface) }, keyboardOptions = keyboardOptions, visualTransformation = visualTransformation, - isError = error + isError = error, ) -} \ No newline at end of file +} diff --git a/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/PermissionBox.kt b/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/PermissionBox.kt index 9f6e5c1e8..afff02d09 100644 --- a/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/PermissionBox.kt +++ b/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/PermissionBox.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.designsystem.component import android.app.Activity @@ -13,6 +22,7 @@ import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.setValue +import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalLifecycleOwner import androidx.core.app.ActivityCompat @@ -25,9 +35,10 @@ import androidx.lifecycle.LifecycleEventObserver fun PermissionBox( requiredPermissions: List, title: Int, - description: Int? = null, confirmButtonText: Int, dismissButtonText: Int, + modifier: Modifier = Modifier, + description: Int? = null, onGranted: @Composable (() -> Unit)? = null, ) { val context = LocalContext.current @@ -38,9 +49,9 @@ fun PermissionBox( requiredPermissions.all { ContextCompat.checkSelfPermission( context, - it + it, ) == PackageManager.PERMISSION_GRANTED - } + }, ) } @@ -48,7 +59,8 @@ fun PermissionBox( requiredPermissions.all { (context as? Activity)?.let { it1 -> ActivityCompat.shouldShowRequestPermissionRationale( - it1, it + it1, + it, ) } == true } @@ -59,79 +71,90 @@ fun PermissionBox( val decideCurrentPermissionStatus: (Boolean, Boolean) -> String = { granted, rationale -> - if (granted) "Granted" - else if (rationale) "Rejected" - else "Denied" + if (granted) { + "Granted" + } else if (rationale) { + "Rejected" + } else { + "Denied" + } } var currentPermissionStatus by remember { mutableStateOf( decideCurrentPermissionStatus( permissionGranted, - shouldShowPermissionRationale - ) + shouldShowPermissionRationale, + ), ) } - val multiplePermissionLauncher = rememberLauncherForActivityResult( - contract = ActivityResultContracts.RequestMultiplePermissions(), - onResult = { permissionResults -> - val isGranted = - requiredPermissions.all { permissionResults[it] ?: false } + val multiplePermissionLauncher = + rememberLauncherForActivityResult( + contract = ActivityResultContracts.RequestMultiplePermissions(), + onResult = { permissionResults -> + val isGranted = + requiredPermissions.all { permissionResults[it] ?: false } - permissionGranted = isGranted + permissionGranted = isGranted - if (!isGranted) { - shouldShowPermissionRationale = - requiredPermissions.all { - ActivityCompat.shouldShowRequestPermissionRationale( - context as Activity, - it - ) - } - } - shouldDirectUserToApplicationSettings = - !shouldShowPermissionRationale && !permissionGranted - currentPermissionStatus = decideCurrentPermissionStatus( - permissionGranted, - shouldShowPermissionRationale - ) - }) + if (!isGranted) { + shouldShowPermissionRationale = + requiredPermissions.all { + ActivityCompat.shouldShowRequestPermissionRationale( + context as Activity, + it, + ) + } + } + shouldDirectUserToApplicationSettings = + !shouldShowPermissionRationale && + !permissionGranted + currentPermissionStatus = + decideCurrentPermissionStatus( + permissionGranted, + shouldShowPermissionRationale, + ) + }, + ) - DisposableEffect(key1 = lifecycleOwner, effect = { - val observer = LifecycleEventObserver { _, event -> - if (event == Lifecycle.Event.ON_START && - !permissionGranted && - !shouldShowPermissionRationale - ) { - multiplePermissionLauncher.launch(requiredPermissions.toTypedArray()) + DisposableEffect( + key1 = lifecycleOwner, + effect = { + val observer = + LifecycleEventObserver { _, event -> + if (event == Lifecycle.Event.ON_START && + !permissionGranted && + !shouldShowPermissionRationale + ) { + multiplePermissionLauncher.launch(requiredPermissions.toTypedArray()) + } + } + lifecycleOwner.lifecycle.addObserver(observer) + onDispose { + lifecycleOwner.lifecycle.removeObserver(observer) } - } - lifecycleOwner.lifecycle.addObserver(observer) - onDispose { - lifecycleOwner.lifecycle.removeObserver(observer) - } - }) + }, + ) - if (shouldShowPermissionRationale) { - MifosDialogBox( - showDialogState = shouldShowPermissionRationale, - onDismiss = { shouldShowPermissionRationale = false }, - title = title, - confirmButtonText = confirmButtonText, - onConfirm = { - shouldShowPermissionRationale = false - multiplePermissionLauncher.launch(requiredPermissions.toTypedArray()) - }, - dismissButtonText = dismissButtonText, - message = description - ) - } + MifosDialogBox( + showDialogState = shouldShowPermissionRationale, + onDismiss = { shouldShowPermissionRationale = false }, + title = title, + confirmButtonText = confirmButtonText, + onConfirm = { + shouldShowPermissionRationale = false + multiplePermissionLauncher.launch(requiredPermissions.toTypedArray()) + }, + dismissButtonText = dismissButtonText, + message = description, + modifier = modifier, + ) if (shouldDirectUserToApplicationSettings) { Intent( Settings.ACTION_APPLICATION_DETAILS_SETTINGS, - Uri.fromParts("package", context.packageName, null) + Uri.fromParts("package", context.packageName, null), ).also { context.startActivity(it) } @@ -142,4 +165,4 @@ fun PermissionBox( onGranted() } } -} \ No newline at end of file +} diff --git a/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/TextField.kt b/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/TextField.kt index 6adf88567..096c206da 100644 --- a/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/TextField.kt +++ b/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/TextField.kt @@ -1,8 +1,16 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.designsystem.component import androidx.compose.foundation.Image import androidx.compose.foundation.background -import androidx.compose.foundation.isSystemInDarkTheme import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.text.KeyboardActions @@ -32,19 +40,18 @@ import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.sp import org.mifospay.core.designsystem.theme.MifosTheme - @Composable fun MfOutlinedTextField( - modifier: Modifier = Modifier, value: String, label: String, + onValueChange: (String) -> Unit, + modifier: Modifier = Modifier, isError: Boolean = false, errorMessage: String = "", singleLine: Boolean = false, - onValueChange: (String) -> Unit, onKeyboardActions: (() -> Unit)? = null, trailingIcon: @Composable (() -> Unit)? = null, - keyboardOptions: KeyboardOptions = KeyboardOptions.Default + keyboardOptions: KeyboardOptions = KeyboardOptions.Default, ) { OutlinedTextField( modifier = modifier, @@ -58,30 +65,33 @@ fun MfOutlinedTextField( }, singleLine = singleLine, trailingIcon = trailingIcon, - keyboardActions = KeyboardActions { + keyboardActions = + KeyboardActions { onKeyboardActions?.invoke() }, keyboardOptions = keyboardOptions, - colors = OutlinedTextFieldDefaults.colors( + colors = + OutlinedTextFieldDefaults.colors( focusedBorderColor = MaterialTheme.colorScheme.onSurface, - focusedLabelColor = MaterialTheme.colorScheme.onSurface + focusedLabelColor = MaterialTheme.colorScheme.onSurface, ), - textStyle = LocalDensity.current.run { + textStyle = + LocalDensity.current.run { TextStyle(fontSize = 18.sp, color = MaterialTheme.colorScheme.onSurface) - } + }, ) } @Composable fun MfPasswordTextField( - modifier: Modifier = Modifier, password: String, label: String, isError: Boolean, - errorMessage: String? = null, isPasswordVisible: Boolean, onTogglePasswordVisibility: () -> Unit, onPasswordChange: (String) -> Unit, + modifier: Modifier = Modifier, + errorMessage: String? = null, ) { OutlinedTextField( modifier = modifier, @@ -89,7 +99,8 @@ fun MfPasswordTextField( onValueChange = onPasswordChange, label = { Text(label) }, isError = isError, - visualTransformation = if (isPasswordVisible) { + visualTransformation = + if (isPasswordVisible) { VisualTransformation.None } else { PasswordVisualTransformation() @@ -101,59 +112,63 @@ fun MfPasswordTextField( IconButton(onClick = onTogglePasswordVisibility) { Icon( if (isPasswordVisible) Icons.Filled.Visibility else Icons.Filled.VisibilityOff, - contentDescription = "Show password" + contentDescription = "Show password", ) } - } + }, ) } - @Composable fun MifosOutlinedTextField( + label: Int, value: TextFieldValue, onValueChange: (TextFieldValue) -> Unit, + modifier: Modifier = Modifier, maxLines: Int = 1, - modifier: Modifier, singleLine: Boolean = true, icon: Int? = null, - label: Int, visualTransformation: VisualTransformation = VisualTransformation.None, trailingIcon: @Composable (() -> Unit)? = null, keyboardActions: KeyboardActions = KeyboardActions.Default, error: Boolean = false, ) { - OutlinedTextField( value = value, onValueChange = onValueChange, label = { Text(stringResource(id = label)) }, modifier = modifier, - leadingIcon = if (icon != null) { + leadingIcon = + if (icon != null) { { Image( painter = painterResource(id = icon), contentDescription = null, - colorFilter = ColorFilter.tint( - MaterialTheme.colorScheme.onSurface - ) + colorFilter = + ColorFilter.tint( + MaterialTheme.colorScheme.onSurface, + ), ) } - } else null, + } else { + null + }, trailingIcon = trailingIcon, maxLines = maxLines, singleLine = singleLine, - colors = OutlinedTextFieldDefaults.colors( + colors = + OutlinedTextFieldDefaults.colors( focusedBorderColor = MaterialTheme.colorScheme.onSurface, - focusedLabelColor = MaterialTheme.colorScheme.onSurface + focusedLabelColor = MaterialTheme.colorScheme.onSurface, ), - textStyle = LocalDensity.current.run { + textStyle = + LocalDensity.current.run { TextStyle(fontSize = 18.sp, color = MaterialTheme.colorScheme.onSurface) }, keyboardOptions = KeyboardOptions(imeAction = ImeAction.Next), keyboardActions = keyboardActions, visualTransformation = visualTransformation, - isError = error + isError = error, ) } @@ -162,16 +177,16 @@ fun MifosOutlinedTextField( fun MfOutlinedTextFieldPreview() { MifosTheme { Box( - modifier = Modifier.background(color = MaterialTheme.colorScheme.surface) + modifier = Modifier.background(color = MaterialTheme.colorScheme.surface), ) { MfOutlinedTextField( - modifier = Modifier, value = "Text Field Value", label = "Text Field", + onValueChange = { }, + modifier = Modifier, isError = true, errorMessage = "Error Message", - onValueChange = { }, - onKeyboardActions = { } + onKeyboardActions = { }, ) } } @@ -183,23 +198,18 @@ fun MfPasswordTextFieldPreview() { MifosTheme { val password = " " Box( - modifier = Modifier.background(color = Color.White) + modifier = Modifier.background(color = Color.White), ) { MfPasswordTextField( - modifier = Modifier.fillMaxWidth(), password = password, label = "Password", - isError = password.isEmpty() || password.length < 6, - errorMessage = if (password.isEmpty()) { - "Password cannot be empty" - } else if (password.length < 6) { - "Password must be at least 6 characters" - } else null, - onPasswordChange = { }, + isError = true, isPasswordVisible = true, - onTogglePasswordVisibility = { } + onTogglePasswordVisibility = { }, + onPasswordChange = { }, + modifier = Modifier.fillMaxWidth(), + errorMessage = "Password must be at least 6 characters", ) } } } - diff --git a/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/TextUserImage.kt b/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/TextUserImage.kt index 62b3beda1..6be7620d3 100644 --- a/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/TextUserImage.kt +++ b/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/TextUserImage.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.designsystem.component import androidx.compose.foundation.background @@ -15,18 +24,23 @@ import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp @Composable -fun MifosTextUserImage(modifier: Modifier = Modifier, text: String, size: Dp = 100.dp) { +fun MifosTextUserImage( + text: String, + modifier: Modifier = Modifier, + size: Dp = 100.dp, +) { Box( - modifier = modifier + modifier = + modifier .size(size) .clip(CircleShape) .background(color = MaterialTheme.colorScheme.primary), - contentAlignment = Alignment.Center + contentAlignment = Alignment.Center, ) { Text( text = text, color = MaterialTheme.colorScheme.onPrimary, - fontSize = with(LocalDensity.current) { (size / 2).toSp() } + fontSize = with(LocalDensity.current) { (size / 2).toSp() }, ) } } diff --git a/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/TopAppBar.kt b/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/TopAppBar.kt index a6330a969..a2a25b3d3 100644 --- a/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/TopAppBar.kt +++ b/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/TopAppBar.kt @@ -1,4 +1,12 @@ - +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ @file:OptIn(ExperimentalMaterial3Api::class) package org.mifospay.core.designsystem.component @@ -25,8 +33,8 @@ import org.mifospay.core.designsystem.theme.MifosTheme @OptIn(ExperimentalMaterial3Api::class) @Composable fun MifosTopAppBar( - modifier: Modifier = Modifier, @StringRes titleRes: Int, + modifier: Modifier = Modifier, navigationIcon: ImageVector? = null, navigationIconContentDescription: String? = null, actionIcon: ImageVector? = null, @@ -67,18 +75,20 @@ fun MifosTopAppBar( @Composable fun MifosNavigationTopAppBar( @StringRes titleRes: Int, - onNavigationClick: (() -> Unit)? + onNavigationClick: (() -> Unit)?, ) { MifosTopAppBar( titleRes = titleRes, navigationIcon = MifosIcons.Back, - navigationIconContentDescription = stringResource( + navigationIconContentDescription = + stringResource( id = titleRes, ), - colors = TopAppBarDefaults.centerAlignedTopAppBarColors( + colors = + TopAppBarDefaults.centerAlignedTopAppBarColors( containerColor = Color.Transparent, ), - onNavigationClick = onNavigationClick + onNavigationClick = onNavigationClick, ) } diff --git a/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/icon/MifosIcons.kt b/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/icon/MifosIcons.kt index bb3285763..7912bd160 100644 --- a/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/icon/MifosIcons.kt +++ b/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/icon/MifosIcons.kt @@ -1,6 +1,14 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.designsystem.icon -import android.content.SharedPreferences.Editor import androidx.compose.material.icons.Icons import androidx.compose.material.icons.automirrored.filled.ArrowBack import androidx.compose.material.icons.automirrored.outlined.ArrowBack @@ -34,7 +42,6 @@ import androidx.compose.material.icons.rounded.SwapHoriz import androidx.compose.material.icons.rounded.Wallet import androidx.compose.ui.graphics.vector.ImageVector - /** * Mifos icons. Material icons are [ImageVector]s, custom icons are drawable resource IDs. */ diff --git a/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/theme/BackgroundTheme.kt b/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/theme/BackgroundTheme.kt index 6e11ed88b..7f8b7d438 100644 --- a/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/theme/BackgroundTheme.kt +++ b/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/theme/BackgroundTheme.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.designsystem.theme import androidx.compose.runtime.Immutable diff --git a/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/theme/Color.kt b/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/theme/Color.kt index dbc2464f7..c872243fc 100644 --- a/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/theme/Color.kt +++ b/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/theme/Color.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.designsystem.theme import androidx.compose.ui.graphics.Color @@ -79,5 +88,5 @@ val otherTextColor = Color.Yellow val greyBackgroundColor = Color(0xFFF7F7F7) val primaryDarkBlue = Color(0xFF303F9F) val InitialAvatarBgColor = Color(0xFF9999CC) -val submitButtonColor = Color(0xFF0000FF) -val ElectricViolet = Color(0xFF6200EE) \ No newline at end of file +val submitButtonColor = Color(0xFF0000FF) +val ElectricViolet = Color(0xFF6200EE) diff --git a/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/theme/GradientColors.kt b/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/theme/GradientColors.kt index 5490c8562..f80ab4efd 100644 --- a/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/theme/GradientColors.kt +++ b/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/theme/GradientColors.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.designsystem.theme import androidx.compose.runtime.Immutable diff --git a/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/theme/MifosTextStyle.kt b/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/theme/MifosTextStyle.kt index 533943a00..df1571753 100644 --- a/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/theme/MifosTextStyle.kt +++ b/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/theme/MifosTextStyle.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.designsystem.theme import androidx.compose.ui.graphics.Color @@ -7,32 +16,36 @@ import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.sp -val styleMedium16sp = TextStyle( - fontSize = 16.sp, - fontFamily = FontFamily.SansSerif, - fontWeight = FontWeight.Medium, - color = black, -) +val styleMedium16sp = + TextStyle( + fontSize = 16.sp, + fontFamily = FontFamily.SansSerif, + fontWeight = FontWeight.Medium, + color = black, + ) -val styleNormal18sp = TextStyle( - fontSize = 18.sp, - fontFamily = FontFamily.SansSerif, - fontWeight = FontWeight.Normal, - color = black, -) +val styleNormal18sp = + TextStyle( + fontSize = 18.sp, + fontFamily = FontFamily.SansSerif, + fontWeight = FontWeight.Normal, + color = black, + ) -val styleMedium30sp = TextStyle( - fontSize = 30.sp, - fontFamily = FontFamily.SansSerif, - fontWeight = FontWeight.Medium, - color = black, -) +val styleMedium30sp = + TextStyle( + fontSize = 30.sp, + fontFamily = FontFamily.SansSerif, + fontWeight = FontWeight.Medium, + color = black, + ) -val styleMifosTopBar = TextStyle( - color = Color(0xFF212121), - fontWeight = FontWeight.SemiBold, - fontSize = 20.sp -) +val styleMifosTopBar = + TextStyle( + color = Color(0xFF212121), + fontWeight = FontWeight.SemiBold, + fontSize = 20.sp, + ) val styleSettingsButton = TextStyle(color = Color.White, textAlign = TextAlign.Center) -val historyItemTextStyle = TextStyle(color = Color.Black, fontSize = 16.sp) \ No newline at end of file +val historyItemTextStyle = TextStyle(color = Color.Black, fontSize = 16.sp) diff --git a/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/theme/Theme.kt b/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/theme/Theme.kt index 31f4b925d..5fa7b0ae2 100644 --- a/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/theme/Theme.kt +++ b/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/theme/Theme.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.designsystem.theme import androidx.compose.foundation.isSystemInDarkTheme @@ -40,7 +49,6 @@ private val LightDefaultColorScheme = lightColorScheme( scrim = md_theme_light_scrim, ) - private val DarkDefaultColorScheme = darkColorScheme( primary = md_theme_dark_primary, onPrimary = md_theme_dark_onPrimary, @@ -79,7 +87,7 @@ fun MifosTheme( darkTheme: Boolean = isSystemInDarkTheme(), // Dynamic color is available on Android 12+ dynamicColor: Boolean = true, - content: @Composable () -> Unit + content: @Composable () -> Unit, ) { // Color scheme val colorScheme = when { diff --git a/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/theme/TintTheme.kt b/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/theme/TintTheme.kt index ad63e0003..3531a62a4 100644 --- a/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/theme/TintTheme.kt +++ b/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/theme/TintTheme.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.designsystem.theme import androidx.compose.runtime.Immutable diff --git a/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/theme/Type.kt b/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/theme/Type.kt index f0a45f48e..68823df6b 100644 --- a/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/theme/Type.kt +++ b/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/theme/Type.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.designsystem.theme import androidx.compose.material3.Typography diff --git a/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/utils/ExpirationDateMask.kt b/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/utils/ExpirationDateMask.kt index 931d254b5..dabd6bc46 100644 --- a/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/utils/ExpirationDateMask.kt +++ b/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/utils/ExpirationDateMask.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.designsystem.utils import androidx.compose.ui.text.AnnotatedString @@ -7,12 +16,9 @@ import androidx.compose.ui.text.input.VisualTransformation @Suppress("ReturnCount") class ExpirationDateMask : VisualTransformation { - override fun filter(text: AnnotatedString): TransformedText { - return makeExpirationFilter(text) - } + override fun filter(text: AnnotatedString): TransformedText = makeExpirationFilter(text) private fun makeExpirationFilter(text: AnnotatedString): TransformedText { - val trimmed = if (text.text.length >= 4) text.text.substring(0..3) else text.text var out = "" for (i in trimmed.indices) { @@ -20,20 +26,21 @@ class ExpirationDateMask : VisualTransformation { if (i == 1) out += "/" } - val offsetMapping = object : OffsetMapping { - override fun originalToTransformed(offset: Int): Int { - if (offset <= 1) return offset - if (offset <= 4) return offset + 1 - return 5 - } + val offsetMapping = + object : OffsetMapping { + override fun originalToTransformed(offset: Int): Int { + if (offset <= 1) return offset + if (offset <= 4) return offset + 1 + return 5 + } - override fun transformedToOriginal(offset: Int): Int { - if (offset <= 2) return offset - if (offset <= 5) return offset - 1 - return 4 + override fun transformedToOriginal(offset: Int): Int { + if (offset <= 2) return offset + if (offset <= 5) return offset - 1 + return 4 + } } - } return TransformedText(AnnotatedString(out), offsetMapping) } -} \ No newline at end of file +} diff --git a/core/model/build.gradle.kts b/core/model/build.gradle.kts index f3c451a59..49dc20a70 100644 --- a/core/model/build.gradle.kts +++ b/core/model/build.gradle.kts @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ plugins { alias(libs.plugins.mifospay.android.library) alias(libs.plugins.kotlin.parcelize) @@ -12,7 +21,6 @@ apply(from = "${project.rootDir}/config/quality/quality.gradle") dependencies { api(libs.kotlinx.datetime) - implementation(libs.jetbrains.kotlin.jdk7) // For Serialized name implementation(libs.squareup.retrofit.converter.gson) diff --git a/core/model/src/main/AndroidManifest.xml b/core/model/src/main/AndroidManifest.xml index a5918e68a..961389810 100644 --- a/core/model/src/main/AndroidManifest.xml +++ b/core/model/src/main/AndroidManifest.xml @@ -1,4 +1,13 @@ + \ No newline at end of file diff --git a/core/model/src/main/java/com/mifospay/core/model/City.kt b/core/model/src/main/java/com/mifospay/core/model/City.kt index 63fff72e2..ab02c68cb 100644 --- a/core/model/src/main/java/com/mifospay/core/model/City.kt +++ b/core/model/src/main/java/com/mifospay/core/model/City.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package com.mifospay.core.model import kotlinx.serialization.SerialName @@ -8,5 +17,5 @@ data class City( val id: String, val name: String, @SerialName("state_id") - val stateId: String + val stateId: String, ) diff --git a/core/model/src/main/java/com/mifospay/core/model/Country.kt b/core/model/src/main/java/com/mifospay/core/model/Country.kt index 7e00906f1..8bf05c28d 100644 --- a/core/model/src/main/java/com/mifospay/core/model/Country.kt +++ b/core/model/src/main/java/com/mifospay/core/model/Country.kt @@ -1,8 +1,16 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package com.mifospay.core.model import kotlinx.serialization.Serializable - @Serializable data class Country( val id: String, diff --git a/core/model/src/main/java/com/mifospay/core/model/State.kt b/core/model/src/main/java/com/mifospay/core/model/State.kt index 2c182fb78..de96c402b 100644 --- a/core/model/src/main/java/com/mifospay/core/model/State.kt +++ b/core/model/src/main/java/com/mifospay/core/model/State.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package com.mifospay.core.model import kotlinx.serialization.SerialName @@ -8,5 +17,5 @@ data class State( val id: String, val name: String, @SerialName("country_id") - val countryId: String + val countryId: String, ) diff --git a/core/model/src/main/java/com/mifospay/core/model/UserData.kt b/core/model/src/main/java/com/mifospay/core/model/UserData.kt index e99556391..dfd447b72 100644 --- a/core/model/src/main/java/com/mifospay/core/model/UserData.kt +++ b/core/model/src/main/java/com/mifospay/core/model/UserData.kt @@ -1,7 +1,16 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package com.mifospay.core.model data class UserData( val isAuthenticated: Boolean, val userName: String, - val clientId: Long -) \ No newline at end of file + val clientId: Long, +) diff --git a/core/model/src/main/java/com/mifospay/core/model/domain/Account.kt b/core/model/src/main/java/com/mifospay/core/model/domain/Account.kt index 1baa7d40a..3753343b5 100644 --- a/core/model/src/main/java/com/mifospay/core/model/domain/Account.kt +++ b/core/model/src/main/java/com/mifospay/core/model/domain/Account.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package com.mifospay.core.model.domain import android.os.Parcelable @@ -5,11 +14,11 @@ import kotlinx.parcelize.Parcelize @Parcelize data class Account( - var image: String="", + var image: String = "", var name: String, var number: String, - var balance: Double=0.0, - var id: Long=0L, - var productId: Long=0L, + var balance: Double = 0.0, + var id: Long = 0L, + var productId: Long = 0L, var currency: com.mifospay.core.model.domain.Currency, ) : Parcelable diff --git a/core/model/src/main/java/com/mifospay/core/model/domain/Bank.kt b/core/model/src/main/java/com/mifospay/core/model/domain/Bank.kt index 6f7b7942b..1c2c9a868 100644 --- a/core/model/src/main/java/com/mifospay/core/model/domain/Bank.kt +++ b/core/model/src/main/java/com/mifospay/core/model/domain/Bank.kt @@ -1,12 +1,21 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package com.mifospay.core.model.domain - class Bank( val name: String, val image: Int, - val bankType: BankType = BankType.OTHER + val bankType: BankType = BankType.OTHER, ) enum class BankType { - POPULAR, OTHER -} \ No newline at end of file + POPULAR, + OTHER, +} diff --git a/core/model/src/main/java/com/mifospay/core/model/domain/BankAccountDetails.kt b/core/model/src/main/java/com/mifospay/core/model/domain/BankAccountDetails.kt index 19eb2bfd7..7cfb9064e 100644 --- a/core/model/src/main/java/com/mifospay/core/model/domain/BankAccountDetails.kt +++ b/core/model/src/main/java/com/mifospay/core/model/domain/BankAccountDetails.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package com.mifospay.core.model.domain import android.os.Parcelable @@ -11,7 +20,7 @@ data class BankAccountDetails( var ifsc: String? = null, var type: String? = null, var isUpiEnabled: Boolean = false, - var upiPin: String? = null + var upiPin: String? = null, ) : Parcelable { constructor() : this("", "", "", "", "", false, "") } diff --git a/core/model/src/main/java/com/mifospay/core/model/domain/Currency.kt b/core/model/src/main/java/com/mifospay/core/model/domain/Currency.kt index 1303f1400..e5d6a693b 100644 --- a/core/model/src/main/java/com/mifospay/core/model/domain/Currency.kt +++ b/core/model/src/main/java/com/mifospay/core/model/domain/Currency.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package com.mifospay.core.model.domain import android.os.Parcelable @@ -7,7 +16,7 @@ import kotlinx.parcelize.Parcelize data class Currency( var code: String, var displaySymbol: String, - var displayLabel: String + var displayLabel: String, ) : Parcelable { constructor() : this("", "", "") } diff --git a/core/model/src/main/java/com/mifospay/core/model/domain/NewAccount.kt b/core/model/src/main/java/com/mifospay/core/model/domain/NewAccount.kt index 1b403eff1..a276663aa 100644 --- a/core/model/src/main/java/com/mifospay/core/model/domain/NewAccount.kt +++ b/core/model/src/main/java/com/mifospay/core/model/domain/NewAccount.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package com.mifospay.core.model.domain import java.util.Date @@ -7,5 +16,5 @@ data class NewAccount( var submittedOnDate: Date? = null, var accountNo: String, var locale: String? = null, - var dateFormat: String? = null + var dateFormat: String? = null, ) diff --git a/core/model/src/main/java/com/mifospay/core/model/domain/NotificationPayload.kt b/core/model/src/main/java/com/mifospay/core/model/domain/NotificationPayload.kt index e35acf60d..f89982818 100644 --- a/core/model/src/main/java/com/mifospay/core/model/domain/NotificationPayload.kt +++ b/core/model/src/main/java/com/mifospay/core/model/domain/NotificationPayload.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package com.mifospay.core.model.domain import android.os.Parcelable @@ -7,5 +16,5 @@ import kotlinx.parcelize.Parcelize data class NotificationPayload( var title: String? = null, var body: String? = null, - var timestamp: String? = null + var timestamp: String? = null, ) : Parcelable diff --git a/core/model/src/main/java/com/mifospay/core/model/domain/SearchResult.kt b/core/model/src/main/java/com/mifospay/core/model/domain/SearchResult.kt index c008958b7..94d31b09b 100644 --- a/core/model/src/main/java/com/mifospay/core/model/domain/SearchResult.kt +++ b/core/model/src/main/java/com/mifospay/core/model/domain/SearchResult.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package com.mifospay.core.model.domain import android.os.Parcelable @@ -7,7 +16,7 @@ import kotlinx.parcelize.Parcelize data class SearchResult( var resultId: Int = 0, var resultName: String, - var resultType: String + var resultType: String, ) : Parcelable { constructor() : this(0, "", "") } diff --git a/core/model/src/main/java/com/mifospay/core/model/domain/Transaction.kt b/core/model/src/main/java/com/mifospay/core/model/domain/Transaction.kt index 07085e18f..ed13dfd16 100644 --- a/core/model/src/main/java/com/mifospay/core/model/domain/Transaction.kt +++ b/core/model/src/main/java/com/mifospay/core/model/domain/Transaction.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package com.mifospay.core.model.domain import android.os.Parcelable @@ -16,7 +25,7 @@ data class Transaction( var transactionType: com.mifospay.core.model.domain.TransactionType = com.mifospay.core.model.domain.TransactionType.OTHER, var transferId: Long = 0, var transferDetail: TransferDetail = TransferDetail(), - var receiptId: String? = null + var receiptId: String? = null, ) : Parcelable { constructor() : this( "", @@ -28,6 +37,6 @@ data class Transaction( com.mifospay.core.model.domain.TransactionType.OTHER, 0, TransferDetail(), - "" + "", ) -} \ No newline at end of file +} diff --git a/core/model/src/main/java/com/mifospay/core/model/domain/TransactionType.kt b/core/model/src/main/java/com/mifospay/core/model/domain/TransactionType.kt index dd8293953..ad57f69fb 100644 --- a/core/model/src/main/java/com/mifospay/core/model/domain/TransactionType.kt +++ b/core/model/src/main/java/com/mifospay/core/model/domain/TransactionType.kt @@ -1,7 +1,16 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package com.mifospay.core.model.domain enum class TransactionType { DEBIT, CREDIT, - OTHER + OTHER, } diff --git a/core/model/src/main/java/com/mifospay/core/model/domain/client/Client.kt b/core/model/src/main/java/com/mifospay/core/model/domain/client/Client.kt index 3f7b27c1a..578d0f3fe 100644 --- a/core/model/src/main/java/com/mifospay/core/model/domain/client/Client.kt +++ b/core/model/src/main/java/com/mifospay/core/model/domain/client/Client.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package com.mifospay.core.model.domain.client import android.os.Parcelable @@ -7,10 +16,10 @@ import kotlinx.parcelize.Parcelize data class Client( var name: String? = null, var image: String, - var externalId: String?= null, + var externalId: String? = null, var clientId: Long = 0L, var displayName: String, - var mobileNo: String + var mobileNo: String, ) : Parcelable { - constructor() : this( "", "", "", 0L, "", "") + constructor() : this("", "", "", 0L, "", "") } diff --git a/core/model/src/main/java/com/mifospay/core/model/domain/client/NewClient.kt b/core/model/src/main/java/com/mifospay/core/model/domain/client/NewClient.kt index 85611580b..2fdb25e29 100644 --- a/core/model/src/main/java/com/mifospay/core/model/domain/client/NewClient.kt +++ b/core/model/src/main/java/com/mifospay/core/model/domain/client/NewClient.kt @@ -1,10 +1,19 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package com.mifospay.core.model.domain.client import com.mifospay.core.model.utils.DateHelper data class NewClient( val fullname: String?, - val userName : String?, + val userName: String?, val addressLine1: String?, val addressLine2: String?, val city: String?, @@ -12,13 +21,13 @@ data class NewClient( val stateProvinceId: String?, val countryId: String?, val mobileNo: String?, - val mifosSavingsProductId: Int? + val mifosSavingsProductId: Int?, ) { val address: MutableList = mutableListOf() val activationDate: String = DateHelper.getDateAsStringFromLong(System.currentTimeMillis()) val submittedOnDate: String = activationDate val savingsProductId: Int = mifosSavingsProductId ?: 0 - val externalId: String = userName+ "@mifos" + val externalId: String = userName + "@mifos" init { address.add( @@ -28,8 +37,8 @@ data class NewClient( city, postalCode, stateProvinceId, - countryId - ) + countryId, + ), ) } @@ -39,14 +48,14 @@ data class NewClient( val street: String?, val postalCode: String?, val stateProvinceId: String?, - val countryId: String? + val countryId: String?, ) data class CustomDataTable( val registeredTableName: String = "client_info", val data: HashMap = hashMapOf( "locale" to "en", - "info_id" to 1 - ) + "info_id" to 1, + ), ) } diff --git a/core/model/src/main/java/com/mifospay/core/model/domain/client/UpdateClientEntityMobile.kt b/core/model/src/main/java/com/mifospay/core/model/domain/client/UpdateClientEntityMobile.kt index 1d711998a..9ca0bc770 100644 --- a/core/model/src/main/java/com/mifospay/core/model/domain/client/UpdateClientEntityMobile.kt +++ b/core/model/src/main/java/com/mifospay/core/model/domain/client/UpdateClientEntityMobile.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package com.mifospay.core.model.domain.client data class UpdateClientEntityMobile(val mobileNo: String) diff --git a/core/model/src/main/java/com/mifospay/core/model/domain/twofactor/AccessToken.kt b/core/model/src/main/java/com/mifospay/core/model/domain/twofactor/AccessToken.kt index aafd145d3..1af3aec06 100644 --- a/core/model/src/main/java/com/mifospay/core/model/domain/twofactor/AccessToken.kt +++ b/core/model/src/main/java/com/mifospay/core/model/domain/twofactor/AccessToken.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package com.mifospay.core.model.domain.twofactor import android.os.Parcelable @@ -7,6 +16,5 @@ import kotlinx.parcelize.Parcelize data class AccessToken( var token: String? = null, var validFrom: Long? = null, - var validTo: Long? = null + var validTo: Long? = null, ) : Parcelable - diff --git a/core/model/src/main/java/com/mifospay/core/model/domain/twofactor/DeliveryMethod.kt b/core/model/src/main/java/com/mifospay/core/model/domain/twofactor/DeliveryMethod.kt index 15aa29306..a7381e6f7 100644 --- a/core/model/src/main/java/com/mifospay/core/model/domain/twofactor/DeliveryMethod.kt +++ b/core/model/src/main/java/com/mifospay/core/model/domain/twofactor/DeliveryMethod.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package com.mifospay.core.model.domain.twofactor import android.os.Parcelable @@ -6,5 +15,5 @@ import kotlinx.parcelize.Parcelize @Parcelize data class DeliveryMethod( var name: String?, - var target: String? + var target: String?, ) : Parcelable diff --git a/core/model/src/main/java/com/mifospay/core/model/domain/user/NewUser.kt b/core/model/src/main/java/com/mifospay/core/model/domain/user/NewUser.kt index 07699d329..12c8de930 100644 --- a/core/model/src/main/java/com/mifospay/core/model/domain/user/NewUser.kt +++ b/core/model/src/main/java/com/mifospay/core/model/domain/user/NewUser.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package com.mifospay.core.model.domain.user import java.util.Collections @@ -7,7 +16,7 @@ class NewUser( val firstname: String?, val lastname: String?, val email: String?, - val password: String? + val password: String?, ) { val officeId = "1" val roles: MutableList = NEW_USER_ROLE_IDS.toMutableList() @@ -20,5 +29,5 @@ private const val MOBILE_WALLET_ROLE_ID = 471 private const val SUPER_USER_ROLE_ID = 1 val NEW_USER_ROLE_IDS: Collection = Collections.unmodifiableList( - listOf(MOBILE_WALLET_ROLE_ID, SUPER_USER_ROLE_ID) + listOf(MOBILE_WALLET_ROLE_ID, SUPER_USER_ROLE_ID), ) diff --git a/core/model/src/main/java/com/mifospay/core/model/domain/user/UpdateUserEntityClients.kt b/core/model/src/main/java/com/mifospay/core/model/domain/user/UpdateUserEntityClients.kt index d29de3ad0..e21861e51 100644 --- a/core/model/src/main/java/com/mifospay/core/model/domain/user/UpdateUserEntityClients.kt +++ b/core/model/src/main/java/com/mifospay/core/model/domain/user/UpdateUserEntityClients.kt @@ -1,5 +1,14 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package com.mifospay.core.model.domain.user data class UpdateUserEntityClients( - var clients: ArrayList + var clients: ArrayList, ) diff --git a/core/model/src/main/java/com/mifospay/core/model/domain/user/UpdateUserEntityEmail.kt b/core/model/src/main/java/com/mifospay/core/model/domain/user/UpdateUserEntityEmail.kt index 93aece53e..b45dfc156 100644 --- a/core/model/src/main/java/com/mifospay/core/model/domain/user/UpdateUserEntityEmail.kt +++ b/core/model/src/main/java/com/mifospay/core/model/domain/user/UpdateUserEntityEmail.kt @@ -1,5 +1,14 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package com.mifospay.core.model.domain.user data class UpdateUserEntityEmail( - var email: String? + var email: String?, ) diff --git a/core/model/src/main/java/com/mifospay/core/model/domain/user/UpdateUserEntityPassword.kt b/core/model/src/main/java/com/mifospay/core/model/domain/user/UpdateUserEntityPassword.kt index 689821b0f..b1fa56521 100644 --- a/core/model/src/main/java/com/mifospay/core/model/domain/user/UpdateUserEntityPassword.kt +++ b/core/model/src/main/java/com/mifospay/core/model/domain/user/UpdateUserEntityPassword.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package com.mifospay.core.model.domain.user data class UpdateUserEntityPassword(val password: String) { diff --git a/core/model/src/main/java/com/mifospay/core/model/domain/user/User.kt b/core/model/src/main/java/com/mifospay/core/model/domain/user/User.kt index 2fdcea1a8..6b14a6029 100644 --- a/core/model/src/main/java/com/mifospay/core/model/domain/user/User.kt +++ b/core/model/src/main/java/com/mifospay/core/model/domain/user/User.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package com.mifospay.core.model.domain.user import android.os.Parcelable @@ -16,5 +25,5 @@ data class User( val permissions: List, val clients: List, val shouldRenewPassword: Boolean, - val isTwoFactorAuthenticationRequired: Boolean + val isTwoFactorAuthenticationRequired: Boolean, ) : Parcelable diff --git a/core/model/src/main/java/com/mifospay/core/model/entity/Invoice.kt b/core/model/src/main/java/com/mifospay/core/model/entity/Invoice.kt index ce00cc12a..12fd3d9f0 100644 --- a/core/model/src/main/java/com/mifospay/core/model/entity/Invoice.kt +++ b/core/model/src/main/java/com/mifospay/core/model/entity/Invoice.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package com.mifospay.core.model.entity import android.os.Parcelable @@ -33,7 +42,7 @@ data class Invoice( var title: String? = null, @SerializedName("date") - var date: @RawValue MutableList = ArrayList() + var date: @RawValue MutableList = ArrayList(), ) : Parcelable { constructor() : this(null, null, 0.0, null, 0L, null, 0L, null, ArrayList()) diff --git a/core/model/src/main/java/com/mifospay/core/model/entity/Page.kt b/core/model/src/main/java/com/mifospay/core/model/entity/Page.kt index af959dd3e..2cd34f259 100644 --- a/core/model/src/main/java/com/mifospay/core/model/entity/Page.kt +++ b/core/model/src/main/java/com/mifospay/core/model/entity/Page.kt @@ -1,6 +1,15 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package com.mifospay.core.model.entity data class Page( var totalFilteredRecords: Int = 0, - var pageItems: MutableList = ArrayList() + var pageItems: MutableList = ArrayList(), ) diff --git a/core/model/src/main/java/com/mifospay/core/model/entity/Role.kt b/core/model/src/main/java/com/mifospay/core/model/entity/Role.kt index 2bc636734..febe8f84e 100644 --- a/core/model/src/main/java/com/mifospay/core/model/entity/Role.kt +++ b/core/model/src/main/java/com/mifospay/core/model/entity/Role.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package com.mifospay.core.model.entity import android.os.Parcelable @@ -8,5 +17,5 @@ data class Role( var id: String? = null, var name: String? = null, var description: String? = null, - val disabled: Boolean + val disabled: Boolean, ) : Parcelable diff --git a/core/model/src/main/java/com/mifospay/core/model/entity/SearchedEntity.kt b/core/model/src/main/java/com/mifospay/core/model/entity/SearchedEntity.kt index 1ba810d65..6ce6d00a7 100644 --- a/core/model/src/main/java/com/mifospay/core/model/entity/SearchedEntity.kt +++ b/core/model/src/main/java/com/mifospay/core/model/entity/SearchedEntity.kt @@ -1,9 +1,17 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package com.mifospay.core.model.entity import android.os.Parcelable import kotlinx.parcelize.Parcelize - @Parcelize data class SearchedEntity( var entityId: Int = 0, @@ -11,5 +19,5 @@ data class SearchedEntity( var entityName: String = " ", var entityType: String = " ", var parentId: Int = 0, - var parentName: String = " " + var parentName: String = " ", ) : Parcelable diff --git a/core/model/src/main/java/com/mifospay/core/model/entity/TPTResponse.kt b/core/model/src/main/java/com/mifospay/core/model/entity/TPTResponse.kt index b3ad02124..2adb9aaaa 100644 --- a/core/model/src/main/java/com/mifospay/core/model/entity/TPTResponse.kt +++ b/core/model/src/main/java/com/mifospay/core/model/entity/TPTResponse.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package com.mifospay.core.model.entity import android.os.Parcelable diff --git a/core/model/src/main/java/com/mifospay/core/model/entity/Timeline.kt b/core/model/src/main/java/com/mifospay/core/model/entity/Timeline.kt index e26d8c4a8..8ee44f42a 100644 --- a/core/model/src/main/java/com/mifospay/core/model/entity/Timeline.kt +++ b/core/model/src/main/java/com/mifospay/core/model/entity/Timeline.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package com.mifospay.core.model.entity import android.os.Parcelable @@ -16,7 +25,7 @@ data class Timeline( var closedOnDate: List = ArrayList(), var closedByUsername: String? = null, var closedByFirstname: String? = null, - var closedByLastname: String? = null + var closedByLastname: String? = null, ) : Parcelable { constructor() : this(ArrayList(), "", "", "", ArrayList(), "", "", "", ArrayList(), "", "", "") -} \ No newline at end of file +} diff --git a/core/model/src/main/java/com/mifospay/core/model/entity/UserEntity.kt b/core/model/src/main/java/com/mifospay/core/model/entity/UserEntity.kt index e75133fec..63c6277cd 100644 --- a/core/model/src/main/java/com/mifospay/core/model/entity/UserEntity.kt +++ b/core/model/src/main/java/com/mifospay/core/model/entity/UserEntity.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package com.mifospay.core.model.entity data class UserEntity( @@ -11,5 +20,5 @@ data class UserEntity( val permissions: List, val clients: List, val shouldRenewPassword: Boolean, - val isTwoFactorAuthenticationRequired: Boolean + val isTwoFactorAuthenticationRequired: Boolean, ) diff --git a/core/model/src/main/java/com/mifospay/core/model/entity/UserWithRole.kt b/core/model/src/main/java/com/mifospay/core/model/entity/UserWithRole.kt index df237b2e8..fb752e586 100644 --- a/core/model/src/main/java/com/mifospay/core/model/entity/UserWithRole.kt +++ b/core/model/src/main/java/com/mifospay/core/model/entity/UserWithRole.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package com.mifospay.core.model.entity import android.os.Parcelable @@ -10,5 +19,5 @@ data class UserWithRole( var firstname: String? = null, var lastname: String? = null, var email: String? = null, - var selectedRoles: List? = ArrayList() + var selectedRoles: List? = ArrayList(), ) : Parcelable diff --git a/core/model/src/main/java/com/mifospay/core/model/entity/accounts/SavingAccountsListResponse.kt b/core/model/src/main/java/com/mifospay/core/model/entity/accounts/SavingAccountsListResponse.kt index 8f5248d28..ea86805fe 100644 --- a/core/model/src/main/java/com/mifospay/core/model/entity/accounts/SavingAccountsListResponse.kt +++ b/core/model/src/main/java/com/mifospay/core/model/entity/accounts/SavingAccountsListResponse.kt @@ -1,7 +1,16 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package com.mifospay.core.model.entity.accounts import com.mifospay.core.model.entity.accounts.savings.SavingAccount data class SavingAccountsListResponse( - var savingsAccounts: List = ArrayList() + var savingsAccounts: List = ArrayList(), ) diff --git a/core/model/src/main/java/com/mifospay/core/model/entity/accounts/savings/Currency.kt b/core/model/src/main/java/com/mifospay/core/model/entity/accounts/savings/Currency.kt index d6a396426..962fd9e7b 100644 --- a/core/model/src/main/java/com/mifospay/core/model/entity/accounts/savings/Currency.kt +++ b/core/model/src/main/java/com/mifospay/core/model/entity/accounts/savings/Currency.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package com.mifospay.core.model.entity.accounts.savings import android.os.Parcelable @@ -26,7 +35,7 @@ data class Currency( var nameCode: String = " ", @SerializedName("displayLabel") - var displayLabel: String = " " + var displayLabel: String = " ", ) : Parcelable { constructor() : this("", "", 0, 0, "", "", "") diff --git a/core/model/src/main/java/com/mifospay/core/model/entity/accounts/savings/PaymentDetailData.kt b/core/model/src/main/java/com/mifospay/core/model/entity/accounts/savings/PaymentDetailData.kt index e7ad8f1f1..718942f83 100644 --- a/core/model/src/main/java/com/mifospay/core/model/entity/accounts/savings/PaymentDetailData.kt +++ b/core/model/src/main/java/com/mifospay/core/model/entity/accounts/savings/PaymentDetailData.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package com.mifospay.core.model.entity.accounts.savings import android.os.Parcelable @@ -25,7 +34,7 @@ data class PaymentDetailData( var receiptNumber: String? = null, @SerializedName("bankNumber") - var bankNumber: String? = null + var bankNumber: String? = null, ) : Parcelable { constructor() : this(null, null, null, null, null, null, null) } diff --git a/core/model/src/main/java/com/mifospay/core/model/entity/accounts/savings/PaymentType.kt b/core/model/src/main/java/com/mifospay/core/model/entity/accounts/savings/PaymentType.kt index 63ebaeb1d..034d39aa5 100644 --- a/core/model/src/main/java/com/mifospay/core/model/entity/accounts/savings/PaymentType.kt +++ b/core/model/src/main/java/com/mifospay/core/model/entity/accounts/savings/PaymentType.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package com.mifospay.core.model.entity.accounts.savings import android.os.Parcelable @@ -10,6 +19,6 @@ data class PaymentType( var id: Int? = null, @SerializedName("name") - var name: String? = null + var name: String? = null, ) : Parcelable diff --git a/core/model/src/main/java/com/mifospay/core/model/entity/accounts/savings/SavingAccount.kt b/core/model/src/main/java/com/mifospay/core/model/entity/accounts/savings/SavingAccount.kt index 4bafd145b..8d6ce73b2 100644 --- a/core/model/src/main/java/com/mifospay/core/model/entity/accounts/savings/SavingAccount.kt +++ b/core/model/src/main/java/com/mifospay/core/model/entity/accounts/savings/SavingAccount.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package com.mifospay.core.model.entity.accounts.savings import android.os.Parcelable @@ -6,19 +15,19 @@ import com.mifospay.core.model.entity.client.DepositType import kotlinx.parcelize.Parcelize @Parcelize -data class SavingAccount( +data class SavingAccount( @SerializedName("id") var id: Long = 0L, @SerializedName("accountNo") - var accountNo: String=" ", + var accountNo: String = " ", @SerializedName("productName") - var productName: String= " ", - + var productName: String = " ", + @SerializedName("productId") - var productId: Int=0 , + var productId: Int = 0, @SerializedName("overdraftLimit") var overdraftLimit: Long = 0L, @@ -30,30 +39,30 @@ data class SavingAccount( var accountBalance: Double = 0.0, @SerializedName("totalDeposits") - var totalDeposits :Double = 0.0, + var totalDeposits: Double = 0.0, @SerializedName("savingsProductName") - var savingsProductName: String?=null, + var savingsProductName: String? = null, @SerializedName("clientName") - var clientName: String?=null, + var clientName: String? = null, @SerializedName("savingsProductId") - var savingsProductId: String?=null, + var savingsProductId: String? = null, @SerializedName("nominalAnnualInterestRate") var nominalAnnualInterestRate: Double = 0.0, @SerializedName("status") - var status: Status?=null, + var status: Status? = null, @SerializedName("currency") - var currency: Currency= Currency(), + var currency: Currency = Currency(), @SerializedName("depositType") - var depositType: DepositType?=null, + var depositType: DepositType? = null, -): Parcelable { +) : Parcelable { fun isRecurring(): Boolean { return this.depositType != null && this.depositType!!.isRecurring } diff --git a/core/model/src/main/java/com/mifospay/core/model/entity/accounts/savings/SavingsWithAssociations.kt b/core/model/src/main/java/com/mifospay/core/model/entity/accounts/savings/SavingsWithAssociations.kt index 424fc4506..50a202acf 100644 --- a/core/model/src/main/java/com/mifospay/core/model/entity/accounts/savings/SavingsWithAssociations.kt +++ b/core/model/src/main/java/com/mifospay/core/model/entity/accounts/savings/SavingsWithAssociations.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package com.mifospay.core.model.entity.accounts.savings import android.os.Parcelable @@ -75,7 +84,7 @@ data class SavingsWithAssociations( var summary: Summary? = null, @SerializedName("transactions") - var transactions: List = ArrayList() + var transactions: List = ArrayList(), ) : Parcelable { constructor() : this( @@ -100,6 +109,6 @@ data class SavingsWithAssociations( null, listOf(), null, - null + null, ) } diff --git a/core/model/src/main/java/com/mifospay/core/model/entity/accounts/savings/Status.kt b/core/model/src/main/java/com/mifospay/core/model/entity/accounts/savings/Status.kt index 83d434102..205279d60 100644 --- a/core/model/src/main/java/com/mifospay/core/model/entity/accounts/savings/Status.kt +++ b/core/model/src/main/java/com/mifospay/core/model/entity/accounts/savings/Status.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package com.mifospay.core.model.entity.accounts.savings import android.os.Parcelable @@ -5,47 +14,47 @@ import com.google.gson.annotations.SerializedName import kotlinx.parcelize.Parcelize @Parcelize -data class Status ( +data class Status( @SerializedName("id") - var id: Int?=null, + var id: Int? = null, @SerializedName("code") - var code: String?=null, + var code: String? = null, @SerializedName("value") - var value: String?=null, + var value: String? = null, @SerializedName("submittedAndPendingApproval") - var submittedAndPendingApproval: Boolean?=null, + var submittedAndPendingApproval: Boolean? = null, @SerializedName("approved") - var approved: Boolean?=null, + var approved: Boolean? = null, @SerializedName("rejected") - var rejected: Boolean?=null, + var rejected: Boolean? = null, @SerializedName("withdrawnByApplicant") - var withdrawnByApplicant: Boolean?=null, + var withdrawnByApplicant: Boolean? = null, @SerializedName("active") - var active: Boolean?=null, + var active: Boolean? = null, @SerializedName("closed") - var closed: Boolean?=null, + var closed: Boolean? = null, @SerializedName("prematureClosed") - var prematureClosed: Boolean?=null, + var prematureClosed: Boolean? = null, @SerializedName("transferInProgress") - var transferInProgress: Boolean?=null, + var transferInProgress: Boolean? = null, @SerializedName("transferOnHold") - var transferOnHold: Boolean?=null, + var transferOnHold: Boolean? = null, @SerializedName("matured") - var matured: Boolean?=null, - ) : Parcelable { + var matured: Boolean? = null, +) : Parcelable { constructor() : this( null, null, @@ -59,6 +68,6 @@ data class Status ( null, null, null, - null + null, ) -} \ No newline at end of file +} diff --git a/core/model/src/main/java/com/mifospay/core/model/entity/accounts/savings/Summary.kt b/core/model/src/main/java/com/mifospay/core/model/entity/accounts/savings/Summary.kt index 0d04253df..55b0c9074 100644 --- a/core/model/src/main/java/com/mifospay/core/model/entity/accounts/savings/Summary.kt +++ b/core/model/src/main/java/com/mifospay/core/model/entity/accounts/savings/Summary.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package com.mifospay.core.model.entity.accounts.savings import android.os.Parcelable @@ -31,5 +40,5 @@ data class Summary( var interestNotPosted: Double? = null, @SerializedName("lastInterestCalculationDate") - var lastInterestCalculationDate: List? = null + var lastInterestCalculationDate: List? = null, ) : Parcelable diff --git a/core/model/src/main/java/com/mifospay/core/model/entity/accounts/savings/TimeLine.kt b/core/model/src/main/java/com/mifospay/core/model/entity/accounts/savings/TimeLine.kt index 4e3239809..aa0210783 100644 --- a/core/model/src/main/java/com/mifospay/core/model/entity/accounts/savings/TimeLine.kt +++ b/core/model/src/main/java/com/mifospay/core/model/entity/accounts/savings/TimeLine.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package com.mifospay.core.model.entity.accounts.savings import android.os.Parcelable @@ -40,7 +49,7 @@ data class TimeLine( var activatedByFirstname: String? = null, @SerializedName("activatedByLastname") - var activatedByLastname: String? = null + var activatedByLastname: String? = null, ) : Parcelable { constructor() : this( ArrayList(), @@ -54,6 +63,6 @@ data class TimeLine( null, null, null, - null + null, ) } diff --git a/core/model/src/main/java/com/mifospay/core/model/entity/accounts/savings/TransactionType.kt b/core/model/src/main/java/com/mifospay/core/model/entity/accounts/savings/TransactionType.kt index 8ef8d580a..2c72300f9 100644 --- a/core/model/src/main/java/com/mifospay/core/model/entity/accounts/savings/TransactionType.kt +++ b/core/model/src/main/java/com/mifospay/core/model/entity/accounts/savings/TransactionType.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package com.mifospay.core.model.entity.accounts.savings import android.os.Parcelable @@ -57,5 +66,5 @@ data class TransactionType( var withholdTax: Boolean = false, @SerializedName("escheat") - var escheat: Boolean? = null + var escheat: Boolean? = null, ) : Parcelable diff --git a/core/model/src/main/java/com/mifospay/core/model/entity/accounts/savings/Transactions.kt b/core/model/src/main/java/com/mifospay/core/model/entity/accounts/savings/Transactions.kt index 640dcc17d..58c3a9afa 100644 --- a/core/model/src/main/java/com/mifospay/core/model/entity/accounts/savings/Transactions.kt +++ b/core/model/src/main/java/com/mifospay/core/model/entity/accounts/savings/Transactions.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package com.mifospay.core.model.entity.accounts.savings import android.os.Parcelable @@ -44,8 +53,7 @@ data class Transactions( var submittedOnDate: List = ArrayList(), @SerializedName("interestedPostedAsOn") - - var interestedPostedAsOn: Boolean? = null + var interestedPostedAsOn: Boolean? = null, ) : Parcelable { constructor() : this( 0, @@ -60,6 +68,6 @@ data class Transactions( 0.0, false, ArrayList(), - false + false, ) } diff --git a/core/model/src/main/java/com/mifospay/core/model/entity/accounts/savings/Transfer.kt b/core/model/src/main/java/com/mifospay/core/model/entity/accounts/savings/Transfer.kt index 39c1d6bd9..5162dc4b0 100644 --- a/core/model/src/main/java/com/mifospay/core/model/entity/accounts/savings/Transfer.kt +++ b/core/model/src/main/java/com/mifospay/core/model/entity/accounts/savings/Transfer.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package com.mifospay.core.model.entity.accounts.savings import android.os.Parcelable diff --git a/core/model/src/main/java/com/mifospay/core/model/entity/accounts/savings/TransferDetail.kt b/core/model/src/main/java/com/mifospay/core/model/entity/accounts/savings/TransferDetail.kt index 2b9040a18..a7d02d0ef 100644 --- a/core/model/src/main/java/com/mifospay/core/model/entity/accounts/savings/TransferDetail.kt +++ b/core/model/src/main/java/com/mifospay/core/model/entity/accounts/savings/TransferDetail.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package com.mifospay.core.model.entity.accounts.savings import android.os.Parcelable @@ -5,7 +14,6 @@ import com.google.gson.annotations.SerializedName import com.mifospay.core.model.domain.client.Client import kotlinx.parcelize.Parcelize - @Parcelize data class TransferDetail( @SerializedName("id") @@ -23,7 +31,11 @@ data class TransferDetail( @SerializedName("toAccount") var toAccount: SavingAccount = SavingAccount(), ) : Parcelable { - constructor() : this(0L, - com.mifospay.core.model.domain.client.Client(), SavingAccount(), - com.mifospay.core.model.domain.client.Client(), SavingAccount()) + constructor() : this( + 0L, + com.mifospay.core.model.domain.client.Client(), + SavingAccount(), + com.mifospay.core.model.domain.client.Client(), + SavingAccount(), + ) } diff --git a/core/model/src/main/java/com/mifospay/core/model/entity/authentication/AuthenticationPayload.kt b/core/model/src/main/java/com/mifospay/core/model/entity/authentication/AuthenticationPayload.kt index f24ddb21d..8bd8f3cdf 100644 --- a/core/model/src/main/java/com/mifospay/core/model/entity/authentication/AuthenticationPayload.kt +++ b/core/model/src/main/java/com/mifospay/core/model/entity/authentication/AuthenticationPayload.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package com.mifospay.core.model.entity.authentication import android.os.Parcelable @@ -9,5 +18,5 @@ class AuthenticationPayload( @SerializedName("username") val userName: String, @SerializedName("password") - val password: String + val password: String, ) : Parcelable diff --git a/core/model/src/main/java/com/mifospay/core/model/entity/beneficary/Beneficiary.kt b/core/model/src/main/java/com/mifospay/core/model/entity/beneficary/Beneficiary.kt index 54797c711..4e7fe3b95 100644 --- a/core/model/src/main/java/com/mifospay/core/model/entity/beneficary/Beneficiary.kt +++ b/core/model/src/main/java/com/mifospay/core/model/entity/beneficary/Beneficiary.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package com.mifospay.core.model.entity.beneficary import android.os.Parcelable @@ -27,5 +36,5 @@ data class Beneficiary( var accountNumber: String? = null, @SerializedName("transferLimit") - var transferLimit: Int = 0 + var transferLimit: Int = 0, ) : Parcelable diff --git a/core/model/src/main/java/com/mifospay/core/model/entity/beneficary/BeneficiaryPayload.kt b/core/model/src/main/java/com/mifospay/core/model/entity/beneficary/BeneficiaryPayload.kt index ea25285fa..4fa428cd2 100644 --- a/core/model/src/main/java/com/mifospay/core/model/entity/beneficary/BeneficiaryPayload.kt +++ b/core/model/src/main/java/com/mifospay/core/model/entity/beneficary/BeneficiaryPayload.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package com.mifospay.core.model.entity.beneficary import android.os.Parcelable diff --git a/core/model/src/main/java/com/mifospay/core/model/entity/beneficary/BeneficiaryUpdatePayload.kt b/core/model/src/main/java/com/mifospay/core/model/entity/beneficary/BeneficiaryUpdatePayload.kt index f1cfa9f26..36e334e75 100644 --- a/core/model/src/main/java/com/mifospay/core/model/entity/beneficary/BeneficiaryUpdatePayload.kt +++ b/core/model/src/main/java/com/mifospay/core/model/entity/beneficary/BeneficiaryUpdatePayload.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package com.mifospay.core.model.entity.beneficary import com.google.gson.annotations.SerializedName @@ -7,5 +16,5 @@ data class BeneficiaryUpdatePayload( var name: String? = null, @SerializedName("transferLimit") - var transferLimit: Int = 0 + var transferLimit: Int = 0, ) diff --git a/core/model/src/main/java/com/mifospay/core/model/entity/client/Client.kt b/core/model/src/main/java/com/mifospay/core/model/entity/client/Client.kt index c4e8f4f12..e1cd187ae 100644 --- a/core/model/src/main/java/com/mifospay/core/model/entity/client/Client.kt +++ b/core/model/src/main/java/com/mifospay/core/model/entity/client/Client.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package com.mifospay.core.model.entity.client import android.os.Parcelable @@ -66,7 +75,7 @@ data class Client( var externalId: String = "", @SerializedName("mobileNo") - var mobileNo: String = "" + var mobileNo: String = "", ) : Parcelable { constructor() : this( 0, @@ -88,6 +97,6 @@ data class Client( 0, false, "", - "" + "", ) } diff --git a/core/model/src/main/java/com/mifospay/core/model/entity/client/ClientAccounts.kt b/core/model/src/main/java/com/mifospay/core/model/entity/client/ClientAccounts.kt index 325e466ee..b534e6f90 100644 --- a/core/model/src/main/java/com/mifospay/core/model/entity/client/ClientAccounts.kt +++ b/core/model/src/main/java/com/mifospay/core/model/entity/client/ClientAccounts.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package com.mifospay.core.model.entity.client import android.os.Parcelable @@ -6,7 +15,7 @@ import kotlinx.parcelize.Parcelize @Parcelize data class ClientAccounts( - var savingsAccounts: List = ArrayList() + var savingsAccounts: List = ArrayList(), ) : Parcelable { fun withSavingsAccounts(savingsAccounts: List): ClientAccounts { diff --git a/core/model/src/main/java/com/mifospay/core/model/entity/client/Currency.kt b/core/model/src/main/java/com/mifospay/core/model/entity/client/Currency.kt index ae4901206..7ebf60fb1 100644 --- a/core/model/src/main/java/com/mifospay/core/model/entity/client/Currency.kt +++ b/core/model/src/main/java/com/mifospay/core/model/entity/client/Currency.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package com.mifospay.core.model.entity.client import android.os.Parcelable @@ -25,4 +34,4 @@ data class Currency( var displayLabel: String? = null, ) : Parcelable { constructor() : this(null, null, null, null, null, null) -} \ No newline at end of file +} diff --git a/core/model/src/main/java/com/mifospay/core/model/entity/client/DepositType.kt b/core/model/src/main/java/com/mifospay/core/model/entity/client/DepositType.kt index 183d69b56..7a76a1a60 100644 --- a/core/model/src/main/java/com/mifospay/core/model/entity/client/DepositType.kt +++ b/core/model/src/main/java/com/mifospay/core/model/entity/client/DepositType.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package com.mifospay.core.model.entity.client import android.os.Parcelable @@ -13,7 +22,7 @@ data class DepositType( var code: String? = null, @SerializedName("value") - var value: String? = null + var value: String? = null, ) : Parcelable { val isRecurring: Boolean @@ -23,11 +32,11 @@ data class DepositType( val serverType: ServerTypes get() = ServerTypes.fromId(id!!) - enum class ServerTypes(val id: Int, val code: String, val endpoint: String) { SAVINGS(100, "depositAccountType.savingsDeposit", "savingsaccounts"), FIXED(200, "depositAccountType.fixedDeposit", "savingsaccounts"), - RECURRING(300, "depositAccountType.recurringDeposit", "recurringdepositaccounts"); + RECURRING(300, "depositAccountType.recurringDeposit", "recurringdepositaccounts"), + ; companion object { fun fromId(id: Int): ServerTypes { @@ -40,4 +49,4 @@ data class DepositType( } } } -} \ No newline at end of file +} diff --git a/core/model/src/main/java/com/mifospay/core/model/entity/client/Status.kt b/core/model/src/main/java/com/mifospay/core/model/entity/client/Status.kt index 3aa243e94..87913df15 100644 --- a/core/model/src/main/java/com/mifospay/core/model/entity/client/Status.kt +++ b/core/model/src/main/java/com/mifospay/core/model/entity/client/Status.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package com.mifospay.core.model.entity.client import android.os.Parcelable @@ -16,4 +25,4 @@ data class Status( var value: String? = null, ) : Parcelable { constructor() : this(null, null, null) -} \ No newline at end of file +} diff --git a/core/model/src/main/java/com/mifospay/core/model/entity/client/Type.kt b/core/model/src/main/java/com/mifospay/core/model/entity/client/Type.kt index d9222d900..e30c7e3fe 100644 --- a/core/model/src/main/java/com/mifospay/core/model/entity/client/Type.kt +++ b/core/model/src/main/java/com/mifospay/core/model/entity/client/Type.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package com.mifospay.core.model.entity.client import android.os.Parcelable diff --git a/core/model/src/main/java/com/mifospay/core/model/entity/kyc/KYCLevel1Details.kt b/core/model/src/main/java/com/mifospay/core/model/entity/kyc/KYCLevel1Details.kt index da741b1a4..507dd276a 100644 --- a/core/model/src/main/java/com/mifospay/core/model/entity/kyc/KYCLevel1Details.kt +++ b/core/model/src/main/java/com/mifospay/core/model/entity/kyc/KYCLevel1Details.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package com.mifospay.core.model.entity.kyc import android.os.Parcelable @@ -25,5 +34,5 @@ data class KYCLevel1Details( var dob: String? = null, @SerializedName("currentLevel") - var currentLevel: String = " " + var currentLevel: String = " ", ) : Parcelable diff --git a/core/model/src/main/java/com/mifospay/core/model/entity/noncore/Document.kt b/core/model/src/main/java/com/mifospay/core/model/entity/noncore/Document.kt index 8eedec3ee..eb371c4da 100644 --- a/core/model/src/main/java/com/mifospay/core/model/entity/noncore/Document.kt +++ b/core/model/src/main/java/com/mifospay/core/model/entity/noncore/Document.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package com.mifospay.core.model.entity.noncore import android.os.Parcelable diff --git a/core/model/src/main/java/com/mifospay/core/model/entity/payload/ClientPayload.kt b/core/model/src/main/java/com/mifospay/core/model/entity/payload/ClientPayload.kt index de7d082a2..0fc7e0b7d 100644 --- a/core/model/src/main/java/com/mifospay/core/model/entity/payload/ClientPayload.kt +++ b/core/model/src/main/java/com/mifospay/core/model/entity/payload/ClientPayload.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package com.mifospay.core.model.entity.payload import android.os.Parcelable @@ -55,5 +64,5 @@ data class ClientPayload( var locale: String? = "en", @SerializedName("datatables") - var datatables: List = ArrayList() + var datatables: List = ArrayList(), ) : Parcelable diff --git a/core/model/src/main/java/com/mifospay/core/model/entity/payload/DataTablePayload.kt b/core/model/src/main/java/com/mifospay/core/model/entity/payload/DataTablePayload.kt index 5270f5b2d..e7d62cc13 100644 --- a/core/model/src/main/java/com/mifospay/core/model/entity/payload/DataTablePayload.kt +++ b/core/model/src/main/java/com/mifospay/core/model/entity/payload/DataTablePayload.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package com.mifospay.core.model.entity.payload import android.os.Parcelable @@ -16,5 +25,5 @@ data class DataTablePayload( var dataTableString: String? = null, var registeredTableName: String? = null, var applicationTableName: String? = null, - var data: @RawValue HashMap? = null + var data: @RawValue HashMap? = null, ) : Parcelable diff --git a/core/model/src/main/java/com/mifospay/core/model/entity/payload/PayPayload.kt b/core/model/src/main/java/com/mifospay/core/model/entity/payload/PayPayload.kt index 32dc3b1cf..93abfca12 100644 --- a/core/model/src/main/java/com/mifospay/core/model/entity/payload/PayPayload.kt +++ b/core/model/src/main/java/com/mifospay/core/model/entity/payload/PayPayload.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package com.mifospay.core.model.entity.payload import android.os.Parcelable @@ -10,5 +19,5 @@ data class PayPayload( val note: String, val dateFormat: String, val paymentTypeId: Int = 1, - val locale: String = "en" + val locale: String = "en", ) : Parcelable diff --git a/core/model/src/main/java/com/mifospay/core/model/entity/payload/PayResponse.kt b/core/model/src/main/java/com/mifospay/core/model/entity/payload/PayResponse.kt index 0dd706e7d..d1998737e 100644 --- a/core/model/src/main/java/com/mifospay/core/model/entity/payload/PayResponse.kt +++ b/core/model/src/main/java/com/mifospay/core/model/entity/payload/PayResponse.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package com.mifospay.core.model.entity.payload data class PayResponse( @@ -5,9 +14,9 @@ data class PayResponse( val clientId: Int, val savingsId: Int, val resourceId: Int, - val changes: Change + val changes: Change, ) data class Change( - val paymentTypeId: Int + val paymentTypeId: Int, ) diff --git a/core/model/src/main/java/com/mifospay/core/model/entity/payload/StandingInstructionPayload.kt b/core/model/src/main/java/com/mifospay/core/model/entity/payload/StandingInstructionPayload.kt index 1676f2d2e..aab5fe44c 100644 --- a/core/model/src/main/java/com/mifospay/core/model/entity/payload/StandingInstructionPayload.kt +++ b/core/model/src/main/java/com/mifospay/core/model/entity/payload/StandingInstructionPayload.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package com.mifospay.core.model.entity.payload import android.os.Parcelable @@ -27,5 +36,5 @@ data class StandingInstructionPayload( val dateFormat: String?, var validTill: String?, var recurrenceOnMonthDay: String?, - val monthDayFormat: String? + val monthDayFormat: String?, ) : Parcelable diff --git a/core/model/src/main/java/com/mifospay/core/model/entity/payload/TransferPayload.kt b/core/model/src/main/java/com/mifospay/core/model/entity/payload/TransferPayload.kt index e9a4d1ec4..a6194e91c 100644 --- a/core/model/src/main/java/com/mifospay/core/model/entity/payload/TransferPayload.kt +++ b/core/model/src/main/java/com/mifospay/core/model/entity/payload/TransferPayload.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package com.mifospay.core.model.entity.payload import android.os.Parcelable @@ -39,7 +48,7 @@ data class TransferPayload( @SerializedName("transferDescription") var transferDescription: String? = null, var dateFormat: String? = "dd MMMM yyyy", - var locale: String? = "en" + var locale: String? = "en", ) : Parcelable { constructor() : this(null, null, null, null, null, null, null, null, null, null, null) } diff --git a/core/model/src/main/java/com/mifospay/core/model/entity/payload/UpdateVpaPayload.kt b/core/model/src/main/java/com/mifospay/core/model/entity/payload/UpdateVpaPayload.kt index 98ad5a596..10fc54e41 100644 --- a/core/model/src/main/java/com/mifospay/core/model/entity/payload/UpdateVpaPayload.kt +++ b/core/model/src/main/java/com/mifospay/core/model/entity/payload/UpdateVpaPayload.kt @@ -1,5 +1,14 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package com.mifospay.core.model.entity.payload data class UpdateVpaPayload( - var externalId: String? = null + var externalId: String? = null, ) diff --git a/core/model/src/main/java/com/mifospay/core/model/entity/register/RegisterPayload.kt b/core/model/src/main/java/com/mifospay/core/model/entity/register/RegisterPayload.kt index 688269cf8..80ed5ffb7 100644 --- a/core/model/src/main/java/com/mifospay/core/model/entity/register/RegisterPayload.kt +++ b/core/model/src/main/java/com/mifospay/core/model/entity/register/RegisterPayload.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package com.mifospay.core.model.entity.register import com.google.gson.annotations.SerializedName @@ -25,5 +34,5 @@ data class RegisterPayload( var password: String? = null, @SerializedName("authenticationMode") - var authenticationMode: String? = null -) \ No newline at end of file + var authenticationMode: String? = null, +) diff --git a/core/model/src/main/java/com/mifospay/core/model/entity/register/UserVerify.kt b/core/model/src/main/java/com/mifospay/core/model/entity/register/UserVerify.kt index a70dbdb25..3fee2f9de 100644 --- a/core/model/src/main/java/com/mifospay/core/model/entity/register/UserVerify.kt +++ b/core/model/src/main/java/com/mifospay/core/model/entity/register/UserVerify.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package com.mifospay.core.model.entity.register import com.google.gson.annotations.SerializedName @@ -7,5 +16,5 @@ data class UserVerify( var requestId: String? = null, @SerializedName("authenticationToken") - var authenticationToken: String? = null + var authenticationToken: String? = null, ) diff --git a/core/model/src/main/java/com/mifospay/core/model/entity/savedcards/Card.kt b/core/model/src/main/java/com/mifospay/core/model/entity/savedcards/Card.kt index 4d0bf267f..25d08479e 100644 --- a/core/model/src/main/java/com/mifospay/core/model/entity/savedcards/Card.kt +++ b/core/model/src/main/java/com/mifospay/core/model/entity/savedcards/Card.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package com.mifospay.core.model.entity.savedcards import android.os.Parcelable @@ -22,5 +31,5 @@ data class Card( var lastName: String = " ", @SerializedName("id") - var id: Int = 0 -) : Parcelable \ No newline at end of file + var id: Int = 0, +) : Parcelable diff --git a/core/model/src/main/java/com/mifospay/core/model/entity/standinginstruction/SDIResponse.kt b/core/model/src/main/java/com/mifospay/core/model/entity/standinginstruction/SDIResponse.kt index bd375d180..f3a320406 100644 --- a/core/model/src/main/java/com/mifospay/core/model/entity/standinginstruction/SDIResponse.kt +++ b/core/model/src/main/java/com/mifospay/core/model/entity/standinginstruction/SDIResponse.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package com.mifospay.core.model.entity.standinginstruction import android.os.Parcelable diff --git a/core/model/src/main/java/com/mifospay/core/model/entity/standinginstruction/StandingInstruction.kt b/core/model/src/main/java/com/mifospay/core/model/entity/standinginstruction/StandingInstruction.kt index 661ecdd83..11aacf0ba 100644 --- a/core/model/src/main/java/com/mifospay/core/model/entity/standinginstruction/StandingInstruction.kt +++ b/core/model/src/main/java/com/mifospay/core/model/entity/standinginstruction/StandingInstruction.kt @@ -1,11 +1,20 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package com.mifospay.core.model.entity.standinginstruction import android.os.Parcelable import com.google.gson.annotations.SerializedName -import kotlinx.parcelize.Parcelize import com.mifospay.core.model.entity.accounts.savings.SavingAccount import com.mifospay.core.model.entity.client.Client import com.mifospay.core.model.entity.client.Status +import kotlinx.parcelize.Parcelize @Parcelize data class StandingInstruction( @@ -43,5 +52,5 @@ data class StandingInstruction( var recurrenceInterval: Int, @SerializedName("recurrenceOnMonthDay") - val recurrenceOnMonthDay: List -) : Parcelable \ No newline at end of file + val recurrenceOnMonthDay: List, +) : Parcelable diff --git a/core/model/src/main/java/com/mifospay/core/model/entity/templates/account/AccountOption.kt b/core/model/src/main/java/com/mifospay/core/model/entity/templates/account/AccountOption.kt index 6bffe780d..ca3e6434b 100644 --- a/core/model/src/main/java/com/mifospay/core/model/entity/templates/account/AccountOption.kt +++ b/core/model/src/main/java/com/mifospay/core/model/entity/templates/account/AccountOption.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package com.mifospay.core.model.entity.templates.account import android.os.Parcelable diff --git a/core/model/src/main/java/com/mifospay/core/model/entity/templates/account/AccountOptionsTemplate.kt b/core/model/src/main/java/com/mifospay/core/model/entity/templates/account/AccountOptionsTemplate.kt index afdd640a9..6f6e068a3 100644 --- a/core/model/src/main/java/com/mifospay/core/model/entity/templates/account/AccountOptionsTemplate.kt +++ b/core/model/src/main/java/com/mifospay/core/model/entity/templates/account/AccountOptionsTemplate.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package com.mifospay.core.model.entity.templates.account import android.os.Parcelable @@ -9,5 +18,5 @@ data class AccountOptionsTemplate( var fromAccountOptions: List? = ArrayList(), @SerializedName("toAccountOptions") - var toAccountOptions: List? = ArrayList() + var toAccountOptions: List? = ArrayList(), ) : Parcelable diff --git a/core/model/src/main/java/com/mifospay/core/model/entity/templates/account/AccountType.kt b/core/model/src/main/java/com/mifospay/core/model/entity/templates/account/AccountType.kt index 13ee87508..0df94a88d 100644 --- a/core/model/src/main/java/com/mifospay/core/model/entity/templates/account/AccountType.kt +++ b/core/model/src/main/java/com/mifospay/core/model/entity/templates/account/AccountType.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package com.mifospay.core.model.entity.templates.account import android.os.Parcelable diff --git a/core/model/src/main/java/com/mifospay/core/model/entity/templates/beneficiary/AccountTypeOption.kt b/core/model/src/main/java/com/mifospay/core/model/entity/templates/beneficiary/AccountTypeOption.kt index 6f71169a0..54467b5fa 100644 --- a/core/model/src/main/java/com/mifospay/core/model/entity/templates/beneficiary/AccountTypeOption.kt +++ b/core/model/src/main/java/com/mifospay/core/model/entity/templates/beneficiary/AccountTypeOption.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package com.mifospay.core.model.entity.templates.beneficiary import android.os.Parcelable diff --git a/core/model/src/main/java/com/mifospay/core/model/entity/templates/beneficiary/BeneficiaryTemplate.kt b/core/model/src/main/java/com/mifospay/core/model/entity/templates/beneficiary/BeneficiaryTemplate.kt index f4c2927fd..4468f9756 100644 --- a/core/model/src/main/java/com/mifospay/core/model/entity/templates/beneficiary/BeneficiaryTemplate.kt +++ b/core/model/src/main/java/com/mifospay/core/model/entity/templates/beneficiary/BeneficiaryTemplate.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package com.mifospay.core.model.entity.templates.beneficiary import android.os.Parcelable @@ -7,5 +16,5 @@ import kotlinx.parcelize.Parcelize @Parcelize data class BeneficiaryTemplate( @SerializedName("accountTypeOptions") - var accountTypeOptions: List? = null + var accountTypeOptions: List? = null, ) : Parcelable diff --git a/core/model/src/main/java/com/mifospay/core/model/signup/PasswordStrength.kt b/core/model/src/main/java/com/mifospay/core/model/signup/PasswordStrength.kt index fc3ab405a..c14ecab3e 100644 --- a/core/model/src/main/java/com/mifospay/core/model/signup/PasswordStrength.kt +++ b/core/model/src/main/java/com/mifospay/core/model/signup/PasswordStrength.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package com.mifospay.core.model.signup enum class PasswordStrength { @@ -6,5 +15,5 @@ enum class PasswordStrength { STRONG, VERY_STRONG, EXCELLENT, - INVALID + INVALID, } diff --git a/core/model/src/main/java/com/mifospay/core/model/signup/SignupData.kt b/core/model/src/main/java/com/mifospay/core/model/signup/SignupData.kt index 734d9e060..6ccc012d6 100644 --- a/core/model/src/main/java/com/mifospay/core/model/signup/SignupData.kt +++ b/core/model/src/main/java/com/mifospay/core/model/signup/SignupData.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package com.mifospay.core.model.signup import android.os.Parcelable @@ -19,5 +28,5 @@ data class SignupData( val city: String? = null, val countryName: String? = null, val countryId: String? = null, - val mifosSavingsProductId: Int = 0 + val mifosSavingsProductId: Int = 0, ) : Parcelable diff --git a/core/model/src/main/java/com/mifospay/core/model/utils/DateHelper.kt b/core/model/src/main/java/com/mifospay/core/model/utils/DateHelper.kt index 2fca45cf1..da39fd6ab 100644 --- a/core/model/src/main/java/com/mifospay/core/model/utils/DateHelper.kt +++ b/core/model/src/main/java/com/mifospay/core/model/utils/DateHelper.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package com.mifospay.core.model.utils import android.util.Log @@ -8,10 +17,9 @@ import java.util.Date import java.util.Locale object DateHelper { - val LOG_TAG = DateHelper::class.java.simpleName - const val FORMAT_dd_MMMM_yyyy = "dd MMMM yyyy" - const val DD_MMM_YYYY = "dd MMM yyyy" - const val DD_MM_YYYY = "dd-MM-yyyy" + private val LOG_TAG = DateHelper::class.java.simpleName + private const val DD_MMM_YYYY = "dd MMM yyyy" + private const val DD_MM_YYYY = "dd-MM-yyyy" /** * the result string uses the list given in a reverse order ([x, y, z] results in "z y x") @@ -34,7 +42,8 @@ object DateHelper { fun getDateAsString(integersOfDate: List, pattern: String?): String { return getFormatConverter( DD_MMM_YYYY, - pattern, getDateAsString(integersOfDate) + pattern, + getDateAsString(integersOfDate), ) } @@ -45,21 +54,22 @@ object DateHelper { * @param dateString date string * @return dd MMMM yyyy format date string. */ - fun getSpecificFormat(format: String?, dateString: String?): String { + fun getSpecificFormat(format: String, dateString: String): String { val pickerFormat = SimpleDateFormat(DD_MM_YYYY, Locale.ENGLISH) val finalFormat = SimpleDateFormat(format, Locale.ENGLISH) var date: Date? = null try { date = pickerFormat.parse(dateString) } catch (e: ParseException) { - Log.d(LOG_TAG, e.localizedMessage) + Log.d(LOG_TAG, e.message.toString()) } return finalFormat.format(date) } fun getFormatConverter( - currentFormat: String?, requiredFormat: String?, - dateString: String? + currentFormat: String?, + requiredFormat: String?, + dateString: String?, ): String { val pickerFormat = SimpleDateFormat(currentFormat, Locale.ENGLISH) val finalFormat = SimpleDateFormat(requiredFormat, Locale.ENGLISH) @@ -76,7 +86,7 @@ object DateHelper { * @param month an integer from 1 to 12 * @return string representation of the month like Jan or Feb..etc */ - fun getMonthName(month: Int): String { + private fun getMonthName(month: Int): String { var monthName = "" when (month) { 1 -> monthName = "Jan" @@ -95,8 +105,8 @@ object DateHelper { return monthName } - fun getDateAsLongFromString(dateStr: String?, pattern: String?): Long { - val sdf = SimpleDateFormat(pattern) + private fun getDateAsLongFromString(dateStr: String?, pattern: String?): Long { + val sdf = SimpleDateFormat(pattern, Locale.getDefault()) var date: Date? = null try { date = sdf.parse(dateStr) @@ -125,7 +135,7 @@ object DateHelper { @JvmStatic fun getDateAsStringFromLong(timeInMillis: Long): String { - val sdf = SimpleDateFormat(DD_MMM_YYYY) + val sdf = SimpleDateFormat(DD_MMM_YYYY, Locale.getDefault()) return sdf.format(Date(timeInMillis)) } -} \ No newline at end of file +} diff --git a/core/model/src/test/java/com/mifos/mobilewallet/model/ExampleUnitTest.kt b/core/model/src/test/java/com/mifos/mobilewallet/model/ExampleUnitTest.kt index ec0ddd756..1915be841 100644 --- a/core/model/src/test/java/com/mifos/mobilewallet/model/ExampleUnitTest.kt +++ b/core/model/src/test/java/com/mifos/mobilewallet/model/ExampleUnitTest.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package com.mifos.mobilewallet.model import org.junit.Assert.assertEquals @@ -13,4 +22,4 @@ class ExampleUnitTest { fun addition_isCorrect() { assertEquals(4, 2 + 2) } -} \ No newline at end of file +} diff --git a/core/network/build.gradle.kts b/core/network/build.gradle.kts index 5850c8241..0a8390812 100644 --- a/core/network/build.gradle.kts +++ b/core/network/build.gradle.kts @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ plugins { alias(libs.plugins.mifospay.android.library) alias(libs.plugins.mifospay.android.hilt) @@ -37,8 +46,5 @@ dependencies { implementation(libs.reactivex.rxjava.android) implementation(libs.reactivex.rxjava) - implementation(libs.jetbrains.kotlin.jdk7) - - testImplementation(libs.kotlinx.coroutines.test) } diff --git a/core/network/src/main/AndroidManifest.xml b/core/network/src/main/AndroidManifest.xml index a5918e68a..961389810 100644 --- a/core/network/src/main/AndroidManifest.xml +++ b/core/network/src/main/AndroidManifest.xml @@ -1,4 +1,13 @@ + \ No newline at end of file diff --git a/core/network/src/main/kotlin/org/mifospay/core/network/ApiEndPoints.kt b/core/network/src/main/kotlin/org/mifospay/core/network/ApiEndPoints.kt index ae2308f71..eb4d9bee8 100644 --- a/core/network/src/main/kotlin/org/mifospay/core/network/ApiEndPoints.kt +++ b/core/network/src/main/kotlin/org/mifospay/core/network/ApiEndPoints.kt @@ -1,7 +1,16 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.network object ApiEndPoints { - //This class contains all the Constants for API End Points + // This class contains all the Constants for API End Points const val AUTHENTICATION = "authentication" const val REGISTRATION = "registration" const val CLIENTS = "clients" diff --git a/core/network/src/main/kotlin/org/mifospay/core/network/ApiInterceptor.kt b/core/network/src/main/kotlin/org/mifospay/core/network/ApiInterceptor.kt index 966781178..a006691cd 100644 --- a/core/network/src/main/kotlin/org/mifospay/core/network/ApiInterceptor.kt +++ b/core/network/src/main/kotlin/org/mifospay/core/network/ApiInterceptor.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.network import okhttp3.Interceptor @@ -12,7 +21,7 @@ class ApiInterceptor(private val preferencesHelper: PreferencesHelper) : Interce val chainRequest = chain.request() val builder = chainRequest.newBuilder().header( org.mifospay.core.network.ApiInterceptor.Companion.HEADER_TENANT, - org.mifospay.core.network.ApiInterceptor.Companion.DEFAULT + org.mifospay.core.network.ApiInterceptor.Companion.DEFAULT, ) val authToken = preferencesHelper.token if (!authToken.isNullOrEmpty()) { diff --git a/core/network/src/main/kotlin/org/mifospay/core/network/BaseURL.kt b/core/network/src/main/kotlin/org/mifospay/core/network/BaseURL.kt index 2af67897d..1359b7e8c 100644 --- a/core/network/src/main/kotlin/org/mifospay/core/network/BaseURL.kt +++ b/core/network/src/main/kotlin/org/mifospay/core/network/BaseURL.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.network class BaseURL { @@ -11,7 +20,7 @@ class BaseURL { const val API_ENDPOINT = "venus.mifos.community" const val API_PATH = "/fineract-provider/api/v1/" - //self service url + // self service url const val API_ENDPOINT_SELF = "venus.mifos.community" const val API_PATH_SELF = "/fineract-provider/api/v1/self/" } diff --git a/core/network/src/main/kotlin/org/mifospay/core/network/FineractApiManager.kt b/core/network/src/main/kotlin/org/mifospay/core/network/FineractApiManager.kt index 7d0b8cf76..0b4b41062 100644 --- a/core/network/src/main/kotlin/org/mifospay/core/network/FineractApiManager.kt +++ b/core/network/src/main/kotlin/org/mifospay/core/network/FineractApiManager.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.network import org.mifospay.core.network.services.AccountTransfersService diff --git a/core/network/src/main/kotlin/org/mifospay/core/network/GenericResponse.kt b/core/network/src/main/kotlin/org/mifospay/core/network/GenericResponse.kt index ae12d7100..59c2772f4 100644 --- a/core/network/src/main/kotlin/org/mifospay/core/network/GenericResponse.kt +++ b/core/network/src/main/kotlin/org/mifospay/core/network/GenericResponse.kt @@ -1,5 +1,14 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.network data class GenericResponse( - var responseFields: HashMap = hashMapOf() + var responseFields: HashMap = hashMapOf(), ) diff --git a/core/network/src/main/kotlin/org/mifospay/core/network/JvmLocalAssetManager.kt b/core/network/src/main/kotlin/org/mifospay/core/network/JvmLocalAssetManager.kt index 5c43c784f..a2e332838 100644 --- a/core/network/src/main/kotlin/org/mifospay/core/network/JvmLocalAssetManager.kt +++ b/core/network/src/main/kotlin/org/mifospay/core/network/JvmLocalAssetManager.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.network import androidx.annotation.VisibleForTesting diff --git a/core/network/src/main/kotlin/org/mifospay/core/network/MifosWalletOkHttpClient.kt b/core/network/src/main/kotlin/org/mifospay/core/network/MifosWalletOkHttpClient.kt index 1db7e8e60..c58705e70 100644 --- a/core/network/src/main/kotlin/org/mifospay/core/network/MifosWalletOkHttpClient.kt +++ b/core/network/src/main/kotlin/org/mifospay/core/network/MifosWalletOkHttpClient.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.network import okhttp3.OkHttpClient @@ -14,7 +23,7 @@ import javax.net.ssl.X509TrustManager class MifosWalletOkHttpClient(private val preferences: PreferencesHelper) { // Create a trust manager that does not validate certificate chains val mifosOkHttpClient: OkHttpClient - //Interceptor :> Full Body Logger and ApiRequest Header + // Interceptor :> Full Body Logger and ApiRequest Header get() { val builder = OkHttpClient.Builder() try { @@ -24,21 +33,21 @@ class MifosWalletOkHttpClient(private val preferences: PreferencesHelper) { @Throws(CertificateException::class) override fun checkClientTrusted( chain: Array, - authType: String + authType: String, ) { } @Throws(CertificateException::class) override fun checkServerTrusted( chain: Array, - authType: String + authType: String, ) { } override fun getAcceptedIssuers(): Array { return emptyArray() } - } + }, ) // Install the all-trusting trust manager @@ -47,14 +56,14 @@ class MifosWalletOkHttpClient(private val preferences: PreferencesHelper) { // Create an ssl socket factory with our all-trusting manager val sslSocketFactory = sslContext.socketFactory - //Enable Full Body Logging + // Enable Full Body Logging val logger = HttpLoggingInterceptor() logger.level = HttpLoggingInterceptor.Level.BODY - //Set SSL certificate to OkHttpClient Builder + // Set SSL certificate to OkHttpClient Builder // builder.sslSocketFactory(sslSocketFactory) builder.sslSocketFactory(sslSocketFactory, trustAllCerts[0] as X509TrustManager) - builder.hostnameVerifier { hostname, session -> true } + builder.hostnameVerifier { _, _ -> true } } catch (e: Exception) { throw RuntimeException(e) } diff --git a/core/network/src/main/kotlin/org/mifospay/core/network/SelfServiceApiManager.kt b/core/network/src/main/kotlin/org/mifospay/core/network/SelfServiceApiManager.kt index bb5ce1c27..834b790bb 100644 --- a/core/network/src/main/kotlin/org/mifospay/core/network/SelfServiceApiManager.kt +++ b/core/network/src/main/kotlin/org/mifospay/core/network/SelfServiceApiManager.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.network import org.mifospay.core.network.services.AuthenticationService diff --git a/core/network/src/main/kotlin/org/mifospay/core/network/di/LocalModule.kt b/core/network/src/main/kotlin/org/mifospay/core/network/di/LocalModule.kt index cb998b332..c6217e930 100644 --- a/core/network/src/main/kotlin/org/mifospay/core/network/di/LocalModule.kt +++ b/core/network/src/main/kotlin/org/mifospay/core/network/di/LocalModule.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.network.di import dagger.Binds diff --git a/core/network/src/main/kotlin/org/mifospay/core/network/di/NetworkModule.kt b/core/network/src/main/kotlin/org/mifospay/core/network/di/NetworkModule.kt index 699290073..45e4f79f8 100644 --- a/core/network/src/main/kotlin/org/mifospay/core/network/di/NetworkModule.kt +++ b/core/network/src/main/kotlin/org/mifospay/core/network/di/NetworkModule.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.network.di import android.content.Context @@ -113,7 +122,7 @@ class NetworkModule { userService, thirdPartyTransferService, standingInstructionService, - notificationService + notificationService, ) } @@ -133,11 +142,11 @@ class NetworkModule { savingsAccountsService, registrationService, beneficiaryService, - thirdPartyTransferService + thirdPartyTransferService, ) } - //-----Fineract API Service---------// + // -----Fineract API Service---------// @Provides @Singleton @@ -240,13 +249,13 @@ class NetworkModule { return retrofit.create(StandingInstructionService::class.java) } - //-------SelfService API Service-------// + // -------SelfService API Service-------// @Provides @Singleton @Named("SelfServiceAuthenticationService") fun providesSelfServiceAuthenticationService( - @SelfServiceApi retrofit: Retrofit + @SelfServiceApi retrofit: Retrofit, ): AuthenticationService { return retrofit.create(AuthenticationService::class.java) } @@ -255,7 +264,7 @@ class NetworkModule { @Singleton @Named("SelfServiceClientService") fun providesSelfServiceClientService( - @SelfServiceApi retrofit: Retrofit + @SelfServiceApi retrofit: Retrofit, ): ClientService { return retrofit.create(ClientService::class.java) } @@ -264,7 +273,7 @@ class NetworkModule { @Singleton @Named("SelfServiceSavingsAccountsService") fun providesSelfServiceSavingsAccountsService( - @SelfServiceApi retrofit: Retrofit + @SelfServiceApi retrofit: Retrofit, ): SavingsAccountsService { return retrofit.create(SavingsAccountsService::class.java) } @@ -273,7 +282,7 @@ class NetworkModule { @Singleton @Named("SelfServiceRegistrationService") fun providesSelfServiceRegistrationService( - @SelfServiceApi retrofit: Retrofit + @SelfServiceApi retrofit: Retrofit, ): RegistrationService { return retrofit.create(RegistrationService::class.java) } @@ -281,7 +290,7 @@ class NetworkModule { @Provides @Singleton fun providesSelfServiceBeneficiaryService( - @SelfServiceApi retrofit: Retrofit + @SelfServiceApi retrofit: Retrofit, ): BeneficiaryService { return retrofit.create(BeneficiaryService::class.java) } @@ -290,8 +299,8 @@ class NetworkModule { @Singleton @Named("SelfServiceThirdPartyTransferService") fun providesSelfServiceThirdPartyTransferService( - @SelfServiceApi retrofit: Retrofit + @SelfServiceApi retrofit: Retrofit, ): ThirdPartyTransferService { return retrofit.create(ThirdPartyTransferService::class.java) } -} \ No newline at end of file +} diff --git a/core/network/src/main/kotlin/org/mifospay/core/network/di/Qualifier.kt b/core/network/src/main/kotlin/org/mifospay/core/network/di/Qualifier.kt index 7b5815f34..10c2ed1a8 100644 --- a/core/network/src/main/kotlin/org/mifospay/core/network/di/Qualifier.kt +++ b/core/network/src/main/kotlin/org/mifospay/core/network/di/Qualifier.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.network.di import javax.inject.Qualifier diff --git a/core/network/src/main/kotlin/org/mifospay/core/network/localAssets/LocalAssetDataSource.kt b/core/network/src/main/kotlin/org/mifospay/core/network/localAssets/LocalAssetDataSource.kt index e112cc86f..351a54ba9 100644 --- a/core/network/src/main/kotlin/org/mifospay/core/network/localAssets/LocalAssetDataSource.kt +++ b/core/network/src/main/kotlin/org/mifospay/core/network/localAssets/LocalAssetDataSource.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.network.localAssets import com.mifospay.core.model.City diff --git a/core/network/src/main/kotlin/org/mifospay/core/network/localAssets/LocalAssetManager.kt b/core/network/src/main/kotlin/org/mifospay/core/network/localAssets/LocalAssetManager.kt index b5db8e70e..9930fbcf2 100644 --- a/core/network/src/main/kotlin/org/mifospay/core/network/localAssets/LocalAssetManager.kt +++ b/core/network/src/main/kotlin/org/mifospay/core/network/localAssets/LocalAssetManager.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.network.localAssets import java.io.InputStream diff --git a/core/network/src/main/kotlin/org/mifospay/core/network/localAssets/MifosLocalAssetDataSource.kt b/core/network/src/main/kotlin/org/mifospay/core/network/localAssets/MifosLocalAssetDataSource.kt index 3c74ae5e8..4b85dc667 100644 --- a/core/network/src/main/kotlin/org/mifospay/core/network/localAssets/MifosLocalAssetDataSource.kt +++ b/core/network/src/main/kotlin/org/mifospay/core/network/localAssets/MifosLocalAssetDataSource.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.network.localAssets import android.annotation.SuppressLint diff --git a/core/network/src/main/kotlin/org/mifospay/core/network/services/AccountTransfersService.kt b/core/network/src/main/kotlin/org/mifospay/core/network/services/AccountTransfersService.kt index 85f84e354..731fb2795 100644 --- a/core/network/src/main/kotlin/org/mifospay/core/network/services/AccountTransfersService.kt +++ b/core/network/src/main/kotlin/org/mifospay/core/network/services/AccountTransfersService.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.network.services import com.mifospay.core.model.entity.accounts.savings.TransferDetail diff --git a/core/network/src/main/kotlin/org/mifospay/core/network/services/AuthenticationService.kt b/core/network/src/main/kotlin/org/mifospay/core/network/services/AuthenticationService.kt index 0bd3d366e..c4706dc3c 100644 --- a/core/network/src/main/kotlin/org/mifospay/core/network/services/AuthenticationService.kt +++ b/core/network/src/main/kotlin/org/mifospay/core/network/services/AuthenticationService.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.network.services import com.mifospay.core.model.domain.user.User diff --git a/core/network/src/main/kotlin/org/mifospay/core/network/services/BeneficiaryService.kt b/core/network/src/main/kotlin/org/mifospay/core/network/services/BeneficiaryService.kt index 427f114a4..e9b074a1a 100644 --- a/core/network/src/main/kotlin/org/mifospay/core/network/services/BeneficiaryService.kt +++ b/core/network/src/main/kotlin/org/mifospay/core/network/services/BeneficiaryService.kt @@ -1,10 +1,19 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.network.services -import okhttp3.ResponseBody 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.templates.beneficiary.BeneficiaryTemplate +import okhttp3.ResponseBody import org.mifospay.core.network.ApiEndPoints import retrofit2.http.Body import retrofit2.http.DELETE @@ -30,7 +39,7 @@ interface BeneficiaryService { @PUT(ApiEndPoints.BENEFICIARIES + "/tpt/{beneficiaryId}") fun updateBeneficiary( @Path("beneficiaryId") beneficiaryId: Long, - @Body payload: BeneficiaryUpdatePayload + @Body payload: BeneficiaryUpdatePayload, ): Observable @DELETE(ApiEndPoints.BENEFICIARIES + "/tpt/{beneficiaryId}") diff --git a/core/network/src/main/kotlin/org/mifospay/core/network/services/ClientService.kt b/core/network/src/main/kotlin/org/mifospay/core/network/services/ClientService.kt index 972a90073..02f7511f3 100644 --- a/core/network/src/main/kotlin/org/mifospay/core/network/services/ClientService.kt +++ b/core/network/src/main/kotlin/org/mifospay/core/network/services/ClientService.kt @@ -1,11 +1,20 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.network.services import com.mifospay.core.model.domain.NewAccount -import okhttp3.MultipartBody -import okhttp3.ResponseBody import com.mifospay.core.model.entity.Page import com.mifospay.core.model.entity.client.Client import com.mifospay.core.model.entity.client.ClientAccounts +import okhttp3.MultipartBody +import okhttp3.ResponseBody import org.mifospay.core.network.ApiEndPoints import org.mifospay.core.network.GenericResponse import retrofit2.http.Body @@ -27,7 +36,7 @@ interface ClientService { @PUT(ApiEndPoints.CLIENTS + "/{clientId}") fun updateClient( @Path("clientId") clientId: Long, - @Body payload: Any + @Body payload: Any, ): Observable @GET(ApiEndPoints.CLIENTS + "/{clientId}/images") @@ -36,7 +45,7 @@ interface ClientService { @PUT(ApiEndPoints.CLIENTS + "/{clientId}/images") fun updateClientImage( @Path("clientId") clientId: Long, - @Part typedFile: MultipartBody.Part? + @Part typedFile: MultipartBody.Part?, ): Observable @GET(ApiEndPoints.CLIENTS + "/{clientId}/accounts") @@ -45,7 +54,7 @@ interface ClientService { @GET(ApiEndPoints.CLIENTS + "/{clientId}/accounts") fun getAccounts( @Path("clientId") clientId: Long, - @Query("fields") accountType: String + @Query("fields") accountType: String, ): Observable @POST(ApiEndPoints.CLIENTS) diff --git a/core/network/src/main/kotlin/org/mifospay/core/network/services/DocumentService.kt b/core/network/src/main/kotlin/org/mifospay/core/network/services/DocumentService.kt index 951f41b7b..f02c64ed9 100644 --- a/core/network/src/main/kotlin/org/mifospay/core/network/services/DocumentService.kt +++ b/core/network/src/main/kotlin/org/mifospay/core/network/services/DocumentService.kt @@ -1,8 +1,17 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.network.services +import com.mifospay.core.model.entity.noncore.Document import okhttp3.MultipartBody import okhttp3.ResponseBody -import com.mifospay.core.model.entity.noncore.Document import org.mifospay.core.network.ApiEndPoints import org.mifospay.core.network.GenericResponse import retrofit2.http.DELETE @@ -21,7 +30,7 @@ interface DocumentService { @GET("{entityType}/{entityId}/" + ApiEndPoints.DOCUMENTS) fun getDocuments( @Path("entityType") entityType: String?, - @Path("entityId") entityId: Int + @Path("entityId") entityId: Int, ): Observable> /** @@ -39,7 +48,7 @@ interface DocumentService { @Path("entityId") entityId: Long, @Part("name") nameOfDocument: String, @Part("description") description: String, - @Part typedFile: MultipartBody.Part + @Part typedFile: MultipartBody.Part, ): Observable /** @@ -58,7 +67,7 @@ interface DocumentService { fun downloadDocument( @Path("entityType") entityType: String, @Path("entityId") entityId: Int, - @Path("documentId") documentId: Int + @Path("documentId") documentId: Int, ): Observable /** @@ -76,7 +85,7 @@ interface DocumentService { fun removeDocument( @Path("entityType") entityType: String, @Path("entityId") entityId: Int, - @Path("documentId") documentId: Int + @Path("documentId") documentId: Int, ): Observable /** @@ -102,6 +111,6 @@ interface DocumentService { @Path("documentId") documentId: Int, @Part("name") nameOfDocument: String, @Part("description") description: String, - @Part typedFile: MultipartBody.Part + @Part typedFile: MultipartBody.Part, ): Observable } diff --git a/core/network/src/main/kotlin/org/mifospay/core/network/services/InvoiceService.kt b/core/network/src/main/kotlin/org/mifospay/core/network/services/InvoiceService.kt index 183923c5a..2a29470c0 100644 --- a/core/network/src/main/kotlin/org/mifospay/core/network/services/InvoiceService.kt +++ b/core/network/src/main/kotlin/org/mifospay/core/network/services/InvoiceService.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.network.services import com.mifospay.core.model.entity.Invoice @@ -18,7 +27,7 @@ interface InvoiceService { @POST(ApiEndPoints.DATATABLES + "/invoices/{clientId}") fun addInvoice( @Path("clientId") clientId: String, - @Body invoice: Invoice? + @Body invoice: Invoice?, ): Observable @GET(ApiEndPoints.DATATABLES + "/invoices/{clientId}") @@ -27,19 +36,19 @@ interface InvoiceService { @GET(ApiEndPoints.DATATABLES + "/invoices/{clientId}/{invoiceId}") fun getInvoice( @Path("clientId") clientId: String, - @Path("invoiceId") invoiceId: String + @Path("invoiceId") invoiceId: String, ): Observable> @DELETE(ApiEndPoints.DATATABLES + "/invoices/{clientId}/{invoiceId}") fun deleteInvoice( @Path("clientId") clientId: String, - @Path("invoiceId") invoiceId: Int + @Path("invoiceId") invoiceId: Int, ): Observable @PUT(ApiEndPoints.DATATABLES + "/invoices/{clientId}/{invoiceId}") fun updateInvoice( @Path("clientId") clientId: String, @Path("invoiceId") invoiceId: Long, - @Body invoice: Invoice? + @Body invoice: Invoice?, ): Observable } diff --git a/core/network/src/main/kotlin/org/mifospay/core/network/services/KYCLevel1Service.kt b/core/network/src/main/kotlin/org/mifospay/core/network/services/KYCLevel1Service.kt index 1b567187a..444b72cb6 100644 --- a/core/network/src/main/kotlin/org/mifospay/core/network/services/KYCLevel1Service.kt +++ b/core/network/src/main/kotlin/org/mifospay/core/network/services/KYCLevel1Service.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.network.services import com.mifospay.core.model.entity.kyc.KYCLevel1Details @@ -14,7 +23,7 @@ interface KYCLevel1Service { @POST(ApiEndPoints.DATATABLES + "/kyc_level1_details/{clientId}") fun addKYCLevel1Details( @Path("clientId") clientId: Int, - @Body kycLevel1Details: KYCLevel1Details + @Body kycLevel1Details: KYCLevel1Details, ): Observable @GET(ApiEndPoints.DATATABLES + "/kyc_level1_details/{clientId}") @@ -23,6 +32,6 @@ interface KYCLevel1Service { @PUT(ApiEndPoints.DATATABLES + "/kyc_level1_details/{clientId}/") fun updateKYCLevel1Details( @Path("clientId") clientId: Int, - @Body kycLevel1Details: KYCLevel1Details + @Body kycLevel1Details: KYCLevel1Details, ): Observable } diff --git a/core/network/src/main/kotlin/org/mifospay/core/network/services/NotificationService.kt b/core/network/src/main/kotlin/org/mifospay/core/network/services/NotificationService.kt index b8ad43d15..69528821d 100644 --- a/core/network/src/main/kotlin/org/mifospay/core/network/services/NotificationService.kt +++ b/core/network/src/main/kotlin/org/mifospay/core/network/services/NotificationService.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.network.services import com.mifospay.core.model.domain.NotificationPayload diff --git a/core/network/src/main/kotlin/org/mifospay/core/network/services/RegistrationService.kt b/core/network/src/main/kotlin/org/mifospay/core/network/services/RegistrationService.kt index 2afc0fb8d..fa05bc240 100644 --- a/core/network/src/main/kotlin/org/mifospay/core/network/services/RegistrationService.kt +++ b/core/network/src/main/kotlin/org/mifospay/core/network/services/RegistrationService.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.network.services import com.mifospay.core.model.entity.register.RegisterPayload @@ -14,4 +23,4 @@ interface RegistrationService { @POST(ApiEndPoints.REGISTRATION + "/user") fun verifyUser(@Body userVerify: UserVerify): Observable -} \ No newline at end of file +} diff --git a/core/network/src/main/kotlin/org/mifospay/core/network/services/RunReportService.kt b/core/network/src/main/kotlin/org/mifospay/core/network/services/RunReportService.kt index 62d675d68..68c9d6d6e 100644 --- a/core/network/src/main/kotlin/org/mifospay/core/network/services/RunReportService.kt +++ b/core/network/src/main/kotlin/org/mifospay/core/network/services/RunReportService.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.network.services import okhttp3.ResponseBody @@ -14,6 +23,6 @@ interface RunReportService { @GET(ApiEndPoints.RUN_REPORT + "/Savings Transaction Receipt") fun getTransactionReceipt( @Query("output-type") outputType: String, - @Query("R_transactionId") R_transactionId: String + @Query("R_transactionId") R_transactionId: String, ): Observable } diff --git a/core/network/src/main/kotlin/org/mifospay/core/network/services/SavedCardService.kt b/core/network/src/main/kotlin/org/mifospay/core/network/services/SavedCardService.kt index 205c84a17..916554e7c 100644 --- a/core/network/src/main/kotlin/org/mifospay/core/network/services/SavedCardService.kt +++ b/core/network/src/main/kotlin/org/mifospay/core/network/services/SavedCardService.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.network.services import com.mifospay.core.model.entity.savedcards.Card @@ -18,7 +27,7 @@ interface SavedCardService { @POST(ApiEndPoints.DATATABLES + "/saved_cards/{clientId}") fun addSavedCard( @Path("clientId") clientId: Int, - @Body card: Card + @Body card: Card, ): Observable @GET(ApiEndPoints.DATATABLES + "/saved_cards/{clientId}") @@ -27,13 +36,13 @@ interface SavedCardService { @DELETE(ApiEndPoints.DATATABLES + "/saved_cards/{clientId}/{cardId}") fun deleteCard( @Path("clientId") clientId: Int, - @Path("cardId") cardId: Int + @Path("cardId") cardId: Int, ): Observable @PUT(ApiEndPoints.DATATABLES + "/saved_cards/{clientId}/{cardId}") fun updateCard( @Path("clientId") clientId: Int, @Path("cardId") cardId: Int, - @Body card: Card + @Body card: Card, ): Observable } diff --git a/core/network/src/main/kotlin/org/mifospay/core/network/services/SavingsAccountsService.kt b/core/network/src/main/kotlin/org/mifospay/core/network/services/SavingsAccountsService.kt index 34e9ef564..816029c4c 100644 --- a/core/network/src/main/kotlin/org/mifospay/core/network/services/SavingsAccountsService.kt +++ b/core/network/src/main/kotlin/org/mifospay/core/network/services/SavingsAccountsService.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.network.services import com.mifospay.core.model.entity.Page @@ -17,12 +26,12 @@ interface SavingsAccountsService { @GET(ApiEndPoints.SAVINGS_ACCOUNTS + "/{accountId}") fun getSavingsWithAssociations( @Path("accountId") accountId: Long, - @Query("associations") associationType: String + @Query("associations") associationType: String, ): Observable @GET(ApiEndPoints.SAVINGS_ACCOUNTS) fun getSavingsAccounts( - @Query("limit") limit: Int + @Query("limit") limit: Int, ): Observable> @POST(ApiEndPoints.SAVINGS_ACCOUNTS) @@ -31,21 +40,21 @@ interface SavingsAccountsService { @POST(ApiEndPoints.SAVINGS_ACCOUNTS + "/{accountId}") fun blockUnblockAccount( @Path("accountId") accountId: Long, - @Query("command") command: String? + @Query("command") command: String?, ): Observable @GET( - ApiEndPoints.SAVINGS_ACCOUNTS + "/{accountId}/" + ApiEndPoints.TRANSACTIONS - + "/{transactionId}" + ApiEndPoints.SAVINGS_ACCOUNTS + "/{accountId}/" + ApiEndPoints.TRANSACTIONS + + "/{transactionId}", ) fun getSavingAccountTransaction( @Path("accountId") accountId: Long, - @Path("transactionId") transactionId: Long + @Path("transactionId") transactionId: Long, ): Observable @POST( - ApiEndPoints.SAVINGS_ACCOUNTS + "/{accountId}/" + ApiEndPoints.TRANSACTIONS - + "?command=deposit" + ApiEndPoints.SAVINGS_ACCOUNTS + "/{accountId}/" + ApiEndPoints.TRANSACTIONS + + "?command=deposit", ) fun payViaMobile(@Path("accountId") accountId: Long): Observable } diff --git a/core/network/src/main/kotlin/org/mifospay/core/network/services/SearchService.kt b/core/network/src/main/kotlin/org/mifospay/core/network/services/SearchService.kt index 3d342d10b..a11f281e0 100644 --- a/core/network/src/main/kotlin/org/mifospay/core/network/services/SearchService.kt +++ b/core/network/src/main/kotlin/org/mifospay/core/network/services/SearchService.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.network.services import com.mifospay.core.model.entity.SearchedEntity @@ -11,6 +20,6 @@ interface SearchService { fun searchResources( @Query("query") query: String, @Query("resource") resources: String, - @Query("exactMatch") exactMatch: Boolean + @Query("exactMatch") exactMatch: Boolean, ): Observable> } diff --git a/core/network/src/main/kotlin/org/mifospay/core/network/services/StandingInstructionService.kt b/core/network/src/main/kotlin/org/mifospay/core/network/services/StandingInstructionService.kt index aacdf56b0..13426e54a 100644 --- a/core/network/src/main/kotlin/org/mifospay/core/network/services/StandingInstructionService.kt +++ b/core/network/src/main/kotlin/org/mifospay/core/network/services/StandingInstructionService.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.network.services import com.mifospay.core.model.entity.Page @@ -17,19 +26,24 @@ import rx.Observable interface StandingInstructionService { @POST(ApiEndPoints.STANDING_INSTRUCTION) - fun createStandingInstruction(@Body standingInstructionPayload: StandingInstructionPayload) : - Observable + fun createStandingInstruction( + @Body + standingInstructionPayload: StandingInstructionPayload, + ): Observable /** * @param clientId - passed as Query to limit the response to client specific response */ @GET(ApiEndPoints.STANDING_INSTRUCTION) - fun getAllStandingInstructions(@Query("clientId") clientId : Long) - : Observable> + fun getAllStandingInstructions( + @Query("clientId") clientId: Long, + ): Observable> @GET("${ApiEndPoints.STANDING_INSTRUCTION}/{standingInstructionId}") - fun getStandingInstruction(@Path("standingInstructionId") standingInstructionId: Long) - : Observable + fun getStandingInstruction( + @Path("standingInstructionId") + standingInstructionId: Long, + ): Observable /** * @param command - if command is passed as "update" then the corresponding standing instruction @@ -40,13 +54,14 @@ interface StandingInstructionService { */ @PUT("${ApiEndPoints.STANDING_INSTRUCTION}/{standingInstructionId}") fun deleteStandingInstruction( - @Path("standingInstructionId") standingInstructionId: Long, - @Query("command") command: String): Observable + @Path("standingInstructionId") standingInstructionId: Long, + @Query("command") command: String, + ): Observable @PUT("${ApiEndPoints.STANDING_INSTRUCTION}/{standingInstructionId}") fun updateStandingInstruction( @Path("standingInstructionId") standingInstructionId: Long, @Body standingInstructionPayload: StandingInstructionPayload, - @Query("command") command: String): Observable - -} \ No newline at end of file + @Query("command") command: String, + ): Observable +} diff --git a/core/network/src/main/kotlin/org/mifospay/core/network/services/ThirdPartyTransferService.kt b/core/network/src/main/kotlin/org/mifospay/core/network/services/ThirdPartyTransferService.kt index 664b415e2..2e6d73f6d 100644 --- a/core/network/src/main/kotlin/org/mifospay/core/network/services/ThirdPartyTransferService.kt +++ b/core/network/src/main/kotlin/org/mifospay/core/network/services/ThirdPartyTransferService.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.network.services import com.mifospay.core.model.entity.TPTResponse diff --git a/core/network/src/main/kotlin/org/mifospay/core/network/services/TwoFactorAuthService.kt b/core/network/src/main/kotlin/org/mifospay/core/network/services/TwoFactorAuthService.kt index a34b02d65..8a4b53ec4 100644 --- a/core/network/src/main/kotlin/org/mifospay/core/network/services/TwoFactorAuthService.kt +++ b/core/network/src/main/kotlin/org/mifospay/core/network/services/TwoFactorAuthService.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.network.services import com.mifospay.core.model.domain.twofactor.AccessToken @@ -20,4 +29,4 @@ interface TwoFactorAuthService { @POST(ApiEndPoints.TWOFACTOR + "/validate") fun validateToken(@Query("token") token: String): Observable -} \ No newline at end of file +} diff --git a/core/network/src/main/kotlin/org/mifospay/core/network/services/UserService.kt b/core/network/src/main/kotlin/org/mifospay/core/network/services/UserService.kt index a2a866c7a..b2c65fba7 100644 --- a/core/network/src/main/kotlin/org/mifospay/core/network/services/UserService.kt +++ b/core/network/src/main/kotlin/org/mifospay/core/network/services/UserService.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.network.services import com.mifospay.core.model.domain.user.NewUser @@ -25,12 +34,12 @@ interface UserService { @PUT(ApiEndPoints.USER + "/{userId}") fun updateUser( @Path("userId") userId: Int, - @Body updateUserEntity: Any + @Body updateUserEntity: Any, ): Observable @DELETE(ApiEndPoints.USER + "/{userId}") fun deleteUser( - @Path("userId") userId: Int + @Path("userId") userId: Int, ): Observable @GET("self/userdetails") diff --git a/core/network/src/test/java/org/mifospay/mobilewallet/mifospay/network/ExampleUnitTest.kt b/core/network/src/test/java/org/mifospay/mobilewallet/mifospay/network/ExampleUnitTest.kt index 8b722a1ed..bbaddbe81 100644 --- a/core/network/src/test/java/org/mifospay/mobilewallet/mifospay/network/ExampleUnitTest.kt +++ b/core/network/src/test/java/org/mifospay/mobilewallet/mifospay/network/ExampleUnitTest.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.mobilewallet.mifospay.network import org.junit.Assert.assertEquals @@ -13,4 +22,4 @@ class ExampleUnitTest { fun addition_isCorrect() { assertEquals(4, 2 + 2) } -} \ No newline at end of file +} diff --git a/core/ui/build.gradle.kts b/core/ui/build.gradle.kts index 81cede87c..e602f3f1a 100644 --- a/core/ui/build.gradle.kts +++ b/core/ui/build.gradle.kts @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ plugins { alias(libs.plugins.mifospay.android.library) alias(libs.plugins.mifospay.android.library.compose) diff --git a/core/ui/src/main/AndroidManifest.xml b/core/ui/src/main/AndroidManifest.xml index a5918e68a..961389810 100644 --- a/core/ui/src/main/AndroidManifest.xml +++ b/core/ui/src/main/AndroidManifest.xml @@ -1,4 +1,13 @@ + \ No newline at end of file diff --git a/core/ui/src/main/kotlin/org/mifospay/core/ui/DevicePreviews.kt b/core/ui/src/main/kotlin/org/mifospay/core/ui/DevicePreviews.kt index 4df509814..95699ccc4 100644 --- a/core/ui/src/main/kotlin/org/mifospay/core/ui/DevicePreviews.kt +++ b/core/ui/src/main/kotlin/org/mifospay/core/ui/DevicePreviews.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.ui import androidx.compose.ui.tooling.preview.Preview diff --git a/core/ui/src/main/kotlin/org/mifospay/core/ui/EmptyContentScreen.kt b/core/ui/src/main/kotlin/org/mifospay/core/ui/EmptyContentScreen.kt index 55320e31d..8c6b5ed34 100644 --- a/core/ui/src/main/kotlin/org/mifospay/core/ui/EmptyContentScreen.kt +++ b/core/ui/src/main/kotlin/org/mifospay/core/ui/EmptyContentScreen.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.ui import androidx.compose.foundation.Image @@ -30,18 +39,18 @@ import org.mifospay.core.designsystem.theme.MifosTheme @Composable fun EmptyContentScreen( - modifier: Modifier = Modifier, title: String, subTitle: String, - imageContent: @Composable () -> Unit + imageContent: @Composable () -> Unit, + modifier: Modifier = Modifier, ) { Column( - modifier = Modifier.fillMaxSize(), + modifier = modifier.fillMaxSize(), horizontalAlignment = Alignment.CenterHorizontally, - verticalArrangement = Arrangement.Center + verticalArrangement = Arrangement.Center, ) { Column( - modifier = modifier + modifier = Modifier .padding(16.dp) .fillMaxSize() .testTag("mifos:empty"), @@ -71,7 +80,7 @@ fun EmptyContentScreen( .padding(start = 24.dp, end = 24.dp), textAlign = TextAlign.Center, style = MaterialTheme.typography.bodyMedium, - color = MaterialTheme.colorScheme.onSurface + color = MaterialTheme.colorScheme.onSurface, ) } } @@ -79,14 +88,13 @@ fun EmptyContentScreen( @Composable fun EmptyContentScreen( - modifier: Modifier = Modifier, title: String, subTitle: String, + iconDrawable: Int, + modifier: Modifier = Modifier, iconTint: Color = MaterialTheme.colorScheme.surfaceTint, - iconDrawable: Int ) { EmptyContentScreen( - modifier = modifier, title = title, subTitle = subTitle, imageContent = { @@ -96,20 +104,20 @@ fun EmptyContentScreen( colorFilter = if (iconTint != Color.Unspecified) ColorFilter.tint(iconTint) else null, contentDescription = null, ) - } + }, + modifier = modifier, ) } @Composable fun EmptyContentScreen( - modifier: Modifier = Modifier, title: String, subTitle: String, + modifier: Modifier = Modifier, iconTint: Color = MaterialTheme.colorScheme.surfaceTint, - iconImageVector: ImageVector = Icons.Rounded.Search + iconImageVector: ImageVector = Icons.Rounded.Search, ) { EmptyContentScreen( - modifier = modifier, title = title, subTitle = subTitle, imageContent = { @@ -117,9 +125,10 @@ fun EmptyContentScreen( modifier = Modifier.size(64.dp), imageVector = iconImageVector, contentDescription = null, - tint = iconTint + tint = iconTint, ) - } + }, + modifier = modifier, ) } @@ -128,11 +137,11 @@ fun EmptyContentScreen( fun EmptyContentScreenDrawableImagePreview() { MifosTheme { EmptyContentScreen( - modifier = Modifier, title = "No data found", subTitle = "Please check you connection or try again", + iconDrawable = R.drawable.core_ui_baseline_info_outline_24, + modifier = Modifier, iconTint = MaterialTheme.colorScheme.primary, - iconDrawable = R.drawable.core_ui_baseline_info_outline_24 ) } } @@ -142,11 +151,11 @@ fun EmptyContentScreenDrawableImagePreview() { fun EmptyContentScreenImageVectorPreview() { MifosTheme { EmptyContentScreen( - modifier = Modifier, title = "No data found", subTitle = "Please check you connection or try again", + modifier = Modifier, iconTint = MaterialTheme.colorScheme.primary, - iconImageVector = Icons.Rounded.Search + iconImageVector = Icons.Rounded.Search, ) } -} \ No newline at end of file +} diff --git a/core/ui/src/main/kotlin/org/mifospay/core/ui/ErrorScreenContent.kt b/core/ui/src/main/kotlin/org/mifospay/core/ui/ErrorScreenContent.kt index 0f6c20862..da9b7c755 100644 --- a/core/ui/src/main/kotlin/org/mifospay/core/ui/ErrorScreenContent.kt +++ b/core/ui/src/main/kotlin/org/mifospay/core/ui/ErrorScreenContent.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.ui import androidx.compose.foundation.layout.Arrangement @@ -27,22 +36,21 @@ fun ErrorScreenContent( modifier: Modifier = Modifier, title: String = stringResource(id = R.string.core_ui_error_occurred), subTitle: String = stringResource(id = R.string.core_ui_please_check_your_connection_or_try_again), - onClickRetry: () -> Unit = { } + onClickRetry: () -> Unit = { }, ) { Column( - modifier = Modifier.fillMaxSize(), + modifier = modifier.fillMaxSize(), horizontalAlignment = Alignment.CenterHorizontally, - verticalArrangement = Arrangement.Center + verticalArrangement = Arrangement.Center, ) { Column( - modifier = modifier + modifier = Modifier .padding(16.dp) .fillMaxSize() .testTag("mifos:empty"), verticalArrangement = Arrangement.Center, horizontalAlignment = Alignment.CenterHorizontally, ) { - Spacer(modifier = Modifier.height(48.dp)) Text( @@ -70,7 +78,7 @@ fun ErrorScreenContent( modifier = Modifier .width(150.dp) .padding(top = 16.dp), - onClick = onClickRetry + onClick = onClickRetry, ) { Text(text = stringResource(id = R.string.core_ui_retry)) } @@ -86,7 +94,7 @@ fun ErrorContentScreenDrawableImagePreview() { modifier = Modifier, title = "Error Occurred!", subTitle = "Please check your connection or try again", - onClickRetry = { } + onClickRetry = { }, ) } } diff --git a/core/ui/src/main/kotlin/org/mifospay/core/ui/ExpiryDateInput.kt b/core/ui/src/main/kotlin/org/mifospay/core/ui/ExpiryDateInput.kt index d2ec8f055..0fd2cc515 100644 --- a/core/ui/src/main/kotlin/org/mifospay/core/ui/ExpiryDateInput.kt +++ b/core/ui/src/main/kotlin/org/mifospay/core/ui/ExpiryDateInput.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.ui import androidx.compose.foundation.layout.Arrangement @@ -11,6 +20,7 @@ import androidx.compose.foundation.text.BasicTextField import androidx.compose.foundation.text.KeyboardActions import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.ExperimentalComposeUiApi @@ -33,18 +43,21 @@ fun ExpiryDateInput( date: String, onDateChange: (String) -> Unit, onDone: () -> Unit, + modifier: Modifier = Modifier, ) { val (a, b, c) = FocusRequester.createRefs() Row( - modifier = Modifier + modifier = modifier .fillMaxWidth() - .padding(8.dp), verticalAlignment = Alignment.Bottom + .padding(8.dp), + verticalAlignment = Alignment.Bottom, ) { - BasicTextField(modifier = Modifier - .focusRequester(b) - .focusProperties { - next = c - }, + BasicTextField( + modifier = Modifier + .focusRequester(b) + .focusProperties { + next = c + }, value = TextFieldValue(date, selection = TextRange(date.length)), onValueChange = { if (it.text.length == 3 && it.text[2] != '/') { @@ -62,28 +75,35 @@ fun ExpiryDateInput( } onDateChange(it.text) }, - keyboardActions = KeyboardActions(onDone = { - onDone() - }), + keyboardActions = KeyboardActions( + onDone = { + onDone() + }, + ), keyboardOptions = KeyboardOptions.Default.copy( - keyboardType = KeyboardType.Number, imeAction = ImeAction.Done + keyboardType = KeyboardType.Number, + imeAction = ImeAction.Done, ), decorationBox = { Row(horizontalArrangement = Arrangement.Center) { repeat(7) { index -> FormattedDateView( - index = index, text = date + index = index, + text = date, ) Spacer(modifier = Modifier.width(8.dp)) } } - }) + }, + ) } } @Composable fun FormattedDateView( - index: Int, text: String + index: Int, + text: String, + modifier: Modifier = Modifier, ) { val isFocused = text.length == index @@ -93,8 +113,8 @@ fun FormattedDateView( index > text.length -> "_" else -> text[index].toString() } - androidx.compose.material3.Text( - modifier = Modifier + Text( + modifier = modifier .width(40.dp) .wrapContentHeight(align = Alignment.CenterVertically), text = char, @@ -104,7 +124,7 @@ fun FormattedDateView( } else { Color.LightGray }, - textAlign = TextAlign.Center + textAlign = TextAlign.Center, ) } @@ -113,4 +133,3 @@ fun FormattedDateView( fun ExpiryDateInputPreview() { ExpiryDateInput(date = "", onDateChange = {}, onDone = {}) } - diff --git a/core/ui/src/main/kotlin/org/mifospay/core/ui/FaqItemScreen.kt b/core/ui/src/main/kotlin/org/mifospay/core/ui/FaqItemScreen.kt index 954ea3c0d..6072ad5fc 100644 --- a/core/ui/src/main/kotlin/org/mifospay/core/ui/FaqItemScreen.kt +++ b/core/ui/src/main/kotlin/org/mifospay/core/ui/FaqItemScreen.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.ui import androidx.compose.animation.AnimatedVisibility @@ -24,21 +33,21 @@ import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.scale -import androidx.compose.ui.graphics.Color import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.unit.dp @Composable fun FaqItemScreen( - question: String?, - answer: String?, + modifier: Modifier = Modifier, + question: String? = null, + answer: String? = null, ) { var isSelected by remember { mutableStateOf(false) } Column( - modifier = Modifier + modifier = modifier .fillMaxWidth() - .padding(horizontal = 16.dp) + .padding(horizontal = 16.dp), ) { Row( modifier = Modifier @@ -46,7 +55,7 @@ fun FaqItemScreen( isSelected = !isSelected } .padding(vertical = 8.dp), - verticalAlignment = Alignment.CenterVertically + verticalAlignment = Alignment.CenterVertically, ) { Text( text = question.orEmpty(), @@ -62,7 +71,7 @@ fun FaqItemScreen( contentDescription = "drop down", tint = MaterialTheme.colorScheme.onSurface, modifier = Modifier - .scale(1f, if (isSelected) -1f else 1f) + .scale(1f, if (isSelected) -1f else 1f), ) } @@ -70,9 +79,9 @@ fun FaqItemScreen( visible = isSelected, enter = fadeIn() + expandVertically( animationSpec = spring( - stiffness = Spring.StiffnessMedium - ) - ) + stiffness = Spring.StiffnessMedium, + ), + ), ) { Text( text = answer.orEmpty(), @@ -80,10 +89,10 @@ fun FaqItemScreen( color = MaterialTheme.colorScheme.onSurface, modifier = Modifier .fillMaxWidth() - .padding(bottom = 8.dp) + .padding(bottom = 8.dp), ) } Divider() } -} \ No newline at end of file +} diff --git a/core/ui/src/main/kotlin/org/mifospay/core/ui/HeadingTitile.kt b/core/ui/src/main/kotlin/org/mifospay/core/ui/HeadingTitile.kt index 1b2cb2e13..c558064fa 100644 --- a/core/ui/src/main/kotlin/org/mifospay/core/ui/HeadingTitile.kt +++ b/core/ui/src/main/kotlin/org/mifospay/core/ui/HeadingTitile.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.ui import androidx.compose.foundation.layout.Row @@ -22,11 +31,14 @@ import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import org.mifospay.core.designsystem.theme.MifosTheme - @Composable -fun VerifyStepHeader(text: String, isVerified: Boolean) { +fun VerifyStepHeader( + text: String, + isVerified: Boolean, + modifier: Modifier = Modifier, +) { Row( - modifier = Modifier + modifier = modifier .fillMaxWidth(), ) { Text( @@ -38,21 +50,23 @@ fun VerifyStepHeader(text: String, isVerified: Boolean) { .padding(16.dp) .weight(1f), textAlign = TextAlign.Start, - style = TextStyle(fontWeight = FontWeight.Bold) + style = TextStyle(fontWeight = FontWeight.Bold), ) IconButton( onClick = { }, ) { - if (isVerified) + if (isVerified) { Icon( imageVector = Icons.Default.Check, contentDescription = null, tint = if (isVerified) MaterialTheme.colorScheme.onSurface else Color.Gray, - modifier = Modifier.size(24.dp) + modifier = Modifier.size(24.dp), ) + } } } } + @Preview @Composable fun VerifyStepHeaderVerifiedPreview() { @@ -65,4 +79,4 @@ fun VerifyStepHeaderVerifiedPreview() { @Composable fun VerifyStepHeaderUnverifiedPreview() { VerifyStepHeader(text = "Enter OTP ", isVerified = false) -} \ No newline at end of file +} diff --git a/core/ui/src/main/kotlin/org/mifospay/core/ui/JankStatsExtensions.kt b/core/ui/src/main/kotlin/org/mifospay/core/ui/JankStatsExtensions.kt index c39cb16fb..a13127e5b 100644 --- a/core/ui/src/main/kotlin/org/mifospay/core/ui/JankStatsExtensions.kt +++ b/core/ui/src/main/kotlin/org/mifospay/core/ui/JankStatsExtensions.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.ui import androidx.compose.foundation.gestures.ScrollableState diff --git a/core/ui/src/main/kotlin/org/mifospay/core/ui/LocalTimeZone.kt b/core/ui/src/main/kotlin/org/mifospay/core/ui/LocalTimeZone.kt index c09ea1b86..94d3d953d 100644 --- a/core/ui/src/main/kotlin/org/mifospay/core/ui/LocalTimeZone.kt +++ b/core/ui/src/main/kotlin/org/mifospay/core/ui/LocalTimeZone.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.ui import androidx.compose.runtime.compositionLocalOf diff --git a/core/ui/src/main/kotlin/org/mifospay/core/ui/MifosUserImage.kt b/core/ui/src/main/kotlin/org/mifospay/core/ui/MifosUserImage.kt index 7e3da32fc..84f4ad55e 100644 --- a/core/ui/src/main/kotlin/org/mifospay/core/ui/MifosUserImage.kt +++ b/core/ui/src/main/kotlin/org/mifospay/core/ui/MifosUserImage.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.ui import android.graphics.Bitmap @@ -12,21 +21,16 @@ import androidx.compose.ui.graphics.asImageBitmap import androidx.compose.ui.layout.ContentScale import org.mifospay.core.designsystem.component.MifosTextUserImage -/** - * @author pratyush - * @since 20/12/2023 - */ - @Composable fun MifosUserImage( - bitmap: Bitmap?, modifier: Modifier = Modifier, - username: String? = null + bitmap: Bitmap? = null, + username: String? = null, ) { if (bitmap == null) { MifosTextUserImage( + text = username?.firstOrNull()?.toString() ?: "J", modifier = modifier, - text = username?.firstOrNull()?.toString() ?: "J" ) } else { Image( diff --git a/core/ui/src/main/kotlin/org/mifospay/core/ui/OtpTextField.kt b/core/ui/src/main/kotlin/org/mifospay/core/ui/OtpTextField.kt index 2127f3cd6..59b034b7d 100644 --- a/core/ui/src/main/kotlin/org/mifospay/core/ui/OtpTextField.kt +++ b/core/ui/src/main/kotlin/org/mifospay/core/ui/OtpTextField.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.ui import androidx.compose.foundation.layout.Arrangement @@ -31,10 +40,10 @@ import androidx.compose.ui.unit.dp @Composable fun OtpTextField( + onOtpTextCorrectlyEntered: () -> Unit, modifier: Modifier = Modifier, realOtp: String = "", otpCount: Int = 4, - onOtpTextCorrectlyEntered: () -> Unit ) { var otpText by remember { mutableStateOf("") } var isError by remember { mutableStateOf(false) } @@ -42,10 +51,10 @@ fun OtpTextField( modifier = modifier .fillMaxWidth() .padding(16.dp), - horizontalAlignment = Alignment.CenterHorizontally + horizontalAlignment = Alignment.CenterHorizontally, ) { - - BasicTextField(modifier = modifier, + BasicTextField( + modifier = Modifier, value = TextFieldValue(otpText, selection = TextRange(otpText.length)), onValueChange = { otpText = it.text @@ -58,27 +67,32 @@ fun OtpTextField( } } }, - keyboardActions = KeyboardActions(onDone = { - if (otpText != realOtp) { - isError = true - } else { - onOtpTextCorrectlyEntered.invoke() - } - println("OTP: $otpText and $isError") - }), + keyboardActions = KeyboardActions( + onDone = { + if (otpText != realOtp) { + isError = true + } else { + onOtpTextCorrectlyEntered.invoke() + } + println("OTP: $otpText and $isError") + }, + ), keyboardOptions = KeyboardOptions.Default.copy( - keyboardType = KeyboardType.Number, imeAction = ImeAction.Done + keyboardType = KeyboardType.Number, + imeAction = ImeAction.Done, ), decorationBox = { Row(horizontalArrangement = Arrangement.Center) { repeat(otpCount) { index -> CharView( - index = index, text = otpText + index = index, + text = otpText, ) Spacer(modifier = Modifier.width(8.dp)) } } - }) + }, + ) if (isError) { // display erro message in text Text( @@ -86,7 +100,7 @@ fun OtpTextField( style = MaterialTheme.typography.bodyMedium, color = Color.Red, textAlign = TextAlign.Center, - modifier = Modifier.padding(top = 8.dp) + modifier = Modifier.padding(top = 8.dp), ) } } @@ -94,7 +108,9 @@ fun OtpTextField( @Composable fun CharView( - index: Int, text: String + index: Int, + text: String, + modifier: Modifier = Modifier, ) { val isFocused = text.length == index val char = when { @@ -103,7 +119,7 @@ fun CharView( else -> text[index].toString() } Text( - modifier = Modifier + modifier = modifier .width(40.dp) .wrapContentHeight(align = Alignment.CenterVertically), text = char, @@ -113,7 +129,7 @@ fun CharView( } else { Color.LightGray }, - textAlign = TextAlign.Center + textAlign = TextAlign.Center, ) } @@ -121,8 +137,8 @@ fun CharView( @Composable fun PreviewOtpTextField() { OtpTextField( + onOtpTextCorrectlyEntered = {}, realOtp = "1234", otpCount = 4, - onOtpTextCorrectlyEntered = {} ) } diff --git a/core/ui/src/main/kotlin/org/mifospay/core/ui/ProfileConcentricImage.kt b/core/ui/src/main/kotlin/org/mifospay/core/ui/ProfileConcentricImage.kt index 58b79edb9..79ca16e76 100644 --- a/core/ui/src/main/kotlin/org/mifospay/core/ui/ProfileConcentricImage.kt +++ b/core/ui/src/main/kotlin/org/mifospay/core/ui/ProfileConcentricImage.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.ui import android.graphics.Bitmap @@ -16,12 +25,15 @@ import androidx.compose.ui.graphics.Color import androidx.compose.ui.unit.dp @Composable -fun ProfileImage(bitmap: Bitmap?) { +fun ProfileImage( + modifier: Modifier = Modifier, + bitmap: Bitmap? = null, +) { Row( - modifier = Modifier + modifier = modifier .fillMaxWidth() .padding(top = 64.dp, bottom = 12.dp), - horizontalArrangement = Arrangement.Center + horizontalArrangement = Arrangement.Center, ) { Box( contentAlignment = Alignment.Center, @@ -30,15 +42,15 @@ fun ProfileImage(bitmap: Bitmap?) { .border( width = 2.dp, color = Color.Gray, - shape = CircleShape - ) + shape = CircleShape, + ), ) { MifosUserImage( - bitmap = bitmap, modifier = Modifier .size(200.dp) - .padding(10.dp) + .padding(10.dp), + bitmap = bitmap, ) } } -} \ No newline at end of file +} diff --git a/core/ui/src/main/kotlin/org/mifospay/core/ui/ScrollableTabRow.kt b/core/ui/src/main/kotlin/org/mifospay/core/ui/ScrollableTabRow.kt index 085e55491..f5394a96a 100644 --- a/core/ui/src/main/kotlin/org/mifospay/core/ui/ScrollableTabRow.kt +++ b/core/ui/src/main/kotlin/org/mifospay/core/ui/ScrollableTabRow.kt @@ -1,6 +1,14 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.ui -import androidx.compose.foundation.ExperimentalFoundationApi import androidx.compose.material3.MaterialTheme import androidx.compose.material3.ScrollableTabRow import androidx.compose.material3.Tab @@ -16,7 +24,7 @@ import com.google.accompanist.pager.PagerState import kotlinx.coroutines.launch import org.mifospay.core.ui.utility.TabContent -@OptIn(ExperimentalFoundationApi::class) +@Suppress("MultipleEmitters") @Composable fun MifosScrollableTabRow( tabContents: List, @@ -25,7 +33,7 @@ fun MifosScrollableTabRow( containerColor: Color = MaterialTheme.colorScheme.surface, selectedContentColor: Color = MaterialTheme.colorScheme.onSurface, unselectedContentColor: Color = Color.LightGray, - edgePadding: Dp = 8.dp + edgePadding: Dp = 8.dp, ) { val scope = rememberCoroutineScope() @@ -37,8 +45,12 @@ fun MifosScrollableTabRow( ) { tabContents.forEachIndexed { index, currentTab -> Tab( - text = { Text(text = currentTab.tabName, - color = MaterialTheme.colorScheme.onSurface) }, + text = { + Text( + text = currentTab.tabName, + color = MaterialTheme.colorScheme.onSurface, + ) + }, selected = pagerState.currentPage == index, selectedContentColor = selectedContentColor, unselectedContentColor = unselectedContentColor, @@ -46,14 +58,14 @@ fun MifosScrollableTabRow( scope.launch { pagerState.animateScrollToPage(index) } - } + }, ) } } HorizontalPager( count = tabContents.size, - state = pagerState + state = pagerState, ) { tabContents[it].content.invoke() } diff --git a/core/ui/src/main/kotlin/org/mifospay/core/ui/TransactionItemScreen.kt b/core/ui/src/main/kotlin/org/mifospay/core/ui/TransactionItemScreen.kt index 05f56d89f..cb9c5bc71 100644 --- a/core/ui/src/main/kotlin/org/mifospay/core/ui/TransactionItemScreen.kt +++ b/core/ui/src/main/kotlin/org/mifospay/core/ui/TransactionItemScreen.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.ui import androidx.compose.foundation.Image @@ -28,14 +37,14 @@ import org.mifospay.core.designsystem.theme.red @Composable fun TransactionItemScreen( + transaction: Transaction, modifier: Modifier = Modifier, - transaction: com.mifospay.core.model.domain.Transaction ) { Row( modifier = modifier .fillMaxWidth() .padding(bottom = 16.dp), - horizontalArrangement = Arrangement.Absolute.SpaceBetween + horizontalArrangement = Arrangement.Absolute.SpaceBetween, ) { Image( modifier = Modifier @@ -43,18 +52,18 @@ fun TransactionItemScreen( .padding(top = 2.dp), painter = painterResource( id = when (transaction.transactionType) { - com.mifospay.core.model.domain.TransactionType.DEBIT -> R.drawable.core_ui_money_out - com.mifospay.core.model.domain.TransactionType.CREDIT -> R.drawable.core_ui_money_in + TransactionType.DEBIT -> R.drawable.core_ui_money_out + TransactionType.CREDIT -> R.drawable.core_ui_money_in else -> R.drawable.core_ui_money_in - } + }, ), contentDescription = null, - colorFilter = ColorFilter.tint(MaterialTheme.colorScheme.onSurface) + colorFilter = ColorFilter.tint(MaterialTheme.colorScheme.onSurface), ) Column( modifier = Modifier .padding(start = 32.dp) - .weight(.3f) + .weight(.3f), ) { Text( text = transaction.transactionType.toString(), @@ -63,19 +72,22 @@ fun TransactionItemScreen( fontWeight = FontWeight(400), color = MaterialTheme.colorScheme.onSurface, - ) + ), ) Text( text = transaction.date.toString(), style = TextStyle( fontSize = 10.sp, fontWeight = FontWeight(400), - color = Color(0x66000000) - ) + color = Color(0x66000000), + ), ) } - val formattedAmount = - getFormattedAccountBalance(transaction.amount, transaction.currency.code, 2) + val formattedAmount = getFormattedAccountBalance( + balance = transaction.amount, + currencyCode = transaction.currency.code, + maximumFractionDigits = 2, + ) val amount = when (transaction.transactionType) { TransactionType.DEBIT -> "- $formattedAmount" TransactionType.CREDIT -> "+ $formattedAmount" @@ -93,7 +105,7 @@ fun TransactionItemScreen( else -> Color.Black }, textAlign = TextAlign.End, - ) + ), ) } } @@ -101,5 +113,5 @@ fun TransactionItemScreen( @Preview @Composable fun ItemTransactionPreview() { - TransactionItemScreen(modifier = Modifier, Transaction()) + TransactionItemScreen(Transaction(), modifier = Modifier) } diff --git a/core/ui/src/main/kotlin/org/mifospay/core/ui/utility/AddBtnChip.kt b/core/ui/src/main/kotlin/org/mifospay/core/ui/utility/AddBtnChip.kt index 924f87048..1d6b33189 100644 --- a/core/ui/src/main/kotlin/org/mifospay/core/ui/utility/AddBtnChip.kt +++ b/core/ui/src/main/kotlin/org/mifospay/core/ui/utility/AddBtnChip.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.ui.utility import androidx.compose.foundation.layout.padding @@ -11,41 +20,40 @@ import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier -import androidx.compose.ui.graphics.Color import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.unit.dp @Composable fun AddCardChip( - modifier: Modifier, - onAddBtn: () -> Unit, text: Int, - btnText: Int + btnText: Int, + onAddBtn: () -> Unit, + modifier: Modifier = Modifier, ) { AssistChip( modifier = modifier, - onClick = { onAddBtn.invoke() }, + onClick = onAddBtn, label = { Text( stringResource(text), style = MaterialTheme.typography.bodyLarge.copy( fontWeight = FontWeight.Bold, - color = MaterialTheme.colorScheme.onPrimary + color = MaterialTheme.colorScheme.onPrimary, ), - modifier = Modifier.padding(horizontal = 8.dp) + modifier = Modifier.padding(horizontal = 8.dp), ) }, leadingIcon = { Icon( - Icons.Filled.Add, + imageVector = Icons.Filled.Add, contentDescription = stringResource(btnText), modifier = Modifier.size(16.dp), - tint = MaterialTheme.colorScheme.onPrimary + tint = MaterialTheme.colorScheme.onPrimary, ) }, colors = AssistChipDefaults.assistChipColors( - containerColor = MaterialTheme.colorScheme.primary + containerColor = MaterialTheme.colorScheme.primary, ), ) -} \ No newline at end of file +} diff --git a/core/ui/src/main/kotlin/org/mifospay/core/ui/utility/DialogState.kt b/core/ui/src/main/kotlin/org/mifospay/core/ui/utility/DialogState.kt index b76535209..6ed1a950e 100644 --- a/core/ui/src/main/kotlin/org/mifospay/core/ui/utility/DialogState.kt +++ b/core/ui/src/main/kotlin/org/mifospay/core/ui/utility/DialogState.kt @@ -1,6 +1,15 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.ui.utility data class DialogState( val type: DialogType = DialogType.NONE, - val onConfirm: () -> Unit = {} + val onConfirm: () -> Unit = {}, ) diff --git a/core/ui/src/main/kotlin/org/mifospay/core/ui/utility/DialogType.kt b/core/ui/src/main/kotlin/org/mifospay/core/ui/utility/DialogType.kt index 6e3b3a03c..56bb3f228 100644 --- a/core/ui/src/main/kotlin/org/mifospay/core/ui/utility/DialogType.kt +++ b/core/ui/src/main/kotlin/org/mifospay/core/ui/utility/DialogType.kt @@ -1,7 +1,16 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.ui.utility enum class DialogType { NONE, DISABLE_ACCOUNT, - LOGOUT -} \ No newline at end of file + LOGOUT, +} diff --git a/core/ui/src/main/kotlin/org/mifospay/core/ui/utility/TabContent.kt b/core/ui/src/main/kotlin/org/mifospay/core/ui/utility/TabContent.kt index 673542749..75f044063 100644 --- a/core/ui/src/main/kotlin/org/mifospay/core/ui/utility/TabContent.kt +++ b/core/ui/src/main/kotlin/org/mifospay/core/ui/utility/TabContent.kt @@ -1,9 +1,17 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.core.ui.utility import androidx.compose.runtime.Composable data class TabContent( val tabName: String, - val content: @Composable () -> Unit + val content: @Composable () -> Unit, ) - diff --git a/core/ui/src/main/res/drawable/core_ui_baseline_info_outline_24.xml b/core/ui/src/main/res/drawable/core_ui_baseline_info_outline_24.xml index 7aea0c1a8..88b82efed 100644 --- a/core/ui/src/main/res/drawable/core_ui_baseline_info_outline_24.xml +++ b/core/ui/src/main/res/drawable/core_ui_baseline_info_outline_24.xml @@ -1,3 +1,13 @@ + + + Retry Error Occurred! diff --git a/core/ui/src/test/java/org/mifospay/mobilewallet/mifospay/ui/ExampleUnitTest.kt b/core/ui/src/test/java/org/mifospay/mobilewallet/mifospay/ui/ExampleUnitTest.kt index 3eff5cb78..45d28910b 100644 --- a/core/ui/src/test/java/org/mifospay/mobilewallet/mifospay/ui/ExampleUnitTest.kt +++ b/core/ui/src/test/java/org/mifospay/mobilewallet/mifospay/ui/ExampleUnitTest.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.mobilewallet.mifospay.ui import org.junit.Assert.assertEquals @@ -13,4 +22,4 @@ class ExampleUnitTest { fun addition_isCorrect() { assertEquals(4, 2 + 2) } -} \ No newline at end of file +} diff --git a/desktop/build.gradle.kts b/desktop/build.gradle.kts index 3b1627122..4c039b97e 100644 --- a/desktop/build.gradle.kts +++ b/desktop/build.gradle.kts @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ import org.jetbrains.compose.desktop.application.dsl.TargetFormat plugins { diff --git a/desktop/src/jvmMain/kotlin/Main.kt b/desktop/src/jvmMain/kotlin/Main.kt index 9bfc3a1d0..4804014a6 100644 --- a/desktop/src/jvmMain/kotlin/Main.kt +++ b/desktop/src/jvmMain/kotlin/Main.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ import androidx.compose.ui.window.Window import androidx.compose.ui.window.application import androidx.compose.ui.window.rememberWindowState @@ -9,7 +18,7 @@ fun main() { Window( onCloseRequest = ::exitApplication, state = windowState, - title = "MifosWallet" + title = "MifosWallet", ) { MainView() } diff --git a/feature/accounts/src/main/kotlin/org/mifospay/feature/bank/accounts/AccountsScreen.kt b/feature/accounts/src/main/kotlin/org/mifospay/feature/bank/accounts/AccountsScreen.kt index 659500a8c..01a0209b3 100644 --- a/feature/accounts/src/main/kotlin/org/mifospay/feature/bank/accounts/AccountsScreen.kt +++ b/feature/accounts/src/main/kotlin/org/mifospay/feature/bank/accounts/AccountsScreen.kt @@ -93,9 +93,9 @@ private fun AccountScreen( AccountsUiState.Error -> { EmptyContentScreen( - modifier = Modifier, title = stringResource(id = R.string.feature_accounts_error_oops), subTitle = stringResource(id = R.string.feature_accounts_unexpected_error_subtitle), + modifier = Modifier, iconTint = MaterialTheme.colorScheme.onSurface, iconImageVector = Icons.Rounded.Info, ) @@ -135,10 +135,10 @@ private fun AccountScreen( .background(MaterialTheme.colorScheme.surface), ) { AddCardChip( - modifier = Modifier.align(Alignment.Center), - onAddBtn = onAddAccount, text = R.string.feature_accounts_add_account, btnText = R.string.feature_accounts_add_cards, + onAddBtn = onAddAccount, + modifier = Modifier.align(Alignment.Center), ) } } @@ -175,10 +175,10 @@ private fun NoLinkedAccountsScreen( ) { Text(text = stringResource(R.string.feature_accounts_no_linked_bank_accounts)) AddCardChip( - modifier = Modifier, - onAddBtn = onAddBtn, text = R.string.feature_accounts_add_account, btnText = R.string.feature_accounts_add_cards, + onAddBtn = onAddBtn, + modifier = Modifier, ) } } diff --git a/feature/accounts/src/main/kotlin/org/mifospay/feature/bank/accounts/link/LinkBankAccountScreen.kt b/feature/accounts/src/main/kotlin/org/mifospay/feature/bank/accounts/link/LinkBankAccountScreen.kt index dd2469007..1c81b3c13 100644 --- a/feature/accounts/src/main/kotlin/org/mifospay/feature/bank/accounts/link/LinkBankAccountScreen.kt +++ b/feature/accounts/src/main/kotlin/org/mifospay/feature/bank/accounts/link/LinkBankAccountScreen.kt @@ -123,10 +123,10 @@ private fun LinkBankAccountScreen( titleRes = R.string.feature_accounts_link_bank_account, navigationIcon = MifosIcons.Back, navigationIconContentDescription = "Back icon", - onNavigationClick = onBackClick, colors = TopAppBarDefaults.centerAlignedTopAppBarColors( containerColor = MaterialTheme.colorScheme.surface, ), + onNavigationClick = onBackClick, ) }, ) { paddingValues -> @@ -173,15 +173,15 @@ private fun BankListScreenContent( .verticalScroll(rememberScrollState()), ) { MifosOutlinedTextField( - modifier = Modifier - .fillMaxWidth() - .padding(horizontal = 16.dp), + label = R.string.feature_accounts_search, value = searchQuery, onValueChange = { searchQuery = it onBankSearch(it) }, - label = R.string.feature_accounts_search, + modifier = Modifier + .fillMaxWidth() + .padding(horizontal = 16.dp), trailingIcon = { Icon(imageVector = Icons.Filled.Search, contentDescription = null) }, diff --git a/feature/auth/src/main/kotlin/org/mifospay/feature/auth/login/LoginScreen.kt b/feature/auth/src/main/kotlin/org/mifospay/feature/auth/login/LoginScreen.kt index 9dc0b73e2..6f253b7d0 100644 --- a/feature/auth/src/main/kotlin/org/mifospay/feature/auth/login/LoginScreen.kt +++ b/feature/auth/src/main/kotlin/org/mifospay/feature/auth/login/LoginScreen.kt @@ -142,21 +142,21 @@ private fun LoginScreenContent( ) Spacer(modifier = Modifier.padding(top = 32.dp)) MifosOutlinedTextField( - modifier = Modifier.fillMaxWidth(), + label = R.string.feature_auth_username, value = userName, onValueChange = { userName = it }, - label = R.string.feature_auth_username, + modifier = Modifier.fillMaxWidth(), ) Spacer(modifier = Modifier.padding(top = 16.dp)) MifosOutlinedTextField( - modifier = Modifier.fillMaxWidth(), + label = R.string.feature_auth_password, value = password, onValueChange = { password = it }, - label = R.string.feature_auth_password, + modifier = Modifier.fillMaxWidth(), visualTransformation = if (passwordVisibility) { VisualTransformation.None } else { diff --git a/feature/auth/src/main/kotlin/org/mifospay/feature/auth/mobileVerify/MobileVerificationScreen.kt b/feature/auth/src/main/kotlin/org/mifospay/feature/auth/mobileVerify/MobileVerificationScreen.kt index 0aff53567..b867b7e55 100644 --- a/feature/auth/src/main/kotlin/org/mifospay/feature/auth/mobileVerify/MobileVerificationScreen.kt +++ b/feature/auth/src/main/kotlin/org/mifospay/feature/auth/mobileVerify/MobileVerificationScreen.kt @@ -229,13 +229,13 @@ private fun EnterOtpScreen( } MifosOutlinedTextField( - modifier = modifier, + label = R.string.feature_auth_enter_otp, value = otp, onValueChange = { otp = it onOtpValidated(otp.text.length == 6, otp.text) }, - label = R.string.feature_auth_enter_otp, + modifier = modifier, keyboardActions = KeyboardActions { keyboardController?.hide() }, ) } diff --git a/feature/auth/src/main/kotlin/org/mifospay/feature/auth/signup/SignupScreen.kt b/feature/auth/src/main/kotlin/org/mifospay/feature/auth/signup/SignupScreen.kt index b8c0d15bc..76bc47ae9 100644 --- a/feature/auth/src/main/kotlin/org/mifospay/feature/auth/signup/SignupScreen.kt +++ b/feature/auth/src/main/kotlin/org/mifospay/feature/auth/signup/SignupScreen.kt @@ -138,59 +138,72 @@ private fun SignupScreenContent( var selectedState by rememberSaveable { mutableStateOf(null) } fun validateAllFields() { - val isAnyFieldEmpty = firstName.isEmpty() || lastName.isEmpty() || email.isEmpty() || - userName.isEmpty() || addressLine1.isEmpty() || addressLine2.isEmpty() || - pinCode.isEmpty() || password.isEmpty() || confirmPassword.isEmpty() || - selectedState == null + val isAnyFieldEmpty = + firstName.isEmpty() || + lastName.isEmpty() || + email.isEmpty() || + userName.isEmpty() || + addressLine1.isEmpty() || + addressLine2.isEmpty() || + pinCode.isEmpty() || + password.isEmpty() || + confirmPassword.isEmpty() || + selectedState == null - val isNameOfBusinessEmpty = data.mifosSavingsProductId == MIFOS_MERCHANT_SAVINGS_PRODUCT_ID && - nameOfBusiness.isEmpty() + val isNameOfBusinessEmpty = + data.mifosSavingsProductId == MIFOS_MERCHANT_SAVINGS_PRODUCT_ID && + nameOfBusiness.isEmpty() if (!email.isValidEmail()) { - Toast.makeText( - context, - context.getString(R.string.feature_auth_validate_email), - Toast.LENGTH_SHORT, - ).show() + Toast + .makeText( + context, + context.getString(R.string.feature_auth_validate_email), + Toast.LENGTH_SHORT, + ).show() return } if (isAnyFieldEmpty || isNameOfBusinessEmpty) { - Toast.makeText( - context, - context.getString(R.string.feature_auth_all_fields_are_mandatory), - Toast.LENGTH_SHORT, - ).show() + Toast + .makeText( + context, + context.getString(R.string.feature_auth_all_fields_are_mandatory), + Toast.LENGTH_SHORT, + ).show() return } } fun completeRegistration() { - val signUpData = data.copy( - firstName = firstName, - lastName = lastName, - email = email, - userName = userName, - addressLine1 = addressLine1, - addressLine2 = addressLine2, - pinCode = pinCode, - businessName = nameOfBusiness, - password = password, - stateId = selectedState?.id, - ) + val signUpData = + data.copy( + firstName = firstName, + lastName = lastName, + email = email, + userName = userName, + addressLine1 = addressLine1, + addressLine2 = addressLine2, + pinCode = pinCode, + businessName = nameOfBusiness, + password = password, + stateId = selectedState?.id, + ) onCompleteRegistration.invoke(signUpData) } Box(modifier) { Column( - modifier = Modifier + modifier = + Modifier .fillMaxSize() .background(color = MaterialTheme.colorScheme.surface) .verticalScroll(rememberScrollState()) .focusable(!showProgressState), ) { Column( - modifier = Modifier + modifier = + Modifier .fillMaxWidth() .background(color = MaterialTheme.colorScheme.primary), verticalArrangement = Arrangement.Top, @@ -201,7 +214,8 @@ private fun SignupScreenContent( style = MaterialTheme.typography.titleLarge.copy(color = MaterialTheme.colorScheme.onPrimary), ) Text( - modifier = Modifier.padding( + modifier = + Modifier.padding( top = 4.dp, bottom = 32.dp, start = 24.dp, @@ -213,13 +227,15 @@ private fun SignupScreenContent( } Column( - modifier = Modifier + modifier = + Modifier .fillMaxWidth() .padding(horizontal = 32.dp) .focusable(!showProgressState), ) { UserInfoTextField( - modifier = Modifier + modifier = + Modifier .fillMaxWidth() .padding(top = 16.dp), label = stringResource(id = R.string.feature_auth_first_name), @@ -228,7 +244,8 @@ private fun SignupScreenContent( firstName = it } UserInfoTextField( - modifier = Modifier + modifier = + Modifier .fillMaxWidth() .padding(top = 8.dp), label = stringResource(id = R.string.feature_auth_last_name), @@ -237,7 +254,8 @@ private fun SignupScreenContent( lastName = it } UserInfoTextField( - modifier = Modifier + modifier = + Modifier .fillMaxWidth() .padding(top = 8.dp), label = stringResource(id = R.string.feature_auth_username), @@ -258,7 +276,8 @@ private fun SignupScreenContent( }, ) UserInfoTextField( - modifier = Modifier + modifier = + Modifier .fillMaxWidth() .padding(top = 8.dp), label = stringResource(id = R.string.feature_auth_email), @@ -268,7 +287,8 @@ private fun SignupScreenContent( } if (data.mifosSavingsProductId == MIFOS_MERCHANT_SAVINGS_PRODUCT_ID) { UserInfoTextField( - modifier = Modifier + modifier = + Modifier .fillMaxWidth() .padding(top = 8.dp), label = stringResource(id = R.string.feature_auth_name_of_business), @@ -278,7 +298,8 @@ private fun SignupScreenContent( } } UserInfoTextField( - modifier = Modifier + modifier = + Modifier .fillMaxWidth() .padding(top = 8.dp), label = stringResource(id = R.string.feature_auth_address_line_1), @@ -287,7 +308,8 @@ private fun SignupScreenContent( addressLine1 = it } UserInfoTextField( - modifier = Modifier + modifier = + Modifier .fillMaxWidth() .padding(top = 8.dp), label = stringResource(id = R.string.feature_auth_address_line_2), @@ -312,7 +334,8 @@ private fun SignupScreenContent( } HorizontalDivider(thickness = 24.dp, color = Color.White) Button( - modifier = Modifier + modifier = + Modifier .fillMaxWidth() .padding(horizontal = 16.dp), colors = ButtonDefaults.buttonColors(containerColor = MaterialTheme.colorScheme.primary), @@ -332,7 +355,9 @@ private fun SignupScreenContent( } if (showProgressState) { - MfOverlayLoadingWheel(stringResource(id = R.string.feature_auth_please_wait)) + MfOverlayLoadingWheel( + contentDesc = stringResource(id = R.string.feature_auth_please_wait), + ) } } } @@ -390,12 +415,12 @@ private fun UserInfoTextField( onValueChange: (String) -> Unit = {}, ) { MfOutlinedTextField( - modifier = modifier, value = value, label = label, + onValueChange = onValueChange, + modifier = modifier, isError = value.isEmpty(), errorMessage = stringResource(id = R.string.feature_auth_mandatory), - onValueChange = onValueChange, ) } @@ -413,36 +438,38 @@ private fun PasswordAndConfirmPassword( ) { Column(modifier) { MfPasswordTextField( - modifier = Modifier.fillMaxWidth(), password = password, label = stringResource(id = R.string.feature_auth_password), isError = password.isEmpty() || password.length < 6, - errorMessage = if (password.isEmpty()) { + isPasswordVisible = isPasswordVisible, + onTogglePasswordVisibility = onTogglePasswordVisibility, + onPasswordChange = onPasswordChange, + modifier = Modifier.fillMaxWidth(), + errorMessage = + if (password.isEmpty()) { stringResource(id = R.string.feature_auth_password_cannot_be_empty) } else if (password.length < 6) { stringResource(id = R.string.feature_auth_password_must_be_least_6_characters) } else { null }, - onPasswordChange = onPasswordChange, - isPasswordVisible = isPasswordVisible, - onTogglePasswordVisibility = onTogglePasswordVisibility, ) MfPasswordTextField( - modifier = Modifier.fillMaxWidth(), password = confirmPassword, label = stringResource(id = R.string.feature_auth_confirm_password), isError = confirmPassword.isEmpty() || password != confirmPassword, - errorMessage = if (confirmPassword.isEmpty()) { + isPasswordVisible = isConfirmPasswordVisible, + onTogglePasswordVisibility = onConfirmTogglePasswordVisibility, + onPasswordChange = onConfirmPasswordChange, + modifier = Modifier.fillMaxWidth(), + errorMessage = + if (confirmPassword.isEmpty()) { stringResource(id = R.string.feature_auth_confirm_password_cannot_empty) } else if (password != confirmPassword) { stringResource(id = R.string.feature_auth_passwords_do_not_match) } else { null }, - onPasswordChange = onConfirmPasswordChange, - isPasswordVisible = isConfirmPasswordVisible, - onTogglePasswordVisibility = onConfirmTogglePasswordVisibility, ) if (password.length >= 6) { Text( @@ -470,12 +497,13 @@ private fun getPasswordStrength(password: String): String { val hasNumbers = password.any { it.isDigit() } val hasSymbols = password.any { !it.isLetterOrDigit() } - val numTypesPresent = intArrayOf( - hasUpperCase.toInt(), - hasLowerCase.toInt(), - hasNumbers.toInt(), - hasSymbols.toInt(), - ).sum() + val numTypesPresent = + intArrayOf( + hasUpperCase.toInt(), + hasLowerCase.toInt(), + hasNumbers.toInt(), + hasSymbols.toInt(), + ).sum() return PasswordStrength.entries[numTypesPresent].name } diff --git a/feature/editpassword/src/main/kotlin/org/mifospay/feature/editpassword/EditPasswordScreen.kt b/feature/editpassword/src/main/kotlin/org/mifospay/feature/editpassword/EditPasswordScreen.kt index 5c351797c..9d04e31c3 100644 --- a/feature/editpassword/src/main/kotlin/org/mifospay/feature/editpassword/EditPasswordScreen.kt +++ b/feature/editpassword/src/main/kotlin/org/mifospay/feature/editpassword/EditPasswordScreen.kt @@ -121,9 +121,6 @@ private fun EditPasswordScreen( .padding(paddingValues), ) { MfPasswordTextField( - modifier = Modifier - .fillMaxWidth() - .padding(horizontal = 16.dp), password = currentPassword, label = stringResource(R.string.feature_editpassword_current_password), isError = false, @@ -132,15 +129,21 @@ private fun EditPasswordScreen( isConfirmPasswordVisible = !isConfirmPasswordVisible }, onPasswordChange = { currentPassword = it }, - ) - MfPasswordTextField( modifier = Modifier .fillMaxWidth() .padding(horizontal = 16.dp), - + ) + MfPasswordTextField( password = newPassword, + label = stringResource(id = R.string.feature_editpassword_new_password), isError = newPassword.isNotEmpty() && newPassword.length < 6, + isPasswordVisible = isNewPasswordVisible, + onTogglePasswordVisibility = { isNewPasswordVisible = !isNewPasswordVisible }, + onPasswordChange = { newPassword = it }, + modifier = Modifier + .fillMaxWidth() + .padding(horizontal = 16.dp), errorMessage = if (newPassword.isNotEmpty() && newPassword.length < 6) { stringResource( id = R.string.feature_editpassword_password_length_error, @@ -148,17 +151,19 @@ private fun EditPasswordScreen( } else { null }, - isPasswordVisible = isNewPasswordVisible, - onTogglePasswordVisibility = { isNewPasswordVisible = !isNewPasswordVisible }, - onPasswordChange = { newPassword = it }, ) MfPasswordTextField( - modifier = Modifier - .fillMaxWidth() - .padding(horizontal = 16.dp), password = confirmNewPassword, label = stringResource(id = R.string.feature_editpassword_confirm_new_password), isError = newPassword != confirmNewPassword && confirmNewPassword.isNotEmpty(), + isPasswordVisible = isConfirmNewPasswordVisible, + onTogglePasswordVisibility = { + isConfirmNewPasswordVisible = !isConfirmNewPasswordVisible + }, + onPasswordChange = { confirmNewPassword = it }, + modifier = Modifier + .fillMaxWidth() + .padding(horizontal = 16.dp), errorMessage = if (newPassword != confirmNewPassword && confirmNewPassword.isNotEmpty() ) { @@ -168,11 +173,6 @@ private fun EditPasswordScreen( } else { null }, - isPasswordVisible = isConfirmNewPasswordVisible, - onTogglePasswordVisibility = { - isConfirmNewPasswordVisible = !isConfirmNewPasswordVisible - }, - onPasswordChange = { confirmNewPassword = it }, ) Row( diff --git a/feature/history/src/main/kotlin/org/mifospay/feature/history/HistoryScreen.kt b/feature/history/src/main/kotlin/org/mifospay/feature/history/HistoryScreen.kt index c00a183a3..5bb170539 100644 --- a/feature/history/src/main/kotlin/org/mifospay/feature/history/HistoryScreen.kt +++ b/feature/history/src/main/kotlin/org/mifospay/feature/history/HistoryScreen.kt @@ -85,9 +85,9 @@ private fun HistoryScreen( when (historyUiState) { HistoryUiState.Empty -> { EmptyContentScreen( - modifier = Modifier, title = stringResource(id = R.string.feature_history_error_oops), subTitle = stringResource(id = R.string.feature_history_empty_no_transaction_history_title), + modifier = Modifier, iconTint = MaterialTheme.colorScheme.primary, iconImageVector = Icons.Rounded.Info, ) @@ -95,9 +95,9 @@ private fun HistoryScreen( is HistoryUiState.Error -> { EmptyContentScreen( - modifier = Modifier, title = stringResource(id = R.string.feature_history_error_oops), subTitle = stringResource(id = R.string.feature_history_unexpected_error_subtitle), + modifier = Modifier, iconTint = MaterialTheme.colorScheme.primary, iconImageVector = Icons.Rounded.Info, ) @@ -139,10 +139,10 @@ private fun HistoryScreen( items(filteredTransactions) { Column { TransactionItemScreen( + transaction = it, modifier = Modifier .padding(start = 24.dp, end = 24.dp) .clickable { transactionDetailState = it }, - transaction = it, ) Spacer(modifier = Modifier.height(16.dp)) } diff --git a/feature/history/src/main/kotlin/org/mifospay/feature/specific/transactions/SpecificTransactionsScreen.kt b/feature/history/src/main/kotlin/org/mifospay/feature/specific/transactions/SpecificTransactionsScreen.kt index 854c0bd9b..47e325ebb 100644 --- a/feature/history/src/main/kotlin/org/mifospay/feature/specific/transactions/SpecificTransactionsScreen.kt +++ b/feature/history/src/main/kotlin/org/mifospay/feature/specific/transactions/SpecificTransactionsScreen.kt @@ -111,9 +111,9 @@ internal fun SpecificTransactionsScreen( is SpecificTransactionsUiState.Success -> { if (uiState.transactionsList.isEmpty()) { EmptyContentScreen( - modifier = Modifier, title = stringResource(id = R.string.feature_history_error_oops), subTitle = stringResource(id = R.string.feature_history_no_transactions_found), + modifier = Modifier, iconTint = MaterialTheme.colorScheme.onSurface, iconImageVector = Icons.Rounded.Info, ) diff --git a/feature/invoices/src/main/kotlin/org/mifospay/feature/invoices/InvoiceScreen.kt b/feature/invoices/src/main/kotlin/org/mifospay/feature/invoices/InvoiceScreen.kt index a03722322..f2e6a32f3 100644 --- a/feature/invoices/src/main/kotlin/org/mifospay/feature/invoices/InvoiceScreen.kt +++ b/feature/invoices/src/main/kotlin/org/mifospay/feature/invoices/InvoiceScreen.kt @@ -57,9 +57,9 @@ private fun InvoiceScreen( when (invoiceUiState) { is InvoicesUiState.Error -> { EmptyContentScreen( - modifier = Modifier, title = stringResource(id = R.string.feature_invoices_error_oops), subTitle = stringResource(id = R.string.feature_invoices_unexpected_error_subtitle), + modifier = Modifier, iconTint = Color.Black, iconImageVector = Info, ) @@ -92,9 +92,9 @@ private fun InvoiceScreen( InvoicesUiState.Empty -> { EmptyContentScreen( - modifier = Modifier, title = stringResource(id = R.string.feature_invoices_error_oops), subTitle = stringResource(id = R.string.feature_invoices_error_no_invoices_found), + modifier = Modifier, iconTint = Color.Black, ) } diff --git a/feature/kyc/src/main/kotlin/org/mifospay/feature/kyc/KYCDescriptionScreen.kt b/feature/kyc/src/main/kotlin/org/mifospay/feature/kyc/KYCDescriptionScreen.kt index dcf6c1796..35d032c17 100644 --- a/feature/kyc/src/main/kotlin/org/mifospay/feature/kyc/KYCDescriptionScreen.kt +++ b/feature/kyc/src/main/kotlin/org/mifospay/feature/kyc/KYCDescriptionScreen.kt @@ -110,9 +110,9 @@ private fun KYCDescriptionScreen( is KYCDescriptionUiState.Error -> { EmptyContentScreen( - modifier = Modifier, title = stringResource(id = R.string.feature_kyc_error_oops), subTitle = stringResource(id = R.string.feature_kyc_unexpected_error_subtitle), + modifier = Modifier, iconTint = MaterialTheme.colorScheme.primary, iconImageVector = Icons.Rounded.Info, ) diff --git a/feature/kyc/src/main/kotlin/org/mifospay/feature/kyc/KYCLevel1Screen.kt b/feature/kyc/src/main/kotlin/org/mifospay/feature/kyc/KYCLevel1Screen.kt index a41203e94..301cc6f90 100644 --- a/feature/kyc/src/main/kotlin/org/mifospay/feature/kyc/KYCLevel1Screen.kt +++ b/feature/kyc/src/main/kotlin/org/mifospay/feature/kyc/KYCLevel1Screen.kt @@ -85,7 +85,9 @@ private fun KYCLevel1Screen( when (uiState) { KYCLevel1UiState.Loading -> { - MfOverlayLoadingWheel(stringResource(id = R.string.feature_kyc_submitting)) + MfOverlayLoadingWheel( + contentDesc = stringResource(id = R.string.feature_kyc_submitting), + ) } KYCLevel1UiState.Error -> { @@ -140,44 +142,44 @@ private fun Kyc1Form( ) { Spacer(modifier = Modifier.height(20.dp)) MifosOutlinedTextField( - modifier = Modifier - .fillMaxWidth() - .padding(vertical = 8.dp), + label = R.string.feature_kyc_first_name, value = firstName, onValueChange = { firstName = it }, - label = R.string.feature_kyc_first_name, - ) - MifosOutlinedTextField( modifier = Modifier .fillMaxWidth() .padding(vertical = 8.dp), + ) + MifosOutlinedTextField( + label = R.string.feature_kyc_last_name, value = lastName, onValueChange = { lastName = it }, - label = R.string.feature_kyc_last_name, - ) - MifosOutlinedTextField( modifier = Modifier .fillMaxWidth() .padding(vertical = 8.dp), + ) + MifosOutlinedTextField( + label = R.string.feature_kyc_address_line_1, value = address1, onValueChange = { address1 = it }, - label = R.string.feature_kyc_address_line_1, - ) - MifosOutlinedTextField( modifier = Modifier .fillMaxWidth() .padding(vertical = 8.dp), + ) + MifosOutlinedTextField( + label = R.string.feature_kyc_address_line_2, value = address2, onValueChange = { address2 = it }, - label = R.string.feature_kyc_address_line_2, + modifier = Modifier + .fillMaxWidth() + .padding(vertical = 8.dp), ) Box( diff --git a/feature/kyc/src/main/kotlin/org/mifospay/feature/kyc/KYCLevel2Screen.kt b/feature/kyc/src/main/kotlin/org/mifospay/feature/kyc/KYCLevel2Screen.kt index ce10cb812..610dcef1e 100644 --- a/feature/kyc/src/main/kotlin/org/mifospay/feature/kyc/KYCLevel2Screen.kt +++ b/feature/kyc/src/main/kotlin/org/mifospay/feature/kyc/KYCLevel2Screen.kt @@ -94,7 +94,9 @@ private fun KYCLevel2Screen( when (uiState) { KYCLevel2UiState.Loading -> { - MfOverlayLoadingWheel(stringResource(id = R.string.feature_kyc_submitting)) + MfOverlayLoadingWheel( + contentDesc = stringResource(id = R.string.feature_kyc_submitting), + ) } KYCLevel2UiState.Error -> { @@ -256,14 +258,14 @@ private fun Kyc2Form( verticalArrangement = Arrangement.spacedBy(20.dp), ) { MifosOutlinedTextField( - modifier = Modifier - .fillMaxWidth() - .padding(vertical = 8.dp), + label = R.string.feature_kyc_id_type, value = idType, onValueChange = { idType = it }, - label = R.string.feature_kyc_id_type, + modifier = Modifier + .fillMaxWidth() + .padding(vertical = 8.dp), ) Row { diff --git a/feature/kyc/src/main/kotlin/org/mifospay/feature/kyc/KYCLevel3Screen.kt b/feature/kyc/src/main/kotlin/org/mifospay/feature/kyc/KYCLevel3Screen.kt index f8e523542..f8bcece6c 100644 --- a/feature/kyc/src/main/kotlin/org/mifospay/feature/kyc/KYCLevel3Screen.kt +++ b/feature/kyc/src/main/kotlin/org/mifospay/feature/kyc/KYCLevel3Screen.kt @@ -55,7 +55,7 @@ private fun KYCLevel3Screen( when (uiState) { KYCLevel3UiState.Loading -> { - MfOverlayLoadingWheel(stringResource(id = R.string.feature_kyc_submitting)) + MfOverlayLoadingWheel(contentDesc = stringResource(id = R.string.feature_kyc_submitting)) } KYCLevel3UiState.Error -> { @@ -81,14 +81,14 @@ private fun Kyc3Form( verticalArrangement = Arrangement.spacedBy(10.dp), ) { MifosOutlinedTextField( - modifier = Modifier - .fillMaxWidth() - .padding(vertical = 8.dp), + label = R.string.feature_kyc_pan_id, value = panIdValue, onValueChange = { panIdValue = it }, - label = R.string.feature_kyc_pan_id, + modifier = Modifier + .fillMaxWidth() + .padding(vertical = 8.dp), ) Button( diff --git a/feature/make-transfer/src/main/kotlin/org/mifospay/feature/make/transfer/navigation/MakeTransferNavigation.kt b/feature/make-transfer/src/main/kotlin/org/mifospay/feature/make/transfer/navigation/MakeTransferNavigation.kt index 5e8f0be49..3cab13c8b 100644 --- a/feature/make-transfer/src/main/kotlin/org/mifospay/feature/make/transfer/navigation/MakeTransferNavigation.kt +++ b/feature/make-transfer/src/main/kotlin/org/mifospay/feature/make/transfer/navigation/MakeTransferNavigation.kt @@ -21,8 +21,8 @@ import org.mifospay.feature.make.transfer.MakeTransferScreenRoute const val MAKE_TRANSFER_ROUTE_BASE = "make_transfer_route" const val MAKE_TRANSFER_ROUTE = MAKE_TRANSFER_ROUTE_BASE + - "?${PAYEE_EXTERNAL_ID_ARG}={$PAYEE_EXTERNAL_ID_ARG}" + - "&${TRANSFER_AMOUNT_ARG}={$TRANSFER_AMOUNT_ARG}" + "?${PAYEE_EXTERNAL_ID_ARG}={$PAYEE_EXTERNAL_ID_ARG}" + + "&${TRANSFER_AMOUNT_ARG}={$TRANSFER_AMOUNT_ARG}" fun NavController.navigateToMakeTransferScreen( externalId: String? = null, @@ -31,10 +31,10 @@ fun NavController.navigateToMakeTransferScreen( ) { val route = MAKE_TRANSFER_ROUTE_BASE + if (transferAmount != null) { "?${PAYEE_EXTERNAL_ID_ARG}=$externalId" + - "&${TRANSFER_AMOUNT_ARG}=$transferAmount" + "&${TRANSFER_AMOUNT_ARG}=$transferAmount" } else { "?${PAYEE_EXTERNAL_ID_ARG}=$externalId" + - "&${TRANSFER_AMOUNT_ARG}=${"0.0"}" + "&${TRANSFER_AMOUNT_ARG}=${"0.0"}" } navigate(route, navOptions) } diff --git a/feature/merchants/src/main/kotlin/org/mifospay/feature/merchants/ui/MerchantScreen.kt b/feature/merchants/src/main/kotlin/org/mifospay/feature/merchants/ui/MerchantScreen.kt index aaee375fc..7a6d1066d 100644 --- a/feature/merchants/src/main/kotlin/org/mifospay/feature/merchants/ui/MerchantScreen.kt +++ b/feature/merchants/src/main/kotlin/org/mifospay/feature/merchants/ui/MerchantScreen.kt @@ -95,9 +95,9 @@ internal fun MerchantScreen( when (merchantUiState) { MerchantUiState.Empty -> { EmptyContentScreen( - modifier = Modifier, title = stringResource(id = R.string.feature_merchants_empty_no_merchants_title), subTitle = stringResource(id = R.string.feature_merchants_empty_no_merchants_subtitle), + modifier = Modifier, iconTint = MaterialTheme.colorScheme.primary, iconImageVector = Icons.Rounded.Info, ) @@ -105,9 +105,9 @@ internal fun MerchantScreen( is MerchantUiState.Error -> { EmptyContentScreen( - modifier = Modifier, title = stringResource(id = R.string.feature_merchants_error_oops), subTitle = stringResource(id = R.string.feature_merchants_unexpected_error_subtitle), + modifier = Modifier, iconTint = MaterialTheme.colorScheme.primary, iconImageVector = Icons.Rounded.Info, ) diff --git a/feature/merchants/src/main/kotlin/org/mifospay/feature/merchants/ui/MerchantTransferScreen.kt b/feature/merchants/src/main/kotlin/org/mifospay/feature/merchants/ui/MerchantTransferScreen.kt index 15491cd96..2f9f471dd 100644 --- a/feature/merchants/src/main/kotlin/org/mifospay/feature/merchants/ui/MerchantTransferScreen.kt +++ b/feature/merchants/src/main/kotlin/org/mifospay/feature/merchants/ui/MerchantTransferScreen.kt @@ -142,9 +142,9 @@ internal fun MerchantTransferScreen( is MerchantTransferUiState.Empty -> { EmptyContentScreen( - modifier = Modifier, title = stringResource(id = R.string.feature_merchants_error_oops), subTitle = stringResource(id = R.string.feature_merchants_no_transactions_found), + modifier = Modifier, iconTint = MaterialTheme.colorScheme.onSurface, iconImageVector = MifosIcons.Info, ) @@ -155,11 +155,12 @@ internal fun MerchantTransferScreen( } is MerchantTransferUiState.InsufficientBalance -> { - Toast.makeText( - context, - stringResource(id = R.string.feature_merchants_insufficient_balance), - Toast.LENGTH_SHORT, - ).show() + Toast + .makeText( + context, + stringResource(id = R.string.feature_merchants_insufficient_balance), + Toast.LENGTH_SHORT, + ).show() } } @@ -207,7 +208,8 @@ private fun MerchantBottomSheet( MifosBottomSheet( content = { Column( - modifier = Modifier + modifier = + Modifier .fillMaxWidth() .padding(horizontal = 16.dp, vertical = 24.dp), horizontalAlignment = Alignment.CenterHorizontally, @@ -227,10 +229,10 @@ private fun MerchantBottomSheet( Spacer(modifier = Modifier.height(24.dp)) MfOutlinedTextField( value = amount, - onValueChange = onAmountChange, label = stringResource(id = R.string.feature_merchants_amount), - keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Number), + onValueChange = onAmountChange, modifier = Modifier.fillMaxWidth(), + keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Number), ) Spacer(modifier = Modifier.height(24.dp)) Button( @@ -289,7 +291,8 @@ private fun MerchantInitialAvatar( val initial = merchantName.take(1).uppercase() Box( - modifier = modifier + modifier = + modifier .size(86.dp) .background( color = MaterialTheme.colorScheme.primary, @@ -342,7 +345,8 @@ private fun SpecificTransactionItem( style = MaterialTheme.typography.bodyLarge, ) Text( - text = when (transaction.transactionType) { + text = + when (transaction.transactionType) { TransactionType.DEBIT -> stringResource(id = R.string.feature_merchants_debits) TransactionType.CREDIT -> stringResource(id = R.string.feature_merchants_credits) TransactionType.OTHER -> stringResource(id = R.string.feature_merchants_other) @@ -354,7 +358,8 @@ private fun SpecificTransactionItem( Text( text = "${transaction.currency.code}${transaction.amount}", style = MaterialTheme.typography.displaySmall, - color = when (transaction.transactionType) { + color = + when (transaction.transactionType) { TransactionType.DEBIT -> debitTextColor TransactionType.CREDIT -> creditTextColor TransactionType.OTHER -> otherTextColor @@ -372,7 +377,8 @@ private fun SpecificTransactionAccountInfo( accountClicked: (String) -> Unit = {}, ) { Column( - modifier = modifier.clickable { + modifier = + modifier.clickable { accountClicked(account.accountNo) }, horizontalAlignment = Alignment.CenterHorizontally, @@ -389,16 +395,16 @@ private fun SpecificTransactionAccountInfo( } } -internal class MerchantTransferUiStateProvider : - PreviewParameterProvider { +internal class MerchantTransferUiStateProvider : PreviewParameterProvider { override val values: Sequence - get() = sequenceOf( - MerchantTransferUiState.Success(arrayListOf(Transaction())), - MerchantTransferUiState.Error, - MerchantTransferUiState.Loading, - MerchantTransferUiState.Empty, - MerchantTransferUiState.InsufficientBalance, - ) + get() = + sequenceOf( + MerchantTransferUiState.Success(arrayListOf(Transaction())), + MerchantTransferUiState.Error, + MerchantTransferUiState.Loading, + MerchantTransferUiState.Empty, + MerchantTransferUiState.InsufficientBalance, + ) } @Preview(showSystemUi = true) diff --git a/feature/notification/src/main/kotlin/org/mifospay/feature/notification/NotificationScreen.kt b/feature/notification/src/main/kotlin/org/mifospay/feature/notification/NotificationScreen.kt index 8bc5f4641..c46a711d3 100644 --- a/feature/notification/src/main/kotlin/org/mifospay/feature/notification/NotificationScreen.kt +++ b/feature/notification/src/main/kotlin/org/mifospay/feature/notification/NotificationScreen.kt @@ -79,9 +79,9 @@ internal fun NotificationScreen( when (uiState) { is NotificationUiState.Error -> { EmptyContentScreen( - modifier = Modifier, title = stringResource(id = R.string.feature_notification_error_oops), subTitle = stringResource(id = R.string.feature_notification_unexpected_error_subtitle), + modifier = Modifier, iconTint = MaterialTheme.colorScheme.primary, iconImageVector = MifosIcons.RoundedInfo, ) @@ -97,9 +97,9 @@ internal fun NotificationScreen( is NotificationUiState.Success -> { if (uiState.notificationList.isEmpty()) { EmptyContentScreen( - modifier = Modifier, title = stringResource(R.string.feature_notification_nothing_to_notify), subTitle = stringResource(R.string.feature_notification_there_is_nothing_to_show), + modifier = Modifier, iconTint = MaterialTheme.colorScheme.onSurface, iconImageVector = MifosIcons.RoundedInfo, ) diff --git a/feature/profile/src/main/kotlin/org/mifospay/feature/profile/edit/EditProfileScreen.kt b/feature/profile/src/main/kotlin/org/mifospay/feature/profile/edit/EditProfileScreen.kt index 949e053f3..c355412b2 100644 --- a/feature/profile/src/main/kotlin/org/mifospay/feature/profile/edit/EditProfileScreen.kt +++ b/feature/profile/src/main/kotlin/org/mifospay/feature/profile/edit/EditProfileScreen.kt @@ -111,7 +111,8 @@ fun EditProfileScreen( var showDiscardChangesDialog by rememberSaveable { mutableStateOf(false) } Box( - modifier = modifier + modifier = + modifier .fillMaxSize(), ) { MifosScaffold( @@ -163,6 +164,7 @@ fun EditProfileScreen( } } +@Suppress("LongMethod") @Composable private fun EditProfileScreenContent( initialUsername: String, @@ -186,7 +188,8 @@ private fun EditProfileScreenContent( val context = LocalContext.current PermissionBox( - requiredPermissions = if (Build.VERSION.SDK_INT >= 33) { + requiredPermissions = + if (Build.VERSION.SDK_INT >= 33) { listOf(Manifest.permission.CAMERA) } else { listOf( @@ -196,22 +199,23 @@ private fun EditProfileScreenContent( ) }, title = R.string.feature_profile_permission_required, - description = R.string.feature_profile_approve_description, confirmButtonText = R.string.feature_profile_proceed, dismissButtonText = R.string.feature_profile_dismiss, + description = R.string.feature_profile_approve_description, onGranted = { val cameraLauncher = rememberLauncherForActivityResult(ActivityResultContracts.TakePicture()) { imageUri = uri } - val galleryLauncher = rememberLauncherForActivityResult( - contract = ActivityResultContracts.GetContent(), - ) { uri: Uri? -> - uri?.let { - imageUri = uri + val galleryLauncher = + rememberLauncherForActivityResult( + contract = ActivityResultContracts.GetContent(), + ) { uri: Uri? -> + uri?.let { + imageUri = uri + } } - } if (showBottomSheet) { MifosBottomSheet( @@ -239,12 +243,14 @@ private fun EditProfileScreenContent( }, ) Box( - modifier = modifier + modifier = + modifier .padding(contentPadding) .fillMaxSize(), ) { Column( - modifier = Modifier + modifier = + Modifier .fillMaxSize() .background(color = MaterialTheme.colorScheme.surface) .verticalScroll(rememberScrollState()), @@ -254,31 +260,35 @@ private fun EditProfileScreenContent( onCameraIconClick = { showBottomSheet = true }, ) MfOutlinedTextField( - modifier = Modifier - .fillMaxWidth() - .padding(start = 16.dp, end = 16.dp), value = username, label = stringResource(id = R.string.feature_profile_username), onValueChange = { username = it }, - ) - MfOutlinedTextField( - modifier = Modifier + modifier = + Modifier .fillMaxWidth() .padding(start = 16.dp, end = 16.dp), + ) + MfOutlinedTextField( value = email, label = stringResource(id = R.string.feature_profile_email), onValueChange = { email = it }, - ) - MfOutlinedTextField( - modifier = Modifier + modifier = + Modifier .fillMaxWidth() .padding(start = 16.dp, end = 16.dp), + ) + MfOutlinedTextField( value = vpa, label = stringResource(id = R.string.feature_profile_vpa), onValueChange = { vpa = it }, + modifier = + Modifier + .fillMaxWidth() + .padding(start = 16.dp, end = 16.dp), ) Box( - modifier = Modifier + modifier = + Modifier .fillMaxWidth() .padding(start = 16.dp, end = 16.dp), ) { @@ -291,7 +301,8 @@ private fun EditProfileScreenContent( initialPhoneNumber = " ", autoDetectCode = true, shape = RoundedCornerShape(3.dp), - colors = TextFieldDefaults.outlinedTextFieldColors( + colors = + TextFieldDefaults.outlinedTextFieldColors( focusedBorderColor = MaterialTheme.colorScheme.onSurface, ), onValueChange = { (code, phone), isValid -> @@ -317,12 +328,12 @@ private fun EditProfileScreenContent( // same behaviour as onBackPress, hence reused the callback onBackClick.invoke() } else { - Toast.makeText( - context, - R.string.feature_profile_failed_to_save_changes, - Toast.LENGTH_SHORT, - ) - .show() + Toast + .makeText( + context, + R.string.feature_profile_failed_to_save_changes, + Toast.LENGTH_SHORT, + ).show() } }, buttonText = R.string.feature_profile_save, @@ -331,9 +342,10 @@ private fun EditProfileScreenContent( } } -private fun isDataSaveNecessary(input: String, initialInput: String): Boolean { - return input == initialInput -} +private fun isDataSaveNecessary( + input: String, + initialInput: String, +): Boolean = input == initialInput @Composable fun EditProfileBottomSheetContent( @@ -343,12 +355,14 @@ fun EditProfileBottomSheetContent( modifier: Modifier = Modifier, ) { Column( - modifier = modifier + modifier = + modifier .background(MaterialTheme.colorScheme.surface) .padding(top = 8.dp, bottom = 12.dp), ) { Row( - modifier = Modifier + modifier = + Modifier .fillMaxWidth() .padding(12.dp) .clickable { onClickProfilePicture.invoke() }, @@ -362,7 +376,8 @@ fun EditProfileBottomSheetContent( ) } Row( - modifier = Modifier + modifier = + Modifier .fillMaxWidth() .padding(12.dp) .clickable { onChangeProfilePicture.invoke() }, @@ -376,7 +391,8 @@ fun EditProfileBottomSheetContent( ) } Row( - modifier = Modifier + modifier = + Modifier .fillMaxWidth() .padding(12.dp) .clickable { onRemoveProfilePicture.invoke() }, @@ -401,7 +417,8 @@ private fun EditProfileSaveButton( Button( onClick = onClick, colors = ButtonDefaults.buttonColors(MaterialTheme.colorScheme.primary), - modifier = modifier + modifier = + modifier .fillMaxWidth() .padding(16.dp), shape = RoundedCornerShape(10.dp), @@ -426,17 +443,18 @@ private fun createImageFile(context: Context): File { internal class EditProfilePreviewProvider : PreviewParameterProvider { override val values: Sequence - get() = sequenceOf( - EditProfileUiState.Loading, - EditProfileUiState.Success(), - EditProfileUiState.Success( - name = "John Doe", - username = "John", - email = "john@mifos.org", - vpa = "vpa", - mobile = "+1 55557772901", - ), - ) + get() = + sequenceOf( + EditProfileUiState.Loading, + EditProfileUiState.Success(), + EditProfileUiState.Success( + name = "John Doe", + username = "John", + email = "john@mifos.org", + vpa = "vpa", + mobile = "+1 55557772901", + ), + ) } @Preview(showBackground = true, showSystemUi = true) diff --git a/feature/qr/src/main/kotlin/org/mifospay/feature/read/qr/ReadQrScreen.kt b/feature/qr/src/main/kotlin/org/mifospay/feature/read/qr/ReadQrScreen.kt index 47bfe6072..c1660cb7c 100644 --- a/feature/qr/src/main/kotlin/org/mifospay/feature/read/qr/ReadQrScreen.kt +++ b/feature/qr/src/main/kotlin/org/mifospay/feature/read/qr/ReadQrScreen.kt @@ -111,9 +111,9 @@ internal fun ReadQrScreen( ) }, title = R.string.feature_qr_permission_required, - description = R.string.feature_qr_approve_permission_description_camera, confirmButtonText = R.string.feature_qr_proceed, dismissButtonText = R.string.feature_qr_dismiss, + description = R.string.feature_qr_approve_permission_description_camera, onGranted = { Box { MifosScaffold( @@ -135,9 +135,9 @@ internal fun ReadQrScreen( is ReadQrUiState.Error -> { EmptyContentScreen( - modifier = Modifier, title = stringResource(R.string.feature_qr_oops), subTitle = stringResource(id = R.string.feature_qr_unexpected_error_subtitle), + modifier = Modifier, iconTint = MaterialTheme.colorScheme.onSurface, iconImageVector = MifosIcons.Info, ) diff --git a/feature/receipt/src/main/kotlin/org/mifospay/feature/receipt/ReceiptScreen.kt b/feature/receipt/src/main/kotlin/org/mifospay/feature/receipt/ReceiptScreen.kt index b47f8b592..7da744baf 100644 --- a/feature/receipt/src/main/kotlin/org/mifospay/feature/receipt/ReceiptScreen.kt +++ b/feature/receipt/src/main/kotlin/org/mifospay/feature/receipt/ReceiptScreen.kt @@ -194,9 +194,9 @@ private fun ReceiptScreenContent( ) }, title = R.string.feature_receipt_approve_permission_storage, - description = R.string.feature_receipt_approve_permission_storage_receiptDescription, confirmButtonText = R.string.feature_receipt_proceed, dismissButtonText = R.string.feature_receipt_dismiss, + description = R.string.feature_receipt_approve_permission_storage_receiptDescription, onGranted = { downloadData(transaction.transactionId.toString()) LaunchedEffect(Unit) { diff --git a/feature/request-money/src/main/kotlin/org/mifospay/feature/request/money/SetAmountDialog.kt b/feature/request-money/src/main/kotlin/org/mifospay/feature/request/money/SetAmountDialog.kt index da9f9e396..eab98646c 100644 --- a/feature/request-money/src/main/kotlin/org/mifospay/feature/request/money/SetAmountDialog.kt +++ b/feature/request-money/src/main/kotlin/org/mifospay/feature/request/money/SetAmountDialog.kt @@ -59,26 +59,32 @@ internal fun SetAmountDialog( var currencyValidator by rememberSaveable { mutableStateOf(null) } LaunchedEffect(key1 = amount) { - amountValidator = when { - amount.trim() == "" -> null - amount.trim().any { it.isLetter() } || - amount.trim() - .toDoubleOrNull() == null -> context.getString(R.string.feature_request_money_enter_valid_amount) - - amount.trim().toDouble() - .compareTo(0.0) <= 0 -> context.getString(R.string.feature_request_money_enter_valid_amount) - - else -> null - } + amountValidator = + when { + amount.trim() == "" -> null + amount.trim().any { it.isLetter() } || + amount + .trim() + .toDoubleOrNull() == null -> context.getString(R.string.feature_request_money_enter_valid_amount) + + amount + .trim() + .toDouble() + .compareTo(0.0) <= 0 -> context.getString(R.string.feature_request_money_enter_valid_amount) + + else -> null + } } LaunchedEffect(key1 = currency) { - currencyValidator = when { - currency.trim() - .isEmpty() -> context.getString(R.string.feature_request_money_enter_currency) + currencyValidator = + when { + currency + .trim() + .isEmpty() -> context.getString(R.string.feature_request_money_enter_currency) - else -> null - } + else -> null + } } fun validateAllFields(): Boolean { @@ -113,12 +119,9 @@ internal fun SetAmountDialog( MfOutlinedTextField( value = amount, + label = stringResource(id = R.string.feature_request_money_set_amount), onValueChange = { amount = it }, modifier = Modifier.fillMaxWidth(), - label = stringResource(id = R.string.feature_request_money_set_amount), - keyboardOptions = KeyboardOptions( - keyboardType = KeyboardType.Number, - ), trailingIcon = { IconButton( onClick = { @@ -131,14 +134,19 @@ internal fun SetAmountDialog( ) } }, + keyboardOptions = + KeyboardOptions( + keyboardType = KeyboardType.Number, + ), ) MfOutlinedTextField( value = currency, + label = stringResource(id = R.string.feature_request_money_currency), onValueChange = { currency = it }, modifier = Modifier.fillMaxWidth(), - label = stringResource(id = R.string.feature_request_money_currency), - keyboardOptions = KeyboardOptions( + keyboardOptions = + KeyboardOptions( keyboardType = KeyboardType.Text, ), ) diff --git a/feature/request-money/src/main/kotlin/org/mifospay/feature/request/money/ShowQrScreenRoute.kt b/feature/request-money/src/main/kotlin/org/mifospay/feature/request/money/ShowQrScreenRoute.kt index 5b46d0837..2d1fa677c 100644 --- a/feature/request-money/src/main/kotlin/org/mifospay/feature/request/money/ShowQrScreenRoute.kt +++ b/feature/request-money/src/main/kotlin/org/mifospay/feature/request/money/ShowQrScreenRoute.kt @@ -94,9 +94,9 @@ internal fun ShowQrScreen( is ShowQrUiState.Success -> { if (uiState.qrDataBitmap == null) { EmptyContentScreen( - modifier = Modifier, title = stringResource(R.string.feature_request_money_nothing_to_notify), subTitle = stringResource(R.string.feature_request_money_there_is_nothing_to_show), + modifier = Modifier, iconTint = MaterialTheme.colorScheme.onSurface, iconImageVector = MifosIcons.Info, ) @@ -113,9 +113,9 @@ internal fun ShowQrScreen( is ShowQrUiState.Error -> { EmptyContentScreen( - modifier = Modifier, title = stringResource(id = R.string.feature_request_money_error_oops), subTitle = stringResource(id = R.string.feature_request_money_unexpected_error_subtitle), + modifier = Modifier, iconTint = MaterialTheme.colorScheme.onSurface, iconImageVector = MifosIcons.Info, ) diff --git a/feature/savedcards/src/main/kotlin/org/mifospay/feature/savedcards/AddCardDialogSheet.kt b/feature/savedcards/src/main/kotlin/org/mifospay/feature/savedcards/AddCardDialogSheet.kt index ca860e65f..773768448 100644 --- a/feature/savedcards/src/main/kotlin/org/mifospay/feature/savedcards/AddCardDialogSheet.kt +++ b/feature/savedcards/src/main/kotlin/org/mifospay/feature/savedcards/AddCardDialogSheet.kt @@ -174,24 +174,24 @@ private fun AddCardDialogSheetContent( .padding(16.dp), ) { MifosOutlinedTextField( + label = R.string.feature_savedcards_first_name, value = firstName, onValueChange = { firstName = it }, modifier = Modifier.fillMaxWidth(), - label = R.string.feature_savedcards_first_name, ) Spacer(modifier = Modifier.height(8.dp)) MifosOutlinedTextField( + label = R.string.feature_savedcards_last_name, value = lastName, onValueChange = { lastName = it }, modifier = Modifier.fillMaxWidth(), - label = R.string.feature_savedcards_last_name, ) Spacer(modifier = Modifier.height(8.dp)) MifosOutlinedTextField( + label = R.string.feature_savedcards_credit_card_number, value = creditCardNumber, onValueChange = { if (it.length <= 16) creditCardNumber = it }, modifier = Modifier.fillMaxWidth(), - label = R.string.feature_savedcards_credit_card_number, keyboardOptions = KeyboardOptions.Default.copy(keyboardType = KeyboardType.NumberPassword), ) Spacer(modifier = Modifier.height(16.dp)) @@ -199,19 +199,19 @@ private fun AddCardDialogSheetContent( Spacer(modifier = Modifier.height(8.dp)) Row(modifier = Modifier.fillMaxWidth()) { MifosOutlinedTextField( + label = R.string.feature_savedcards_mm_yy, value = expiration, onValueChange = { if (it.length <= 4) expiration = it }, modifier = Modifier.weight(1f), - label = R.string.feature_savedcards_mm_yy, visualTransformation = ExpirationDateMask(), keyboardOptions = KeyboardOptions.Default.copy(keyboardType = KeyboardType.NumberPassword), ) Spacer(modifier = Modifier.width(16.dp)) MifosOutlinedTextField( + label = R.string.feature_savedcards_cvv, value = cvv, onValueChange = { if (it.length <= 3) cvv = it }, modifier = Modifier.weight(1f), - label = R.string.feature_savedcards_cvv, keyboardOptions = KeyboardOptions.Default.copy(keyboardType = KeyboardType.NumberPassword), ) } diff --git a/feature/savedcards/src/main/kotlin/org/mifospay/feature/savedcards/CardsScreen.kt b/feature/savedcards/src/main/kotlin/org/mifospay/feature/savedcards/CardsScreen.kt index 888af3112..d96055f24 100644 --- a/feature/savedcards/src/main/kotlin/org/mifospay/feature/savedcards/CardsScreen.kt +++ b/feature/savedcards/src/main/kotlin/org/mifospay/feature/savedcards/CardsScreen.kt @@ -154,9 +154,9 @@ internal fun CardsScreen( is CardsUiState.Error -> { EmptyContentScreen( - modifier = Modifier, title = stringResource(id = R.string.feature_savedcards_error_oops), subTitle = stringResource(id = R.string.feature_savedcards_unexpected_error_subtitle), + modifier = Modifier, iconTint = MaterialTheme.colorScheme.primary, iconImageVector = Icons.Rounded.Info, ) @@ -245,10 +245,10 @@ private fun CardsScreenContent( .background(color = MaterialTheme.colorScheme.surface), ) { AddCardChip( - modifier = Modifier.align(Alignment.Center), - onAddBtn = onAddBtn, text = R.string.feature_savedcards_add_cards, btnText = R.string.feature_savedcards_add_cards, + onAddBtn = onAddBtn, + modifier = Modifier.align(Alignment.Center), ) } } @@ -416,10 +416,10 @@ private fun NoCardAddCardsScreen( color = MaterialTheme.colorScheme.onSurface, ) AddCardChip( - modifier = Modifier, - onAddBtn = onAddBtn, text = R.string.feature_savedcards_add_cards, btnText = R.string.feature_savedcards_add_cards, + onAddBtn = onAddBtn, + modifier = Modifier, ) } } diff --git a/feature/send-money/src/main/kotlin/org/mifospay/feature/send/money/SendScreenRoute.kt b/feature/send-money/src/main/kotlin/org/mifospay/feature/send/money/SendScreenRoute.kt index 35398e0c7..1623c2f3e 100644 --- a/feature/send-money/src/main/kotlin/org/mifospay/feature/send/money/SendScreenRoute.kt +++ b/feature/send-money/src/main/kotlin/org/mifospay/feature/send/money/SendScreenRoute.kt @@ -143,12 +143,13 @@ internal fun SendMoneyScreen( val contactUri by rememberSaveable { mutableStateOf(null) } fun validateInfo() { - isValidInfo = when (sendMethodType) { - SendMethodType.VPA -> amount.isNotEmpty() && vpa.isNotEmpty() - SendMethodType.MOBILE -> { - isValidMobileNumber && mobileNumber.isNotEmpty() && amount.isNotEmpty() + isValidInfo = + when (sendMethodType) { + SendMethodType.VPA -> amount.isNotEmpty() && vpa.isNotEmpty() + SendMethodType.MOBILE -> { + isValidMobileNumber && mobileNumber.isNotEmpty() && amount.isNotEmpty() + } } - } } LaunchedEffect(key1 = contactUri) { @@ -157,26 +158,26 @@ internal fun SendMoneyScreen( } } - val options = GmsBarcodeScannerOptions.Builder() - .setBarcodeFormats( - Barcode.FORMAT_QR_CODE, - Barcode.FORMAT_AZTEC, - ) - .build() + val options = + GmsBarcodeScannerOptions + .Builder() + .setBarcodeFormats( + Barcode.FORMAT_QR_CODE, + Barcode.FORMAT_AZTEC, + ).build() val scanner = GmsBarcodeScanning.getClient(context, options) fun startScan() { - scanner.startScan() + scanner + .startScan() .addOnSuccessListener { barcode -> barcode.rawValue?.let { vpa = it } - } - .addOnCanceledListener { + }.addOnCanceledListener { // Task canceled - } - .addOnFailureListener { e -> + }.addOnFailureListener { e -> // Task failed with an exception e.localizedMessage?.let { Log.d("SendMoney: Barcode scan failed", it) } } @@ -198,7 +199,8 @@ internal fun SendMoneyScreen( Column(modifier = Modifier.padding(16.dp)) { Row( verticalAlignment = Alignment.CenterVertically, - modifier = Modifier + modifier = + Modifier .fillMaxWidth() .padding(top = 20.dp, bottom = 20.dp), ) { @@ -216,24 +218,24 @@ internal fun SendMoneyScreen( } MfOutlinedTextField( value = amount, + label = stringResource(id = R.string.feature_send_money_amount), onValueChange = { amount = it validateInfo() }, + modifier = Modifier.fillMaxWidth(), singleLine = true, keyboardOptions = KeyboardOptions.Default.copy(keyboardType = KeyboardType.Number), - label = stringResource(id = R.string.feature_send_money_amount), - modifier = Modifier.fillMaxWidth(), ) when (sendMethodType) { SendMethodType.VPA -> { MfOutlinedTextField( value = vpa, + label = stringResource(id = R.string.feature_send_money_virtual_payment_address), onValueChange = { vpa = it validateInfo() }, - label = stringResource(id = R.string.feature_send_money_virtual_payment_address), modifier = Modifier.fillMaxWidth(), trailingIcon = { IconButton( @@ -253,7 +255,8 @@ internal fun SendMoneyScreen( SendMethodType.MOBILE -> { EnterPhoneScreen( - modifier = Modifier + modifier = + Modifier .fillMaxWidth() .padding(bottom = 8.dp), initialPhoneNumber = mobileNumber, @@ -269,7 +272,8 @@ internal fun SendMoneyScreen( } Spacer(modifier = Modifier.height(16.dp)) MifosButton( - modifier = Modifier + modifier = + Modifier .fillMaxWidth() .padding(top = 16.dp) .align(Alignment.CenterHorizontally), @@ -315,7 +319,8 @@ private fun EnterPhoneScreen( TogiCountryCodePicker( modifier = modifier, shape = RoundedCornerShape(8.dp), - colors = TextFieldDefaults.outlinedTextFieldColors( + colors = + TextFieldDefaults.outlinedTextFieldColors( focusedBorderColor = MaterialTheme.colorScheme.primary, ), initialPhoneNumber = initialPhoneNumber, @@ -337,7 +342,8 @@ private fun VpaMobileChip( MifosButton( onClick = onClick, color = if (selected) MaterialTheme.colorScheme.primary else Color.LightGray, - modifier = modifier + modifier = + modifier .padding(4.dp) .wrapContentSize(), ) { @@ -348,16 +354,20 @@ private fun VpaMobileChip( } } -private suspend fun getContactPhoneNumber(uri: Uri, context: Context): String { +private suspend fun getContactPhoneNumber( + uri: Uri, + context: Context, +): String { val contactId: String = uri.lastPathSegment ?: return "" return withContext(Dispatchers.IO) { - val phoneCursor = context.contentResolver.query( - ContactsContract.CommonDataKinds.Phone.CONTENT_URI, - arrayOf(ContactsContract.CommonDataKinds.Phone.NUMBER), - "${ContactsContract.CommonDataKinds.Phone.CONTACT_ID} = ?", - arrayOf(contactId), - null, - ) + val phoneCursor = + context.contentResolver.query( + ContactsContract.CommonDataKinds.Phone.CONTENT_URI, + arrayOf(ContactsContract.CommonDataKinds.Phone.NUMBER), + "${ContactsContract.CommonDataKinds.Phone.CONTACT_ID} = ?", + arrayOf(contactId), + null, + ) phoneCursor?.use { cursor -> if (cursor.moveToFirst()) { val phoneNumberIndex = diff --git a/feature/standing-instruction/src/main/kotlin/org/mifospay/feature/standing/instruction/NewSIScreenRoute.kt b/feature/standing-instruction/src/main/kotlin/org/mifospay/feature/standing/instruction/NewSIScreenRoute.kt index 356aa5fcd..b27321f6b 100644 --- a/feature/standing-instruction/src/main/kotlin/org/mifospay/feature/standing/instruction/NewSIScreenRoute.kt +++ b/feature/standing-instruction/src/main/kotlin/org/mifospay/feature/standing/instruction/NewSIScreenRoute.kt @@ -202,26 +202,26 @@ private fun NewSIBody( .padding(paddingValues), ) { MifosOutlinedTextField( - modifier = Modifier - .fillMaxWidth() - .padding(horizontal = 20.dp), + label = R.string.feature_standing_instruction_amount, value = amount, onValueChange = { amount = it }, - label = R.string.feature_standing_instruction_amount, + modifier = Modifier + .fillMaxWidth() + .padding(horizontal = 20.dp), keyboardOptions = KeyboardOptions.Default.copy(keyboardType = KeyboardType.Number), ) Spacer(modifier = Modifier.padding(top = 16.dp)) MifosOutlinedTextField( - modifier = Modifier - .fillMaxWidth() - .padding(horizontal = 20.dp), + label = R.string.feature_standing_instruction_vpa, value = vpa, onValueChange = { vpa = it }, - label = R.string.feature_standing_instruction_vpa, + modifier = Modifier + .fillMaxWidth() + .padding(horizontal = 20.dp), trailingIcon = { IconButton(onClick = { startScan() }) { Icon( @@ -234,14 +234,14 @@ private fun NewSIBody( ) Spacer(modifier = Modifier.padding(top = 16.dp)) MifosOutlinedTextField( - modifier = Modifier - .fillMaxWidth() - .padding(horizontal = 20.dp), + label = R.string.feature_standing_instruction_interval, value = siInterval, onValueChange = { siInterval = it }, - label = R.string.feature_standing_instruction_interval, + modifier = Modifier + .fillMaxWidth() + .padding(horizontal = 20.dp), ) Row( modifier = Modifier diff --git a/feature/standing-instruction/src/main/kotlin/org/mifospay/feature/standing/instruction/StandingInstructionScreen.kt b/feature/standing-instruction/src/main/kotlin/org/mifospay/feature/standing/instruction/StandingInstructionScreen.kt index 4bdd1eeae..d19f8d519 100644 --- a/feature/standing-instruction/src/main/kotlin/org/mifospay/feature/standing/instruction/StandingInstructionScreen.kt +++ b/feature/standing-instruction/src/main/kotlin/org/mifospay/feature/standing/instruction/StandingInstructionScreen.kt @@ -78,9 +78,9 @@ internal fun StandingInstructionScreen( when (standingInstructionsUiState) { StandingInstructionsUiState.Empty -> { EmptyContentScreen( - modifier = Modifier, title = stringResource(id = R.string.feature_standing_instruction_error_oops), subTitle = stringResource(id = R.string.feature_standing_instruction_empty_standing_instructions), + modifier = Modifier, iconTint = MaterialTheme.colorScheme.primary, iconImageVector = Icons.Rounded.Info, ) @@ -88,9 +88,9 @@ internal fun StandingInstructionScreen( is StandingInstructionsUiState.Error -> { EmptyContentScreen( - modifier = Modifier, title = stringResource(id = R.string.feature_standing_instruction_error_oops), subTitle = stringResource(id = R.string.feature_standing_instruction_error_fetching_si_list), + modifier = Modifier, iconTint = MaterialTheme.colorScheme.primary, iconImageVector = MifosIcons.RoundedInfo, ) diff --git a/feature/upi-setup/src/main/kotlin/org/mifospay/feature/upiSetup/screens/OtpScreen.kt b/feature/upi-setup/src/main/kotlin/org/mifospay/feature/upiSetup/screens/OtpScreen.kt index 5396672ff..537c8c2c6 100644 --- a/feature/upi-setup/src/main/kotlin/org/mifospay/feature/upiSetup/screens/OtpScreen.kt +++ b/feature/upi-setup/src/main/kotlin/org/mifospay/feature/upiSetup/screens/OtpScreen.kt @@ -77,11 +77,11 @@ private fun OtpScreenContent( style = MaterialTheme.typography.headlineMedium, ) OtpTextField( - modifier = Modifier.padding(top = 20.dp), - realOtp = realOtp, onOtpTextCorrectlyEntered = { onOtpTextCorrectlyEntered() }, + modifier = Modifier.padding(top = 20.dp), + realOtp = realOtp, ) } } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index b8f312808..d8dfb79b3 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -17,8 +17,9 @@ targetSdk = "34" androidTools = "31.5.1" androidxActivity = "1.9.1" androidxComposeBom = "2024.06.00" -androidxComposeCompiler = "1.5.15" +androidxComposeCompiler = "1.5.10" androidxComposeUi = "1.6.8" +androidxComposeUiTest = "1.7.0-beta01" androidxComposeRuntime = "1.6.8" androidxCore = "1.10.1" androidxHilt = "1.2.0" @@ -109,7 +110,7 @@ compose-material = { group = "androidx.compose.material", name = "material", ver androidx-compose-material-iconsExtended = { group = "androidx.compose.material", name = "material-icons-extended" } androidx-compose-material3-windowSizeClass = { group = "androidx.compose.material3", name = "material3-window-size-class" } androidx-compose-ui = { group = "androidx.compose.ui", name = "ui", version.ref="androidxComposeUi" } -androidx-compose-ui-test = { group = "androidx.compose.ui", name = "ui-test-junit4" } +androidx-compose-ui-test = { group = "androidx.compose.ui", name = "ui-test-junit4", version.ref = "androidxComposeUiTest" } androidx-compose-ui-test-manifest = { group = "androidx.compose.ui", name = "ui-test-manifest" } androidx-compose-ui-tooling = { group = "androidx.compose.ui", name = "ui-tooling" } androidx-compose-runtime = { group = "androidx.compose.runtime", name = "runtime", version.ref="androidxComposeRuntime" } diff --git a/mifospay/build.gradle.kts b/mifospay/build.gradle.kts index ab143a17b..219aa620d 100644 --- a/mifospay/build.gradle.kts +++ b/mifospay/build.gradle.kts @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ import org.mifospay.MifosBuildType plugins { @@ -69,9 +78,6 @@ dependencies { implementation(libs.androidx.fragment.ktx) implementation(libs.androidx.swiperefresh.layout) -// implementation("androidx.vectordrawable:vectordrawable-animated:1.1.0") -// implementation("androidx.media:media:1.6.0") -// implementation("androidx.cardview:cardview:1.0.0") implementation("androidx.recyclerview:recyclerview:1.3.2") api("com.google.android.material:material:1.0.0") // update require alot of UI changes @@ -122,10 +128,6 @@ dependencies { ksp(libs.hilt.compiler) - // 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 - // Google Bar code scanner implementation(libs.google.play.services.code.scanner) @@ -146,38 +148,8 @@ dependencies { runtimeOnly(libs.androidx.compose.runtime) debugImplementation(libs.androidx.compose.ui.tooling) -// implementation(libs.squareup.retrofit2) { -// // exclude Retrofit’s OkHttp peer-dependency module and define your own module import -// exclude(module = "okhttp") -// } -// implementation(libs.squareup.retrofit.adapter.rxjava) -// implementation(libs.squareup.retrofit.converter.gson) -// implementation(libs.squareup.okhttp) -// implementation(libs.squareup.logging.interceptor) -// -// implementation(libs.android.pdf.viewer) -// -// implementation(libs.reactivex.rxjava.android) -// implementation(libs.reactivex.rxjava) -// -// implementation("io.michaelrocks:libphonenumber-android:8.11.0") -// -// implementation("me.dm7.barcodescanner:zxing:1.9.13") -// implementation("com.journeyapps:zxing-android-embedded:4.2.0") - implementation(libs.mifosPasscode) -// // Coil -// implementation("io.coil-kt:coil-compose:2.6.0") -// -// implementation("com.google.android.gms:play-services-auth:20.7.0") -// -// implementation("com.hbb20:ccp:2.2.0") -// implementation("com.github.MdFarhanRaja:SearchableSpinner:1.9") -// implementation("com.alimuzaffar.lib:pinentryedittext:1.3.1") -// implementation("de.hdodenhof:circleimageview:3.1.0") -// implementation("com.github.yalantis:ucrop:2.2.2") - kspTest(libs.hilt.compiler) testImplementation(libs.junit) diff --git a/mifospay/dependencies/prodReleaseRuntimeClasspath.txt b/mifospay/dependencies/prodReleaseRuntimeClasspath.txt index 61800b5d5..730d11403 100644 --- a/mifospay/dependencies/prodReleaseRuntimeClasspath.txt +++ b/mifospay/dependencies/prodReleaseRuntimeClasspath.txt @@ -80,11 +80,11 @@ androidx.credentials:credentials:1.3.0-beta01 androidx.cursoradapter:cursoradapter:1.0.0 androidx.customview:customview-poolingcontainer:1.0.0 androidx.customview:customview:1.1.0 -androidx.databinding:databinding-adapters:8.5.1 -androidx.databinding:databinding-common:8.5.1 -androidx.databinding:databinding-ktx:8.5.1 -androidx.databinding:databinding-runtime:8.5.1 -androidx.databinding:viewbinding:8.5.1 +androidx.databinding:databinding-adapters:8.4.0 +androidx.databinding:databinding-common:8.4.0 +androidx.databinding:databinding-ktx:8.4.0 +androidx.databinding:databinding-runtime:8.4.0 +androidx.databinding:viewbinding:8.4.0 androidx.datastore:datastore-android:1.1.1 androidx.datastore:datastore-core-android:1.1.1 androidx.datastore:datastore-core-okio-jvm:1.1.1 @@ -257,13 +257,23 @@ javax.inject:javax.inject:1 me.dm7.barcodescanner:core:1.9.13 me.dm7.barcodescanner:zxing:1.9.13 org.checkerframework:checker-qual:3.12.0 -org.jetbrains.kotlin:kotlin-android-extensions-runtime:1.9.25 +org.jetbrains.compose.desktop:desktop-jvm-windows-x64:1.6.1 +org.jetbrains.compose.desktop:desktop-jvm:1.6.1 +org.jetbrains.compose.desktop:desktop:1.6.1 +org.jetbrains.compose.foundation:foundation:1.6.1 +org.jetbrains.compose.material3:material3:1.6.1 +org.jetbrains.compose.material:material:1.6.1 +org.jetbrains.compose.runtime:runtime:1.6.1 +org.jetbrains.compose.ui:ui-tooling-preview:1.6.1 +org.jetbrains.compose.ui:ui-util:1.6.1 +org.jetbrains.compose.ui:ui:1.6.1 +org.jetbrains.kotlin:kotlin-android-extensions-runtime:1.9.22 org.jetbrains.kotlin:kotlin-bom:1.8.22 -org.jetbrains.kotlin:kotlin-parcelize-runtime:1.9.25 -org.jetbrains.kotlin:kotlin-stdlib-common:1.9.25 -org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.9.25 -org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.9.20 -org.jetbrains.kotlin:kotlin-stdlib:1.9.25 +org.jetbrains.kotlin:kotlin-parcelize-runtime:1.9.22 +org.jetbrains.kotlin:kotlin-stdlib-common:1.9.23 +org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.9.23 +org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.9.23 +org.jetbrains.kotlin:kotlin-stdlib:1.9.23 org.jetbrains.kotlinx:kotlinx-collections-immutable-jvm:0.3.7 org.jetbrains.kotlinx:kotlinx-collections-immutable:0.3.7 org.jetbrains.kotlinx:kotlinx-coroutines-android:1.8.1 @@ -279,4 +289,6 @@ org.jetbrains.kotlinx:kotlinx-serialization-core-jvm:1.6.3 org.jetbrains.kotlinx:kotlinx-serialization-core:1.6.3 org.jetbrains.kotlinx:kotlinx-serialization-json-jvm:1.6.3 org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.3 +org.jetbrains.skiko:skiko-awt-runtime-windows-x64:0.7.97 +org.jetbrains.skiko:skiko-awt:0.7.97 org.jetbrains:annotations:23.0.0 diff --git a/mifospay/prodRelease-badging.txt b/mifospay/prodRelease-badging.txt new file mode 100644 index 000000000..206563104 --- /dev/null +++ b/mifospay/prodRelease-badging.txt @@ -0,0 +1,145 @@ +package: name='org.mifospay' versionCode='1' versionName='1.0' platformBuildVersionName='14' platformBuildVersionCode='34' compileSdkVersion='34' compileSdkVersionCodename='14' +sdkVersion:'24' +targetSdkVersion:'34' +uses-permission: name='android.permission.INTERNET' +uses-permission: name='android.permission.CAMERA' +uses-permission: name='android.permission.READ_EXTERNAL_STORAGE' +uses-permission: name='android.permission.WRITE_EXTERNAL_STORAGE' +uses-permission: name='android.permission.READ_CONTACTS' +uses-permission: name='android.permission.ACCESS_NETWORK_STATE' +uses-permission: name='android.permission.POST_NOTIFICATIONS' +uses-permission: name='android.permission.WAKE_LOCK' +uses-permission: name='com.google.android.c2dm.permission.RECEIVE' +uses-permission: name='android.permission.ACCESS_ADSERVICES_ATTRIBUTION' +uses-permission: name='android.permission.ACCESS_ADSERVICES_AD_ID' +uses-permission: name='com.google.android.finsky.permission.BIND_GET_INSTALL_REFERRER_SERVICE' +uses-permission: name='org.mifospay.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION' +application-label:'Mifos Pay' +application-label-af:'Mifos Pay' +application-label-am:'Mifos Pay' +application-label-ar:'Mifos Pay' +application-label-as:'Mifos Pay' +application-label-az:'Mifos Pay' +application-label-be:'Mifos Pay' +application-label-bg:'Mifos Pay' +application-label-bn:'Mifos Pay' +application-label-bs:'Mifos Pay' +application-label-ca:'Mifos Pay' +application-label-cs:'Mifos Pay' +application-label-da:'Mifos Pay' +application-label-de:'Mifos Pay' +application-label-de-DE:'Mifos Pay' +application-label-el:'Mifos Pay' +application-label-en-AU:'Mifos Pay' +application-label-en-CA:'Mifos Pay' +application-label-en-GB:'Mifos Pay' +application-label-en-IN:'Mifos Pay' +application-label-en-XC:'Mifos Pay' +application-label-eo:'Mifos Pay' +application-label-es:'Mifos Pay' +application-label-es-419:'Mifos Pay' +application-label-es-US:'Mifos Pay' +application-label-et:'Mifos Pay' +application-label-eu:'Mifos Pay' +application-label-fa:'Mifos Pay' +application-label-fi:'Mifos Pay' +application-label-fr:'Mifos Pay' +application-label-fr-CA:'Mifos Pay' +application-label-ga:'Mifos Pay' +application-label-gd:'Mifos Pay' +application-label-gl:'Mifos Pay' +application-label-gu:'Mifos Pay' +application-label-hi:'Mifos Pay' +application-label-hr:'Mifos Pay' +application-label-hu:'Mifos Pay' +application-label-hy:'Mifos Pay' +application-label-in:'Mifos Pay' +application-label-in-ID:'Mifos Pay' +application-label-is:'Mifos Pay' +application-label-it:'Mifos Pay' +application-label-it-IT:'Mifos Pay' +application-label-iw:'Mifos Pay' +application-label-ja:'Mifos Pay' +application-label-jv:'Mifos Pay' +application-label-ka:'Mifos Pay' +application-label-kk:'Mifos Pay' +application-label-km:'Mifos Pay' +application-label-kn:'Mifos Pay' +application-label-ko:'Mifos Pay' +application-label-ku:'Mifos Pay' +application-label-ky:'Mifos Pay' +application-label-lb:'Mifos Pay' +application-label-lo:'Mifos Pay' +application-label-lt:'Mifos Pay' +application-label-lv:'Mifos Pay' +application-label-mk:'Mifos Pay' +application-label-ml:'Mifos Pay' +application-label-mn:'Mifos Pay' +application-label-mr:'Mifos Pay' +application-label-ms:'Mifos Pay' +application-label-my:'Mifos Pay' +application-label-nb:'Mifos Pay' +application-label-ne:'Mifos Pay' +application-label-nl:'Mifos Pay' +application-label-no:'Mifos Pay' +application-label-or:'Mifos Pay' +application-label-pa:'Mifos Pay' +application-label-pl:'Mifos Pay' +application-label-pt:'Mifos Pay' +application-label-pt-BR:'Mifos Pay' +application-label-pt-PT:'Mifos Pay' +application-label-ro:'Mifos Pay' +application-label-ru:'Mifos Pay' +application-label-ru-RU:'Mifos Pay' +application-label-si:'Mifos Pay' +application-label-sk:'Mifos Pay' +application-label-sl:'Mifos Pay' +application-label-so:'Mifos Pay' +application-label-sq:'Mifos Pay' +application-label-sr:'Mifos Pay' +application-label-sr-Latn:'Mifos Pay' +application-label-sv:'Mifos Pay' +application-label-sw:'Mifos Pay' +application-label-ta:'Mifos Pay' +application-label-te:'Mifos Pay' +application-label-th:'Mifos Pay' +application-label-tl:'Mifos Pay' +application-label-tr:'Mifos Pay' +application-label-tr-TR:'Mifos Pay' +application-label-uk:'Mifos Pay' +application-label-ur:'Mifos Pay' +application-label-uz:'Mifos Pay' +application-label-vi:'Mifos Pay' +application-label-zh:'Mifos Pay' +application-label-zh-CN:'Mifos Pay' +application-label-zh-HK:'Mifos Pay' +application-label-zh-TW:'Mifos Pay' +application-label-zu:'Mifos Pay' +application-icon-120:'res/mipmap/ic_launcher.png' +application-icon-160:'res/mipmap/ic_launcher.png' +application-icon-240:'res/mipmap/ic_launcher.png' +application-icon-320:'res/mipmap/ic_launcher.png' +application-icon-480:'res/mipmap/ic_launcher.png' +application-icon-640:'res/mipmap/ic_launcher.png' +application-icon-65534:'res/mipmap/ic_launcher.png' +application: label='Mifos Pay' icon='res/mipmap/ic_launcher.png' +launchable-activity: name='org.mifospay.SplashScreenActivity' label='' icon='' +property: name='android.adservices.AD_SERVICES_CONFIG' resource='res/xml/ga_ad_services_config.xml' +uses-library-not-required:'androidx.window.extensions' +uses-library-not-required:'androidx.window.sidecar' +uses-library-not-required:'android.ext.adservices' +feature-group: label='' + uses-feature-not-required: name='android.hardware.camera' + uses-feature: name='android.hardware.faketouch' + uses-implied-feature: name='android.hardware.faketouch' reason='default feature for all apps' + uses-feature: name='android.hardware.screen.portrait' + uses-implied-feature: name='android.hardware.screen.portrait' reason='one or more activities have specified a portrait orientation' +main +other-activities +other-receivers +other-services +supports-screens: 'small' 'normal' 'large' 'xlarge' +supports-any-density: 'true' +locales: '--_--' 'af' 'am' 'ar' 'as' 'az' 'be' 'bg' 'bn' 'bs' 'ca' 'cs' 'da' 'de' 'de-DE' 'el' 'en-AU' 'en-CA' 'en-GB' 'en-IN' 'en-XC' 'eo' 'es' 'es-419' 'es-US' 'et' 'eu' 'fa' 'fi' 'fr' 'fr-CA' 'ga' 'gd' 'gl' 'gu' 'hi' 'hr' 'hu' 'hy' 'in' 'in-ID' 'is' 'it' 'it-IT' 'iw' 'ja' 'jv' 'ka' 'kk' 'km' 'kn' 'ko' 'ku' 'ky' 'lb' 'lo' 'lt' 'lv' 'mk' 'ml' 'mn' 'mr' 'ms' 'my' 'nb' 'ne' 'nl' 'no' 'or' 'pa' 'pl' 'pt' 'pt-BR' 'pt-PT' 'ro' 'ru' 'ru-RU' 'si' 'sk' 'sl' 'so' 'sq' 'sr' 'sr-Latn' 'sv' 'sw' 'ta' 'te' 'th' 'tl' 'tr' 'tr-TR' 'uk' 'ur' 'uz' 'vi' 'zh' 'zh-CN' 'zh-HK' 'zh-TW' 'zu' +densities: '120' '160' '240' '320' '480' '640' '65534' +native-code: 'arm64-v8a' 'armeabi' 'armeabi-v7a' 'mips' 'mips64' 'x86' 'x86_64' diff --git a/mifospay/src/androidTest/java/org/mifospay/ExampleInstrumentedTest.kt b/mifospay/src/androidTest/java/org/mifospay/ExampleInstrumentedTest.kt index fde9fa532..504fdba19 100644 --- a/mifospay/src/androidTest/java/org/mifospay/ExampleInstrumentedTest.kt +++ b/mifospay/src/androidTest/java/org/mifospay/ExampleInstrumentedTest.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay import androidx.test.ext.junit.runners.AndroidJUnit4 diff --git a/mifospay/src/main/AndroidManifest.xml b/mifospay/src/main/AndroidManifest.xml index e42369a2d..8384b76be 100644 --- a/mifospay/src/main/AndroidManifest.xml +++ b/mifospay/src/main/AndroidManifest.xml @@ -1,4 +1,13 @@ + diff --git a/mifospay/src/main/java/org/mifospay/MainActivity.kt b/mifospay/src/main/java/org/mifospay/MainActivity.kt index 73b9b545c..e22024333 100644 --- a/mifospay/src/main/java/org/mifospay/MainActivity.kt +++ b/mifospay/src/main/java/org/mifospay/MainActivity.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay import android.os.Bundle @@ -94,7 +103,7 @@ class MainActivity : ComponentActivity() { windowSizeClass = calculateWindowSizeClass(this), networkMonitor = networkMonitor, timeZoneMonitor = timeZoneMonitor, - navController = navController + navController = navController, ) val currentTimeZone by appState.currentTimeZone.collectAsStateWithLifecycle() @@ -108,7 +117,6 @@ class MainActivity : ComponentActivity() { } } } - } override fun onResume() { @@ -121,7 +129,6 @@ class MainActivity : ComponentActivity() { lazyStats.get().isTrackingEnabled = false } - /** * The default light scrim, as defined by androidx and the platform: * https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:activity/activity/src/main/kotlin/androidx/activity/EdgeToEdge.kt;l=35-38;drc=27e7d52e8604a080133e8b842db10c89b4482598 diff --git a/mifospay/src/main/java/org/mifospay/MainActivityViewModel.kt b/mifospay/src/main/java/org/mifospay/MainActivityViewModel.kt index 27ff3b20b..615109974 100644 --- a/mifospay/src/main/java/org/mifospay/MainActivityViewModel.kt +++ b/mifospay/src/main/java/org/mifospay/MainActivityViewModel.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay import androidx.lifecycle.ViewModel @@ -11,10 +20,9 @@ import kotlinx.coroutines.flow.stateIn import org.mifospay.core.data.repository.auth.UserDataRepository import javax.inject.Inject - @HiltViewModel class MainActivityViewModel @Inject constructor( - userDataRepository: UserDataRepository + userDataRepository: UserDataRepository, ) : ViewModel() { val uiState: StateFlow = userDataRepository.userData.map { diff --git a/mifospay/src/main/java/org/mifospay/MifosPayApp.kt b/mifospay/src/main/java/org/mifospay/MifosPayApp.kt index 4b4802503..6a0d29fc7 100644 --- a/mifospay/src/main/java/org/mifospay/MifosPayApp.kt +++ b/mifospay/src/main/java/org/mifospay/MifosPayApp.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay import android.app.Application @@ -17,7 +26,7 @@ class MifosPayApp : Application() { instance = this } - //Initialize ForegroundChecker + // Initialize ForegroundChecker ForegroundChecker.init(this) } diff --git a/mifospay/src/main/java/org/mifospay/SplashScreenActivity.kt b/mifospay/src/main/java/org/mifospay/SplashScreenActivity.kt index 4ff597fda..60aae0d34 100644 --- a/mifospay/src/main/java/org/mifospay/SplashScreenActivity.kt +++ b/mifospay/src/main/java/org/mifospay/SplashScreenActivity.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay import android.annotation.SuppressLint @@ -16,7 +25,7 @@ import org.mifospay.feature.auth.login.LoginActivity class SplashScreenActivity : ComponentActivity() { override fun onCreate(savedInstanceState: Bundle?) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S){ + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { val splashScreen = installSplashScreen() splashScreen.setKeepOnScreenCondition { true } } diff --git a/mifospay/src/main/java/org/mifospay/base/BaseActivity.kt b/mifospay/src/main/java/org/mifospay/base/BaseActivity.kt index c1ca596f2..7043ab6b1 100644 --- a/mifospay/src/main/java/org/mifospay/base/BaseActivity.kt +++ b/mifospay/src/main/java/org/mifospay/base/BaseActivity.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.base import android.app.ProgressDialog @@ -131,7 +140,7 @@ open class BaseActivity : BasePassCodeActivity(), BaseActivityCallback { val backStateName = fragment.javaClass.name val fragmentPopped = supportFragmentManager.popBackStackImmediate( backStateName, - 0 + 0, ) if (!fragmentPopped && supportFragmentManager.findFragmentByTag(backStateName) == null @@ -158,4 +167,4 @@ open class BaseActivity : BasePassCodeActivity(), BaseActivityCallback { override fun getPassCodeClass(): Class<*> { return PassCodeActivity::class.java } -} \ No newline at end of file +} diff --git a/mifospay/src/main/java/org/mifospay/base/BaseActivityCallback.kt b/mifospay/src/main/java/org/mifospay/base/BaseActivityCallback.kt index 46d548384..3c520cc3a 100644 --- a/mifospay/src/main/java/org/mifospay/base/BaseActivityCallback.kt +++ b/mifospay/src/main/java/org/mifospay/base/BaseActivityCallback.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.base import androidx.swiperefreshlayout.widget.SwipeRefreshLayout @@ -16,4 +25,4 @@ interface BaseActivityCallback { fun dismissProgressDialog() val swipeRefreshLayout: SwipeRefreshLayout? -} \ No newline at end of file +} diff --git a/mifospay/src/main/java/org/mifospay/base/BaseFragment.kt b/mifospay/src/main/java/org/mifospay/base/BaseFragment.kt index c0e86f851..844ee85d9 100644 --- a/mifospay/src/main/java/org/mifospay/base/BaseFragment.kt +++ b/mifospay/src/main/java/org/mifospay/base/BaseFragment.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.base import android.app.Activity @@ -62,7 +71,9 @@ open class BaseFragment : Fragment() { protected val swipeRefreshLayout: SwipeRefreshLayout? protected get() = if (callback != null) { callback!!.swipeRefreshLayout - } else null + } else { + null + } override fun onAttach(context: Context) { super.onAttach(context) @@ -71,8 +82,8 @@ open class BaseFragment : Fragment() { activity as BaseActivityCallback? } catch (e: ClassCastException) { throw ClassCastException( - activity.toString() - + " must implement BaseActivityCallback methods" + activity.toString() + + " must implement BaseActivityCallback methods", ) } } @@ -83,13 +94,14 @@ open class BaseFragment : Fragment() { } fun replaceFragmentUsingFragmentManager( - fragment: Fragment, addToBackStack: Boolean, - containerId: Int + fragment: Fragment, + addToBackStack: Boolean, + containerId: Int, ) { val backStateName = fragment.javaClass.name val fragmentPopped = requireFragmentManager().popBackStackImmediate( backStateName, - 0 + 0, ) if (!fragmentPopped && requireFragmentManager().findFragmentByTag(backStateName) == null @@ -107,7 +119,7 @@ open class BaseFragment : Fragment() { val backStateName = fragment.javaClass.name val fragmentPopped = childFragmentManager.popBackStackImmediate( backStateName, - 0 + 0, ) if (!fragmentPopped && childFragmentManager.findFragmentByTag(backStateName) == null @@ -120,4 +132,4 @@ open class BaseFragment : Fragment() { transaction.commit() } } -} \ No newline at end of file +} diff --git a/mifospay/src/main/java/org/mifospay/base/BasePresenter.kt b/mifospay/src/main/java/org/mifospay/base/BasePresenter.kt index 5700bca49..31b2286c3 100644 --- a/mifospay/src/main/java/org/mifospay/base/BasePresenter.kt +++ b/mifospay/src/main/java/org/mifospay/base/BasePresenter.kt @@ -1,5 +1,14 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.base interface BasePresenter { fun attachView(baseView: BaseView<*>?) -} \ No newline at end of file +} diff --git a/mifospay/src/main/java/org/mifospay/base/BaseView.kt b/mifospay/src/main/java/org/mifospay/base/BaseView.kt index 42955454a..b976ed255 100644 --- a/mifospay/src/main/java/org/mifospay/base/BaseView.kt +++ b/mifospay/src/main/java/org/mifospay/base/BaseView.kt @@ -1,5 +1,14 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.base interface BaseView { fun setPresenter(presenter: T) -} \ No newline at end of file +} diff --git a/mifospay/src/main/java/org/mifospay/common/SearchContract.kt b/mifospay/src/main/java/org/mifospay/common/SearchContract.kt index 45a0db446..df3312894 100644 --- a/mifospay/src/main/java/org/mifospay/common/SearchContract.kt +++ b/mifospay/src/main/java/org/mifospay/common/SearchContract.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.common import com.mifospay.core.model.domain.SearchResult @@ -17,4 +26,4 @@ interface SearchContract { interface SearchPresenter : BasePresenter { fun performSearch(query: String) } -} \ No newline at end of file +} diff --git a/mifospay/src/main/java/org/mifospay/common/TransferContract.kt b/mifospay/src/main/java/org/mifospay/common/TransferContract.kt index b1cc2a90f..8eac88d5e 100644 --- a/mifospay/src/main/java/org/mifospay/common/TransferContract.kt +++ b/mifospay/src/main/java/org/mifospay/common/TransferContract.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.common import org.mifospay.base.BasePresenter @@ -19,4 +28,4 @@ interface TransferContract { fun fetchClient(externalId: String) fun makeTransfer(fromClientId: Long, toClientId: Long, amount: Double) } -} \ No newline at end of file +} diff --git a/mifospay/src/main/java/org/mifospay/common/presenter/MakeTransferPresenter.kt b/mifospay/src/main/java/org/mifospay/common/presenter/MakeTransferPresenter.kt index 53962da58..dd528805b 100644 --- a/mifospay/src/main/java/org/mifospay/common/presenter/MakeTransferPresenter.kt +++ b/mifospay/src/main/java/org/mifospay/common/presenter/MakeTransferPresenter.kt @@ -1,11 +1,20 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.common.presenter +import org.mifospay.base.BaseView +import org.mifospay.common.TransferContract import org.mifospay.core.data.base.UseCase.UseCaseCallback import org.mifospay.core.data.base.UseCaseHandler import org.mifospay.core.data.domain.usecase.account.TransferFunds import org.mifospay.core.data.domain.usecase.client.SearchClient -import org.mifospay.base.BaseView -import org.mifospay.common.TransferContract import javax.inject.Inject /** @@ -27,14 +36,17 @@ class MakeTransferPresenter @Inject constructor(private val mUsecaseHandler: Use } override fun fetchClient(externalId: String) { - mUsecaseHandler.execute(searchClient, SearchClient.RequestValues(externalId), + mUsecaseHandler.execute( + searchClient, + SearchClient.RequestValues(externalId), object : UseCaseCallback { override fun onSuccess(response: SearchClient.ResponseValue) { val searchResult = response.results[0] searchResult.resultId.let { mTransferView?.showToClientDetails( it.toLong(), - searchResult.resultName, externalId + searchResult.resultName, + externalId, ) } } @@ -42,12 +54,14 @@ class MakeTransferPresenter @Inject constructor(private val mUsecaseHandler: Use override fun onError(message: String) { mTransferView?.showVpaNotFoundSnackbar() } - }) + }, + ) } override fun makeTransfer(fromClientId: Long, toClientId: Long, amount: Double) { mTransferView?.enableDragging(false) - mUsecaseHandler.execute(transferFunds, + mUsecaseHandler.execute( + transferFunds, TransferFunds.RequestValues(fromClientId, toClientId, amount), object : UseCaseCallback { override fun onSuccess(response: TransferFunds.ResponseValue) { @@ -59,6 +73,7 @@ class MakeTransferPresenter @Inject constructor(private val mUsecaseHandler: Use mTransferView?.enableDragging(true) mTransferView?.transferFailure() } - }) + }, + ) } -} \ No newline at end of file +} diff --git a/mifospay/src/main/java/org/mifospay/common/presenter/SearchPresenter.kt b/mifospay/src/main/java/org/mifospay/common/presenter/SearchPresenter.kt index 693aaa392..2b774f710 100644 --- a/mifospay/src/main/java/org/mifospay/common/presenter/SearchPresenter.kt +++ b/mifospay/src/main/java/org/mifospay/common/presenter/SearchPresenter.kt @@ -1,10 +1,19 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.common.presenter +import org.mifospay.base.BaseView +import org.mifospay.common.SearchContract import org.mifospay.core.data.base.UseCase.UseCaseCallback import org.mifospay.core.data.base.UseCaseHandler import org.mifospay.core.data.domain.usecase.client.SearchClient -import org.mifospay.base.BaseView -import org.mifospay.common.SearchContract import javax.inject.Inject /** @@ -22,13 +31,16 @@ class SearchPresenter @Inject constructor(private val mUsecaseHandler: UseCaseHa } override fun performSearch(query: String) { - mUsecaseHandler.execute(searchClient, SearchClient.RequestValues(query), + mUsecaseHandler.execute( + searchClient, + SearchClient.RequestValues(query), object : UseCaseCallback { override fun onSuccess(response: SearchClient.ResponseValue) { mSearchView.showSearchResult(response?.results?.toMutableList()) } override fun onError(message: String) {} - }) + }, + ) } -} \ No newline at end of file +} diff --git a/mifospay/src/main/java/org/mifospay/common/presenter/SearchViewModel.kt b/mifospay/src/main/java/org/mifospay/common/presenter/SearchViewModel.kt index 572d29c1a..6b3b0c2da 100644 --- a/mifospay/src/main/java/org/mifospay/common/presenter/SearchViewModel.kt +++ b/mifospay/src/main/java/org/mifospay/common/presenter/SearchViewModel.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.common.presenter import androidx.lifecycle.SavedStateHandle @@ -16,7 +25,7 @@ import javax.inject.Inject class SearchViewModel @Inject constructor( private val mUsecaseHandler: UseCaseHandler, private val searchClient: SearchClient, - private val savedStateHandle: SavedStateHandle + private val savedStateHandle: SavedStateHandle, ) : ViewModel() { val searchQuery = savedStateHandle.getStateFlow(SEARCH_QUERY, "") @@ -34,7 +43,9 @@ class SearchViewModel @Inject constructor( } private fun performSearch(query: String) { - mUsecaseHandler.execute(searchClient, SearchClient.RequestValues(query), + mUsecaseHandler.execute( + searchClient, + SearchClient.RequestValues(query), object : UseCase.UseCaseCallback { override fun onSuccess(response: SearchClient.ResponseValue) { _searchResults.value = @@ -42,7 +53,8 @@ class SearchViewModel @Inject constructor( } override fun onError(message: String) {} - }) + }, + ) } } @@ -53,4 +65,4 @@ sealed class SearchResultState { data class Error(val message: String) : SearchResultState() } -private const val SEARCH_QUERY = "searchQuery" \ No newline at end of file +private const val SEARCH_QUERY = "searchQuery" diff --git a/mifospay/src/main/java/org/mifospay/common/ui/SearchActivity.kt b/mifospay/src/main/java/org/mifospay/common/ui/SearchActivity.kt index 2adacc792..10e908f4f 100644 --- a/mifospay/src/main/java/org/mifospay/common/ui/SearchActivity.kt +++ b/mifospay/src/main/java/org/mifospay/common/ui/SearchActivity.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.common.ui import android.os.Bundle @@ -16,9 +25,9 @@ class SearchActivity : BaseActivity() { setContent { MifosTheme { SearchScreenRoute( - onBackClick = { finish() } + onBackClick = { finish() }, ) } } } -} \ No newline at end of file +} diff --git a/mifospay/src/main/java/org/mifospay/common/ui/SearchScreen.kt b/mifospay/src/main/java/org/mifospay/common/ui/SearchScreen.kt index 264e039f7..d57605d07 100644 --- a/mifospay/src/main/java/org/mifospay/common/ui/SearchScreen.kt +++ b/mifospay/src/main/java/org/mifospay/common/ui/SearchScreen.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.common.ui import androidx.compose.foundation.layout.Column @@ -41,33 +50,35 @@ import org.mifospay.core.designsystem.theme.MifosTheme @Composable fun SearchScreenRoute( - viewModel: SearchViewModel = hiltViewModel(), onBackClick: () -> Unit, + modifier: Modifier = Modifier, + viewModel: SearchViewModel = hiltViewModel(), ) { val searchQuery by viewModel.searchQuery.collectAsState() val searchResultState by viewModel.searchResults.collectAsState() SearchScreen( onBackClick = onBackClick, + searchResultState, searchQueryChanged = viewModel::onSearchQueryChanged, - searchQuery, - searchResultState + searchQuery = searchQuery, + modifier = modifier, ) } @Composable fun SearchScreen( onBackClick: () -> Unit, - searchQueryChanged: (String) -> Unit = {}, + searchResultState: SearchResultState, + modifier: Modifier = Modifier, searchQuery: String = "", - searchResultState: SearchResultState + searchQueryChanged: (String) -> Unit = {}, ) { Column( - modifier = Modifier + modifier = modifier .fillMaxSize() - .padding(16.dp) + .padding(16.dp), ) { - SearchToolbar( onBackClick = onBackClick, onSearchQueryChanged = searchQueryChanged, @@ -79,19 +90,21 @@ fun SearchScreen( SearchResultState.Loading -> { MfLoadingWheel( contentDesc = stringResource(R.string.feature_accounts_loading), - backgroundColor = MaterialTheme.colorScheme.surface + backgroundColor = MaterialTheme.colorScheme.surface, ) } is SearchResultState.Success -> { SearchResultList( - searchResults = searchResultState.results + searchResults = searchResultState.results, ) } is SearchResultState.Error -> { - Text(text = searchResultState.message, - color = MaterialTheme.colorScheme.onSurface) + Text( + text = searchResultState.message, + color = MaterialTheme.colorScheme.onSurface, + ) } } } @@ -99,9 +112,9 @@ fun SearchScreen( @Composable private fun SearchToolbar( - modifier: Modifier = Modifier, onBackClick: () -> Unit, onSearchQueryChanged: (String) -> Unit, + modifier: Modifier = Modifier, searchQuery: String = "", ) { Row( @@ -116,7 +129,7 @@ private fun SearchToolbar( } SearchTextField( onSearchQueryChanged = onSearchQueryChanged, - searchQuery = searchQuery + searchQuery = searchQuery, ) } } @@ -124,7 +137,8 @@ private fun SearchToolbar( @Composable fun SearchTextField( onSearchQueryChanged: (String) -> Unit, - searchQuery: String + searchQuery: String, + modifier: Modifier = Modifier, ) { val keyboardController = LocalSoftwareKeyboardController.current val onSearchExplicitlyTriggered = { @@ -162,7 +176,7 @@ fun SearchTextField( onValueChange = { if ("\n" !in it) onSearchQueryChanged(it) }, - modifier = Modifier + modifier = modifier .fillMaxWidth() .padding(16.dp) .onKeyEvent { @@ -191,10 +205,10 @@ fun SearchTextField( @Composable fun SearchResultList( searchResults: List, - modifier: Modifier = Modifier + modifier: Modifier = Modifier, ) { LazyColumn( - modifier = modifier + modifier = modifier, ) { items(searchResults) { searchResult -> SearchResultItem(searchResult = searchResult) @@ -204,14 +218,15 @@ fun SearchResultList( @Composable fun SearchResultItem( - searchResult: SearchResult + searchResult: SearchResult, + modifier: Modifier = Modifier, ) { Text( text = searchResult.resultName, - modifier = Modifier + modifier = modifier .fillMaxWidth() .padding(16.dp), - color = MaterialTheme.colorScheme.onSurface + color = MaterialTheme.colorScheme.onSurface, ) } @@ -221,7 +236,7 @@ private fun SearchToolbarPreview() { MifosTheme { SearchToolbar( onBackClick = {}, - onSearchQueryChanged = {} + onSearchQueryChanged = {}, ) } } @@ -231,15 +246,15 @@ private fun SearchToolbarPreview() { fun SearchScreenSuccessPreview() { MifosTheme { SearchScreen( + onBackClick = {}, searchResultState = SearchResultState.Success( mutableListOf( SearchResult(1, "John Doe", "Client"), SearchResult(2, "Jane Smith", "Client"), SearchResult(3, "example@email.com", "Email"), - SearchResult(4, "555-1234", "Phone Number") - ) + SearchResult(4, "555-1234", "Phone Number"), + ), ), - onBackClick = {} ) } } @@ -249,8 +264,8 @@ fun SearchScreenSuccessPreview() { fun SearchScreenLoadingPreview() { MifosTheme { SearchScreen( + onBackClick = {}, searchResultState = SearchResultState.Loading, - onBackClick = {} ) } } @@ -260,8 +275,8 @@ fun SearchScreenLoadingPreview() { fun SearchScreenIdlePreview() { MifosTheme { SearchScreen( + onBackClick = {}, searchResultState = SearchResultState.Idle, - onBackClick = {} ) } } @@ -271,10 +286,8 @@ fun SearchScreenIdlePreview() { fun SearchScreenErrorPreview() { MifosTheme { SearchScreen( + onBackClick = {}, searchResultState = SearchResultState.Error("Error"), - onBackClick = {} ) } } - - diff --git a/mifospay/src/main/java/org/mifospay/data/firebase/api/services/MifosPayMessagingService.kt b/mifospay/src/main/java/org/mifospay/data/firebase/api/services/MifosPayMessagingService.kt index 745b82509..cad620c78 100644 --- a/mifospay/src/main/java/org/mifospay/data/firebase/api/services/MifosPayMessagingService.kt +++ b/mifospay/src/main/java/org/mifospay/data/firebase/api/services/MifosPayMessagingService.kt @@ -1,17 +1,11 @@ -/** - * Copyright 2016 Google Inc. All Rights Reserved. +/* + * Copyright 2016 Mifos Initiative * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md */ package org.mifospay.data.firebase.api.services @@ -32,10 +26,7 @@ import org.mifospay.R import org.mifospay.feature.notification.NotificationActivity import org.mifospay.utils.NotificationUtils -/** - * Created by ankur on 20/June/2018 - */ -@Suppress("UnusedParameter", "UnusedPrivateMember") +@Suppress("UnusedPrivateMember") class MifosPayMessagingService : FirebaseMessagingService() { /** * Called if InstanceID token is updated. This may occur if the security of @@ -78,7 +69,7 @@ class MifosPayMessagingService : FirebaseMessagingService() { // Check if message contains a data payload. // We will use data messages and hence our messages will be handled here - if (remoteMessage.data.size > 0) { + if (remoteMessage.data.isNotEmpty()) { Log.d(TAG, "Message data payload: " + remoteMessage.data) try { val json = JSONObject(remoteMessage.data.toString()) @@ -92,7 +83,7 @@ class MifosPayMessagingService : FirebaseMessagingService() { // scheduleJob(); // } else { // // Handle message within 10 seconds -/// handleNow(); +// / handleNow(); // } } @@ -100,7 +91,7 @@ class MifosPayMessagingService : FirebaseMessagingService() { // We will not use Firebase Notification Message but keeping the code for that won't harm. // if (remoteMessage.getNotification() != null) { // Log.d(TAG, "Message Notification Body: " + remoteMessage.getNotification().getBody()); -//// handleNotification(remoteMessage.getNotification().getBody()); +// // handleNotification(remoteMessage.getNotification().getBody()); // sendNotification(remoteMessage.getNotification().getTitle(), // remoteMessage.getNotification().getBody()); // } @@ -144,13 +135,10 @@ class MifosPayMessagingService : FirebaseMessagingService() { val intent = Intent(this, NotificationActivity::class.java) intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP) val pendingIntent: PendingIntent = PendingIntent.getActivity( - this, 0 /* Request code */, + this, + 0, intent, - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { - PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_ONE_SHOT } - else { - PendingIntent.FLAG_ONE_SHOT - } + PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_ONE_SHOT, ) val channelId = getString(R.string.app_name) val defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION) @@ -168,11 +156,11 @@ class MifosPayMessagingService : FirebaseMessagingService() { val channel = NotificationChannel( channelId, "Channel human readable title", - NotificationManager.IMPORTANCE_DEFAULT + NotificationManager.IMPORTANCE_DEFAULT, ) notificationManager.createNotificationChannel(channel) } - notificationManager.notify(0 /* ID of notification */, notificationBuilder.build()) + notificationManager.notify(0, notificationBuilder.build()) } /** @@ -198,9 +186,7 @@ class MifosPayMessagingService : FirebaseMessagingService() { Log.e(TAG, "type: $type") // payload can be used when one needs to show specific notification with some data // and process it - if (payload != null) { - Log.e(TAG, "payload: $payload") - } + Log.e(TAG, "payload: $payload") Log.e(TAG, "imageUrl: $imageUrl") Log.e(TAG, "timestamp: $timestamp") sendNotification(title, message) @@ -230,8 +216,11 @@ class MifosPayMessagingService : FirebaseMessagingService() { * Showing notification with text only */ private fun showNotificationMessage( - context: Context, title: String, message: String, - timeStamp: String, intent: Intent + context: Context, + title: String, + message: String, + timeStamp: String, + intent: Intent, ) { val notificationUtils = NotificationUtils(context) intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK @@ -242,8 +231,12 @@ class MifosPayMessagingService : FirebaseMessagingService() { * Showing notification with text and image */ private fun showNotificationMessageWithBigImage( - context: Context, title: String, message: String, - timeStamp: String, intent: Intent, imageUrl: String + context: Context, + title: String, + message: String, + timeStamp: String, + intent: Intent, + imageUrl: String, ) { val notificationUtils = NotificationUtils(context) intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK @@ -253,4 +246,4 @@ class MifosPayMessagingService : FirebaseMessagingService() { companion object { private const val TAG = "MifosPayFCM" } -} \ No newline at end of file +} diff --git a/mifospay/src/main/java/org/mifospay/data/local/LocalRepository.kt b/mifospay/src/main/java/org/mifospay/data/local/LocalRepository.kt index 4c2dba4da..0d2cdfc46 100644 --- a/mifospay/src/main/java/org/mifospay/data/local/LocalRepository.kt +++ b/mifospay/src/main/java/org/mifospay/data/local/LocalRepository.kt @@ -1,7 +1,16 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.data.local -import org.mifospay.core.datastore.PreferencesHelper import com.mifospay.core.model.domain.client.Client +import org.mifospay.core.datastore.PreferencesHelper import javax.inject.Inject import javax.inject.Singleton @@ -25,4 +34,4 @@ class LocalRepository @Inject constructor(val preferencesHelper: PreferencesHelp preferencesHelper.clientId = client.clientId preferencesHelper.clientVpa = client.externalId } -} \ No newline at end of file +} diff --git a/mifospay/src/main/java/org/mifospay/di/ApplicationModule.kt b/mifospay/src/main/java/org/mifospay/di/ApplicationModule.kt index 61e4d9e05..ba2dba403 100644 --- a/mifospay/src/main/java/org/mifospay/di/ApplicationModule.kt +++ b/mifospay/src/main/java/org/mifospay/di/ApplicationModule.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.di import android.content.Context @@ -7,8 +16,8 @@ import dagger.Provides import dagger.hilt.InstallIn import dagger.hilt.android.qualifiers.ApplicationContext import dagger.hilt.components.SingletonComponent -import org.mifospay.data.local.LocalRepository import org.mifospay.core.datastore.PreferencesHelper +import org.mifospay.data.local.LocalRepository import javax.inject.Singleton @Module @@ -23,7 +32,7 @@ class ApplicationModule { @Provides @Singleton fun providesPasscodePreferencesHelper( - @ApplicationContext context: Context + @ApplicationContext context: Context, ): PasscodePreferencesHelper { return PasscodePreferencesHelper(context) } diff --git a/mifospay/src/main/java/org/mifospay/di/JankStatsModule.kt b/mifospay/src/main/java/org/mifospay/di/JankStatsModule.kt index 9863c93d8..3ffdca107 100644 --- a/mifospay/src/main/java/org/mifospay/di/JankStatsModule.kt +++ b/mifospay/src/main/java/org/mifospay/di/JankStatsModule.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.di import android.app.Activity diff --git a/mifospay/src/main/java/org/mifospay/navigation/MifosNavHost.kt b/mifospay/src/main/java/org/mifospay/navigation/MifosNavHost.kt index c3b57f5dd..138935bfd 100644 --- a/mifospay/src/main/java/org/mifospay/navigation/MifosNavHost.kt +++ b/mifospay/src/main/java/org/mifospay/navigation/MifosNavHost.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.navigation import android.content.Context @@ -86,7 +95,7 @@ import java.util.Objects * within each route is handled using state and Back Handlers. */ @Composable -@Suppress("MaxLineLength", "LongMethod") +@Suppress("MaxLineLength", "LongMethod", "UnusedParameter") fun MifosNavHost( navController: NavHostController, onShowSnackbar: suspend (String, String?) -> Boolean, @@ -152,7 +161,6 @@ fun MifosNavHost( }, ) - NavHost( navController = navController, startDestination = startDestination, @@ -286,7 +294,7 @@ fun MifosNavHost( context.startActivity(intent) }, onRegisterSuccess = { - //Todo: Implement onRegisterSuccess + // Todo: Implement onRegisterSuccess }, ) mobileVerificationScreen( @@ -305,7 +313,7 @@ fun MifosNavHost( loginScreen( onDismissSignUp = { - //Todo: Navigate to the main screen after successful login + // Todo: Navigate to the main screen after successful login }, onNavigateToMobileVerificationScreen = { mifosSignedUp, googleDisplayName, googleEmail, googleFamilyName, googleGivenName -> navController.navigateToMobileVerification( @@ -324,7 +332,7 @@ private fun Context.logOut() { val intent = Intent(this, LoginActivity::class.java) intent.addFlags( Intent.FLAG_ACTIVITY_CLEAR_TOP or - Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK, + Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK, ) this.startActivity(intent) } @@ -357,7 +365,8 @@ fun Context.openPassCodeActivity(deepLinkURI: Uri) { fun getUri(context: Context, file: File): Uri { val uri = FileProvider.getUriForFile( Objects.requireNonNull(context), - org.mifospay.BuildConfig.APPLICATION_ID + ".provider", file, + org.mifospay.BuildConfig.APPLICATION_ID + ".provider", + file, ) return uri -} \ No newline at end of file +} diff --git a/mifospay/src/main/java/org/mifospay/navigation/TopLevelDestination.kt b/mifospay/src/main/java/org/mifospay/navigation/TopLevelDestination.kt index f9177e265..84f0d3462 100644 --- a/mifospay/src/main/java/org/mifospay/navigation/TopLevelDestination.kt +++ b/mifospay/src/main/java/org/mifospay/navigation/TopLevelDestination.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.navigation import androidx.compose.ui.graphics.vector.ImageVector diff --git a/mifospay/src/main/java/org/mifospay/ui/MifosApp.kt b/mifospay/src/main/java/org/mifospay/ui/MifosApp.kt index c2eb30d44..6c0af7cc3 100644 --- a/mifospay/src/main/java/org/mifospay/ui/MifosApp.kt +++ b/mifospay/src/main/java/org/mifospay/ui/MifosApp.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.ui import androidx.compose.animation.AnimatedVisibility @@ -76,15 +85,17 @@ import org.mifospay.navigation.TopLevelDestination @Composable fun MifosApp( appState: MifosAppState, - bottomSheetNavigator: BottomSheetNavigator + bottomSheetNavigator: BottomSheetNavigator, + modifier: Modifier = Modifier, ) { val shouldShowGradientBackground = appState.currentTopLevelDestination == TopLevelDestination.HOME var showHomeMenuOption by rememberSaveable { mutableStateOf(false) } - MifosBackground { + MifosBackground(modifier) { MifosGradientBackground( - gradientColors = if (shouldShowGradientBackground) { + gradientColors = + if (shouldShowGradientBackground) { LocalGradientColors.current } else { GradientColors() @@ -108,32 +119,41 @@ fun MifosApp( if (showHomeMenuOption) { AnimatedVisibility(true) { Box( - modifier = Modifier + modifier = + Modifier .fillMaxWidth() .wrapContentSize(Alignment.TopEnd) .padding(end = 24.dp) - .background(color = MaterialTheme.colorScheme.surface) + .background(color = MaterialTheme.colorScheme.surface), ) { DropdownMenu( modifier = Modifier.background(color = MaterialTheme.colorScheme.surface), expanded = showHomeMenuOption, - onDismissRequest = { showHomeMenuOption = false } + onDismissRequest = { showHomeMenuOption = false }, ) { DropdownMenuItem( - text = { Text(stringResource(id = R.string.faq), - color = MaterialTheme.colorScheme.onSurface) }, + text = { + Text( + stringResource(id = R.string.faq), + color = MaterialTheme.colorScheme.onSurface, + ) + }, onClick = { showHomeMenuOption = false appState.navController.navigateToFAQ() - } + }, ) DropdownMenuItem( - text = { Text(stringResource(id = R.string.feature_profile_settings), - color = MaterialTheme.colorScheme.onSurface) }, + text = { + Text( + stringResource(id = R.string.feature_profile_settings), + color = MaterialTheme.colorScheme.onSurface, + ) + }, onClick = { showHomeMenuOption = false appState.navController.navigateToSettings() - } + }, ) } } @@ -141,10 +161,11 @@ fun MifosApp( } // TODO unread destinations to show dot indicator - //val unreadDestinations by appState.topLevelDestinationsWithUnreadResources.collectAsStateWithLifecycle() + // val unreadDestinations by appState.topLevelDestinationsWithUnreadResources.collectAsStateWithLifecycle() Scaffold( - modifier = Modifier.semantics { + modifier = + Modifier.semantics { testTagsAsResourceId = true }, containerColor = Color.Transparent, @@ -180,7 +201,8 @@ fun MifosApp( destinationsWithUnreadResources = emptySet(), onNavigateToDestination = appState::navigateToTopLevelDestination, currentDestination = appState.currentDestination, - modifier = Modifier + modifier = + Modifier .testTag("NiaNavRail") .safeDrawingPadding(), ) @@ -193,28 +215,30 @@ fun MifosApp( MifosTopAppBar( titleRes = destination.titleTextId, actionIcon = MifosIcons.MoreVert, - actionIconContentDescription = stringResource( + actionIconContentDescription = + stringResource( id = R.string.feature_profile_settings, ), - colors = TopAppBarDefaults.centerAlignedTopAppBarColors( + colors = + TopAppBarDefaults.centerAlignedTopAppBarColors( containerColor = Color.Transparent, ), - onActionClick = { showHomeMenuOption = true } + onActionClick = { showHomeMenuOption = true }, ) } - ModalBottomSheetLayout(bottomSheetNavigator = bottomSheetNavigator) { - MifosNavHost( - navController = appState.navController, - onShowSnackbar = { message, action -> - snackbarHostState.showSnackbar( - message = message, - actionLabel = action, - duration = Short, - ) == ActionPerformed - }, - ) - } + ModalBottomSheetLayout(bottomSheetNavigator = bottomSheetNavigator) { + MifosNavHost( + navController = appState.navController, + onShowSnackbar = { message, action -> + snackbarHostState.showSnackbar( + message = message, + actionLabel = action, + duration = Short, + ) == ActionPerformed + }, + ) + } } // TODO: We may want to add padding or spacer when the snackbar is shown so that @@ -246,6 +270,7 @@ private fun MifosNavRail( contentDescription = null, ) }, + modifier = if (hasUnread) Modifier.notificationDot() else Modifier, selectedIcon = { Icon( imageVector = destination.selectedIcon, @@ -253,7 +278,6 @@ private fun MifosNavRail( ) }, label = { Text(stringResource(destination.iconTextId)) }, - modifier = if (hasUnread) Modifier.notificationDot() else Modifier, ) } } @@ -282,6 +306,7 @@ private fun MifosBottomBar( contentDescription = null, ) }, + modifier = if (hasUnread) Modifier.notificationDot() else Modifier, selectedIcon = { Icon( imageVector = destination.selectedIcon, @@ -289,7 +314,6 @@ private fun MifosBottomBar( ) }, label = { Text(stringResource(destination.iconTextId)) }, - modifier = if (hasUnread) Modifier.notificationDot() else Modifier, ) } } @@ -306,10 +330,12 @@ private fun Modifier.notificationDot(): Modifier = // This is based on the dimensions of the NavigationBar's "indicator pill"; // however, its parameters are private, so we must depend on them implicitly // (NavigationBarTokens.ActiveIndicatorWidth = 64.dp) - center = center + Offset( - 64.dp.toPx() * .45f, - 32.dp.toPx() * -.45f - 6.dp.toPx(), - ), + center = + center + + Offset( + 64.dp.toPx() * .45f, + 32.dp.toPx() * -.45f - 6.dp.toPx(), + ), ) } } diff --git a/mifospay/src/main/java/org/mifospay/ui/MifosAppState.kt b/mifospay/src/main/java/org/mifospay/ui/MifosAppState.kt index d1582d203..451dfb900 100644 --- a/mifospay/src/main/java/org/mifospay/ui/MifosAppState.kt +++ b/mifospay/src/main/java/org/mifospay/ui/MifosAppState.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.ui import androidx.compose.material3.windowsizeclass.WindowSizeClass diff --git a/mifospay/src/main/java/org/mifospay/utils/AnimationUtil.kt b/mifospay/src/main/java/org/mifospay/utils/AnimationUtil.kt index c5c574211..a98d0d5f2 100644 --- a/mifospay/src/main/java/org/mifospay/utils/AnimationUtil.kt +++ b/mifospay/src/main/java/org/mifospay/utils/AnimationUtil.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.utils import android.view.View @@ -22,8 +31,11 @@ object AnimationUtil { val a: Animation = object : Animation() { override fun applyTransformation(interpolatedTime: Float, t: Transformation) { v.layoutParams.height = - if (interpolatedTime == 1f) LinearLayout.LayoutParams.WRAP_CONTENT - else (targetHeight * interpolatedTime).toInt() + if (interpolatedTime == 1f) { + LinearLayout.LayoutParams.WRAP_CONTENT + } else { + (targetHeight * interpolatedTime).toInt() + } v.requestLayout() } @@ -62,10 +74,14 @@ object AnimationUtil { fun inFromRightAnimation(view: View) { val inFromRight: Animation = TranslateAnimation( - Animation.RELATIVE_TO_PARENT, +1.0f, - Animation.RELATIVE_TO_PARENT, 0.0f, - Animation.RELATIVE_TO_PARENT, 0.0f, - Animation.RELATIVE_TO_PARENT, 0.0f + Animation.RELATIVE_TO_PARENT, + +1.0f, + Animation.RELATIVE_TO_PARENT, + 0.0f, + Animation.RELATIVE_TO_PARENT, + 0.0f, + Animation.RELATIVE_TO_PARENT, + 0.0f, ) inFromRight.duration = 500 inFromRight.interpolator = AccelerateInterpolator() @@ -82,10 +98,14 @@ object AnimationUtil { fun outToLeftAnimation(view: View) { val outtoLeft: Animation = TranslateAnimation( - Animation.RELATIVE_TO_PARENT, 0.0f, - Animation.RELATIVE_TO_PARENT, -1.0f, - Animation.RELATIVE_TO_PARENT, 0.0f, - Animation.RELATIVE_TO_PARENT, 0.0f + Animation.RELATIVE_TO_PARENT, + 0.0f, + Animation.RELATIVE_TO_PARENT, + -1.0f, + Animation.RELATIVE_TO_PARENT, + 0.0f, + Animation.RELATIVE_TO_PARENT, + 0.0f, ) outtoLeft.duration = 500 outtoLeft.interpolator = AccelerateInterpolator() @@ -102,10 +122,14 @@ object AnimationUtil { fun inFromLeftAnimation(view: View) { val inFromLeft: Animation = TranslateAnimation( - Animation.RELATIVE_TO_PARENT, -1.0f, - Animation.RELATIVE_TO_PARENT, 0.0f, - Animation.RELATIVE_TO_PARENT, 0.0f, - Animation.RELATIVE_TO_PARENT, 0.0f + Animation.RELATIVE_TO_PARENT, + -1.0f, + Animation.RELATIVE_TO_PARENT, + 0.0f, + Animation.RELATIVE_TO_PARENT, + 0.0f, + Animation.RELATIVE_TO_PARENT, + 0.0f, ) inFromLeft.duration = 500 inFromLeft.interpolator = AccelerateInterpolator() @@ -122,10 +146,14 @@ object AnimationUtil { fun outToRightAnimation(view: View) { val outtoRight: Animation = TranslateAnimation( - Animation.RELATIVE_TO_PARENT, 0.0f, - Animation.RELATIVE_TO_PARENT, +1.0f, - Animation.RELATIVE_TO_PARENT, 0.0f, - Animation.RELATIVE_TO_PARENT, 0.0f + Animation.RELATIVE_TO_PARENT, + 0.0f, + Animation.RELATIVE_TO_PARENT, + +1.0f, + Animation.RELATIVE_TO_PARENT, + 0.0f, + Animation.RELATIVE_TO_PARENT, + 0.0f, ) outtoRight.duration = 500 outtoRight.interpolator = AccelerateInterpolator() diff --git a/mifospay/src/main/java/org/mifospay/utils/DebugUtil.kt b/mifospay/src/main/java/org/mifospay/utils/DebugUtil.kt index 7a515df86..76632dc4f 100644 --- a/mifospay/src/main/java/org/mifospay/utils/DebugUtil.kt +++ b/mifospay/src/main/java/org/mifospay/utils/DebugUtil.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.utils import android.util.Log diff --git a/mifospay/src/main/java/org/mifospay/utils/DialogBox.kt b/mifospay/src/main/java/org/mifospay/utils/DialogBox.kt index e74a385d3..aec5918cb 100644 --- a/mifospay/src/main/java/org/mifospay/utils/DialogBox.kt +++ b/mifospay/src/main/java/org/mifospay/utils/DialogBox.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.utils import android.content.Context @@ -18,22 +27,26 @@ class DialogBox { } fun show( - context: Context?, title: Int, message: Int, positive: Int, - negative: Int + context: Context?, + title: Int, + message: Int, + positive: Int, + negative: Int, ) { val builder = AlertDialog.Builder( - context!!, R.style.AppTheme_Dialog + context!!, + R.style.AppTheme_Dialog, ) builder.setTitle(title) builder.setMessage(message) builder.setCancelable(true) builder.setPositiveButton( positive, - onPositiveListener + onPositiveListener, ) builder.setNegativeButton( negative, - onNegativeListener + onNegativeListener, ) alertDialog = builder.create() alertDialog!!.show() @@ -42,4 +55,4 @@ class DialogBox { fun dismiss() { if (alertDialog != null) alertDialog!!.dismiss() } -} \ No newline at end of file +} diff --git a/mifospay/src/main/java/org/mifospay/utils/NotificationUtils.kt b/mifospay/src/main/java/org/mifospay/utils/NotificationUtils.kt index 7d530542e..2bdb7c4bd 100644 --- a/mifospay/src/main/java/org/mifospay/utils/NotificationUtils.kt +++ b/mifospay/src/main/java/org/mifospay/utils/NotificationUtils.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.utils import android.app.ActivityManager @@ -32,8 +41,11 @@ import java.text.SimpleDateFormat class NotificationUtils(private val mContext: Context) { @JvmOverloads fun showNotificationMessage( - title: String, message: String?, - timeStamp: String, intent: Intent, imageUrl: String? = null + title: String, + message: String?, + timeStamp: String, + intent: Intent, + imageUrl: String? = null, ) { // Check for empty push message if (TextUtils.isEmpty(message)) { @@ -47,10 +59,10 @@ class NotificationUtils(private val mContext: Context) { mContext, 0, intent, - PendingIntent.FLAG_CANCEL_CURRENT or PendingIntent.FLAG_IMMUTABLE + PendingIntent.FLAG_CANCEL_CURRENT or PendingIntent.FLAG_IMMUTABLE, ) val mBuilder = NotificationCompat.Builder( - mContext + mContext, ) // final Uri alarmSound = Uri.parse(ContentResolver.SCHEME_ANDROID_RESOURCE @@ -58,34 +70,55 @@ class NotificationUtils(private val mContext: Context) { val alarmSound = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION) if (!TextUtils.isEmpty(imageUrl)) { if (imageUrl != null && imageUrl.length > 4 && Patterns.WEB_URL.matcher( - imageUrl + imageUrl, ).matches() ) { val bitmap = getBitmapFromURL(imageUrl) if (bitmap != null) { showBigNotification( - bitmap, mBuilder, icon, title, message, timeStamp, - resultPendingIntent, alarmSound + bitmap, + mBuilder, + icon, + title, + message, + timeStamp, + resultPendingIntent, + alarmSound, ) } else { showSmallNotification( - mBuilder, icon, title, message, timeStamp, - resultPendingIntent, alarmSound + mBuilder, + icon, + title, + message, + timeStamp, + resultPendingIntent, + alarmSound, ) } } } else { showSmallNotification( - mBuilder, icon, title, message, timeStamp, resultPendingIntent, - alarmSound + mBuilder, + icon, + title, + message, + timeStamp, + resultPendingIntent, + alarmSound, ) playNotificationSound() } } private fun showSmallNotification( - mBuilder: NotificationCompat.Builder, icon: Int, title: String, - message: String?, timeStamp: String, resultPendingIntent: PendingIntent, alarmSound: Uri + mBuilder: NotificationCompat.Builder, + icon: Int, + title: String, + message: String?, + timeStamp: String, + resultPendingIntent: PendingIntent, + alarmSound: Uri, ) { val inboxStyle = NotificationCompat.InboxStyle() inboxStyle.addLine(message) @@ -102,15 +135,20 @@ class NotificationUtils(private val mContext: Context) { .setContentText(message) .build() val notificationManager = mContext.getSystemService( - Context.NOTIFICATION_SERVICE + Context.NOTIFICATION_SERVICE, ) as NotificationManager notificationManager.notify(Constants.NOTIFICATION_ID, notification) } private fun showBigNotification( - bitmap: Bitmap, mBuilder: NotificationCompat.Builder, icon: Int, - title: String, message: String?, timeStamp: String, resultPendingIntent: PendingIntent, - alarmSound: Uri + bitmap: Bitmap, + mBuilder: NotificationCompat.Builder, + icon: Int, + title: String, + message: String?, + timeStamp: String, + resultPendingIntent: PendingIntent, + alarmSound: Uri, ) { val bigPictureStyle = NotificationCompat.BigPictureStyle() bigPictureStyle.setBigContentTitle(title) @@ -129,7 +167,7 @@ class NotificationUtils(private val mContext: Context) { .setContentText(message) .build() val notificationManager = mContext.getSystemService( - Context.NOTIFICATION_SERVICE + Context.NOTIFICATION_SERVICE, ) as NotificationManager notificationManager.notify(Constants.NOTIFICATION_ID_BIG_IMAGE, notification) } @@ -200,7 +238,7 @@ class NotificationUtils(private val mContext: Context) { // Clears notification tray messages fun clearNotifications(context: Context) { val notificationManager = context.getSystemService( - Context.NOTIFICATION_SERVICE + Context.NOTIFICATION_SERVICE, ) as NotificationManager notificationManager.cancelAll() } diff --git a/mifospay/src/main/java/org/mifospay/utils/PasswordStrength.kt b/mifospay/src/main/java/org/mifospay/utils/PasswordStrength.kt index 1111190cb..5703b1ba1 100644 --- a/mifospay/src/main/java/org/mifospay/utils/PasswordStrength.kt +++ b/mifospay/src/main/java/org/mifospay/utils/PasswordStrength.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.utils import android.graphics.Color diff --git a/mifospay/src/main/java/org/mifospay/utils/RecyclerItemClickListener.kt b/mifospay/src/main/java/org/mifospay/utils/RecyclerItemClickListener.kt index 310e3217b..26fbbb243 100644 --- a/mifospay/src/main/java/org/mifospay/utils/RecyclerItemClickListener.kt +++ b/mifospay/src/main/java/org/mifospay/utils/RecyclerItemClickListener.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.utils import android.content.Context @@ -98,4 +107,4 @@ class RecyclerItemClickListener(context: Context?, listener: OnItemClickListener return true } } -} \ No newline at end of file +} diff --git a/mifospay/src/main/java/org/mifospay/utils/TextDrawable.kt b/mifospay/src/main/java/org/mifospay/utils/TextDrawable.kt index 5a9b2f4ac..97d8da400 100644 --- a/mifospay/src/main/java/org/mifospay/utils/TextDrawable.kt +++ b/mifospay/src/main/java/org/mifospay/utils/TextDrawable.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.utils import android.graphics.Canvas @@ -65,7 +74,7 @@ class TextDrawable private constructor(builder: Builder) : ShapeDrawable(builder return Color.rgb( (SHADE_FACTOR * Color.red(color)).toInt(), (SHADE_FACTOR * Color.green(color)).toInt(), - (SHADE_FACTOR * Color.blue(color)).toInt() + (SHADE_FACTOR * Color.blue(color)).toInt(), ) } @@ -73,7 +82,6 @@ class TextDrawable private constructor(builder: Builder) : ShapeDrawable(builder super.draw(canvas) val r = bounds - // draw border if (borderThickness > 0) { drawBorder(canvas) @@ -87,8 +95,13 @@ class TextDrawable private constructor(builder: Builder) : ShapeDrawable(builder val fontSize = if (fontSize < 0) Math.min(width, height) / 2 else fontSize textPaint.textSize = fontSize.toFloat() canvas.drawText( - text, (width / 2).toFloat(), height / 2 - (textPaint.descent() + - textPaint.ascent()) / 2, textPaint + text, + (width / 2).toFloat(), + height / 2 - ( + textPaint.descent() + + textPaint.ascent() + ) / 2, + textPaint, ) canvas.restoreToCount(count) } @@ -245,7 +258,7 @@ class TextDrawable private constructor(builder: Builder) : ShapeDrawable(builder radius.toFloat(), radius.toFloat(), radius.toFloat(), - radius.toFloat() + radius.toFloat(), ) shape = RoundRectShape(radii, null, null) return this @@ -279,4 +292,4 @@ class TextDrawable private constructor(builder: Builder) : ShapeDrawable(builder return Builder() } } -} \ No newline at end of file +} diff --git a/mifospay/src/main/java/org/mifospay/utils/ValidateUtil.kt b/mifospay/src/main/java/org/mifospay/utils/ValidateUtil.kt index da2fec814..5385fbdb1 100644 --- a/mifospay/src/main/java/org/mifospay/utils/ValidateUtil.kt +++ b/mifospay/src/main/java/org/mifospay/utils/ValidateUtil.kt @@ -1,9 +1,17 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.utils import android.util.Patterns object ValidateUtil { - fun String.isValidEmail() = this.isNotEmpty() && Patterns.EMAIL_ADDRESS.matcher(this).matches() - -} \ No newline at end of file + fun String.isValidEmail() = this.isNotEmpty() && Patterns.EMAIL_ADDRESS.matcher(this).matches() +} diff --git a/mifospay/src/main/java/org/mifospay/utils/WrapContentHeightViewPager.kt b/mifospay/src/main/java/org/mifospay/utils/WrapContentHeightViewPager.kt index 205e437a5..fcd369221 100644 --- a/mifospay/src/main/java/org/mifospay/utils/WrapContentHeightViewPager.kt +++ b/mifospay/src/main/java/org/mifospay/utils/WrapContentHeightViewPager.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md + */ package org.mifospay.utils import android.content.Context @@ -10,7 +19,8 @@ import androidx.viewpager.widget.ViewPager class WrapContentHeightViewPager : ViewPager { constructor(context: Context?) : super(context!!) constructor(context: Context?, attrs: AttributeSet?) : super( - context!!, attrs + context!!, + attrs, ) override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) { @@ -20,7 +30,7 @@ class WrapContentHeightViewPager : ViewPager { val child = getChildAt(i) child.measure( widthMeasureSpec, - MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED) + MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED), ) val h = child.measuredHeight if (h > height) height = h diff --git a/mifospay/src/main/res/anim/custom_fade_in.xml b/mifospay/src/main/res/anim/custom_fade_in.xml index 25519de9c..65594c153 100644 --- a/mifospay/src/main/res/anim/custom_fade_in.xml +++ b/mifospay/src/main/res/anim/custom_fade_in.xml @@ -1,4 +1,13 @@ + + + diff --git a/mifospay/src/main/res/drawable/bg_et_round_border.xml b/mifospay/src/main/res/drawable/bg_et_round_border.xml index 96bc7ef9b..3183ca5b4 100644 --- a/mifospay/src/main/res/drawable/bg_et_round_border.xml +++ b/mifospay/src/main/res/drawable/bg_et_round_border.xml @@ -1,4 +1,13 @@ + + diff --git a/mifospay/src/main/res/drawable/bg_splash_12.xml b/mifospay/src/main/res/drawable/bg_splash_12.xml index 56bb0f3fa..33f69ca50 100644 --- a/mifospay/src/main/res/drawable/bg_splash_12.xml +++ b/mifospay/src/main/res/drawable/bg_splash_12.xml @@ -1,4 +1,13 @@ + diff --git a/mifospay/src/main/res/drawable/bottomview_selector.xml b/mifospay/src/main/res/drawable/bottomview_selector.xml index 93b516d1e..882420463 100644 --- a/mifospay/src/main/res/drawable/bottomview_selector.xml +++ b/mifospay/src/main/res/drawable/bottomview_selector.xml @@ -1,4 +1,13 @@ + diff --git a/mifospay/src/main/res/drawable/button_round_black.xml b/mifospay/src/main/res/drawable/button_round_black.xml index 45c5ce7a7..835132df5 100644 --- a/mifospay/src/main/res/drawable/button_round_black.xml +++ b/mifospay/src/main/res/drawable/button_round_black.xml @@ -1,4 +1,13 @@ + diff --git a/mifospay/src/main/res/drawable/button_round_gray.xml b/mifospay/src/main/res/drawable/button_round_gray.xml index df3c6d5b6..89b9cb025 100644 --- a/mifospay/src/main/res/drawable/button_round_gray.xml +++ b/mifospay/src/main/res/drawable/button_round_gray.xml @@ -1,4 +1,13 @@ + diff --git a/mifospay/src/main/res/drawable/button_round_primary.xml b/mifospay/src/main/res/drawable/button_round_primary.xml index 45c5ce7a7..835132df5 100644 --- a/mifospay/src/main/res/drawable/button_round_primary.xml +++ b/mifospay/src/main/res/drawable/button_round_primary.xml @@ -1,4 +1,13 @@ + diff --git a/mifospay/src/main/res/drawable/button_round_stroke.xml b/mifospay/src/main/res/drawable/button_round_stroke.xml index b9bbb34e0..b7ceb0ef6 100644 --- a/mifospay/src/main/res/drawable/button_round_stroke.xml +++ b/mifospay/src/main/res/drawable/button_round_stroke.xml @@ -1,4 +1,13 @@ + + + + diff --git a/mifospay/src/main/res/drawable/cardview_round_green.xml b/mifospay/src/main/res/drawable/cardview_round_green.xml index 04854037e..1be22ce0f 100644 --- a/mifospay/src/main/res/drawable/cardview_round_green.xml +++ b/mifospay/src/main/res/drawable/cardview_round_green.xml @@ -1,4 +1,13 @@ + diff --git a/mifospay/src/main/res/drawable/drawable_bottom_sheet_view.xml b/mifospay/src/main/res/drawable/drawable_bottom_sheet_view.xml index ed86e2258..df68df456 100644 --- a/mifospay/src/main/res/drawable/drawable_bottom_sheet_view.xml +++ b/mifospay/src/main/res/drawable/drawable_bottom_sheet_view.xml @@ -1,4 +1,13 @@ + diff --git a/mifospay/src/main/res/drawable/drawable_editable_image_hint.xml b/mifospay/src/main/res/drawable/drawable_editable_image_hint.xml index 1ef5864e8..1b66a55c6 100644 --- a/mifospay/src/main/res/drawable/drawable_editable_image_hint.xml +++ b/mifospay/src/main/res/drawable/drawable_editable_image_hint.xml @@ -1,4 +1,13 @@ + + diff --git a/mifospay/src/main/res/drawable/ic_account_balance_wallet.xml b/mifospay/src/main/res/drawable/ic_account_balance_wallet.xml index 4ec46f071..0f123f2c2 100644 --- a/mifospay/src/main/res/drawable/ic_account_balance_wallet.xml +++ b/mifospay/src/main/res/drawable/ic_account_balance_wallet.xml @@ -1,3 +1,13 @@ + + + + + + + + + + + + + + + + + + diff --git a/mifospay/src/main/res/drawable/ic_edit.xml b/mifospay/src/main/res/drawable/ic_edit.xml index e6a42e70f..1aaddb39c 100644 --- a/mifospay/src/main/res/drawable/ic_edit.xml +++ b/mifospay/src/main/res/drawable/ic_edit.xml @@ -1,4 +1,13 @@ + + diff --git a/mifospay/src/main/res/drawable/ic_empty_state.xml b/mifospay/src/main/res/drawable/ic_empty_state.xml index 051b341be..490b6be50 100644 --- a/mifospay/src/main/res/drawable/ic_empty_state.xml +++ b/mifospay/src/main/res/drawable/ic_empty_state.xml @@ -1,3 +1,13 @@ + + + + + + + + + + + + + + diff --git a/mifospay/src/main/res/drawable/ic_next.xml b/mifospay/src/main/res/drawable/ic_next.xml index db879d1f1..ac2958c7e 100644 --- a/mifospay/src/main/res/drawable/ic_next.xml +++ b/mifospay/src/main/res/drawable/ic_next.xml @@ -1,4 +1,13 @@ + + + + + + + + + diff --git a/mifospay/src/main/res/drawable/ic_request.xml b/mifospay/src/main/res/drawable/ic_request.xml index ab608c60c..fdc053093 100644 --- a/mifospay/src/main/res/drawable/ic_request.xml +++ b/mifospay/src/main/res/drawable/ic_request.xml @@ -1,3 +1,13 @@ + + + \ No newline at end of file diff --git a/mifospay/src/main/res/drawable/ic_right_arrow.xml b/mifospay/src/main/res/drawable/ic_right_arrow.xml index b7e11ecca..f68f3f5af 100644 --- a/mifospay/src/main/res/drawable/ic_right_arrow.xml +++ b/mifospay/src/main/res/drawable/ic_right_arrow.xml @@ -1,4 +1,13 @@ + + + + + + \ No newline at end of file diff --git a/mifospay/src/main/res/drawable/ic_setting.xml b/mifospay/src/main/res/drawable/ic_setting.xml index d7d9ef459..adaf75e5d 100644 --- a/mifospay/src/main/res/drawable/ic_setting.xml +++ b/mifospay/src/main/res/drawable/ic_setting.xml @@ -1,4 +1,13 @@ + + + + + diff --git a/mifospay/src/main/res/drawable/ic_verify.xml b/mifospay/src/main/res/drawable/ic_verify.xml index dd77e4282..72a380b1a 100644 --- a/mifospay/src/main/res/drawable/ic_verify.xml +++ b/mifospay/src/main/res/drawable/ic_verify.xml @@ -1,4 +1,13 @@ + + + + \ No newline at end of file diff --git a/mifospay/src/main/res/drawable/qrcode_blue.xml b/mifospay/src/main/res/drawable/qrcode_blue.xml index 9461c6291..a84a08aef 100644 --- a/mifospay/src/main/res/drawable/qrcode_blue.xml +++ b/mifospay/src/main/res/drawable/qrcode_blue.xml @@ -1,4 +1,13 @@ - + + + \ No newline at end of file diff --git a/mifospay/src/main/res/drawable/shape_bottom_sheet_dialog_grip.xml b/mifospay/src/main/res/drawable/shape_bottom_sheet_dialog_grip.xml index 792c8361b..a182bf8d3 100644 --- a/mifospay/src/main/res/drawable/shape_bottom_sheet_dialog_grip.xml +++ b/mifospay/src/main/res/drawable/shape_bottom_sheet_dialog_grip.xml @@ -1,3 +1,13 @@ + + diff --git a/mifospay/src/main/res/drawable/sim_card_selected.xml b/mifospay/src/main/res/drawable/sim_card_selected.xml index 38499a2a5..369a18515 100644 --- a/mifospay/src/main/res/drawable/sim_card_selected.xml +++ b/mifospay/src/main/res/drawable/sim_card_selected.xml @@ -1,4 +1,13 @@ + + + diff --git a/mifospay/src/main/res/drawable/transfer_failure.xml b/mifospay/src/main/res/drawable/transfer_failure.xml index 4c64104f6..cf8068363 100644 --- a/mifospay/src/main/res/drawable/transfer_failure.xml +++ b/mifospay/src/main/res/drawable/transfer_failure.xml @@ -1,4 +1,13 @@ + diff --git a/mifospay/src/main/res/drawable/transfer_success.xml b/mifospay/src/main/res/drawable/transfer_success.xml index 545662a40..736913a81 100644 --- a/mifospay/src/main/res/drawable/transfer_success.xml +++ b/mifospay/src/main/res/drawable/transfer_success.xml @@ -1,4 +1,13 @@ + diff --git a/mifospay/src/main/res/font/montserrat.xml b/mifospay/src/main/res/font/montserrat.xml index 0421f22c0..9825cc5d2 100644 --- a/mifospay/src/main/res/font/montserrat.xml +++ b/mifospay/src/main/res/font/montserrat.xml @@ -1,4 +1,13 @@ + + + + + +

diff --git a/mifospay/src/main/res/values-v16/styles.xml b/mifospay/src/main/res/values-v16/styles.xml index ef39db251..0a61e396a 100644 --- a/mifospay/src/main/res/values-v16/styles.xml +++ b/mifospay/src/main/res/values-v16/styles.xml @@ -1,4 +1,13 @@ +