This commit is contained in:
Valere 2019-12-13 18:00:04 +01:00
parent ff5305ee66
commit 3727affc15
2 changed files with 8 additions and 7 deletions

View file

@ -33,7 +33,7 @@ internal interface RequestVerificationDMTask : Task<RequestVerificationDMTask.Pa
val cryptoService: CryptoService val cryptoService: CryptoService
) )
fun createParamsAndLocalEcho(roomId: String, from: String, methods: List<String>, to: String, cryptoService: CryptoService) : Params fun createParamsAndLocalEcho(roomId: String, from: String, methods: List<String>, to: String, cryptoService: CryptoService): Params
} }
internal class DefaultRequestVerificationDMTask @Inject constructor( internal class DefaultRequestVerificationDMTask @Inject constructor(
@ -44,7 +44,8 @@ internal class DefaultRequestVerificationDMTask @Inject constructor(
private val roomAPI: RoomAPI) private val roomAPI: RoomAPI)
: RequestVerificationDMTask { : RequestVerificationDMTask {
override fun createParamsAndLocalEcho(roomId: String, from: String, methods: List<String>, to: String, cryptoService: CryptoService): RequestVerificationDMTask.Params { override fun createParamsAndLocalEcho(roomId: String, from: String, methods: List<String>, to: String, cryptoService: CryptoService)
: RequestVerificationDMTask.Params {
val event = localEchoEventFactory.createVerificationRequest(roomId, from, to, methods) val event = localEchoEventFactory.createVerificationRequest(roomId, from, to, methods)
.also { localEchoEventFactory.saveLocalEcho(monarchy, it) } .also { localEchoEventFactory.saveLocalEcho(monarchy, it) }
return RequestVerificationDMTask.Params( return RequestVerificationDMTask.Params(
@ -52,6 +53,7 @@ internal class DefaultRequestVerificationDMTask @Inject constructor(
cryptoService cryptoService
) )
} }
override suspend fun execute(params: RequestVerificationDMTask.Params): SendResponse { override suspend fun execute(params: RequestVerificationDMTask.Params): SendResponse {
val event = handleEncryption(params) val event = handleEncryption(params)
val localID = event.eventId!! val localID = event.eventId!!

View file

@ -81,8 +81,6 @@ class VerificationItemFactory @Inject constructor(
when (event.root.getClearType()) { when (event.root.getClearType()) {
EventType.KEY_VERIFICATION_CANCEL -> { EventType.KEY_VERIFICATION_CANCEL -> {
// Is the request referenced is actually really cancelled? // Is the request referenced is actually really cancelled?
// if (referenceInformationData.referencesInfoData?.verificationStatus?.isCanceled() == false) return ignoredConclusion(event, highlight, callback)
val cancelContent = event.root.getClearContent().toModel<MessageVerificationCancelContent>() val cancelContent = event.root.getClearContent().toModel<MessageVerificationCancelContent>()
?: return ignoredConclusion(event, highlight, callback) ?: return ignoredConclusion(event, highlight, callback)
@ -110,12 +108,13 @@ class VerificationItemFactory @Inject constructor(
.highlighted(highlight) .highlighted(highlight)
.leftGuideline(avatarSizeProvider.leftGuideline) .leftGuideline(avatarSizeProvider.leftGuideline)
} }
else -> ignoredConclusion(event, highlight, callback) else -> ignoredConclusion(event, highlight, callback)
} }
} }
EventType.KEY_VERIFICATION_DONE -> { EventType.KEY_VERIFICATION_DONE -> {
// Is the request referenced is actually really completed? // Is the request referenced is actually really completed?
if (referenceInformationData.referencesInfoData?.verificationStatus != VerificationState.DONE) return ignoredConclusion(event, highlight, callback) if (referenceInformationData.referencesInfoData?.verificationStatus != VerificationState.DONE)
return ignoredConclusion(event, highlight, callback)
// We only tale the one sent by me // We only tale the one sent by me
if (informationData.sentByMe) { if (informationData.sentByMe) {