Skip to content

Commit

Permalink
Bump up all the versions to latest and refactor when required (#313)
Browse files Browse the repository at this point in the history
  • Loading branch information
findjigar authored Jan 30, 2024
1 parent 5851657 commit cf61e26
Show file tree
Hide file tree
Showing 32 changed files with 222 additions and 178 deletions.
4 changes: 3 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
# noinspection EditorConfigKeyCorrectness
[*.{kt,kts}]
ktlint_code_style = android_studio
ktlint_code_style = android_studio
ktlint_function_naming_ignore_when_annotated_with=Composable
6 changes: 3 additions & 3 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion CONTACT_US.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ To join the Kotlin Community Slack, [request access here](http://slack.kotlinlan
For direct assistance, please [reach out to Touchlab](https://go.touchlab.co/contactkamp) to discuss support options.

If you find any bugs or issues in with project, you can create an issue in
the [GitHub repository](https://github.com/touchlab/KaMPKit), but please don't mistake it with general KMM helpline. You
the [GitHub repository](https://github.com/touchlab/KaMPKit), but please don't mistake it with general KMP helpline. You
can get answers for general questions in Slack.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

KaMP Kit started in early 2020 with the goal of helping developers interested in Kotlin Multiplatform (aka KMP) get started
quickly with a great set of libraries and patterns. At the time, there were not many sample apps and getting started
was not trivial. The KMM situation has improved considerably since then, and various barriers to entry have been
was not trivial. The KMP situation has improved considerably since then, and various barriers to entry have been
removed.

Whereas KaMP Kit started with the goal of being a minimal sample, we now intend it to be less "getting started" and
Expand All @@ -23,8 +23,8 @@ We updated `KaMPKit` to make sure of Touchlab's new [SKIE](https://skie.touchlab

> ## Subscribe!
>
> We build solutions that get teams started smoothly with Kotlin Multiplatform and ensure their success in production. Join our community to learn how your peers are adopting KMM.
[Sign up here](https://go.touchlab.co/newsletter-gh)!
> We build solutions that get teams started smoothly with Kotlin Multiplatform and ensure their success in production. Join our community to learn how your peers are adopting KMP.
[Sign up here](https://form.typeform.com/to/MJTpmm?typeform-source=touchlab.co)!

## Getting Help

Expand All @@ -47,7 +47,7 @@ KaMP Kit is designed to get you past that primary stumbling block. You should be

#### *Very Important Message!!!*

This kit exists because the info you may find from Google about KMM and KMP is likely to be outdated or conflicting with the config here. It is highly recommended that you reach out directly if you run into issues.
This kit exists because the info you may find from Google about KMP is likely to be outdated or conflicting with the config here. It is highly recommended that you reach out directly if you run into issues.

### Audience

Expand Down
4 changes: 2 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id("com.android.application")
kotlin("android")
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
}

android {
Expand Down
5 changes: 4 additions & 1 deletion app/src/main/kotlin/co/touchlab/kampkit/android/MainApp.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ class MainApp : Application() {
single<Context> { this@MainApp }
viewModel { BreedViewModel(get(), get { parametersOf("BreedViewModel") }) }
single<SharedPreferences> {
get<Context>().getSharedPreferences("KAMPSTARTER_SETTINGS", Context.MODE_PRIVATE)
get<Context>().getSharedPreferences(
"KAMPSTARTER_SETTINGS",
Context.MODE_PRIVATE
)
}
single<AppInfo> { AndroidAppInfo }
single {
Expand Down
19 changes: 9 additions & 10 deletions app/src/main/kotlin/co/touchlab/kampkit/android/ui/Composables.kt
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,7 @@ import co.touchlab.kermit.Logger
import kotlinx.coroutines.launch

@Composable
fun MainScreen(
viewModel: BreedViewModel,
log: Logger
) {
fun MainScreen(viewModel: BreedViewModel, log: Logger) {
val dogsState by viewModel.breedState.collectAsStateWithLifecycle()
val scope = rememberCoroutineScope()

Expand Down Expand Up @@ -97,7 +94,11 @@ fun MainScreenContent(
}
}

PullRefreshIndicator(dogsState.isLoading, refreshState, Modifier.align(Alignment.TopCenter))
PullRefreshIndicator(
dogsState.isLoading,
refreshState,
Modifier.align(Alignment.TopCenter)
)
}
}
}
Expand Down Expand Up @@ -129,10 +130,7 @@ fun Error(error: String) {
}

@Composable
fun Success(
successData: List<Breed>,
favoriteBreed: (Breed) -> Unit
) {
fun Success(successData: List<Breed>, favoriteBreed: (Breed) -> Unit) {
DogList(breeds = successData, favoriteBreed)
}

Expand Down Expand Up @@ -167,7 +165,8 @@ fun FavoriteIcon(breed: Breed) {
animationSpec = TweenSpec(
durationMillis = 500,
easing = FastOutSlowInEasing
)
),
label = "CrossFadeFavoriteIcon"
) { fav ->
if (fav) {
Image(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,7 @@ private val LightColorPalette = lightColors(
)

@Composable
fun KaMPKitTheme(
darkTheme: Boolean = isSystemInDarkTheme(),
content: @Composable () -> Unit
) {
fun KaMPKitTheme(darkTheme: Boolean = isSystemInDarkTheme(), content: @Composable () -> Unit) {
val colors = if (darkTheme) {
DarkColorPalette
} else {
Expand Down
14 changes: 5 additions & 9 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,24 +1,20 @@
plugins {
alias(libs.plugins.ktlint) apply false
alias(libs.plugins.kotlin.android) apply false
alias(libs.plugins.kotlin.multiplatform) apply false
alias(libs.plugins.sqlDelight) apply false
alias(libs.plugins.android.library) apply false
alias(libs.plugins.android.application) apply false
alias(libs.plugins.kotlin.serialization) apply false
alias(libs.plugins.skie) apply false
}

allprojects {
repositories {
google()
mavenCentral()
}
alias(libs.plugins.cocoapods) apply false
}

subprojects {
apply(plugin = rootProject.libs.plugins.ktlint.get().pluginId)

configure<org.jlleitschuh.gradle.ktlint.KtlintExtension> {
version.set("1.0.0")
version.set("1.1.1")
enableExperimentalRules.set(true)
verbose.set(true)
filter {
Expand All @@ -34,5 +30,5 @@ subprojects {
}

tasks.register<Delete>("clean") {
delete(rootProject.buildDir)
delete(rootProject.layout.buildDirectory)
}
2 changes: 1 addition & 1 deletion docs/APP_BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Before you build the app you will require these items:

* JVM 17
- Android SDK and the latest stable Android Studio (2022.3+) or IntelliJ(2023.2+)
- Android SDK and the latest stable Android Studio (2023.1+) or IntelliJ(2023.3+)
- Mac with Xcode 14+ for the iOS build

For more details, check out the [DETAILED_DEV_SETUP](DETAILED_DEV_SETUP.md) document.
Expand Down
2 changes: 1 addition & 1 deletion docs/DETAILED_DEV_SETUP.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Some alternative options, if desired:
## Install the IDE(s)

You'll also need either Android Studio, IntelliJ, or both. Android Studio is an Android development
focused skin of IntelliJ, which is more platform agnostic. There is a built-in KMM plugin in the
focused skin of IntelliJ, which is more platform agnostic. There is a built-in KMP plugin in the
Android Studio, which enables you to run and debug the iOS part of your application on iOS targets
straight from Android Studio. IntelliJ IDEA has a newer Kotlin API platform and gets bugfixes
sooner, but it has an older version of Android Gradle Plugin. If you don't have either, we recommend
Expand Down
2 changes: 1 addition & 1 deletion docs/GENERAL_ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

* [Structure of the Project](#Structure-of-the-Project)
* [Overall Architecture](#Overall-Architecture)
* [Coroutines and Ktor](#Coroutines-and-Ktor)
* [Kotlinx Coroutines](#kotlinx-Coroutines)
* [Libraries and Dependencies](#Libraries-and-Dependencies)
* [SKIE](#SKIE) - Swift-friendly API generator
* [Kermit](#Kermit) - Logging
Expand Down
6 changes: 4 additions & 2 deletions docs/IOS_PROJ_INTEGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,11 @@ cocoapods {
homepage = "https://github.com/touchlab/KaMPKit"
framework {
isStatic = false
export(Deps.kermit)
transitiveExport = true
linkerOpts("-lsqlite3")
export(libs.touchlab.kermit.simple)
}
extraSpecAttributes["swift_version"] = "\"5.0\"" // <- SKIE Needs this!
podfile = project.file("../ios/Podfile")
}
```
Note that you need to apply the `native.cocoapods` plugin.
Expand Down
6 changes: 4 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx3g
org.gradle.jvmargs=-Xmx6g
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app's APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official
# Tell the KMM plugin where the iOS project lives
# Tell the KMP plugin where the iOS project lives
xcodeproj=./ios
org.gradle.caching=true
org.gradle.parallel=true
34 changes: 18 additions & 16 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,35 @@ targetSdk = "34"
compileSdk = "34"

# Dependencies
kotlin = "1.9.10"
kotlin = "1.9.22"

android-gradle-plugin = "8.1.1"
ktlint-gradle = "11.6.0"
android-gradle-plugin = "8.2.2"
ktlint-gradle = "12.1.0"

compose = "1.5.2"
composeCompiler = "1.5.3"
compose = "1.5.4"
composeCompiler = "1.5.8"

android-desugaring = "2.0.3"
android-desugaring = "2.0.4"
androidx-core = "1.12.0"
androidx-test-junit = "1.1.5"
androidx-activity-compose = "1.7.2"
androidx-lifecycle = "2.6.2"
androidx-activity-compose = "1.8.2"
androidx-lifecycle = "2.7.0"

junit = "4.13.2"

coroutines = "1.7.3"
kotlinx-datetime = "0.4.1"
ktor = "2.3.4"
kotlinx-datetime = "0.5.0"
ktor = "2.3.7"

robolectric = "4.10.3"

kermit = "2.0.1"
skie = "0.5.0"
kermit = "2.0.2"
skie = "0.6.1"

koin = "3.5.0"
multiplatformSettings = "1.0.0"
koin = "3.5.3"
multiplatformSettings = "1.1.1"
turbine = "1.0.0"
sqlDelight = "2.0.0"
sqlDelight = "2.0.1"

[libraries]
android-desugaring = { module = "com.android.tools:desugar_jdk_libs", version.ref = "android-desugaring" }
Expand Down Expand Up @@ -78,7 +78,6 @@ sqlDelight-android = { module = "app.cash.sqldelight:android-driver", version.re
sqlDelight-jvm = { module = "app.cash.sqldelight:sqlite-driver", version.ref = "sqlDelight" }
sqlDelight-coroutinesExt = { module = "app.cash.sqldelight:coroutines-extensions", version.ref = "sqlDelight" }
sqlDelight-native = { module = "app.cash.sqldelight:native-driver", version.ref = "sqlDelight" }
sqlDelight-runtime = { module = "app.cash.sqldelight:runtime", version.ref = "sqlDelight" }

touchlab-kermit = { module = "co.touchlab:kermit", version.ref = "kermit" }
touchlab-kermit-simple = { module = "co.touchlab:kermit-simple", version.ref = "kermit" }
Expand All @@ -89,11 +88,14 @@ kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotl

[plugins]
ktlint = { id = "org.jlleitschuh.gradle.ktlint", version.ref = "ktlint-gradle" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
sqlDelight = { id = "app.cash.sqldelight", version.ref = "sqlDelight" }
android-application = { id = "com.android.application", version.ref = "android-gradle-plugin" }
android-library = { id = "com.android.library", version.ref = "android-gradle-plugin" }
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
skie = { id = "co.touchlab.skie", version.ref = "skie" }
cocoapods = { id = "org.jetbrains.kotlin.native.cocoapods", version.ref = "kotlin" }

[bundles]
app-ui = [
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
12 changes: 8 additions & 4 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,6 @@ done
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum

Expand Down Expand Up @@ -133,10 +130,13 @@ location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi

# Increase the maximum file descriptors if we can.
Expand Down Expand Up @@ -197,6 +197,10 @@ if "$cygwin" || "$msys" ; then
done
fi


# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
Expand Down
4 changes: 2 additions & 2 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ EXTERNAL SOURCES:
:path: "../shared/"

SPEC CHECKSUMS:
shared: ea50f7840493e1a81d5081cf342309e93b0dfa57
shared: 81394056467cc83be297c4a24cbe685ad921e677
SwiftLint: c585ebd615d9520d7fbdbe151f527977b0534f1e

PODFILE CHECKSUM: 3130ca9ec3cd58f2c60cfe8a432d7d96d89938bf

COCOAPODS: 1.12.1
COCOAPODS: 1.14.3
1 change: 1 addition & 0 deletions ios/Pods/Local Podspecs/shared.podspec.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions ios/Pods/Manifest.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit cf61e26

Please sign in to comment.