Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit 37d047a6 authored by Wolf-Martell Montwé's avatar Wolf-Martell Montwé Committed by GitHub
Browse files

Merge pull request #9770 from wmontwe/refactor-message-list-fragment

refactor: message list fragment
parents f555f601 a8caa145
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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)
+2 −2
Original line number Diff line number Diff line
@@ -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 {
+5 −2
Original line number Diff line number Diff line
@@ -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 {
@@ -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(
+34 −4
Original line number Diff line number Diff line
@@ -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>> {
@@ -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))
    }
}
+2 −0
Original line number Diff line number Diff line
@@ -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
@@ -10,6 +11,7 @@ import org.koin.dsl.module
internal val appCommonFeatureModule = module {
    includes(featureLauncherModule)
    includes(featureNotificationModule)
    includes(appCommonFeatureMailModule)

    factory<FeatureLauncherExternalContract.AccountSetupFinishedLauncher> {
        AccountSetupFinishedLauncher(
Loading