Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix sample-viewmodel running #430

Merged
merged 2 commits into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ buildscript {
classpath libs.android.plugin
classpath libs.kotlin.plugin.core
classpath libs.kotlin.plugin.compose
classpath libs.kotlin.ksp.plugin
classpath libs.maven.publish.plugin
classpath libs.dokka.plugin
classpath libs.spotless.plugin
Expand Down
2 changes: 2 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ junit = { module = "junit:junit", version = "4.13.2" }
kotlin-plugin-core = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
kotlin-plugin-compose = { module = "org.jetbrains.kotlin:compose-compiler-gradle-plugin", version.ref = "kotlin" }
kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" }
kotlin-ksp-plugin = "com.google.devtools.ksp:com.google.devtools.ksp.gradle.plugin:2.0.0-1.0.21"

kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "coroutine" }
kotlinx-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "coroutine" }
Expand All @@ -47,6 +48,7 @@ squareup-okhttp-logging-interceptor = { module = "com.squareup.okhttp3:logging-i
squareup-retrofit-client = { module = "com.squareup.retrofit2:retrofit", version.ref = "squareup-retrofit" }
squareup-retrofit-converter-scalars = { module = "com.squareup.retrofit2:converter-scalars", version.ref = "squareup-retrofit" }
squareup-retrofit-converter-moshi = { module = "com.squareup.retrofit2:converter-moshi", version.ref = "squareup-retrofit" }
squareup-moshi-codegen = "com.squareup.moshi:moshi-kotlin-codegen:1.15.1"

assertk = "com.willowtreeapps.assertk:assertk:0.28.1"
turbine = { module = "app.cash.turbine:turbine", version = "1.1.0" }
10 changes: 10 additions & 0 deletions renovate.json5
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,14 @@
"extends": [
"config:base"
],
"packageRules": [
{
// KSP is tightly coupled to Kotlin version.
"groupName": "Kotlin/KSP",
"matchPackagePrefixes": [
"org.jetbrains.kotlin:kotlin",
"com.google.devtools.ksp",
],
},
],
}
3 changes: 3 additions & 0 deletions sample-viewmodel/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
apply plugin: 'com.android.application'
apply plugin: 'org.jetbrains.kotlin.android'
apply plugin: 'org.jetbrains.kotlin.plugin.compose'
apply plugin: 'com.google.devtools.ksp'

dependencies {
implementation projects.moleculeRuntime
Expand All @@ -11,6 +12,8 @@ dependencies {
implementation libs.squareup.retrofit.client
implementation libs.squareup.retrofit.converter.moshi

ksp libs.squareup.moshi.codegen

testImplementation libs.junit
testImplementation libs.kotlinx.coroutines.test
testImplementation libs.turbine
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package com.example.molecule.viewmodel

import com.squareup.moshi.JsonClass
import retrofit2.Retrofit
import retrofit2.converter.moshi.MoshiConverterFactory
import retrofit2.create
Expand Down Expand Up @@ -50,13 +51,16 @@ fun PupperPicsService(): PupperPicsService {
}
}

private interface PupperPicsApi {
interface PupperPicsApi {
@GET("breeds/list/all")
suspend fun listBreeds(): ListResponse

@GET("breed/{breed}/images/random")
suspend fun randomImageFor(@Path("breed", encoded = true) breed: String): ImageResponse

@JsonClass(generateAdapter = true)
data class ListResponse(val message: Map<String, List<String>>)

@JsonClass(generateAdapter = true)
data class ImageResponse(val message: String)
}