Skip to content

Commit

Permalink
Merge pull request #2731 from openMF/development
Browse files Browse the repository at this point in the history
Updating the latest changes on kmp branch
  • Loading branch information
niyajali authored Jan 5, 2025
2 parents 0297116 + efb38f5 commit fefc6ec
Show file tree
Hide file tree
Showing 83 changed files with 2,403 additions and 1,977 deletions.
12 changes: 1 addition & 11 deletions androidApp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,6 @@
*/
import org.mifos.mobile.dynamicVersion

/*
* Copyright 2024 Mifos Initiative
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*
* See https://github.com/openMF/mobile-mobile/blob/master/LICENSE.md
*/
plugins {
alias(libs.plugins.mifos.android.application)
alias(libs.plugins.mifos.android.application.compose)
Expand Down Expand Up @@ -84,7 +75,7 @@ dependencies {
implementation(projects.core.common)
implementation(projects.core.model)
implementation(projects.core.data)
implementation(projects.core.datastore)
implementation(projects.core.database)
implementation(projects.core.ui)
implementation(projects.core.designsystem)

Expand Down Expand Up @@ -132,7 +123,6 @@ dependencies {
implementation(libs.androidx.profileinstaller)
implementation(libs.google.oss.licenses)
implementation(libs.androidx.multidex)
implementation(libs.dbflow)

testImplementation(projects.core.testing)
testImplementation(libs.hilt.android.testing)
Expand Down
2,194 changes: 1,121 additions & 1,073 deletions androidApp/dependencies/releaseRuntimeClasspath.tree.txt

Large diffs are not rendered by default.

291 changes: 152 additions & 139 deletions androidApp/dependencies/releaseRuntimeClasspath.txt

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ package org.mifos.mobile
import androidx.multidex.MultiDex
import androidx.multidex.MultiDexApplication
import com.google.firebase.crashlytics.FirebaseCrashlytics
import com.raizlabs.android.dbflow.config.FlowManager
import dagger.hilt.android.HiltAndroidApp
import org.mifos.mobile.core.datastore.PreferencesHelper
import org.mifos.mobile.feature.settings.applySavedTheme
Expand All @@ -22,13 +21,7 @@ class MifosSelfServiceApp : MultiDexApplication() {
override fun onCreate() {
super.onCreate()
MultiDex.install(this)
FlowManager.init(this)
FirebaseCrashlytics.getInstance().setCrashlyticsCollectionEnabled(true)
FirebaseCrashlytics.getInstance().isCrashlyticsCollectionEnabled = true
PreferencesHelper(this).applySavedTheme()
}

override fun onTerminate() {
super.onTerminate()
FlowManager.destroy()
}
}
1 change: 1 addition & 0 deletions androidApp/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -654,4 +654,5 @@
<string name="s_no">S.No</string>
<string name="no_transaction_found">No Transaction Found</string>
<string name="not_connected">⚠️ You aren’t connected to the internet</string>
<string name="google_maps_key" templateMergeStrategy="preserve" translatable="false">AIzaSyBbeT2BaMWLj-lReCgYoNmXs_TIyRLr9qQ</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ class AndroidApplicationConventionPlugin : Plugin<Project> {
apply("com.dropbox.dependency-guard")
apply("mifos.detekt.plugin")
apply("mifos.spotless.plugin")
apply("mifos.ktlint.plugin")
apply("mifos.git.hooks")
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,30 @@

import org.mifos.mobile.libs
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.dependencies
import org.mifos.mobile.libs

class AndroidHiltConventionPlugin : Plugin<Project> {
override fun apply(target: Project) {
with(target) {
with(pluginManager) {
apply("dagger.hilt.android.plugin")
// KAPT must go last to avoid build warnings.
// See: https://stackoverflow.com/questions/70550883/warning-the-following-options-were-not-recognized-by-any-processor-dagger-f
apply("org.jetbrains.kotlin.kapt")
pluginManager.apply("com.google.devtools.ksp")
dependencies {
"ksp"(libs.findLibrary("hilt.compiler").get())
}

dependencies {
"implementation"(libs.findLibrary("hilt.android").get())
"kapt"(libs.findLibrary("hilt.compiler").get())
"kaptAndroidTest"(libs.findLibrary("hilt.compiler").get())
"kaptTest"(libs.findLibrary("hilt.compiler").get())
// Add support for Jvm Module, base on org.jetbrains.kotlin.jvm
pluginManager.withPlugin("org.jetbrains.kotlin.jvm") {
dependencies {
"implementation"(libs.findLibrary("hilt.core").get())
}
}

/** Add support for Android modules, based on [AndroidBasePlugin] */
pluginManager.withPlugin("com.android.base") {
pluginManager.apply("dagger.hilt.android.plugin")
dependencies {
"implementation"(libs.findLibrary("hilt.android").get())
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ class AndroidLibraryConventionPlugin : Plugin<Project> {
apply("mifos.android.lint")
apply("mifos.detekt.plugin")
apply("mifos.spotless.plugin")
apply("mifos.ktlint.plugin")
}

extensions.configure<LibraryExtension> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@


import androidx.room.gradle.RoomExtension
import com.google.devtools.ksp.gradle.KspExtension
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.dependencies
import org.mifos.mobile.libs

class AndroidRoomConventionPlugin : Plugin<Project> {

override fun apply(target: Project) {
with(target) {
pluginManager.apply("androidx.room")
pluginManager.apply("com.google.devtools.ksp")

extensions.configure<KspExtension> {
arg("room.generateKotlin", "true")
}

extensions.configure<RoomExtension> {
// The schemas directory contains a schema file for each version of the Room database.
// This is required to enable Room auto migrations.
Expand All @@ -20,9 +26,9 @@ class AndroidRoomConventionPlugin : Plugin<Project> {
}

dependencies {
add("implementation", libs.findLibrary("room.runtime").get())
add("implementation", libs.findLibrary("room.ktx").get())
add("ksp", libs.findLibrary("room.compiler").get())
"implementation"(libs.findLibrary("androidx.room.runtime").get())
"implementation"(libs.findLibrary("androidx.room.ktx").get())
"ksp"(libs.findLibrary("androidx.room.compiler").get())
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package org.mifos.mobile
import com.android.build.api.dsl.CommonExtension
import org.gradle.api.Project
import org.gradle.api.provider.Provider
import org.gradle.kotlin.dsl.assign
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.dependencies
import org.jetbrains.kotlin.compose.compiler.gradle.ComposeCompilerGradlePluginExtension
Expand Down Expand Up @@ -50,8 +49,7 @@ internal fun Project.configureAndroidCompose(
.relativeToRootProject("compose-reports")
.let(reportsDestination::set)

stabilityConfigurationFile = rootProject.layout.projectDirectory.file("compose_compiler_config.conf")

enableStrongSkippingMode = true
stabilityConfigurationFiles
.add(isolated.rootProject.projectDirectory.file("compose_compiler_config.conf"))
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package org.mifos.mobile

import com.android.SdkConstants
import com.android.build.api.artifact.SingleArtifact
import com.android.build.api.variant.ApplicationAndroidComponentsExtension
import com.android.build.gradle.BaseExtension
import com.android.SdkConstants
import com.google.common.truth.Truth.assertWithMessage
import org.gradle.api.DefaultTask
import org.gradle.api.Project
Expand All @@ -19,7 +19,6 @@ import org.gradle.api.tasks.OutputFile
import org.gradle.api.tasks.PathSensitive
import org.gradle.api.tasks.PathSensitivity
import org.gradle.api.tasks.TaskAction
import org.gradle.configurationcache.extensions.capitalized
import org.gradle.kotlin.dsl.register
import org.gradle.language.base.plugins.LifecycleBasePlugin
import org.gradle.process.ExecOperations
Expand Down Expand Up @@ -83,7 +82,7 @@ abstract class CheckBadgingTask : DefaultTask() {
fun taskAction() {
assertWithMessage(
"Generated badging is different from golden badging! " +
"If this change is intended, run ./gradlew ${updateBadgingTaskName.get()}",
"If this change is intended, run ./gradlew ${updateBadgingTaskName.get()}",
)
.that(generatedBadging.get().asFile.readText())
.isEqualTo(goldenBadging.get().asFile.readText())
Expand All @@ -97,7 +96,8 @@ fun Project.configureBadgingTasks(
// Registers a callback to be called, when a new variant is configured
componentsExtension.onVariants { variant ->
// Registers a new task to verify the app bundle.
val capitalizedVariantName = variant.name.capitalized()
val capitalizedVariantName = variant.name.toString()
.replaceFirstChar { if (it.isLowerCase()) it.titlecase() else it.toString() }
val generateBadgingTaskName = "generate${capitalizedVariantName}Badging"
val generateBadging =
tasks.register<GenerateBadgingTask>(generateBadgingTaskName) {
Expand All @@ -108,8 +108,8 @@ fun Project.configureBadgingTasks(
File(
baseExtension.sdkDirectory,
"${SdkConstants.FD_BUILD_TOOLS}/" +
"${baseExtension.buildToolsVersion}/" +
SdkConstants.FN_AAPT2,
"${baseExtension.buildToolsVersion}/" +
SdkConstants.FN_AAPT2,
),
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import org.gradle.kotlin.dsl.dependencies
import org.gradle.kotlin.dsl.provideDelegate
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.dsl.KotlinAndroidProjectExtension
import org.jetbrains.kotlin.gradle.dsl.KotlinBaseExtension
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
import org.jetbrains.kotlin.gradle.dsl.KotlinTopLevelExtension

/**
* Configure base Kotlin with Android options
Expand All @@ -20,7 +20,7 @@ internal fun Project.configureKotlinAndroid(
commonExtension: CommonExtension<*, *, *, *, *, *>,
) {
commonExtension.apply {
compileSdk = 34
compileSdk = 35

defaultConfig {
minSdk = 26
Expand Down Expand Up @@ -59,7 +59,7 @@ internal fun Project.configureKotlinJvm() {
/**
* Configure base Kotlin options
*/
private inline fun <reified T : KotlinTopLevelExtension> Project.configureKotlin() = configure<T> {
private inline fun <reified T : KotlinBaseExtension> Project.configureKotlin() = configure<T> {
// Treat all Kotlin warnings as errors (disabled by default)
// Override by setting warningsAsErrors=true in your ~/.gradle/gradle.properties
val warningsAsErrors: String? by project
Expand All @@ -75,7 +75,7 @@ private inline fun <reified T : KotlinTopLevelExtension> Project.configureKotlin
"-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
)
freeCompilerArgs.add(
"-opt-in=androidx.compose.material3.ExperimentalMaterial3Api"
"-opt-in=androidx.compose.material3.ExperimentalMaterial3Api",
)
}
}
Expand Down
2 changes: 0 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ plugins {
alias(libs.plugins.kotlin.android) apply false
alias(libs.plugins.detekt) apply false
alias(libs.plugins.spotless) apply false
alias(libs.plugins.ktlint) apply false
alias(libs.plugins.version.catalog.linter) apply true
alias(libs.plugins.compose.compiler) apply false
alias(libs.plugins.kotlinMultiplatform) apply false
alias(libs.plugins.jetbrainsCompose) apply false
Expand Down
2 changes: 1 addition & 1 deletion ci-prepush.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ tasks=(
"spotlessApply --no-configuration-cache"
"dependencyGuardBaseline"
"detekt"
"testDebug :lint:test :lint:lint :androidApp:lintRelease"
# "testDebug :lint:test :lint:lint :androidApp:lintRelease"
"build"
"updateReleaseBadging"
)
Expand Down
2 changes: 2 additions & 0 deletions core/data/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ dependencies {
api(projects.core.common)
api(projects.core.model)
api(projects.core.network)
api(projects.core.database)
api(projects.core.datastore)

implementation(libs.squareup.retrofit2)
implementation(libs.squareup.okhttp)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
mock-maker-inline
95 changes: 95 additions & 0 deletions core/data/src/main/java/org/mifos/mobile/core/data/model/Charge.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
/*
* Copyright 2025 Mifos Initiative
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*
* See https://github.com/openMF/mobile-mobile/blob/master/LICENSE.md
*/
package org.mifos.mobile.core.data.model

import org.mifos.mobile.core.database.entity.ChargeCalculationTypeEntity
import org.mifos.mobile.core.database.entity.ChargeEntity
import org.mifos.mobile.core.database.entity.ChargeTimeTypeEntity
import org.mifos.mobile.core.database.entity.CurrencyEntity
import org.mifos.mobile.core.model.entity.Charge
import org.mifos.mobile.core.model.entity.ChargeCalculationType
import org.mifos.mobile.core.model.entity.ChargeTimeType
import org.mifos.mobile.core.model.entity.Currency

fun ChargeEntity.toCharge(): Charge {
return Charge(
clientId = clientId,
chargeId = chargeId,
name = name,
dueDate = dueDate,
chargeTimeType = ChargeTimeType(
id = chargeTimeType?.id ?: 0,
code = chargeTimeType?.code,
value = chargeTimeType?.value,
),
chargeCalculationType = ChargeCalculationType(
id = chargeCalculationType?.id ?: 0,
code = chargeCalculationType?.code,
value = chargeCalculationType?.value,
),
currency = Currency(
code = currency?.code,
name = currency?.name,
decimalPlaces = currency?.decimalPlaces ?: 0,
displaySymbol = currency?.displaySymbol,
nameCode = currency?.nameCode,
displayLabel = currency?.displayLabel,
),
amount = amount,
amountPaid = amountPaid,
amountWaived = amountWaived,
amountWrittenOff = amountWrittenOff,
amountOutstanding = amountOutstanding,
penalty = penalty,
isActive = isActive,
isChargePaid = isChargePaid,
isChargeWaived = isChargeWaived,
paid = paid,
waived = waived,
)
}

fun Charge.toChargeEntity(): ChargeEntity {
return ChargeEntity(
clientId = clientId,
chargeId = chargeId,
name = name,
dueDate = dueDate,
chargeTimeType = ChargeTimeTypeEntity(
id = chargeTimeType?.id ?: 0,
code = chargeTimeType?.code,
value = chargeTimeType?.value,
),
chargeCalculationType = ChargeCalculationTypeEntity(
id = chargeCalculationType?.id ?: 0,
code = chargeCalculationType?.code,
value = chargeCalculationType?.value,
),
currency = CurrencyEntity(
code = currency?.code,
name = currency?.name,
decimalPlaces = currency?.decimalPlaces ?: 0,
displaySymbol = currency?.displaySymbol,
nameCode = currency?.nameCode,
displayLabel = currency?.displayLabel,
),
amount = amount,
amountPaid = amountPaid,
amountWaived = amountWaived,
amountWrittenOff = amountWrittenOff,
amountOutstanding = amountOutstanding,
penalty = penalty,
isActive = isActive,
isChargePaid = isChargePaid,
isChargeWaived = isChargeWaived,
paid = paid,
waived = waived,
)
}
Loading

0 comments on commit fefc6ec

Please sign in to comment.