Fix some crypto realm issues

This commit is contained in:
ganfra 2019-12-05 17:14:56 +01:00
parent aa9d66b991
commit eb9775e307
2 changed files with 3 additions and 1 deletions

View File

@ -643,9 +643,10 @@ internal class RealmCryptoStore(private val realmConfiguration: RealmConfigurati
}
override fun getOutgoingRoomKeyRequestByState(states: Set<OutgoingRoomKeyRequest.RequestState>): OutgoingRoomKeyRequest? {
val statesIndex = states.map { it.ordinal }.toTypedArray()
return doRealmQueryAndCopy(realmConfiguration) {
it.where<OutgoingRoomKeyRequestEntity>()
.`in`(OutgoingRoomKeyRequestEntityFields.STATE, states.map { it.ordinal }.toTypedArray())
.`in`(OutgoingRoomKeyRequestEntityFields.STATE, statesIndex)
.findFirst()
}
?.toOutgoingRoomKeyRequest()

View File

@ -41,6 +41,7 @@ internal open class OutgoingRoomKeyRequestEntity(
* Convert to OutgoingRoomKeyRequest
*/
fun toOutgoingRoomKeyRequest(): OutgoingRoomKeyRequest {
val cancellationTxnId = this.cancellationTxnId
return OutgoingRoomKeyRequest(
RoomKeyRequestBody().apply {
algorithm = requestBodyAlgorithm