Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,15 @@ fun GroupConversationDetailsScreen(

val onConversationMediaClick: () -> Unit = {
if (groupOptions.isWireCellEnabled && groupOptions.isWireCellFeatureEnabled) {
navigator.navigate(NavigationCommand(ConversationFilesScreenDestination(viewModel.conversationId.toString())))
navigator.navigate(
NavigationCommand(
ConversationFilesScreenDestination(
conversationId = viewModel.conversationId.toString(),
screenTitle = groupOptions.groupName,
breadcrumbs = arrayOf(groupOptions.groupName)
)
)
)
} else {
navigator.navigate(NavigationCommand(ConversationMediaScreenDestination(viewModel.conversationId)))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/
package com.wire.android.feature.cells.ui

import android.content.Context
import android.os.Environment
import androidx.lifecycle.SavedStateHandle
import androidx.lifecycle.viewModelScope
Expand Down Expand Up @@ -47,6 +48,7 @@ import com.wire.kalium.common.functional.fold
import com.wire.kalium.common.functional.onFailure
import com.wire.kalium.common.functional.onSuccess
import dagger.hilt.android.lifecycle.HiltViewModel
import dagger.hilt.android.qualifiers.ApplicationContext
import kotlinx.collections.immutable.toImmutableMap
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.MutableSharedFlow
Expand Down Expand Up @@ -82,7 +84,8 @@ class CellViewModel @Inject constructor(
private val download: DownloadCellFileUseCase,
private val isCellAvailable: IsAtLeastOneCellAvailableUseCase,
private val fileHelper: FileHelper,
private val fileNameResolver: FileNameResolver
private val fileNameResolver: FileNameResolver,
@ApplicationContext private val context: Context
) : ActionsViewModel<CellViewAction>() {

private val navArgs: CellFilesNavArgs = savedStateHandle.navArgs()
Expand Down Expand Up @@ -241,7 +244,10 @@ class CellViewModel @Inject constructor(
private fun isAllFiles(): Boolean = navArgs.conversationId == null && !isRecycleBin()

internal fun screenTitle(): String? = navArgs.screenTitle
internal fun breadcrumbs(): Array<String>? = navArgs.breadcrumbs
internal fun breadcrumbs(): Array<String>? = navArgs.breadcrumbs?.run {
// Display '🗑 Recycle Bin' as the title when at the root of the Recycle Bin.
if (isRecycleBin() && this.size == 1) plus("🗑 ${context.getString(R.string.recycle_bin)}") else this
}

private fun onFileClick(cellNode: CellNodeUi.File) {
when {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ fun ConversationFilesScreenContent(
NavigationCommand(
RecycleBinScreenDestination(
conversationId = currentNodeUuid?.substringBefore("/"),
isRecycleBin = true
isRecycleBin = true,
breadcrumbs = breadcrumbs?.let { arrayOf(it.first()) } // only root in recycle bin
)
)
)
Expand Down Expand Up @@ -247,11 +248,9 @@ fun ConversationFilesScreenContent(
conversationId = folderPath,
screenTitle = it.name,
isRecycleBin = isRecycleBin,
breadcrumbs = if (!isRecycleBin) {
it.name?.let { name ->
(breadcrumbs ?: emptyArray()) + name
}
} else { null }
breadcrumbs = it.name?.let { name ->
(breadcrumbs ?: emptyArray()) + name
}
),
BackStackMode.NONE,
launchSingleTop = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
package com.wire.android.feature.cells.ui.recyclebin

import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
Expand All @@ -30,6 +33,7 @@ import com.wire.android.feature.cells.R
import com.wire.android.feature.cells.ui.CellFilesNavArgs
import com.wire.android.feature.cells.ui.CellScreenContent
import com.wire.android.feature.cells.ui.CellViewModel
import com.wire.android.feature.cells.ui.common.Breadcrumbs
import com.wire.android.feature.cells.ui.destinations.ConversationFilesWithSlideInTransitionScreenDestination
import com.wire.android.feature.cells.ui.destinations.MoveToFolderScreenDestination
import com.wire.android.feature.cells.ui.destinations.PublicLinkScreenDestination
Expand Down Expand Up @@ -57,20 +61,31 @@ fun RecycleBinScreen(
Box(modifier = modifier) {
WireScaffold(
topBar = {
WireCenterAlignedTopAppBar(
elevation = dimensions().spacing0x,
titleContent = {
WireTopAppBarTitle(
title = stringResource(R.string.recycle_bin),
style = MaterialTheme.wireTypography.title01,
maxLines = 2
Column {
WireCenterAlignedTopAppBar(
elevation = dimensions().spacing0x,
titleContent = {
WireTopAppBarTitle(
title = stringResource(R.string.recycle_bin),
style = MaterialTheme.wireTypography.title01,
maxLines = 2
)
},
navigationIconType = NavigationIconType.Close(com.wire.android.ui.common.R.string.content_description_close),
onNavigationPressed = {
navigator.navigateBack()
}
)
cellViewModel.breadcrumbs()?.let {
Breadcrumbs(
modifier = Modifier
.height(dimensions().spacing40x)
.fillMaxWidth(),
pathSegments = it,
onBreadcrumbsFolderClick = {}
)
},
navigationIconType = NavigationIconType.Close(com.wire.android.ui.common.R.string.content_description_close),
onNavigationPressed = {
navigator.navigateBack()
}
)
}
}
) { innerPadding ->
Box(modifier = Modifier.padding(innerPadding)) {
Expand All @@ -92,7 +107,10 @@ fun RecycleBinScreen(
ConversationFilesWithSlideInTransitionScreenDestination(
conversationId = folderPath,
screenTitle = it.name,
isRecycleBin = true
isRecycleBin = true,
breadcrumbs = it.name?.let { name ->
(cellViewModel.breadcrumbs() ?: emptyArray()) + name
}
),
BackStackMode.NONE,
launchSingleTop = false
Expand Down