Skip to content

Commit

Permalink
fix: do not show confirmation dialogs when unarchiving conversations
Browse files Browse the repository at this point in the history
  • Loading branch information
gongracr committed Oct 5, 2023
1 parent 2553247 commit 2194fb7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ import com.wire.android.ui.home.conversationslist.model.ConversationItem
import com.wire.android.ui.home.conversationslist.model.ConversationsSource
import com.wire.android.ui.home.conversationslist.model.DialogState
import com.wire.android.ui.home.conversationslist.model.GroupDialogState
import com.wire.android.ui.home.conversationslist.model.isArchive
import com.wire.android.ui.home.conversationslist.search.SearchConversationScreen
import com.wire.android.util.extension.openAppInfoScreen
import com.wire.kalium.logic.data.id.ConversationId
Expand Down Expand Up @@ -119,6 +120,16 @@ fun ConversationRouterHomeBridge(
}
}

fun showConfirmationDialogOrUnarchive(): (DialogState) -> Unit {
return { dialogState ->
if (dialogState.isArchived) {
viewModel.moveConversationToArchive(dialogState)
} else {
conversationRouterHomeState.archiveConversationDialogState.show(dialogState)
}
}
}

with(conversationRouterHomeState) {
fun openConversationBottomSheet(
conversationItem: ConversationItem,
Expand Down Expand Up @@ -156,7 +167,7 @@ fun ConversationRouterHomeBridge(
},
addConversationToFavourites = viewModel::addConversationToFavourites,
moveConversationToFolder = viewModel::moveConversationToFolder,
updateConversationArchiveStatus = archiveConversationDialogState::show,
updateConversationArchiveStatus = showConfirmationDialogOrUnarchive(),
clearConversationContent = clearContentDialogState::show,
blockUser = blockUserDialogState::show,
unblockUser = unblockUserDialogState::show,
Expand Down Expand Up @@ -201,6 +212,7 @@ fun ConversationRouterHomeBridge(
ConversationItemType.ALL_CONVERSATIONS ->
AllConversationScreenContent(
conversations = foldersWithConversations,
isFromArchive = conversationsSource.isArchive(),
hasNoConversations = hasNoConversations,
onEditConversation = onEditConversationItem,
onOpenConversationNotificationsSettings = onEditNotifications,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,5 @@ enum class ConversationsSource {
MAIN,
ARCHIVE
}

fun ConversationsSource.isArchive(): Boolean = this == ConversationsSource.ARCHIVE

0 comments on commit 2194fb7

Please sign in to comment.