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

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

Merge pull request #8547 from wmontwe/fix-drawer-account-update

Fix drawer not updating on account changes
parents 5627edf7 dd842775
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -15,7 +15,7 @@ internal fun DrawerContentPreview() {
        DrawerContent(
            state = DrawerContract.State(
                accounts = persistentListOf(),
                selectedAccountUuid = null,
                selectedAccountId = null,
                folders = persistentListOf(),
            ),
            onEvent = {},
@@ -30,7 +30,7 @@ internal fun DrawerContentWithAccountPreview() {
        DrawerContent(
            state = DrawerContract.State(
                accounts = persistentListOf(DISPLAY_ACCOUNT),
                selectedAccountUuid = DISPLAY_ACCOUNT.uuid,
                selectedAccountId = DISPLAY_ACCOUNT.id,
                folders = persistentListOf(),
            ),
            onEvent = {},
@@ -47,7 +47,7 @@ internal fun DrawerContentWithFoldersPreview() {
                accounts = persistentListOf(
                    DISPLAY_ACCOUNT,
                ),
                selectedAccountUuid = null,
                selectedAccountId = null,
                folders = persistentListOf(
                    UNIFIED_FOLDER,
                    DISPLAY_FOLDER,
@@ -67,7 +67,7 @@ internal fun DrawerContentWithSelectedFolderPreview() {
                accounts = persistentListOf(
                    DISPLAY_ACCOUNT,
                ),
                selectedAccountUuid = DISPLAY_ACCOUNT.uuid,
                selectedAccountId = DISPLAY_ACCOUNT.id,
                folders = persistentListOf(
                    UNIFIED_FOLDER,
                    DISPLAY_FOLDER,
@@ -88,7 +88,7 @@ internal fun DrawerContentWithSelectedUnifiedFolderPreview() {
                accounts = persistentListOf(
                    DISPLAY_ACCOUNT,
                ),
                selectedAccountUuid = DISPLAY_ACCOUNT.uuid,
                selectedAccountId = DISPLAY_ACCOUNT.id,
                folders = persistentListOf(
                    UNIFIED_FOLDER,
                    DISPLAY_FOLDER,
+7 −2
Original line number Diff line number Diff line
package app.k9mail.feature.navigation.drawer.ui

import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.toArgb
import app.k9mail.core.mail.folder.api.Folder
import app.k9mail.core.mail.folder.api.FolderType
import app.k9mail.feature.navigation.drawer.domain.entity.DisplayAccount
@@ -35,7 +37,10 @@ internal object FakeData {
    }

    val DISPLAY_ACCOUNT = DisplayAccount(
        account = ACCOUNT,
        id = ACCOUNT_UUID,
        name = DISPLAY_NAME,
        email = EMAIL_ADDRESS,
        color = Color.Red.toArgb(),
        unreadMessageCount = 0,
        starredMessageCount = 0,
    )
@@ -48,7 +53,7 @@ internal object FakeData {
    )

    val DISPLAY_FOLDER = DisplayAccountFolder(
        accountUuid = ACCOUNT_UUID,
        accountId = ACCOUNT_UUID,
        folder = FOLDER,
        isInTopGroup = false,
        unreadMessageCount = 14,
+1 −1
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@ internal data class FolderDrawerState(

class FolderDrawer(
    override val parent: AppCompatActivity,
    private val openAccount: (account: Account) -> Unit,
    private val openAccount: (accountId: String) -> Unit,
    private val openFolder: (folderId: Long) -> Unit,
    private val openUnifiedFolder: () -> Unit,
    private val openManageFolders: () -> Unit,
+1 −1
Original line number Diff line number Diff line
@@ -17,7 +17,7 @@ internal interface DomainContract {
        }

        fun interface GetDisplayFoldersForAccount {
            operator fun invoke(accountUuid: String, includeUnifiedFolders: Boolean): Flow<List<DisplayFolder>>
            operator fun invoke(accountId: String, includeUnifiedFolders: Boolean): Flow<List<DisplayFolder>>
        }

        /**
+5 −6
Original line number Diff line number Diff line
package app.k9mail.feature.navigation.drawer.domain.entity

import app.k9mail.legacy.account.Account

internal data class DisplayAccount(
    val account: Account,
    val id: String,
    val name: String,
    val email: String,
    val color: Int,
    val unreadMessageCount: Int,
    val starredMessageCount: Int,
) {
    val uuid: String = account.uuid
}
)
Loading