diff --git a/android/build.gradle.kts b/android/build.gradle.kts index dad1854..aa2cd86 100644 --- a/android/build.gradle.kts +++ b/android/build.gradle.kts @@ -23,6 +23,7 @@ try { } android { + namespace = "com.wbrawner.twigs.android" compileSdk = libs.versions.maxSdk.get().toInt() defaultConfig { applicationId = "com.wbrawner.twigs" @@ -52,11 +53,11 @@ android { } } compileOptions { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 + sourceCompatibility = project.ext["jvm"] as JavaVersion + targetCompatibility = project.ext["jvm"] as JavaVersion } kotlinOptions { - jvmTarget = "1.8" + jvmTarget = (project.ext["jvm"] as JavaVersion).majorVersion } buildFeatures { compose = true diff --git a/android/src/androidTest/java/com/wbrawner/budget/ExampleInstrumentedTest.kt b/android/src/androidTest/java/com/wbrawner/twigs/ExampleInstrumentedTest.kt similarity index 95% rename from android/src/androidTest/java/com/wbrawner/budget/ExampleInstrumentedTest.kt rename to android/src/androidTest/java/com/wbrawner/twigs/ExampleInstrumentedTest.kt index 7b65272..9108309 100644 --- a/android/src/androidTest/java/com/wbrawner/budget/ExampleInstrumentedTest.kt +++ b/android/src/androidTest/java/com/wbrawner/twigs/ExampleInstrumentedTest.kt @@ -1,4 +1,4 @@ -package com.wbrawner.budget +package com.wbrawner.twigs import androidx.test.InstrumentationRegistry import androidx.test.runner.AndroidJUnit4 diff --git a/android/src/androidTest/java/com/wbrawner/budget/MigrationTests.java b/android/src/androidTest/java/com/wbrawner/twigs/MigrationTests.java similarity index 96% rename from android/src/androidTest/java/com/wbrawner/budget/MigrationTests.java rename to android/src/androidTest/java/com/wbrawner/twigs/MigrationTests.java index 6dd8e3a..d4d8823 100644 --- a/android/src/androidTest/java/com/wbrawner/budget/MigrationTests.java +++ b/android/src/androidTest/java/com/wbrawner/twigs/MigrationTests.java @@ -1,4 +1,8 @@ -package com.wbrawner.budget; +package com.wbrawner.twigs; + +import static junit.framework.Assert.assertNull; +import static junit.framework.TestCase.assertEquals; +import static junit.framework.TestCase.assertTrue; import android.arch.persistence.db.SupportSQLiteDatabase; import android.arch.persistence.db.framework.FrameworkSQLiteOpenHelperFactory; @@ -8,9 +12,9 @@ import android.database.Cursor; import androidx.test.InstrumentationRegistry; import androidx.test.runner.AndroidJUnit4; -import com.wbrawner.budget.data.BudgetDatabase; -import com.wbrawner.budget.data.migrations.MIGRATION_1_2; -import com.wbrawner.budget.data.migrations.MIGRATION_2_3; +import com.wbrawner.twigs.data.BudgetDatabase; +import com.wbrawner.twigs.data.migrations.MIGRATION_1_2; +import com.wbrawner.twigs.data.migrations.MIGRATION_2_3; import org.junit.Rule; import org.junit.Test; @@ -18,10 +22,6 @@ import org.junit.runner.RunWith; import java.io.IOException; -import static junit.framework.Assert.assertNull; -import static junit.framework.TestCase.assertEquals; -import static junit.framework.TestCase.assertTrue; - @RunWith(AndroidJUnit4.class) public class MigrationTests { private static final String TEST_DB = "migration-test"; diff --git a/android/src/main/AndroidManifest.xml b/android/src/main/AndroidManifest.xml index 7e3576b..3d0ad6f 100644 --- a/android/src/main/AndroidManifest.xml +++ b/android/src/main/AndroidManifest.xml @@ -1,7 +1,6 @@ + xmlns:tools="http://schemas.android.com/tools"> + android:targetPackage="com.wbrawner.twigs" + android:targetClass="com.wbrawner.twigs.ui.transactions.TransactionFormActivity"> diff --git a/android/src/test/java/com/wbrawner/myallowance/ExampleUnitTest.kt b/android/src/test/java/com/wbrawner/myallowance/ExampleUnitTest.kt index d3f7c39..002cb1f 100644 --- a/android/src/test/java/com/wbrawner/myallowance/ExampleUnitTest.kt +++ b/android/src/test/java/com/wbrawner/myallowance/ExampleUnitTest.kt @@ -1,9 +1,8 @@ -package com.wbrawner.budget +package com.wbrawner.twigs +import org.junit.Assert.assertEquals import org.junit.Test -import org.junit.Assert.* - /** * Example local unit test, which will execute on the development machine (host). * diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index bafe7b2..8668126 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,37 +1,36 @@ [versions] -androidx-core = "1.9.0" +androidx-core = "1.12.0" androidx-appcompat = "1.6.1" -androidx-splash = "1.0.0" +androidx-splash = "1.0.1" androidx-test-runner = "1.5.2" androidx-test-orchestrator = "1.4.2" -compose = "1.3.3" -compose-compiler = "1.4.3" -compose-material = "1.3.1" -compose-material3 = "1.1.0-alpha07" +compose = "1.6.3" +compose-compiler = "1.5.10" +compose-material = "1.6.3" +compose-material3 = "1.2.1" espresso = "3.5.1" -hilt-android = "2.44" -kotlin = "1.8.10" -kotlinx-serialization = "1.4.1" -kotlinx-coroutines = "1.6.4" -kotlinx-datetime = "0.4.0" -ktor = "2.2.3" -material = "1.8.0" -maxSdk = "33" +hilt-android = "2.49" +kotlin = "1.9.22" +kotlinx-serialization = "1.6.3" +kotlinx-coroutines = "1.8.0" +kotlinx-datetime = "0.5.0" +ktor = "2.3.4" +material = "1.11.0" +maxSdk = "34" minSdk = "26" -navigation = "2.5.3" -okhttp = "4.2.2" settings = "0.8.1" versionCode = "1" versionName = "1.0" [libraries] -android-gradle = { module = "com.android.tools.build:gradle", version = "7.4.2" } +android-gradle = { module = "com.android.tools.build:gradle", version = "8.3.0" } androidx-appcompat = { module = "androidx.appcompat:appcompat", version.ref = "androidx-appcompat" } androidx-core = { module = "androidx.core:core-ktx", version.ref = "androidx-core" } androidx-splash = { module = "androidx.core:core-splashscreen", version.ref = "androidx-splash" } androidx-test-runner = { module = "androidx.test:runner", version.ref = "androidx-test-runner" } androidx-test-orchestrator = { module = "androidx.test:orchestrator", version.ref = "androidx-test-orchestrator" } -compose-activity = { module = "androidx.activity:activity-compose", version = "1.6.1" } +compose-activity = { module = "androidx.activity:activity-compose", version = "1.8.2" } +compose-compiler = { module = "androidx.compose.compiler:compiler", version.ref = "compose-compiler" } compose-material = { module = "androidx.compose.material:material", version.ref = "compose-material" } compose-material-icons = { module = "androidx.compose.material:material-icons-extended", version.ref = "compose-material" } compose-material3 = { module = "androidx.compose.material3:material3", version.ref = "compose-material3" } @@ -45,7 +44,7 @@ espresso = { module = "androidx.test.espresso:espresso-core", version.ref = "esp hilt-android-core = { module = "com.google.dagger:hilt-android", version.ref = "hilt-android" } hilt-android-kapt = { module = "com.google.dagger:hilt-compiler", version.ref = "hilt-android" } hilt-android-testing = { module = "com.google.dagger:hilt-android-testing", version.ref = "hilt-android" } -hilt-navigation-compose = { module = "androidx.hilt:hilt-navigation-compose", version = "1.0.0" } +hilt-navigation-compose = { module = "androidx.hilt:hilt-navigation-compose", version = "1.2.0" } junit = { module = "junit:junit", version = "4.13.2" } kotlin-gradle = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" } kotlin-reflect = { module = "org.jetbrains.kotlin:kotlin-reflect", version.ref = "kotlin" } @@ -66,9 +65,7 @@ kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serializa material = { module = "com.google.android.material:material", version.ref = "material" } multiplatform-settings = { module = "com.russhwolf:multiplatform-settings-no-arg", version.ref = "settings" } navigation-compose = { module = "androidx.navigation:navigation-compose", version = "navigation" } -navigation-fragment = { module = "androidx.navigation:navigation-fragment-ktx", version.ref = "navigation" } -navigation-ui = { module = "androidx.navigation:navigation-ui-ktx", version.ref = "navigation" } -preference = { module = "androidx.preference:preference-ktx", version = "1.2.0" } +preference = { module = "androidx.preference:preference-ktx", version = "1.2.1" } test-ext = { module = "androidx.test.ext:junit", version = "1.1.5" } [bundles] diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index b457f8f..1f712c4 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-all.zip diff --git a/settings.gradle.kts b/settings.gradle.kts index c3fc1a4..da56724 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,3 +1,2 @@ -enableFeaturePreview("VERSION_CATALOGS") rootProject.name = "Twigs" include(":android", ":shared") diff --git a/shared/build.gradle.kts b/shared/build.gradle.kts index 85ba00e..a71840e 100644 --- a/shared/build.gradle.kts +++ b/shared/build.gradle.kts @@ -5,7 +5,7 @@ plugins { } kotlin { - android() + androidTarget() listOf(iosArm64(), iosSimulatorArm64()).forEach { it.binaries.framework { baseName = "Twigs" @@ -56,15 +56,15 @@ android { compileSdk = libs.versions.maxSdk.get().toInt() defaultConfig { minSdk = libs.versions.minSdk.get().toInt() - targetSdk = libs.versions.maxSdk.get().toInt() } compileOptions { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 + sourceCompatibility = project.ext["jvm"] as JavaVersion + targetCompatibility = project.ext["jvm"] as JavaVersion } buildTypes { release { consumerProguardFiles("proguard-rules.pro") } } + namespace = "com.wbrawner.twigs.android" } diff --git a/shared/proguard-rules.pro b/shared/proguard-rules.pro index a071319..59d5f1e 100644 --- a/shared/proguard-rules.pro +++ b/shared/proguard-rules.pro @@ -24,3 +24,5 @@ # @Serializable and @Polymorphic are used at runtime for polymorphic serialization. -keepattributes RuntimeVisibleAnnotations,AnnotationDefault + +-dontwarn org.slf4j.impl.StaticLoggerBinder \ No newline at end of file diff --git a/shared/src/androidMain/AndroidManifest.xml b/shared/src/androidMain/AndroidManifest.xml index 479380f..294dbaa 100644 --- a/shared/src/androidMain/AndroidManifest.xml +++ b/shared/src/androidMain/AndroidManifest.xml @@ -1,6 +1,5 @@ - + \ No newline at end of file diff --git a/shared/src/commonMain/kotlin/com/wbrawner/twigs/shared/Store.kt b/shared/src/commonMain/kotlin/com/wbrawner/twigs/shared/Store.kt index 3ab54e6..1761077 100644 --- a/shared/src/commonMain/kotlin/com/wbrawner/twigs/shared/Store.kt +++ b/shared/src/commonMain/kotlin/com/wbrawner/twigs/shared/Store.kt @@ -7,6 +7,7 @@ import com.wbrawner.twigs.shared.transaction.Transaction import com.wbrawner.twigs.shared.user.User import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.IO import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.MutableSharedFlow import kotlinx.coroutines.flow.MutableStateFlow @@ -84,7 +85,7 @@ abstract class Reducer : CoroutineScope by CoroutineScope(Dispatchers.Main) { class Store( private val reducers: List, initialState: State = State() -) : CoroutineScope by CoroutineScope(Dispatchers.Main) { +) : CoroutineScope by CoroutineScope(Dispatchers.IO) { private val _state = MutableStateFlow(initialState) val state: StateFlow = _state private val _effects = MutableSharedFlow() @@ -112,7 +113,6 @@ class Store( } fun dispatch(action: Action) { - println(action) launch { var newState = _state.value reducers.forEach {