Skip to content

Commit

Permalink
fix: selection lost on update of share conversation list [#WPB-14911] (
Browse files Browse the repository at this point in the history
  • Loading branch information
sbakhtiarov authored Jan 16, 2025
1 parent cdfd79a commit f1eef77
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ fun ConversationList(
modifier: Modifier = Modifier,
lazyListState: LazyListState = rememberLazyListState(),
isSelectableList: Boolean = false,
selectedConversations: List<ConversationItem> = emptyList(),
selectedConversations: List<ConversationId> = emptyList(),
onOpenConversation: (ConversationItem) -> Unit = {},
onEditConversation: (ConversationItem) -> Unit = {},
onOpenUserProfile: (UserId) -> Unit = {},
Expand Down Expand Up @@ -116,7 +116,7 @@ fun ConversationList(
ConversationItemFactory(
conversation = item,
isSelectableItem = isSelectableList,
isChecked = selectedConversations.contains(item),
isChecked = selectedConversations.contains(item.conversationId),
onConversationSelectedOnRadioGroup = { onConversationSelectedOnRadioGroup(item) },
openConversation = onOpenConversation,
openMenu = onEditConversation,
Expand Down Expand Up @@ -283,6 +283,7 @@ fun PreviewConversationListSelect() = WireTheme {
ConversationList(
lazyPagingConversations = previewConversationFoldersFlow(list = conversationFolders).collectAsLazyPagingItems(),
isSelectableList = true,
selectedConversations = conversationFolders.filterIsInstance<ConversationItem>().filterIndexed { index, _ -> index % 3 == 0 },
selectedConversations = conversationFolders.filterIsInstance<ConversationItem>().filterIndexed { index, _ -> index % 3 == 0 }
.map { it.conversationId },
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ package com.wire.android.ui.sharing
import androidx.compose.runtime.Stable
import androidx.paging.PagingData
import com.wire.android.ui.home.conversationslist.model.ConversationFolderItem
import com.wire.android.ui.home.conversationslist.model.ConversationItem
import com.wire.kalium.logic.data.id.ConversationId
import com.wire.kalium.logic.data.message.SelfDeletionTimer
import kotlinx.collections.immutable.PersistentList
import kotlinx.collections.immutable.persistentListOf
Expand All @@ -33,7 +33,7 @@ data class ImportMediaAuthenticatedState(
val importedText: String? = null,
val isImporting: Boolean = false,
val conversations: Flow<PagingData<ConversationFolderItem>> = emptyFlow(),
val selectedConversationItem: List<ConversationItem> = persistentListOf(),
val selectedConversationItem: List<ConversationId> = persistentListOf(),
val selfDeletingTimer: SelfDeletionTimer = SelfDeletionTimer.Enabled(null)
) {
@Stable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ class ImportMediaAuthenticatedViewModel @Inject constructor(
viewModelScope.launch {
with(conversationItem) {
importMediaState = importMediaState.copy(
selectedConversationItem = listOf(this),
selectedConversationItem = listOf(this.conversationId),
selfDeletingTimer = observeSelfDeletionSettingsForConversation(
conversationId = conversationId,
considerSelfUserSettings = true
Expand Down Expand Up @@ -225,11 +225,11 @@ class ImportMediaAuthenticatedViewModel @Inject constructor(
selfDeletingTimer = SelfDeletionTimer.Enabled(selfDeletionDuration.value)
)
val logMap = importMediaState.selfDeletingTimer.toLogString(
"user timer update for conversationId=${it.conversationId.toLogString()} on ImportMediaScreen"
"user timer update for conversationId=${it.toLogString()} on ImportMediaScreen"
)
appLogger.d("$SELF_DELETION_LOG_TAG: $logMap")
persistNewSelfDeletionTimerUseCase(
conversationId = it.conversationId,
conversationId = it,
newSelfDeletionTimer = importMediaState.selfDeletingTimer
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ private fun ImportMediaAuthenticatedContent(
NavigationCommand(
ConversationScreenDestination(
ConversationNavArgs(
conversationId = conversationItem.conversationId,
conversationId = conversationItem,
pendingBundles = ArrayList(it),
pendingTextBundle = importedText
)
Expand Down

0 comments on commit f1eef77

Please sign in to comment.