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: Remove Reset Session for MLS conversations [WPB-10426] 🍒 #3304

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 @@ -453,7 +453,7 @@ fun ConversationScreen(
is ConversationDetailsData.Group ->
navigator.navigate(NavigationCommand(GroupConversationDetailsScreenDestination(conversationId)))

ConversationDetailsData.None -> { /* do nothing */
is ConversationDetailsData.None -> { /* do nothing */
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,10 @@ fun PreviewConversationScreenTopAppBarLongTitle() {
conversationName = UIText.DynamicString(
"This is some very very very very very very very very very very long conversation title"
),
conversationDetailsData = ConversationDetailsData.Group(QualifiedID("", "")),
conversationDetailsData = ConversationDetailsData.Group(
conversationProtocol = null,
conversationId = QualifiedID("", "")
),
conversationAvatar = ConversationAvatar.OneOne(null, UserAvailabilityStatus.NONE),
),
onBackButtonClick = {},
Expand All @@ -276,7 +279,10 @@ fun PreviewConversationScreenTopAppBarLongTitleWithSearch() {
conversationName = UIText.DynamicString(
"This is some very very very very very very very very very very long conversation title"
),
conversationDetailsData = ConversationDetailsData.Group(QualifiedID("", "")),
conversationDetailsData = ConversationDetailsData.Group(
conversationProtocol = null,
conversationId = QualifiedID("", "")
),
conversationAvatar = ConversationAvatar.OneOne(null, UserAvailabilityStatus.NONE),
),
onBackButtonClick = {},
Expand All @@ -301,7 +307,10 @@ fun PreviewConversationScreenTopAppBarLongTitleWithSearchAndOngoingCall() {
conversationName = UIText.DynamicString(
"This is some very very very very very very very very very very long conversation title"
),
conversationDetailsData = ConversationDetailsData.Group(QualifiedID("", "")),
conversationDetailsData = ConversationDetailsData.Group(
conversationProtocol = null,
conversationId = QualifiedID("", "")
),
conversationAvatar = ConversationAvatar.OneOne(null, UserAvailabilityStatus.NONE),
),
onBackButtonClick = {},
Expand All @@ -325,7 +334,7 @@ fun PreviewConversationScreenTopAppBarShortTitle() {
ConversationInfoViewState(
conversationId = ConversationId("value", "domain"),
conversationName = UIText.DynamicString("Short title"),
conversationDetailsData = ConversationDetailsData.Group(conversationId),
conversationDetailsData = ConversationDetailsData.Group(null, conversationId),
conversationAvatar = ConversationAvatar.Group(conversationId)
),
onBackButtonClick = {},
Expand All @@ -349,7 +358,7 @@ fun PreviewConversationScreenTopAppBarShortTitleWithOngoingCall() {
ConversationInfoViewState(
conversationId = ConversationId("value", "domain"),
conversationName = UIText.DynamicString("Short title"),
conversationDetailsData = ConversationDetailsData.Group(conversationId),
conversationDetailsData = ConversationDetailsData.Group(null, conversationId),
conversationAvatar = ConversationAvatar.Group(conversationId)
),
onBackButtonClick = {},
Expand All @@ -373,7 +382,7 @@ fun PreviewConversationScreenTopAppBarShortTitleWithVerified() {
ConversationInfoViewState(
conversationId = ConversationId("value", "domain"),
conversationName = UIText.DynamicString("Short title"),
conversationDetailsData = ConversationDetailsData.Group(conversationId),
conversationDetailsData = ConversationDetailsData.Group(null, conversationId),
conversationAvatar = ConversationAvatar.Group(conversationId),
protocolInfo = Conversation.ProtocolInfo.Proteus,
proteusVerificationStatus = Conversation.VerificationStatus.VERIFIED,
Expand All @@ -400,7 +409,7 @@ fun PreviewConversationScreenTopAppBarShortTitleWithLegalHold() {
ConversationInfoViewState(
conversationId = ConversationId("value", "domain"),
conversationName = UIText.DynamicString("Short title"),
conversationDetailsData = ConversationDetailsData.Group(conversationId),
conversationDetailsData = ConversationDetailsData.Group(null, conversationId),
conversationAvatar = ConversationAvatar.Group(conversationId),
protocolInfo = Conversation.ProtocolInfo.Proteus,
legalHoldStatus = Conversation.LegalHoldStatus.ENABLED,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,16 +133,21 @@ class ConversationInfoViewModel @Inject constructor(

private fun getConversationDetailsData(conversationDetails: ConversationDetails) =
when (conversationDetails) {
is ConversationDetails.Group -> ConversationDetailsData.Group(conversationDetails.conversation.id)
is ConversationDetails.Group -> ConversationDetailsData.Group(
conversationDetails.conversation.protocol,
conversationDetails.conversation.id
)

is ConversationDetails.OneOne -> ConversationDetailsData.OneOne(
conversationProtocol = conversationDetails.conversation.protocol,
otherUserId = conversationDetails.otherUser.id,
otherUserName = conversationDetails.otherUser.name,
connectionState = conversationDetails.otherUser.connectionStatus,
isBlocked = conversationDetails.otherUser.connectionStatus == ConnectionState.BLOCKED,
isDeleted = conversationDetails.otherUser.deleted
)

else -> ConversationDetailsData.None
else -> ConversationDetailsData.None(conversationDetails.conversation.protocol)
}

private fun getConversationAvatar(conversationDetails: ConversationDetails) =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import com.wire.kalium.logic.data.user.UserId
data class ConversationInfoViewState(
val conversationId: QualifiedID,
val conversationName: UIText = UIText.DynamicString(""),
val conversationDetailsData: ConversationDetailsData = ConversationDetailsData.None,
val conversationDetailsData: ConversationDetailsData = ConversationDetailsData.None(null),
val conversationAvatar: ConversationAvatar = ConversationAvatar.None,
val hasUserPermissionToEdit: Boolean = false,
val conversationType: Conversation.Type = Conversation.Type.ONE_ON_ONE,
Expand All @@ -44,17 +44,21 @@ data class ConversationInfoViewState(
}
}

sealed class ConversationDetailsData {
data object None : ConversationDetailsData()
sealed class ConversationDetailsData(open val conversationProtocol: Conversation.ProtocolInfo?) {
data class None(override val conversationProtocol: Conversation.ProtocolInfo?) : ConversationDetailsData(conversationProtocol)
data class OneOne(
override val conversationProtocol: Conversation.ProtocolInfo?,
val otherUserId: UserId,
val otherUserName: String?,
val connectionState: ConnectionState,
val isBlocked: Boolean,
val isDeleted: Boolean
) : ConversationDetailsData()
) : ConversationDetailsData(conversationProtocol)

data class Group(val conversationId: QualifiedID) : ConversationDetailsData()
data class Group(
override val conversationProtocol: Conversation.ProtocolInfo?,
val conversationId: QualifiedID
) : ConversationDetailsData(conversationProtocol)
}

sealed class ConversationAvatar {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ private fun AssetMessagesListContent(
is UIMessage.Regular -> {
MessageContainerItem(
message = message,
conversationDetailsData = ConversationDetailsData.None,
conversationDetailsData = ConversationDetailsData.None(null),
audioMessagesState = audioMessagesState,
assetStatus = assetStatuses[message.header.messageId]?.transferStatus,
onLongClicked = { },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ import com.wire.android.util.CustomTabsHelper
import com.wire.android.util.EMPTY
import com.wire.android.util.ui.PreviewMultipleThemes
import com.wire.android.util.ui.UIText
import com.wire.kalium.logic.data.conversation.Conversation
import com.wire.kalium.logic.data.user.UserId
import kotlinx.collections.immutable.persistentListOf
import kotlinx.collections.immutable.persistentMapOf
Expand Down Expand Up @@ -228,7 +229,8 @@ private fun SingleUserDeliveryFailure(
internal fun MessageDecryptionFailure(
messageHeader: MessageHeader,
decryptionStatus: MessageFlowStatus.Failure.Decryption,
onResetSessionClicked: (senderUserId: UserId, clientId: String?) -> Unit
onResetSessionClicked: (senderUserId: UserId, clientId: String?) -> Unit,
conversationProtocol: Conversation.ProtocolInfo?
) {
val context = LocalContext.current
val learnMoreUrl = stringResource(R.string.url_decryption_failure_learn_more)
Expand All @@ -251,6 +253,9 @@ internal fun MessageDecryptionFailure(
text = stringResource(R.string.label_learn_more)
)
VerticalSpace.x4()

if (conversationProtocol !is Conversation.ProtocolInfo.Proteus) return@Column

Text(
text = stringResource(R.string.label_message_decryption_failure_informative_message),
style = LocalTextStyle.current,
Expand Down Expand Up @@ -362,7 +367,12 @@ fun PreviewMessageSendFailureWarningWithInteractionDisabled() {
@Composable
fun PreviewMessageDecryptionFailure() {
WireTheme {
MessageDecryptionFailure(mockHeader, MessageFlowStatus.Failure.Decryption(false)) { _, _ -> }
MessageDecryptionFailure(
mockHeader,
MessageFlowStatus.Failure.Decryption(false),
{ _, _ -> },
Conversation.ProtocolInfo.Proteus
)
}
}

Expand Down
Loading
Loading