Skip to content

Commit 36857a8

Browse files
authored
Merge pull request #271 from joreilly/singlein_fix
add SingleIns
2 parents 2bb448c + 632437a commit 36857a8

File tree

4 files changed

+6
-1
lines changed

4 files changed

+6
-1
lines changed

common/src/commonMain/kotlin/dev/johnoreilly/common/repository/CityBikesRepository.kt

+3
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,12 @@ import dev.johnoreilly.common.remote.Station
77
import kotlinx.coroutines.*
88
import kotlinx.coroutines.flow.*
99
import me.tatarka.inject.annotations.Inject
10+
import software.amazon.lastmile.kotlin.inject.anvil.AppScope
11+
import software.amazon.lastmile.kotlin.inject.anvil.SingleIn
1012

1113

1214
@Inject
15+
@SingleIn(AppScope::class)
1316
class CityBikesRepository(val cityBikesApi: CityBikesApi,val database: AppDatabase) {
1417
private val mainScope: CoroutineScope = MainScope()
1518

common/src/commonMain/kotlin/dev/johnoreilly/common/viewmodel/CountriesViewModelShared.kt

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import software.amazon.lastmile.kotlin.inject.anvil.SingleIn
1616
data class Country(val code: String, val displayName: String)
1717

1818
@Inject
19+
@SingleIn(AppScope::class)
1920
open class CountriesViewModelShared(cityBikesRepository: CityBikesRepository) : ViewModel() {
2021

2122
/**

common/src/commonMain/kotlin/dev/johnoreilly/common/viewmodel/NetworksViewModelShared.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ import kotlinx.coroutines.flow.combine
1212
import kotlinx.coroutines.flow.filterNotNull
1313
import me.tatarka.inject.annotations.Inject
1414
import software.amazon.lastmile.kotlin.inject.anvil.AppScope
15-
import software.amazon.lastmile.kotlin.inject.anvil.ContributesBinding
1615
import software.amazon.lastmile.kotlin.inject.anvil.SingleIn
1716

1817
@Inject
18+
@SingleIn(AppScope::class)
1919
open class NetworksViewModelShared(cityBikesRepository: CityBikesRepository) : ViewModel() {
2020
private val countryCode = MutableStateFlow<String?>(viewModelScope, null)
2121

common/src/commonMain/kotlin/dev/johnoreilly/common/viewmodel/StationsViewModelShared.kt

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import software.amazon.lastmile.kotlin.inject.anvil.SingleIn
1616

1717
@OptIn(ExperimentalCoroutinesApi::class)
1818
@Inject
19+
@SingleIn(AppScope::class)
1920
open class StationsViewModelShared(cityBikesRepository: CityBikesRepository) : ViewModel() {
2021
private val network = MutableStateFlow<String?>(viewModelScope, null)
2122

0 commit comments

Comments
 (0)