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

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

Merge pull request #8143 from wmontwe/add-drawer-folder-list-part4

Add drawer folder list - part 4
parents 008a5e28 44c0d114
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -13,7 +13,7 @@ internal fun DrawerContentPreview() {
        DrawerContent(
            state = DrawerContract.State(
                accounts = persistentListOf(),
                currentAccount = null,
                selectedAccount = null,
                folders = persistentListOf(),
            ),
            onEvent = {},
@@ -28,7 +28,8 @@ fun DrawerContentWithAccountPreview() {
        DrawerContent(
            state = DrawerContract.State(
                accounts = persistentListOf(DISPLAY_ACCOUNT),
                currentAccount = DISPLAY_ACCOUNT,
                selectedAccount = DISPLAY_ACCOUNT,
                folders = persistentListOf(),
            ),
            onEvent = {},
        )
+3 −2
Original line number Diff line number Diff line
@@ -3,9 +3,9 @@ package app.k9mail.feature.navigation.drawer.ui
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
import app.k9mail.feature.navigation.drawer.domain.entity.DisplayAccountFolder
import app.k9mail.legacy.account.Account
import app.k9mail.legacy.account.Identity
import app.k9mail.legacy.ui.folder.DisplayFolder

internal object FakeData {

@@ -45,7 +45,8 @@ internal object FakeData {
        isLocalOnly = false,
    )

    val DISPLAY_FOLDER = DisplayFolder(
    val DISPLAY_FOLDER = DisplayAccountFolder(
        accountUuid = ACCOUNT_UUID,
        folder = FOLDER,
        isInTopGroup = false,
        unreadMessageCount = 14,
+9 −1
Original line number Diff line number Diff line
@@ -15,6 +15,9 @@ import org.koin.core.component.inject

class FolderDrawer(
    override val parent: AppCompatActivity,
    private val openAccount: (account: Account) -> Unit,
    private val openFolder: (folderId: Long) -> Unit,
    createDrawerListener: () -> DrawerLayout.DrawerListener,
) : NavigationDrawer, KoinComponent {

    private val themeProvider: FeatureThemeProvider by inject()
@@ -28,10 +31,15 @@ class FolderDrawer(
        sliderView.visibility = View.GONE
        drawerView.visibility = View.VISIBLE
        swipeRefreshLayout.isEnabled = false
        drawer.addDrawerListener(createDrawerListener())

        drawerView.setContent {
            themeProvider.WithTheme {
                DrawerView()
                DrawerView(
                    openAccount = openAccount,
                    openFolder = openFolder,
                    closeDrawer = { close() },
                )
            }
        }
    }
+10 −0
Original line number Diff line number Diff line
package app.k9mail.feature.navigation.drawer

import app.k9mail.feature.navigation.drawer.domain.entity.DrawerConfig

interface NavigationDrawerExternalContract {

    fun interface DrawerConfigLoader {
        fun loadDrawerConfig(): DrawerConfig
    }
}
+16 −0
Original line number Diff line number Diff line
@@ -3,6 +3,8 @@ package app.k9mail.feature.navigation.drawer
import app.k9mail.feature.navigation.drawer.domain.DomainContract.UseCase
import app.k9mail.feature.navigation.drawer.domain.usecase.GetDisplayAccounts
import app.k9mail.feature.navigation.drawer.domain.usecase.GetDisplayFoldersForAccount
import app.k9mail.feature.navigation.drawer.domain.usecase.GetDrawerConfig
import app.k9mail.feature.navigation.drawer.domain.usecase.SyncMail
import app.k9mail.feature.navigation.drawer.legacy.AccountsViewModel
import app.k9mail.feature.navigation.drawer.legacy.FoldersViewModel
import app.k9mail.feature.navigation.drawer.ui.DrawerViewModel
@@ -14,6 +16,12 @@ import org.koin.dsl.module

val navigationDrawerModule: Module = module {

    single<UseCase.GetDrawerConfig> {
        GetDrawerConfig(
            configProver = get(),
        )
    }

    single<UseCase.GetDisplayAccounts> {
        GetDisplayAccounts(
            accountManager = get(),
@@ -28,6 +36,12 @@ val navigationDrawerModule: Module = module {
        )
    }

    single<UseCase.SyncMail> {
        SyncMail(
            messagingController = get(),
        )
    }

    viewModel {
        AccountsViewModel(
            getDisplayAccounts = get(),
@@ -48,8 +62,10 @@ val navigationDrawerModule: Module = module {

    viewModel {
        DrawerViewModel(
            getDrawerConfig = get(),
            getDisplayAccounts = get(),
            getDisplayFoldersForAccount = get(),
            syncMail = get(),
        )
    }
}
Loading