-
Notifications
You must be signed in to change notification settings - Fork 6
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
feat: Update conversation Proteus verification status (WPB-1789) #2157
Changes from 7 commits
551cbd8
1feeac9
be4775d
240203d
8c01cf4
db2b45b
bcfa5a7
ca7540b
c44dd41
83f97e8
9fe06f0
9488aa9
1c5ee36
d149e33
4f9df40
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,11 @@ | |
|
||
package com.wire.kalium.logic.data.conversation | ||
|
||
import com.wire.kalium.logic.data.conversation.Conversation.Access | ||
import com.wire.kalium.logic.data.conversation.Conversation.AccessRole | ||
import com.wire.kalium.logic.data.conversation.Conversation.ProtocolInfo | ||
import com.wire.kalium.logic.data.conversation.Conversation.ReceiptMode | ||
import com.wire.kalium.logic.data.conversation.Conversation.Type | ||
import com.wire.kalium.logic.data.id.ConversationId | ||
import com.wire.kalium.logic.data.id.GroupID | ||
import com.wire.kalium.logic.data.id.PlainId | ||
|
@@ -71,7 +76,8 @@ data class Conversation( | |
val userMessageTimer: Duration?, | ||
val archived: Boolean, | ||
val archivedDateTime: Instant?, | ||
val verificationStatus: VerificationStatus | ||
val mlsVerificationStatus: VerificationStatus, | ||
val proteusVerificationStatus: VerificationStatus | ||
) { | ||
|
||
companion object { | ||
|
@@ -269,6 +275,11 @@ data class Conversation( | |
) | ||
} | ||
|
||
data class ProteusVerificationData( | ||
val conversationId: ConversationId, | ||
val currentVerificationStatus: VerificationStatus, | ||
val isActuallyVerified: Boolean | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. question: what does this mean? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. so isn't better to store the new updated value then return the aggregated value? still I think it's confusing that we're returning two values that one is kinda out dated. |
||
) | ||
} | ||
|
||
sealed class ConversationDetails(open val conversation: Conversation) { | ||
|
@@ -327,7 +338,8 @@ sealed class ConversationDetails(open val conversation: Conversation) { | |
userMessageTimer = null, | ||
archived = false, | ||
archivedDateTime = null, | ||
verificationStatus = Conversation.VerificationStatus.NOT_VERIFIED | ||
mlsVerificationStatus = Conversation.VerificationStatus.NOT_VERIFIED, | ||
proteusVerificationStatus = Conversation.VerificationStatus.NOT_VERIFIED | ||
) | ||
) | ||
} | ||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -248,7 +248,7 @@ interface ConversationRepository { | |||||
domain: String | ||||||
): Either<CoreFailure, OneOnOneMembers> | ||||||
|
||||||
suspend fun updateVerificationStatus( | ||||||
suspend fun updateMlsVerificationStatus( | ||||||
verificationStatus: Conversation.VerificationStatus, | ||||||
conversationID: ConversationId | ||||||
): Either<CoreFailure, Unit> | ||||||
|
@@ -281,6 +281,14 @@ interface ConversationRepository { | |||||
* @return **true** if the protocol was changed or **false** if the protocol was unchanged. | ||||||
*/ | ||||||
suspend fun updateProtocolLocally(conversationId: ConversationId, protocol: Conversation.Protocol): Either<CoreFailure, Boolean> | ||||||
|
||||||
suspend fun getConversationsProteusVerificationDataByClientId( | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
clientId: ClientId | ||||||
): Either<StorageFailure, List<Conversation.ProteusVerificationData>> | ||||||
|
||||||
suspend fun updateProteusVerificationStatuses( | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
statusesToUpdate: Map<QualifiedID, Conversation.VerificationStatus> | ||||||
): Either<StorageFailure, Unit> | ||||||
} | ||||||
|
||||||
@Suppress("LongParameterList", "TooManyFunctions", "LargeClass") | ||||||
|
@@ -963,12 +971,12 @@ internal class ConversationDataSource internal constructor( | |||||
.mapValues { it.value.toModel() } | ||||||
} | ||||||
|
||||||
override suspend fun updateVerificationStatus( | ||||||
override suspend fun updateMlsVerificationStatus( | ||||||
verificationStatus: Conversation.VerificationStatus, | ||||||
conversationID: ConversationId | ||||||
): Either<CoreFailure, Unit> = | ||||||
wrapStorageRequest { | ||||||
conversationDAO.updateVerificationStatus( | ||||||
conversationDAO.updateMlsVerificationStatus( | ||||||
conversationMapper.verificationStatusToEntity(verificationStatus), | ||||||
conversationID.toDao() | ||||||
) | ||||||
|
@@ -990,6 +998,22 @@ internal class ConversationDataSource internal constructor( | |||||
conversationApi.sendTypingIndicatorNotification(conversationId.toApi(), typingStatus.toStatusDto()) | ||||||
} | ||||||
|
||||||
override suspend fun updateProteusVerificationStatuses( | ||||||
statusesToUpdate: Map<QualifiedID, Conversation.VerificationStatus> | ||||||
): Either<StorageFailure, Unit> = | ||||||
wrapStorageRequest { | ||||||
conversationDAO.updateProteusVerificationStatuses( | ||||||
statusesToUpdate.mapKeys { (conversationId, _) -> conversationId.toDao() } | ||||||
.mapValues { (_, verificationStatus) -> conversationMapper.verificationStatusToEntity(verificationStatus) } | ||||||
) | ||||||
} | ||||||
|
||||||
override suspend fun getConversationsProteusVerificationDataByClientId( | ||||||
clientId: ClientId | ||||||
): Either<StorageFailure, List<Conversation.ProteusVerificationData>> = | ||||||
wrapStorageRequest { conversationDAO.getConversationsProteusVerificationDataByClientId(clientId.value) } | ||||||
.map { list -> list.map { conversationMapper.fromDaoModelToProteusVerificationData(it) } } | ||||||
|
||||||
private suspend fun persistIncompleteConversations( | ||||||
conversationsFailed: List<NetworkQualifiedId> | ||||||
): Either<CoreFailure, Unit> { | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: