Skip to content

Commit d6623f8

Browse files
authored
Feat: [:core:common] KMP Migration (#1768)
* Feat: [:core:common] KMP Migration * Updated Usage Declaration
1 parent a3b4fd3 commit d6623f8

File tree

48 files changed

+255
-179
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+255
-179
lines changed

core/common/build.gradle.kts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,36 @@ android {
1616
}
1717

1818
kotlin {
19+
20+
listOf(
21+
iosX64(),
22+
iosArm64(),
23+
iosSimulatorArm64()
24+
).forEach {
25+
it.binaries.framework {
26+
isStatic = false
27+
export(libs.kermit.simple)
28+
}
29+
}
30+
1931
sourceSets {
2032
commonMain.dependencies {
2133
implementation(libs.kotlinx.coroutines.core)
2234
api(libs.coil.kt)
2335
api(libs.coil.core)
2436
api(libs.coil.svg)
2537
api(libs.coil.network.ktor)
38+
api(libs.kermit.logging)
39+
api(libs.squareup.okio)
2640
}
2741
androidMain.dependencies {
2842
implementation(libs.kotlinx.coroutines.android)
2943
}
3044
commonTest.dependencies {
3145
implementation(libs.kotlinx.coroutines.test)
3246
}
47+
iosMain.dependencies {
48+
api(libs.kermit.simple)
49+
}
3350
}
3451
}

core/common/src/androidMain/kotlin/org/mifospay/common/DebugUtil.kt

Lines changed: 0 additions & 26 deletions
This file was deleted.

core/common/src/androidMain/kotlin/org/mifospay/common/FileUtils.kt

Lines changed: 0 additions & 36 deletions
This file was deleted.

core/common/src/androidMain/kotlin/org/mifospay/common/Utils.kt

Lines changed: 0 additions & 34 deletions
This file was deleted.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package org.mifospay.core.common
2+
3+
4+
// JVM and Android implementation
5+
actual fun createPlatformFileUtils(): FileUtils = CommonFileUtils()
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package org.mifospay.core.common
2+
3+
import java.text.NumberFormat
4+
import java.util.Currency
5+
6+
actual class CurrencyFormatter {
7+
actual fun format(
8+
balance: Double?,
9+
currencyCode: String?,
10+
maximumFractionDigits: Int?,
11+
): String {
12+
val balanceFormatter = NumberFormat.getCurrencyInstance()
13+
balanceFormatter.maximumFractionDigits = maximumFractionDigits ?: 0
14+
balanceFormatter.currency = Currency.getInstance(currencyCode)
15+
return balanceFormatter.format(balance)
16+
}
17+
}

core/common/src/androidMain/kotlin/org/mifospay/core/network/di/CoroutineScopesModule.kt

Lines changed: 0 additions & 23 deletions
This file was deleted.

core/common/src/androidMain/kotlin/org/mifospay/common/Constants.kt renamed to core/common/src/commonMain/kotlin/org/mifospay/core/common/Constants.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
* See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md
99
*/
10-
package org.mifospay.common
10+
package org.mifospay.core.common
1111

1212
/**
1313
* Created by naman on 17/6/17.

core/common/src/androidMain/kotlin/org/mifospay/common/CreditCardUtils.kt renamed to core/common/src/commonMain/kotlin/org/mifospay/core/common/CreditCardUtils.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
* See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md
99
*/
10-
package org.mifospay.common
10+
package org.mifospay.core.common
1111

1212
object CreditCardUtils {
1313
fun validateCreditCardNumber(str: String): Boolean {
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
* Copyright 2024 Mifos Initiative
3+
*
4+
* This Source Code Form is subject to the terms of the Mozilla Public
5+
* License, v. 2.0. If a copy of the MPL was not distributed with this
6+
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
7+
*
8+
* See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md
9+
*/
10+
package org.mifospay.core.common
11+
12+
import co.touchlab.kermit.Logger
13+
14+
object DebugUtil {
15+
16+
private val logger = Logger.withTag("QXZ")
17+
18+
fun log(vararg objects: Any): Array<out Any> {
19+
val stringToPrint = objects.joinToString(", ")
20+
logger.d { stringToPrint }
21+
return objects
22+
}
23+
}

0 commit comments

Comments
 (0)