Skip to content

Commit

Permalink
Feat: Migrate :core:designsystem to KMP (#2746)
Browse files Browse the repository at this point in the history
Co-authored-by: Sk Niyaj Ali <[email protected]>
  • Loading branch information
biplab1 and niyajali authored Jan 17, 2025
1 parent 4b60246 commit e54baf1
Show file tree
Hide file tree
Showing 57 changed files with 4,147 additions and 625 deletions.
17 changes: 16 additions & 1 deletion androidApp/dependencies/demoDebugRuntimeClasspath.txt
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ androidx.vectordrawable:vectordrawable-animated:1.1.0
androidx.vectordrawable:vectordrawable:1.1.0
androidx.versionedparcelable:versionedparcelable:1.1.1
androidx.viewpager:viewpager:1.0.0
androidx.window.extensions.core:core:1.0.0
androidx.window:window:1.2.0
app.cash.turbine:turbine-jvm:1.1.0
app.cash.turbine:turbine:1.1.0
co.touchlab:kermit-android-debug:2.0.4
Expand All @@ -139,7 +141,12 @@ co.touchlab:stately-concurrent-collections-jvm:2.1.0
co.touchlab:stately-concurrent-collections:2.1.0
co.touchlab:stately-strict-jvm:2.1.0
co.touchlab:stately-strict:2.1.0
com.arkivanov.essenty:back-handler-android:2.1.0
com.arkivanov.essenty:back-handler:2.1.0
com.arkivanov.essenty:utils-internal-android:2.1.0
com.arkivanov.essenty:utils-internal:2.1.0
com.caverock:androidsvg-aar:1.4
com.google.accompanist:accompanist-drawablepainter:0.36.0
com.google.accompanist:accompanist-pager:0.34.0
com.google.accompanist:accompanist-permissions:0.34.0
com.google.android.gms:play-services-ads-identifier:18.0.0
Expand Down Expand Up @@ -193,8 +200,12 @@ com.squareup.okio:okio-jvm:3.9.1
com.squareup.okio:okio:3.9.1
com.squareup.retrofit2:converter-gson:2.11.0
com.squareup.retrofit2:retrofit:2.11.0
dev.chrisbanes.material3:material3-window-size-class-multiplatform-android:0.5.0
dev.chrisbanes.material3:material3-window-size-class-multiplatform:0.5.0
dev.chrisbanes.snapper:snapper:0.2.2
io.coil-kt.coil3:coil-android:3.0.4
io.coil-kt.coil3:coil-compose-core-android:3.0.4
io.coil-kt.coil3:coil-compose-core:3.0.4
io.coil-kt.coil3:coil-core-android:3.0.4
io.coil-kt.coil3:coil-core:3.0.4
io.coil-kt.coil3:coil-network-core-android:3.0.4
Expand Down Expand Up @@ -255,10 +266,15 @@ org.jetbrains.compose.animation:animation-core:1.7.0-rc01
org.jetbrains.compose.animation:animation:1.7.0-rc01
org.jetbrains.compose.annotation-internal:annotation:1.7.3
org.jetbrains.compose.collection-internal:collection:1.7.3
org.jetbrains.compose.components:components-resources-android:1.7.0-rc01
org.jetbrains.compose.components:components-resources:1.7.0-rc01
org.jetbrains.compose.components:components-ui-tooling-preview-android:1.7.0-rc01
org.jetbrains.compose.components:components-ui-tooling-preview:1.7.0-rc01
org.jetbrains.compose.foundation:foundation-layout:1.7.0-rc01
org.jetbrains.compose.foundation:foundation:1.7.0-rc01
org.jetbrains.compose.material3:material3:1.7.0-rc01
org.jetbrains.compose.material:material-icons-core:1.7.0-rc01
org.jetbrains.compose.material:material-icons-extended:1.7.0-rc01
org.jetbrains.compose.material:material-ripple:1.7.0-rc01
org.jetbrains.compose.material:material:1.7.0-rc01
org.jetbrains.compose.runtime:runtime-saveable:1.7.0-rc01
Expand All @@ -272,7 +288,6 @@ org.jetbrains.compose.ui:ui-util:1.7.0-rc01
org.jetbrains.compose.ui:ui:1.7.0-rc01
org.jetbrains.kotlin:kotlin-android-extensions-runtime:2.1.0
org.jetbrains.kotlin:kotlin-parcelize-runtime:2.1.0
org.jetbrains.kotlin:kotlin-stdlib-common:2.1.0
org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.9.23
org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.22
org.jetbrains.kotlin:kotlin-stdlib:2.1.0
Expand Down
17 changes: 16 additions & 1 deletion androidApp/dependencies/demoReleaseRuntimeClasspath.txt
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ androidx.vectordrawable:vectordrawable-animated:1.1.0
androidx.vectordrawable:vectordrawable:1.1.0
androidx.versionedparcelable:versionedparcelable:1.1.1
androidx.viewpager:viewpager:1.0.0
androidx.window.extensions.core:core:1.0.0
androidx.window:window:1.2.0
app.cash.turbine:turbine-jvm:1.1.0
app.cash.turbine:turbine:1.1.0
co.touchlab:kermit-android:2.0.4
Expand All @@ -134,7 +136,12 @@ co.touchlab:stately-concurrent-collections-jvm:2.1.0
co.touchlab:stately-concurrent-collections:2.1.0
co.touchlab:stately-strict-jvm:2.1.0
co.touchlab:stately-strict:2.1.0
com.arkivanov.essenty:back-handler-android:2.1.0
com.arkivanov.essenty:back-handler:2.1.0
com.arkivanov.essenty:utils-internal-android:2.1.0
com.arkivanov.essenty:utils-internal:2.1.0
com.caverock:androidsvg-aar:1.4
com.google.accompanist:accompanist-drawablepainter:0.36.0
com.google.accompanist:accompanist-pager:0.34.0
com.google.accompanist:accompanist-permissions:0.34.0
com.google.android.gms:play-services-ads-identifier:18.0.0
Expand Down Expand Up @@ -188,8 +195,12 @@ com.squareup.okio:okio-jvm:3.9.1
com.squareup.okio:okio:3.9.1
com.squareup.retrofit2:converter-gson:2.11.0
com.squareup.retrofit2:retrofit:2.11.0
dev.chrisbanes.material3:material3-window-size-class-multiplatform-android:0.5.0
dev.chrisbanes.material3:material3-window-size-class-multiplatform:0.5.0
dev.chrisbanes.snapper:snapper:0.2.2
io.coil-kt.coil3:coil-android:3.0.4
io.coil-kt.coil3:coil-compose-core-android:3.0.4
io.coil-kt.coil3:coil-compose-core:3.0.4
io.coil-kt.coil3:coil-core-android:3.0.4
io.coil-kt.coil3:coil-core:3.0.4
io.coil-kt.coil3:coil-network-core-android:3.0.4
Expand Down Expand Up @@ -250,10 +261,15 @@ org.jetbrains.compose.animation:animation-core:1.7.0-rc01
org.jetbrains.compose.animation:animation:1.7.0-rc01
org.jetbrains.compose.annotation-internal:annotation:1.7.3
org.jetbrains.compose.collection-internal:collection:1.7.3
org.jetbrains.compose.components:components-resources-android:1.7.0-rc01
org.jetbrains.compose.components:components-resources:1.7.0-rc01
org.jetbrains.compose.components:components-ui-tooling-preview-android:1.7.0-rc01
org.jetbrains.compose.components:components-ui-tooling-preview:1.7.0-rc01
org.jetbrains.compose.foundation:foundation-layout:1.7.0-rc01
org.jetbrains.compose.foundation:foundation:1.7.0-rc01
org.jetbrains.compose.material3:material3:1.7.0-rc01
org.jetbrains.compose.material:material-icons-core:1.7.0-rc01
org.jetbrains.compose.material:material-icons-extended:1.7.0-rc01
org.jetbrains.compose.material:material-ripple:1.7.0-rc01
org.jetbrains.compose.material:material:1.7.0-rc01
org.jetbrains.compose.runtime:runtime-saveable:1.7.0-rc01
Expand All @@ -267,7 +283,6 @@ org.jetbrains.compose.ui:ui-util:1.7.0-rc01
org.jetbrains.compose.ui:ui:1.7.0-rc01
org.jetbrains.kotlin:kotlin-android-extensions-runtime:2.1.0
org.jetbrains.kotlin:kotlin-parcelize-runtime:2.1.0
org.jetbrains.kotlin:kotlin-stdlib-common:2.1.0
org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.9.23
org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.22
org.jetbrains.kotlin:kotlin-stdlib:2.1.0
Expand Down
17 changes: 16 additions & 1 deletion androidApp/dependencies/prodDebugRuntimeClasspath.txt
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ androidx.vectordrawable:vectordrawable-animated:1.1.0
androidx.vectordrawable:vectordrawable:1.1.0
androidx.versionedparcelable:versionedparcelable:1.1.1
androidx.viewpager:viewpager:1.0.0
androidx.window.extensions.core:core:1.0.0
androidx.window:window:1.2.0
app.cash.turbine:turbine-jvm:1.1.0
app.cash.turbine:turbine:1.1.0
co.touchlab:kermit-android-debug:2.0.4
Expand All @@ -139,7 +141,12 @@ co.touchlab:stately-concurrent-collections-jvm:2.1.0
co.touchlab:stately-concurrent-collections:2.1.0
co.touchlab:stately-strict-jvm:2.1.0
co.touchlab:stately-strict:2.1.0
com.arkivanov.essenty:back-handler-android:2.1.0
com.arkivanov.essenty:back-handler:2.1.0
com.arkivanov.essenty:utils-internal-android:2.1.0
com.arkivanov.essenty:utils-internal:2.1.0
com.caverock:androidsvg-aar:1.4
com.google.accompanist:accompanist-drawablepainter:0.36.0
com.google.accompanist:accompanist-pager:0.34.0
com.google.accompanist:accompanist-permissions:0.34.0
com.google.android.gms:play-services-ads-identifier:18.0.0
Expand Down Expand Up @@ -193,8 +200,12 @@ com.squareup.okio:okio-jvm:3.9.1
com.squareup.okio:okio:3.9.1
com.squareup.retrofit2:converter-gson:2.11.0
com.squareup.retrofit2:retrofit:2.11.0
dev.chrisbanes.material3:material3-window-size-class-multiplatform-android:0.5.0
dev.chrisbanes.material3:material3-window-size-class-multiplatform:0.5.0
dev.chrisbanes.snapper:snapper:0.2.2
io.coil-kt.coil3:coil-android:3.0.4
io.coil-kt.coil3:coil-compose-core-android:3.0.4
io.coil-kt.coil3:coil-compose-core:3.0.4
io.coil-kt.coil3:coil-core-android:3.0.4
io.coil-kt.coil3:coil-core:3.0.4
io.coil-kt.coil3:coil-network-core-android:3.0.4
Expand Down Expand Up @@ -255,10 +266,15 @@ org.jetbrains.compose.animation:animation-core:1.7.0-rc01
org.jetbrains.compose.animation:animation:1.7.0-rc01
org.jetbrains.compose.annotation-internal:annotation:1.7.3
org.jetbrains.compose.collection-internal:collection:1.7.3
org.jetbrains.compose.components:components-resources-android:1.7.0-rc01
org.jetbrains.compose.components:components-resources:1.7.0-rc01
org.jetbrains.compose.components:components-ui-tooling-preview-android:1.7.0-rc01
org.jetbrains.compose.components:components-ui-tooling-preview:1.7.0-rc01
org.jetbrains.compose.foundation:foundation-layout:1.7.0-rc01
org.jetbrains.compose.foundation:foundation:1.7.0-rc01
org.jetbrains.compose.material3:material3:1.7.0-rc01
org.jetbrains.compose.material:material-icons-core:1.7.0-rc01
org.jetbrains.compose.material:material-icons-extended:1.7.0-rc01
org.jetbrains.compose.material:material-ripple:1.7.0-rc01
org.jetbrains.compose.material:material:1.7.0-rc01
org.jetbrains.compose.runtime:runtime-saveable:1.7.0-rc01
Expand All @@ -272,7 +288,6 @@ org.jetbrains.compose.ui:ui-util:1.7.0-rc01
org.jetbrains.compose.ui:ui:1.7.0-rc01
org.jetbrains.kotlin:kotlin-android-extensions-runtime:2.1.0
org.jetbrains.kotlin:kotlin-parcelize-runtime:2.1.0
org.jetbrains.kotlin:kotlin-stdlib-common:2.1.0
org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.9.23
org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.22
org.jetbrains.kotlin:kotlin-stdlib:2.1.0
Expand Down
17 changes: 16 additions & 1 deletion androidApp/dependencies/prodReleaseRuntimeClasspath.txt
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ androidx.vectordrawable:vectordrawable-animated:1.1.0
androidx.vectordrawable:vectordrawable:1.1.0
androidx.versionedparcelable:versionedparcelable:1.1.1
androidx.viewpager:viewpager:1.0.0
androidx.window.extensions.core:core:1.0.0
androidx.window:window:1.2.0
app.cash.turbine:turbine-jvm:1.1.0
app.cash.turbine:turbine:1.1.0
co.touchlab:kermit-android:2.0.4
Expand All @@ -134,7 +136,12 @@ co.touchlab:stately-concurrent-collections-jvm:2.1.0
co.touchlab:stately-concurrent-collections:2.1.0
co.touchlab:stately-strict-jvm:2.1.0
co.touchlab:stately-strict:2.1.0
com.arkivanov.essenty:back-handler-android:2.1.0
com.arkivanov.essenty:back-handler:2.1.0
com.arkivanov.essenty:utils-internal-android:2.1.0
com.arkivanov.essenty:utils-internal:2.1.0
com.caverock:androidsvg-aar:1.4
com.google.accompanist:accompanist-drawablepainter:0.36.0
com.google.accompanist:accompanist-pager:0.34.0
com.google.accompanist:accompanist-permissions:0.34.0
com.google.android.gms:play-services-ads-identifier:18.0.0
Expand Down Expand Up @@ -188,8 +195,12 @@ com.squareup.okio:okio-jvm:3.9.1
com.squareup.okio:okio:3.9.1
com.squareup.retrofit2:converter-gson:2.11.0
com.squareup.retrofit2:retrofit:2.11.0
dev.chrisbanes.material3:material3-window-size-class-multiplatform-android:0.5.0
dev.chrisbanes.material3:material3-window-size-class-multiplatform:0.5.0
dev.chrisbanes.snapper:snapper:0.2.2
io.coil-kt.coil3:coil-android:3.0.4
io.coil-kt.coil3:coil-compose-core-android:3.0.4
io.coil-kt.coil3:coil-compose-core:3.0.4
io.coil-kt.coil3:coil-core-android:3.0.4
io.coil-kt.coil3:coil-core:3.0.4
io.coil-kt.coil3:coil-network-core-android:3.0.4
Expand Down Expand Up @@ -250,10 +261,15 @@ org.jetbrains.compose.animation:animation-core:1.7.0-rc01
org.jetbrains.compose.animation:animation:1.7.0-rc01
org.jetbrains.compose.annotation-internal:annotation:1.7.3
org.jetbrains.compose.collection-internal:collection:1.7.3
org.jetbrains.compose.components:components-resources-android:1.7.0-rc01
org.jetbrains.compose.components:components-resources:1.7.0-rc01
org.jetbrains.compose.components:components-ui-tooling-preview-android:1.7.0-rc01
org.jetbrains.compose.components:components-ui-tooling-preview:1.7.0-rc01
org.jetbrains.compose.foundation:foundation-layout:1.7.0-rc01
org.jetbrains.compose.foundation:foundation:1.7.0-rc01
org.jetbrains.compose.material3:material3:1.7.0-rc01
org.jetbrains.compose.material:material-icons-core:1.7.0-rc01
org.jetbrains.compose.material:material-icons-extended:1.7.0-rc01
org.jetbrains.compose.material:material-ripple:1.7.0-rc01
org.jetbrains.compose.material:material:1.7.0-rc01
org.jetbrains.compose.runtime:runtime-saveable:1.7.0-rc01
Expand All @@ -267,7 +283,6 @@ org.jetbrains.compose.ui:ui-util:1.7.0-rc01
org.jetbrains.compose.ui:ui:1.7.0-rc01
org.jetbrains.kotlin:kotlin-android-extensions-runtime:2.1.0
org.jetbrains.kotlin:kotlin-parcelize-runtime:2.1.0
org.jetbrains.kotlin:kotlin-stdlib-common:2.1.0
org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.9.23
org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.22
org.jetbrains.kotlin:kotlin-stdlib:2.1.0
Expand Down
61 changes: 46 additions & 15 deletions core/designsystem/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
* See https://github.com/openMF/mobile-mobile/blob/master/LICENSE.md
*/
plugins {
alias(libs.plugins.mifos.android.library)
alias(libs.plugins.mifos.android.library.compose)
alias(libs.plugins.mifos.kmp.library)
alias(libs.plugins.jetbrainsCompose)
alias(libs.plugins.compose.compiler)
alias(libs.plugins.roborazzi)
}

android {
Expand All @@ -19,19 +21,48 @@ android {
namespace = "org.mifos.mobile.core.designsystem"
}

dependencies {
api(libs.androidx.compose.ui)
api(libs.androidx.compose.foundation)
api(libs.androidx.compose.foundation.layout)
api(libs.androidx.compose.material.iconsExtended)
api(libs.androidx.compose.material3)
api(libs.androidx.compose.runtime)
api(libs.androidx.compose.ui.util)
api(libs.androidx.activity.compose)
kotlin {
sourceSets {
androidMain.dependencies {
implementation(libs.androidx.compose.ui.tooling.preview)
implementation(libs.androidx.activity.compose)
implementation(projects.core.model)
}
androidInstrumentedTest.dependencies {
implementation(libs.androidx.compose.ui.test)
}
androidUnitTest.dependencies {
implementation(libs.androidx.compose.ui.test)
}
commonMain.dependencies {
implementation(libs.coil.kt.compose)
implementation(compose.runtime)
implementation(compose.foundation)
implementation(compose.material3)
implementation(compose.materialIconsExtended)
implementation(compose.ui)
implementation(compose.uiUtil)
implementation(compose.components.resources)
implementation(compose.components.uiToolingPreview)
api(libs.back.handler)
api(libs.window.size)
}

// Accompanist Pager Library
implementation(libs.accompanist.pager)
nativeMain.dependencies {
implementation(compose.runtime)
}

testImplementation(libs.androidx.compose.ui.test)
androidTestImplementation(libs.androidx.compose.ui.test)
jsMain.dependencies {
implementation(compose.runtime)
}

wasmJsMain.dependencies {
implementation(compose.runtime)
}
}
}

compose.resources {
publicResClass = true
generateResClass = always
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* 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.designsystem.theme

import android.os.Build
import androidx.compose.material3.ColorScheme
import androidx.compose.material3.dynamicDarkColorScheme
import androidx.compose.material3.dynamicLightColorScheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.platform.LocalContext

@Composable
actual fun colorScheme(useDarkTheme: Boolean, dynamicColor: Boolean): ColorScheme {
return when {
dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> {
val context = LocalContext.current
if (useDarkTheme) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context)
}

useDarkTheme -> darkScheme
else -> lightScheme
}
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading

0 comments on commit e54baf1

Please sign in to comment.