Add koin first declarations in compose module
This commit is contained in:
parent
e372609298
commit
4e09c16d53
@ -76,8 +76,18 @@ dependencies {
|
|||||||
implementation "cafe.adriel.voyager:voyager-bottom-sheet-navigator:$voyager"
|
implementation "cafe.adriel.voyager:voyager-bottom-sheet-navigator:$voyager"
|
||||||
implementation "cafe.adriel.voyager:voyager-tab-navigator:$voyager"
|
implementation "cafe.adriel.voyager:voyager-tab-navigator:$voyager"
|
||||||
implementation "cafe.adriel.voyager:voyager-androidx:$voyager"
|
implementation "cafe.adriel.voyager:voyager-androidx:$voyager"
|
||||||
//implementation "cafe.adriel.voyager:voyager-koin:$voyager"
|
implementation "cafe.adriel.voyager:voyager-koin:$voyager"
|
||||||
|
|
||||||
debugImplementation "androidx.compose.ui:ui-tooling:1.3.3"
|
debugImplementation "androidx.compose.ui:ui-tooling:1.3.3"
|
||||||
implementation "androidx.compose.ui:ui-tooling-preview:1.3.3"
|
implementation "androidx.compose.ui:ui-tooling-preview:1.3.3"
|
||||||
|
|
||||||
|
def lifecycle_version = "2.5.1"
|
||||||
|
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
|
||||||
|
implementation "androidx.lifecycle:lifecycle-viewmodel-compose:$lifecycle_version"
|
||||||
|
implementation "androidx.lifecycle:lifecycle-viewmodel-savedstate:$lifecycle_version"
|
||||||
|
|
||||||
|
/*def koin_version = "3.3.3"
|
||||||
|
implementation "io.insert-koin:koin-core:$koin_version"
|
||||||
|
implementation "io.insert-koin:koin-android:$koin_version"
|
||||||
|
implementation "io.insert-koin:koin-androidx-compose:3.4.2"*/
|
||||||
}
|
}
|
@ -2,6 +2,7 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
<application
|
<application
|
||||||
|
android:name=".ReadropsApp"
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
android:icon="@mipmap/ic_launcher"
|
android:icon="@mipmap/ic_launcher"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
|
@ -0,0 +1,10 @@
|
|||||||
|
package com.readrops.app.compose
|
||||||
|
|
||||||
|
import com.readrops.app.compose.timelime.TimelineViewModel
|
||||||
|
import org.koin.androidx.viewmodel.dsl.viewModel
|
||||||
|
import org.koin.dsl.module
|
||||||
|
|
||||||
|
val composeAppModule = module {
|
||||||
|
|
||||||
|
viewModel { TimelineViewModel(get()) }
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
package com.readrops.app.compose
|
||||||
|
|
||||||
|
import android.app.Application
|
||||||
|
import com.readrops.api.apiModule
|
||||||
|
import com.readrops.db.dbModule
|
||||||
|
import org.koin.android.ext.koin.androidContext
|
||||||
|
import org.koin.android.ext.koin.androidLogger
|
||||||
|
import org.koin.core.context.startKoin
|
||||||
|
import org.koin.core.logger.Level
|
||||||
|
|
||||||
|
open class ReadropsApp : Application() {
|
||||||
|
|
||||||
|
override fun onCreate() {
|
||||||
|
super.onCreate()
|
||||||
|
|
||||||
|
startKoin {
|
||||||
|
androidLogger(Level.ERROR)
|
||||||
|
androidContext(this@ReadropsApp)
|
||||||
|
|
||||||
|
modules(apiModule, dbModule, composeAppModule)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -3,12 +3,15 @@ package com.readrops.app.compose.timelime
|
|||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import cafe.adriel.voyager.androidx.AndroidScreen
|
import cafe.adriel.voyager.androidx.AndroidScreen
|
||||||
|
import org.koin.androidx.compose.getViewModel
|
||||||
|
|
||||||
|
|
||||||
class TimelineScreen : AndroidScreen() {
|
class TimelineScreen : AndroidScreen() {
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
override fun Content() {
|
override fun Content() {
|
||||||
|
val viewModel = getViewModel<TimelineViewModel>()
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
TimelineItem()
|
TimelineItem()
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,12 @@
|
|||||||
|
package com.readrops.app.compose.timelime
|
||||||
|
|
||||||
|
import androidx.lifecycle.ViewModel
|
||||||
|
import com.readrops.db.Database
|
||||||
|
|
||||||
|
class TimelineViewModel(
|
||||||
|
val database: Database
|
||||||
|
) : ViewModel() {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -35,7 +35,7 @@ ext {
|
|||||||
targetSdkVersion = 33
|
targetSdkVersion = 33
|
||||||
buildToolsVersion = "33.0.2"
|
buildToolsVersion = "33.0.2"
|
||||||
|
|
||||||
koin_version = "3.1.2"
|
koin_version = "3.3.3"
|
||||||
}
|
}
|
||||||
|
|
||||||
task clean(type: Delete) {
|
task clean(type: Delete) {
|
||||||
|
@ -93,7 +93,7 @@ dependencies {
|
|||||||
|
|
||||||
api "io.insert-koin:koin-core:$rootProject.ext.koin_version"
|
api "io.insert-koin:koin-core:$rootProject.ext.koin_version"
|
||||||
api "io.insert-koin:koin-android:$rootProject.ext.koin_version"
|
api "io.insert-koin:koin-android:$rootProject.ext.koin_version"
|
||||||
api "io.insert-koin:koin-android-compat:$rootProject.ext.koin_version"
|
api "io.insert-koin:koin-androidx-compose:3.4.2"
|
||||||
|
|
||||||
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4"
|
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4"
|
||||||
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4'
|
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user