Repo created
This commit is contained in:
parent
75dc487a7a
commit
39c29d175b
6317 changed files with 388324 additions and 2 deletions
8
feature/account/core/build.gradle.kts
Normal file
8
feature/account/core/build.gradle.kts
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
plugins {
|
||||
id(ThunderbirdPlugins.Library.jvm)
|
||||
alias(libs.plugins.android.lint)
|
||||
}
|
||||
|
||||
dependencies {
|
||||
api(projects.feature.account.api)
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
package net.thunderbird.feature.account.core
|
||||
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import net.thunderbird.feature.account.AccountId
|
||||
import net.thunderbird.feature.account.profile.AccountProfile
|
||||
|
||||
interface AccountCoreExternalContract {
|
||||
|
||||
interface AccountProfileLocalDataSource {
|
||||
fun getById(accountId: AccountId): Flow<AccountProfile?>
|
||||
|
||||
suspend fun update(accountProfile: AccountProfile)
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package net.thunderbird.feature.account.core
|
||||
|
||||
import net.thunderbird.feature.account.core.data.DefaultAccountProfileRepository
|
||||
import net.thunderbird.feature.account.profile.AccountProfileRepository
|
||||
import org.koin.core.module.Module
|
||||
import org.koin.dsl.module
|
||||
|
||||
val featureAccountCoreModule: Module = module {
|
||||
single<AccountProfileRepository> { DefaultAccountProfileRepository(get()) }
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
package net.thunderbird.feature.account.core.data
|
||||
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.distinctUntilChanged
|
||||
import net.thunderbird.feature.account.AccountId
|
||||
import net.thunderbird.feature.account.core.AccountCoreExternalContract.AccountProfileLocalDataSource
|
||||
import net.thunderbird.feature.account.profile.AccountProfile
|
||||
import net.thunderbird.feature.account.profile.AccountProfileRepository
|
||||
|
||||
class DefaultAccountProfileRepository(
|
||||
private val localDataSource: AccountProfileLocalDataSource,
|
||||
) : AccountProfileRepository {
|
||||
|
||||
override fun getById(accountId: AccountId): Flow<AccountProfile?> {
|
||||
return localDataSource.getById(accountId)
|
||||
.distinctUntilChanged()
|
||||
}
|
||||
|
||||
override suspend fun update(accountProfile: AccountProfile) {
|
||||
localDataSource.update(accountProfile)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue