Compute the content in the LaunchEffect
This commit is contained in:
parent
199342d476
commit
46153c7ac6
1 changed files with 5 additions and 4 deletions
|
|
@ -19,7 +19,8 @@ import dev.zacsweers.metro.Inject
|
||||||
import io.element.android.features.viewfolder.impl.model.Item
|
import io.element.android.features.viewfolder.impl.model.Item
|
||||||
import io.element.android.libraries.architecture.Presenter
|
import io.element.android.libraries.architecture.Presenter
|
||||||
import io.element.android.libraries.core.meta.BuildMeta
|
import io.element.android.libraries.core.meta.BuildMeta
|
||||||
import kotlinx.collections.immutable.toImmutableList
|
import kotlinx.collections.immutable.persistentListOf
|
||||||
|
import kotlinx.collections.immutable.toPersistentList
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
class ViewFolderPresenter(
|
class ViewFolderPresenter(
|
||||||
|
|
@ -35,7 +36,7 @@ class ViewFolderPresenter(
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
override fun present(): ViewFolderState {
|
override fun present(): ViewFolderState {
|
||||||
var content by remember { mutableStateOf(emptyList<Item>()) }
|
var content by remember { mutableStateOf(persistentListOf<Item>()) }
|
||||||
val title = remember {
|
val title = remember {
|
||||||
buildString {
|
buildString {
|
||||||
if (path.contains(buildMeta.applicationId)) {
|
if (path.contains(buildMeta.applicationId)) {
|
||||||
|
|
@ -48,11 +49,11 @@ class ViewFolderPresenter(
|
||||||
content = buildList {
|
content = buildList {
|
||||||
if (canGoUp) add(Item.Parent)
|
if (canGoUp) add(Item.Parent)
|
||||||
addAll(folderExplorer.getItems(path))
|
addAll(folderExplorer.getItems(path))
|
||||||
}
|
}.toPersistentList()
|
||||||
}
|
}
|
||||||
return ViewFolderState(
|
return ViewFolderState(
|
||||||
title = title,
|
title = title,
|
||||||
content = content.toImmutableList(),
|
content = content,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue