README + dependency updates
This commit is contained in:
parent
2c7c5418ee
commit
2142eddf22
5 changed files with 26 additions and 18 deletions
|
@ -18,6 +18,11 @@ Related posts:
|
|||
* [PeopleInSpace hits the web with Kotlin/JS and React](https://johnoreilly.dev/posts/peopleinspace-kotlinjs/)
|
||||
|
||||
|
||||
Note that this repository very much errs on side of mimimalism to help more clearly illustrate key moving parts of a Koltin
|
||||
Multiplatform project and also to hopefully help someone just starting to explore KMP to get up and running for first time. If you're at stage of moving
|
||||
beyond this then I'd definitely recommend checking out [KaMPKit](https://github.com/touchlab/KaMPKit)
|
||||
|
||||
|
||||
**Note**: You need to use Android Studio v4.1 (currently on Canary 8). Have tested on XCode v11.3
|
||||
|
||||
|
||||
|
|
|
@ -26,14 +26,14 @@ class MainActivity : AppCompatActivity() {
|
|||
super.onCreate(savedInstanceState)
|
||||
|
||||
setContent {
|
||||
val peopleState = peopleInSpaceViewModel.peopleInSpace.observeAsState()
|
||||
val peopleState = peopleInSpaceViewModel.peopleInSpace.observeAsState(emptyList())
|
||||
mainLayout(peopleState)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun mainLayout(peopleState: State<List<Assignment>?>) {
|
||||
fun mainLayout(peopleState: State<List<Assignment>>) {
|
||||
MaterialTheme {
|
||||
Column {
|
||||
TopAppBar(
|
||||
|
@ -41,7 +41,7 @@ fun mainLayout(peopleState: State<List<Assignment>?>) {
|
|||
Text("People In Space")
|
||||
}
|
||||
)
|
||||
AdapterList(data = peopleState.value!!) { person ->
|
||||
AdapterList(data = peopleState.value) { person ->
|
||||
Row(person)
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
package com.surrus.peopleinspace
|
||||
|
||||
import com.surrus.common.remote.PeopleInSpaceApi
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import org.junit.Test
|
||||
|
||||
class PeopleInSpaceTest {
|
||||
@Test
|
||||
fun testGetPeople() = runBlocking {
|
||||
val peopleInSpaceApi = PeopleInSpaceApi()
|
||||
val result = peopleInSpaceApi.fetchPeople()
|
||||
println(result)
|
||||
assert(result.people.isNotEmpty())
|
||||
}
|
||||
}
|
|
@ -9,8 +9,7 @@ object Versions {
|
|||
const val kotlinxSerialization = "0.20.0"
|
||||
const val sqlDelight = "1.3.0"
|
||||
const val sqliteJdbcDriver = "3.30.1"
|
||||
const val retrofit = "2.4.0"
|
||||
const val okHttp = "3.12.0"
|
||||
const val slf4j = "1.7.30"
|
||||
const val ktx = "1.0.1"
|
||||
const val nav = "2.1.0-alpha04"
|
||||
const val work = "2.1.0-alpha02"
|
||||
|
@ -91,6 +90,7 @@ object Ktor {
|
|||
const val clientSerializationJs = "io.ktor:ktor-client-serialization-js:${Versions.ktor}"
|
||||
const val freemaker = "io.ktor:ktor-freemarker:${Versions.ktor}"
|
||||
const val locations = "io.ktor:ktor-locations:${Versions.ktor}"
|
||||
const val slf4j = "org.slf4j:slf4j-simple:${Versions.slf4j}"
|
||||
}
|
||||
|
||||
object AndroidSdk {
|
||||
|
@ -128,19 +128,6 @@ object PlayServices {
|
|||
val maps = "com.google.android.gms:play-services-maps:16.1.0"
|
||||
}
|
||||
|
||||
|
||||
object Okhttp {
|
||||
val okhttp = "com.squareup.okhttp3:okhttp:${Versions.okHttp}"
|
||||
val loggingInterceptor = "com.squareup.okhttp3:logging-interceptor:${Versions.okHttp}"
|
||||
}
|
||||
|
||||
object Retrofit {
|
||||
val retrofit = "com.squareup.retrofit2:retrofit:${Versions.retrofit}"
|
||||
val converterGson = "com.squareup.retrofit2:converter-gson:${Versions.retrofit}"
|
||||
val converterScalars = "com.squareup.retrofit2:converter-scalars:${Versions.retrofit}"
|
||||
val coroutinesAdapter = "com.jakewharton.retrofit:retrofit2-kotlin-coroutines-adapter:0.9.2"
|
||||
}
|
||||
|
||||
object Testing {
|
||||
val junit = "junit:junit:${Versions.junit}"
|
||||
val coreTesting = "android.arch.core:core-testing:${Versions.coreTesting}"
|
||||
|
|
|
@ -128,6 +128,7 @@ kotlin {
|
|||
implementation("io.ktor:ktor-client-logging-jvm:${Versions.ktor}")
|
||||
implementation("io.ktor:ktor-client-serialization-jvm:${Versions.ktor}")
|
||||
implementation("io.ktor:ktor-client-apache:${Versions.ktor}")
|
||||
implementation(Ktor.slf4j)
|
||||
|
||||
|
||||
// Serialize
|
||||
|
|
Loading…
Reference in a new issue