Loading app-common/build.gradle.kts +1 −0 Original line number Diff line number Diff line Loading @@ -43,6 +43,7 @@ dependencies { implementation(projects.feature.widget.messageList) implementation(projects.mail.protocols.imap) implementation(projects.backend.imap) implementation(libs.androidx.work.runtime) implementation(libs.androidx.lifecycle.process) Loading app-common/src/main/kotlin/net/thunderbird/app/common/account/AccountColorPicker.kt +2 −2 Original line number Diff line number Diff line Loading @@ -2,10 +2,10 @@ package net.thunderbird.app.common.account import android.content.res.Resources import app.k9mail.core.ui.legacy.theme2.common.R import net.thunderbird.core.android.account.AccountManager import net.thunderbird.core.android.account.LegacyAccountDtoManager internal class AccountColorPicker( private val accountManager: AccountManager, private val accountManager: LegacyAccountDtoManager, private val resources: Resources, ) { fun pickColor(): Int { Loading app-common/src/main/kotlin/net/thunderbird/app/common/account/AppCommonAccountModule.kt +5 −2 Original line number Diff line number Diff line Loading @@ -4,13 +4,16 @@ import app.k9mail.feature.account.setup.AccountSetupExternalContract import net.thunderbird.app.common.account.data.DefaultAccountProfileLocalDataSource import net.thunderbird.app.common.account.data.DefaultLegacyAccountManager import net.thunderbird.core.android.account.AccountDefaultsProvider import net.thunderbird.core.android.account.LegacyAccount import net.thunderbird.core.android.account.LegacyAccountManager import net.thunderbird.feature.account.avatar.AvatarMonogramCreator import net.thunderbird.feature.account.avatar.DefaultAvatarMonogramCreator import net.thunderbird.feature.account.core.AccountCoreExternalContract.AccountProfileLocalDataSource import net.thunderbird.feature.account.core.featureAccountCoreModule import net.thunderbird.feature.account.storage.legacy.featureAccountStorageLegacyModule import net.thunderbird.feature.mail.account.api.AccountManager import org.koin.android.ext.koin.androidApplication import org.koin.dsl.binds import org.koin.dsl.module internal val appCommonAccountModule = module { Loading @@ -19,12 +22,12 @@ internal val appCommonAccountModule = module { featureAccountStorageLegacyModule, ) single<LegacyAccountManager> { single<AccountManager<LegacyAccount>> { DefaultLegacyAccountManager( accountManager = get(), accountDataMapper = get(), ) } } binds arrayOf(LegacyAccountManager::class) single<AccountProfileLocalDataSource> { DefaultAccountProfileLocalDataSource( Loading app-common/src/main/kotlin/net/thunderbird/app/common/account/data/DefaultLegacyAccountManager.kt +34 −4 Original line number Diff line number Diff line Loading @@ -2,15 +2,15 @@ package net.thunderbird.app.common.account.data import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.map import net.thunderbird.core.android.account.AccountManager import net.thunderbird.core.android.account.LegacyAccount import net.thunderbird.core.android.account.LegacyAccountDtoManager import net.thunderbird.core.android.account.LegacyAccountManager import net.thunderbird.feature.account.AccountId import net.thunderbird.feature.account.storage.legacy.mapper.DefaultLegacyAccountWrapperDataMapper import net.thunderbird.feature.account.storage.legacy.mapper.LegacyAccountDataMapper internal class DefaultLegacyAccountManager( private val accountManager: AccountManager, private val accountDataMapper: DefaultLegacyAccountWrapperDataMapper, private val accountManager: LegacyAccountDtoManager, private val accountDataMapper: LegacyAccountDataMapper, ) : LegacyAccountManager { override fun getAll(): Flow<List<LegacyAccount>> { Loading @@ -35,4 +35,34 @@ internal class DefaultLegacyAccountManager( accountDataMapper.toDto(account), ) } override fun getAccounts(): List<LegacyAccount> { return accountManager.getAccounts() .map { account -> accountDataMapper.toDomain(account) } } override fun getAccountsFlow(): Flow<List<LegacyAccount>> = getAll() override fun getAccount(accountUuid: String): LegacyAccount? { val dto = accountManager.getAccount(accountUuid) return dto?.let { accountDataMapper.toDomain(it) } } override fun getAccountFlow(accountUuid: String): Flow<LegacyAccount?> { return accountManager.getAccountFlow(accountUuid).map { account -> account?.let { accountDataMapper.toDomain(it) } } } override fun moveAccount(account: LegacyAccount, newPosition: Int) { accountManager.moveAccount(accountDataMapper.toDto(account), newPosition) } override fun saveAccount(account: LegacyAccount) { accountManager.saveAccount(accountDataMapper.toDto(account)) } } app-common/src/main/kotlin/net/thunderbird/app/common/feature/AppCommonFeatureModule.kt +2 −0 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ package net.thunderbird.app.common.feature import app.k9mail.feature.launcher.FeatureLauncherExternalContract import app.k9mail.feature.launcher.di.featureLauncherModule import net.thunderbird.app.common.feature.mail.appCommonFeatureMailModule import net.thunderbird.feature.navigation.drawer.api.NavigationDrawerExternalContract import net.thunderbird.feature.notification.impl.inject.featureNotificationModule import org.koin.android.ext.koin.androidContext Loading @@ -10,6 +11,7 @@ import org.koin.dsl.module internal val appCommonFeatureModule = module { includes(featureLauncherModule) includes(featureNotificationModule) includes(appCommonFeatureMailModule) factory<FeatureLauncherExternalContract.AccountSetupFinishedLauncher> { AccountSetupFinishedLauncher( Loading Loading
app-common/build.gradle.kts +1 −0 Original line number Diff line number Diff line Loading @@ -43,6 +43,7 @@ dependencies { implementation(projects.feature.widget.messageList) implementation(projects.mail.protocols.imap) implementation(projects.backend.imap) implementation(libs.androidx.work.runtime) implementation(libs.androidx.lifecycle.process) Loading
app-common/src/main/kotlin/net/thunderbird/app/common/account/AccountColorPicker.kt +2 −2 Original line number Diff line number Diff line Loading @@ -2,10 +2,10 @@ package net.thunderbird.app.common.account import android.content.res.Resources import app.k9mail.core.ui.legacy.theme2.common.R import net.thunderbird.core.android.account.AccountManager import net.thunderbird.core.android.account.LegacyAccountDtoManager internal class AccountColorPicker( private val accountManager: AccountManager, private val accountManager: LegacyAccountDtoManager, private val resources: Resources, ) { fun pickColor(): Int { Loading
app-common/src/main/kotlin/net/thunderbird/app/common/account/AppCommonAccountModule.kt +5 −2 Original line number Diff line number Diff line Loading @@ -4,13 +4,16 @@ import app.k9mail.feature.account.setup.AccountSetupExternalContract import net.thunderbird.app.common.account.data.DefaultAccountProfileLocalDataSource import net.thunderbird.app.common.account.data.DefaultLegacyAccountManager import net.thunderbird.core.android.account.AccountDefaultsProvider import net.thunderbird.core.android.account.LegacyAccount import net.thunderbird.core.android.account.LegacyAccountManager import net.thunderbird.feature.account.avatar.AvatarMonogramCreator import net.thunderbird.feature.account.avatar.DefaultAvatarMonogramCreator import net.thunderbird.feature.account.core.AccountCoreExternalContract.AccountProfileLocalDataSource import net.thunderbird.feature.account.core.featureAccountCoreModule import net.thunderbird.feature.account.storage.legacy.featureAccountStorageLegacyModule import net.thunderbird.feature.mail.account.api.AccountManager import org.koin.android.ext.koin.androidApplication import org.koin.dsl.binds import org.koin.dsl.module internal val appCommonAccountModule = module { Loading @@ -19,12 +22,12 @@ internal val appCommonAccountModule = module { featureAccountStorageLegacyModule, ) single<LegacyAccountManager> { single<AccountManager<LegacyAccount>> { DefaultLegacyAccountManager( accountManager = get(), accountDataMapper = get(), ) } } binds arrayOf(LegacyAccountManager::class) single<AccountProfileLocalDataSource> { DefaultAccountProfileLocalDataSource( Loading
app-common/src/main/kotlin/net/thunderbird/app/common/account/data/DefaultLegacyAccountManager.kt +34 −4 Original line number Diff line number Diff line Loading @@ -2,15 +2,15 @@ package net.thunderbird.app.common.account.data import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.map import net.thunderbird.core.android.account.AccountManager import net.thunderbird.core.android.account.LegacyAccount import net.thunderbird.core.android.account.LegacyAccountDtoManager import net.thunderbird.core.android.account.LegacyAccountManager import net.thunderbird.feature.account.AccountId import net.thunderbird.feature.account.storage.legacy.mapper.DefaultLegacyAccountWrapperDataMapper import net.thunderbird.feature.account.storage.legacy.mapper.LegacyAccountDataMapper internal class DefaultLegacyAccountManager( private val accountManager: AccountManager, private val accountDataMapper: DefaultLegacyAccountWrapperDataMapper, private val accountManager: LegacyAccountDtoManager, private val accountDataMapper: LegacyAccountDataMapper, ) : LegacyAccountManager { override fun getAll(): Flow<List<LegacyAccount>> { Loading @@ -35,4 +35,34 @@ internal class DefaultLegacyAccountManager( accountDataMapper.toDto(account), ) } override fun getAccounts(): List<LegacyAccount> { return accountManager.getAccounts() .map { account -> accountDataMapper.toDomain(account) } } override fun getAccountsFlow(): Flow<List<LegacyAccount>> = getAll() override fun getAccount(accountUuid: String): LegacyAccount? { val dto = accountManager.getAccount(accountUuid) return dto?.let { accountDataMapper.toDomain(it) } } override fun getAccountFlow(accountUuid: String): Flow<LegacyAccount?> { return accountManager.getAccountFlow(accountUuid).map { account -> account?.let { accountDataMapper.toDomain(it) } } } override fun moveAccount(account: LegacyAccount, newPosition: Int) { accountManager.moveAccount(accountDataMapper.toDto(account), newPosition) } override fun saveAccount(account: LegacyAccount) { accountManager.saveAccount(accountDataMapper.toDto(account)) } }
app-common/src/main/kotlin/net/thunderbird/app/common/feature/AppCommonFeatureModule.kt +2 −0 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ package net.thunderbird.app.common.feature import app.k9mail.feature.launcher.FeatureLauncherExternalContract import app.k9mail.feature.launcher.di.featureLauncherModule import net.thunderbird.app.common.feature.mail.appCommonFeatureMailModule import net.thunderbird.feature.navigation.drawer.api.NavigationDrawerExternalContract import net.thunderbird.feature.notification.impl.inject.featureNotificationModule import org.koin.android.ext.koin.androidContext Loading @@ -10,6 +11,7 @@ import org.koin.dsl.module internal val appCommonFeatureModule = module { includes(featureLauncherModule) includes(featureNotificationModule) includes(appCommonFeatureMailModule) factory<FeatureLauncherExternalContract.AccountSetupFinishedLauncher> { AccountSetupFinishedLauncher( Loading