Skip to content

Commit 1dc80bc

Browse files
Fix library (#51)
* Update dependencies and add multiplatform sample modules * Updated Gradle wrapper and various library versions in `libs.versions.toml`, including AGP to 8.12.3, Kotlin to 2.3.0, and Compose Multiplatform to 1.10.0. * Increased `minSdk` to 26 for Android. * Added new sample modules for Android, iOS, Desktop, Web, and Shared (`cmp-sample-*`) to the project. * Included resource files (strings, drawables) and basic configurations for the new sample modules. * Updated `settings.gradle.kts` to include the new sample modules and adjusted repository settings. * Removed `@Preview` annotation from `PasscodeScreen.kt`. * Refactor sample modules and enhance passcode component customizability * Updated dependencies in `libs.versions.toml` to include Compose Multiplatform 1.10.0 components, Material3, and UI tooling libraries. * Migrated the sample application to a multi-module structure, moving shared logic to `cmp-sample-shared` and platform-specific code to `cmp-sample-android`, `cmp-sample-ios`, and `cmp-sample-desktop`. * Updated project-wide `build.gradle.kts` files to use `android.kotlin.multiplatform.library` plugin and consolidated Android configurations within `kotlin { androidLibrary { ... } }` blocks. * Refactored `PasscodeScreen` and its sub-components (`PasscodeKeys`, `PasscodeLengthSwitch`, `PasscodeStepIndicator`, etc.) to support extensive UI customization via new parameters for colors, shapes, typography, and dimensions. * Renamed `PasscodeKeyButtonStyle` to `passcodeKeyButtonStyle` in the design system to follow standard naming conventions. * Updated package names across the sample modules to reflect the new directory structure (`cmp.sample.shared.*` and `cmp.sample.android.*`). * Added adaptive launcher icons and standard Android resources to the `cmp-sample-android` module. * Removed the unused `ic_delete.xml` resource. * Refactor PasscodeLengthSwitch component layout * Reordered the "6 digits" button within `PasscodeLengthSwitch.kt` to appear before the `AnimatedContent` block for better structural alignment. * Update PasscodeKeys layout styling * Added `2.dp` padding to `keyModifier` for uniform spacing between keys. * Simplified the modifier for the visibility toggle key to use the shared `keyModifier`, ensuring consistent sizing and alignment with other keys in the grid. * Update PasscodeKeys layout styling * Added `2.dp` padding to `keyModifier` for uniform spacing between keys. * Simplified the modifier for the visibility toggle key to use the shared `keyModifier`, ensuring consistent sizing and alignment with other keys in the grid. * Configure multiplatform sample modules and update JS dependencies * Refactored sample modules by moving source files to `cmp-sample-web`, `cmp-sample-ios`, and `cmp-sample-desktop`. * Added a complete iOS Xcode project configuration under `cmp-sample-ios/iosApp`, including assets, info plists, and Swift entry points. * Updated `settings.gradle.kts` to replace the old `:sample:composeApp` with new platform-specific sample modules. * Updated `kotlin-js-store/yarn.lock` with numerous dependency updates, including Webpack, Mocha, and various library versions. * Configured `build.gradle.kts` for desktop, web (JS/Wasm), and iOS samples with appropriate targets and dependencies. * Increased JVM heap size limits for Kotlin daemon and Gradle in `gradle.properties`. * Added IntelliJ run configurations for Desktop and Web (JS/Wasm) samples. * Adjusted package names across sample modules to reflect the new project structure. * Configure multiplatform sample modules and update JS dependencies * Refactored sample modules by moving source files to `cmp-sample-web`, `cmp-sample-ios`, and `cmp-sample-desktop`. * Added a complete iOS Xcode project configuration under `cmp-sample-ios/iosApp`, including assets, info plists, and Swift entry points. * Updated `settings.gradle.kts` to replace the old `:sample:composeApp` with new platform-specific sample modules. * Updated `kotlin-js-store/yarn.lock` with numerous dependency updates, including Webpack, Mocha, and various library versions. * Configured `build.gradle.kts` for desktop, web (JS/Wasm), and iOS samples with appropriate targets and dependencies. * Increased JVM heap size limits for Kotlin daemon and Gradle in `gradle.properties`. * Added IntelliJ run configurations for Desktop and Web (JS/Wasm) samples. * Adjusted package names across sample modules to reflect the new project structure.
1 parent abc62d3 commit 1dc80bc

94 files changed

Lines changed: 2496 additions & 852 deletions

File tree

Some content is hidden

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

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ captures
99
local.properties
1010
xcuserdata
1111
.kotlin
12-
gradle.properties
12+
#gradle.properties
1313
#So we don't accidentally commit our private keys
14-
*.gpg
14+
*.gpg
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<component name="ProjectRunConfigurationManager">
2+
<configuration default="false" name="cmp-sample-desktop [desktop]" type="GradleRunConfiguration" factoryName="Gradle">
3+
<ExternalSystemSettings>
4+
<option name="executionName" />
5+
<option name="externalProjectPath" value="$PROJECT_DIR$/cmp-sample-desktop" />
6+
<option name="externalSystemIdString" value="GRADLE" />
7+
<option name="scriptParameters" value="-DmainClass=cmp.sample.desktop.MainKt --quiet" />
8+
<option name="taskDescriptions">
9+
<list />
10+
</option>
11+
<option name="taskNames">
12+
<list>
13+
<option value="desktopRun" />
14+
</list>
15+
</option>
16+
<option name="vmOptions" />
17+
</ExternalSystemSettings>
18+
<ExternalSystemDebugServerProcess>false</ExternalSystemDebugServerProcess>
19+
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
20+
<ExternalSystemDebugDisabled>false</ExternalSystemDebugDisabled>
21+
<EXTENSION ID="com.android.tools.idea.testartifacts.testsuite.GradleRunConfigurationExtension">
22+
<com.android.tools.idea.testartifacts.testsuite.SHOW_TEST_RESULT_IN_ANDROID_TEST_SUITE_VIEW>false</com.android.tools.idea.testartifacts.testsuite.SHOW_TEST_RESULT_IN_ANDROID_TEST_SUITE_VIEW>
23+
<android.execution.deploysToLocalDevice>false</android.execution.deploysToLocalDevice>
24+
</EXTENSION>
25+
<DebugAllEnabled>false</DebugAllEnabled>
26+
<RunAsTest>false</RunAsTest>
27+
<GradleProfilingDisabled>false</GradleProfilingDisabled>
28+
<GradleCoverageDisabled>false</GradleCoverageDisabled>
29+
<method v="2" />
30+
</configuration>
31+
</component>
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<component name="ProjectRunConfigurationManager">
2+
<configuration default="false" name="cmp-sample-sample [js]" type="GradleRunConfiguration" factoryName="Gradle">
3+
<ExternalSystemSettings>
4+
<option name="executionName" />
5+
<option name="externalProjectPath" value="$PROJECT_DIR$/cmp-sample-web" />
6+
<option name="externalSystemIdString" value="GRADLE" />
7+
<option name="scriptParameters" value="" />
8+
<option name="taskDescriptions">
9+
<list />
10+
</option>
11+
<option name="taskNames">
12+
<list>
13+
<option value="jsBrowserDevelopmentRun" />
14+
</list>
15+
</option>
16+
<option name="vmOptions" />
17+
</ExternalSystemSettings>
18+
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
19+
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
20+
<ExternalSystemDebugDisabled>false</ExternalSystemDebugDisabled>
21+
<EXTENSION ID="com.android.tools.idea.testartifacts.testsuite.GradleRunConfigurationExtension">
22+
<com.android.tools.idea.testartifacts.testsuite.SHOW_TEST_RESULT_IN_ANDROID_TEST_SUITE_VIEW>false</com.android.tools.idea.testartifacts.testsuite.SHOW_TEST_RESULT_IN_ANDROID_TEST_SUITE_VIEW>
23+
<android.execution.deploysToLocalDevice>false</android.execution.deploysToLocalDevice>
24+
</EXTENSION>
25+
<DebugAllEnabled>false</DebugAllEnabled>
26+
<RunAsTest>false</RunAsTest>
27+
<GradleProfilingDisabled>true</GradleProfilingDisabled>
28+
<GradleCoverageDisabled>true</GradleCoverageDisabled>
29+
<method v="2" />
30+
</configuration>
31+
</component>
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<component name="ProjectRunConfigurationManager">
2+
<configuration default="false" name="cmp-sample-wasmJs [wasmJs]" type="GradleRunConfiguration" factoryName="Gradle">
3+
<ExternalSystemSettings>
4+
<option name="executionName" />
5+
<option name="externalProjectPath" value="$PROJECT_DIR$/cmp-sample-web" />
6+
<option name="externalSystemIdString" value="GRADLE" />
7+
<option name="scriptParameters" value="" />
8+
<option name="taskDescriptions">
9+
<list />
10+
</option>
11+
<option name="taskNames">
12+
<list>
13+
<option value="wasmJsBrowserDevelopmentRun" />
14+
</list>
15+
</option>
16+
<option name="vmOptions" />
17+
</ExternalSystemSettings>
18+
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
19+
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
20+
<ExternalSystemDebugDisabled>false</ExternalSystemDebugDisabled>
21+
<EXTENSION ID="com.android.tools.idea.testartifacts.testsuite.GradleRunConfigurationExtension">
22+
<com.android.tools.idea.testartifacts.testsuite.SHOW_TEST_RESULT_IN_ANDROID_TEST_SUITE_VIEW>false</com.android.tools.idea.testartifacts.testsuite.SHOW_TEST_RESULT_IN_ANDROID_TEST_SUITE_VIEW>
23+
<android.execution.deploysToLocalDevice>false</android.execution.deploysToLocalDevice>
24+
</EXTENSION>
25+
<DebugAllEnabled>false</DebugAllEnabled>
26+
<RunAsTest>false</RunAsTest>
27+
<GradleProfilingDisabled>true</GradleProfilingDisabled>
28+
<GradleCoverageDisabled>true</GradleCoverageDisabled>
29+
<method v="2" />
30+
</configuration>
31+
</component>

build.gradle.kts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
plugins {
22
alias(libs.plugins.androidApplication) apply false
3-
alias(libs.plugins.androidLibrary) apply false
3+
alias(libs.plugins.android.kotlin.multiplatform.library) apply false
44
alias(libs.plugins.kotlinMultiplatform) apply false
55
alias(libs.plugins.composeMultiplatform) apply false
66
alias(libs.plugins.compose.compiler) apply false
77
alias(libs.plugins.vanniktech.mavenPublish) apply false
88
alias(libs.plugins.android.lint) apply false
9+
alias(libs.plugins.kotlin.android) apply false
910
}

cmp-sample-android/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
2+
3+
plugins {
4+
alias(libs.plugins.androidApplication)
5+
alias(libs.plugins.kotlin.android)
6+
alias(libs.plugins.compose.compiler)
7+
}
8+
9+
android {
10+
namespace = "cmp.sample.android"
11+
compileSdk {
12+
version = release(36)
13+
}
14+
15+
defaultConfig {
16+
minSdk = 26
17+
18+
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
19+
}
20+
21+
buildFeatures {
22+
compose = true
23+
}
24+
25+
compileOptions {
26+
sourceCompatibility = JavaVersion.VERSION_17
27+
targetCompatibility = JavaVersion.VERSION_17
28+
}
29+
30+
31+
32+
}
33+
34+
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
35+
compilerOptions {
36+
jvmTarget.set(JvmTarget.JVM_17)
37+
}
38+
}
39+
40+
dependencies {
41+
implementation(projects.cmpSampleShared)
42+
43+
implementation(libs.androidx.core.ktx)
44+
implementation(libs.androidx.appcompat)
45+
implementation(libs.material)
46+
testImplementation(libs.junit)
47+
androidTestImplementation(libs.androidx.junit)
48+
androidTestImplementation(libs.androidx.espresso.core)
49+
50+
implementation(libs.ui.tooling.preview)
51+
implementation(libs.androidx.activity.compose)
52+
//
53+
// implementation(libs.koin.android)
54+
// implementation(libs.koin.androidx.compose)
55+
56+
}

cmp-sample-android/consumer-rules.pro

Whitespace-only changes.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package cmp.sample.android
2+
3+
import androidx.test.platform.app.InstrumentationRegistry
4+
import androidx.test.ext.junit.runners.AndroidJUnit4
5+
6+
import org.junit.Test
7+
import org.junit.runner.RunWith
8+
9+
import org.junit.Assert.*
10+
11+
/**
12+
* Instrumented test, which will execute on an Android device.
13+
*
14+
* See [testing documentation](http://d.android.com/tools/testing).
15+
*/
16+
@RunWith(AndroidJUnit4::class)
17+
class ExampleInstrumentedTest {
18+
@Test
19+
fun useAppContext() {
20+
// Context of the app under test.
21+
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
22+
assertEquals("cmp.sample.android.test", appContext.packageName)
23+
}
24+
}

0 commit comments

Comments
 (0)