Skip to content

Commit

Permalink
refactor SharedRepository
Browse files Browse the repository at this point in the history
  • Loading branch information
dalafiarisamuel committed Aug 28, 2024
1 parent a5dba2c commit 9ce4b52
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package data.repository

import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue

class SharedRepository {
var isDarkThemeEnabled by mutableStateOf(false)
}
interface SharedRepository {
var isDarkThemeEnabled: Boolean
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package data.repository

import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue

class SharedRepositoryImpl : SharedRepository {
override var isDarkThemeEnabled: Boolean by mutableStateOf(false)
}
3 changes: 2 additions & 1 deletion composeApp/src/commonMain/kotlin/di/Koin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import data.mapper.PhotosUrlsMapper
import data.repository.ImageRepository
import data.repository.ImageRepositoryImpl
import data.repository.SharedRepository
import data.repository.SharedRepositoryImpl
import de.jensklingenberg.ktorfit.Ktorfit
import io.ktor.client.HttpClient
import io.ktor.client.plugins.contentnegotiation.ContentNegotiation
Expand Down Expand Up @@ -75,7 +76,7 @@ private fun mapperModule() = module {

private fun repositoryModule() = module {
single<ImageRepository> { ImageRepositoryImpl(get()) }
single { SharedRepository() }
single<SharedRepository> { SharedRepositoryImpl() }
}

private fun viewModelModule() = module {
Expand Down

0 comments on commit 9ce4b52

Please sign in to comment.