Skip to content

Commit

Permalink
Feat: [:core:ui] - Migrated to KMP with CMP Library (#1775)
Browse files Browse the repository at this point in the history
  • Loading branch information
niyajali authored Sep 30, 2024
1 parent d5b7c52 commit 69a04d8
Show file tree
Hide file tree
Showing 63 changed files with 218 additions and 217 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ class KMPLibraryConventionPlugin: Plugin<Project> {
apply("mifospay.kmp.koin")
apply("mifos.detekt.plugin")
apply("mifos.spotless.plugin")
apply("mifos.ktlint.plugin")
}

configureKotlinMultiplatform()
Expand Down
Empty file removed core/analytics/consumer-rules.pro
Empty file.
21 changes: 0 additions & 21 deletions core/analytics/proguard-rules.pro

This file was deleted.

Empty file removed core/common/consumer-rules.pro
Empty file.
21 changes: 0 additions & 21 deletions core/common/proguard-rules.pro

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,9 +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.common

import java.text.NumberFormat
import java.util.Currency

actual class CurrencyFormatter {
actual object CurrencyFormatter {
actual fun format(
balance: Double?,
currencyCode: String?,
Expand All @@ -14,4 +23,4 @@ actual class CurrencyFormatter {
balanceFormatter.currency = Currency.getInstance(currencyCode)
return balanceFormatter.format(balance)
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
/*
* Copyright 2024 Mifos Initiative
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* 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.common


// JVM and Android implementation
actual fun createPlatformFileUtils(): FileUtils = CommonFileUtils()
actual fun createPlatformFileUtils(): FileUtils = CommonFileUtils()
Original file line number Diff line number Diff line change
@@ -0,0 +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.common

expect object CurrencyFormatter {
fun format(balance: Double?, currencyCode: String?, maximumFractionDigits: Int?): String
}

fun <T> List<T>.toArrayList(): ArrayList<T> {
return ArrayList(this)
}
Original file line number Diff line number Diff line change
@@ -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.common

import co.touchlab.kermit.Logger
Expand All @@ -7,7 +16,6 @@ import okio.FileSystem
import okio.Path.Companion.toPath
import okio.SYSTEM


interface FileUtils {
suspend fun writeInputStreamDataToFile(inputStream: ByteArray, filePath: String): Boolean

Expand Down Expand Up @@ -36,4 +44,4 @@ class CommonFileUtils : FileUtils {
false
}
}
}
}
Original file line number Diff line number Diff line change
@@ -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.common

import kotlinx.coroutines.flow.Flow
Expand All @@ -13,4 +22,4 @@ sealed interface Result<out T> {

fun <T> Flow<T>.asResult(): Flow<Result<T>> = map<T, Result<T>> { Result.Success(it) }
.onStart { emit(Result.Loading) }
.catch { emit(Result.Error(it)) }
.catch { emit(Result.Error(it)) }

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,9 +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.common

import java.text.NumberFormat
import java.util.Currency

actual class CurrencyFormatter {
actual object CurrencyFormatter {
actual fun format(
balance: Double?,
currencyCode: String?,
Expand All @@ -14,4 +23,4 @@ actual class CurrencyFormatter {
numberFormat.currency = Currency.getInstance(currencyCode)
return numberFormat.format(balance)
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
/*
* Copyright 2024 Mifos Initiative
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* 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.common

// JVM and Android implementation
actual fun createPlatformFileUtils(): FileUtils = CommonFileUtils()

Original file line number Diff line number Diff line change
@@ -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.common

import platform.Foundation.NSNumberFormatter

actual class CurrencyFormatter {
actual object CurrencyFormatter {
actual fun format(
balance: Double?,
currencyCode: String?,
Expand All @@ -14,4 +23,4 @@ actual class CurrencyFormatter {
numberFormatter.maximumFractionDigits = maximumFractionDigits ?: 0
return numberFormatter.stringFromNumber(balance ?: 0.0) ?: ""
}
}
}
Original file line number Diff line number Diff line change
@@ -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.common

import kotlinx.cinterop.ExperimentalForeignApi
Expand All @@ -21,4 +30,4 @@ actual fun createPlatformFileUtils(): FileUtils = object : FileUtils {
}

private fun ByteArray.toNSData(): NSData = NSData.create(bytes = this.refTo(0), length = this.size.toULong())
}
}
Empty file.
21 changes: 0 additions & 21 deletions core/datastore-proto/proguard-rules.pro

This file was deleted.

21 changes: 0 additions & 21 deletions core/datastore/proguard-rules.pro

This file was deleted.

Original file line number Diff line number Diff line change
@@ -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.mifospay.core.datastore.proto.ClientPreferences
Expand Down Expand Up @@ -113,4 +122,4 @@ fun UserData.toUserPreferences(): UserPreferences {
client = client.toClientPreferences(),
user = user.toUserInfoPreferences(),
)
}
}
Original file line number Diff line number Diff line change
@@ -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
*/
@file:OptIn(ExperimentalSerializationApi::class, ExperimentalSettingsApi::class)

package org.mifospay.core.datastore
Expand Down
Original file line number Diff line number Diff line change
@@ -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 com.russhwolf.settings.Settings
Expand All @@ -9,4 +18,4 @@ val PreferencesModule = module {
factory<Settings> { Settings() }
// Use the IO dispatcher name - MifosDispatchers.IO.name
factory { UserPreferencesDataSource(get(), get(named("IO"))) }
}
}
2 changes: 0 additions & 2 deletions core/designsystem/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ kotlin {
implementation(compose.components.resources)
implementation(compose.components.uiToolingPreview)
implementation(libs.back.handler)
implementation(libs.moko.permission)
implementation(libs.moko.permission.compose)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@ fun MifosTopBar(
actions = actions,
modifier = modifier,
)
}
}
Empty file.
Original file line number Diff line number Diff line change
@@ -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.model

data class ClientInfo(
Expand Down
Loading

0 comments on commit 69a04d8

Please sign in to comment.