Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: selection lost on update of share conversation list [#WPB-14911] #3804

Merged
merged 2 commits into from
Jan 16, 2025
Merged
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 @@ -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
Loading