mirror of
https://github.com/vector-im/element-android.git
synced 2024-11-16 02:05:06 +08:00
Merge pull request #1084 from vector-im/feature/room_key_share_crash
Fix crash after rework. RoomKeyShare is now an interface
This commit is contained in:
commit
9c7f5251b0
@ -19,7 +19,6 @@ package im.vector.matrix.android.internal.crypto
|
||||
import im.vector.matrix.android.api.auth.data.Credentials
|
||||
import im.vector.matrix.android.api.session.crypto.keyshare.RoomKeysRequestListener
|
||||
import im.vector.matrix.android.api.session.events.model.Event
|
||||
import im.vector.matrix.android.api.session.events.model.toModel
|
||||
import im.vector.matrix.android.internal.crypto.model.rest.RoomKeyShare
|
||||
import im.vector.matrix.android.internal.crypto.store.IMXCryptoStore
|
||||
import im.vector.matrix.android.internal.session.SessionScope
|
||||
@ -51,11 +50,10 @@ internal class IncomingRoomKeyRequestManager @Inject constructor(
|
||||
* @param event the announcement event.
|
||||
*/
|
||||
fun onRoomKeyRequestEvent(event: Event) {
|
||||
val roomKeyShare = event.getClearContent().toModel<RoomKeyShare>()
|
||||
when (roomKeyShare?.action) {
|
||||
when (val roomKeyShareAction = event.getClearContent()?.get("action") as? String) {
|
||||
RoomKeyShare.ACTION_SHARE_REQUEST -> IncomingRoomKeyRequest.fromEvent(event)?.let { receivedRoomKeyRequests.add(it) }
|
||||
RoomKeyShare.ACTION_SHARE_CANCELLATION -> IncomingRoomKeyRequestCancellation.fromEvent(event)?.let { receivedRoomKeyRequestCancellations.add(it) }
|
||||
else -> Timber.e("## onRoomKeyRequestEvent() : unsupported action ${roomKeyShare?.action}")
|
||||
else -> Timber.e("## onRoomKeyRequestEvent() : unsupported action $roomKeyShareAction")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,6 @@ package im.vector.matrix.android.internal.crypto.model.rest
|
||||
|
||||
import com.squareup.moshi.Json
|
||||
import com.squareup.moshi.JsonClass
|
||||
import im.vector.matrix.android.internal.crypto.model.rest.RoomKeyShare.Companion.ACTION_SHARE_CANCELLATION
|
||||
|
||||
/**
|
||||
* Class representing a room key request cancellation content
|
||||
@ -25,7 +24,7 @@ import im.vector.matrix.android.internal.crypto.model.rest.RoomKeyShare.Companio
|
||||
@JsonClass(generateAdapter = true)
|
||||
internal data class RoomKeyShareCancellation(
|
||||
@Json(name = "action")
|
||||
override val action: String? = ACTION_SHARE_CANCELLATION,
|
||||
override val action: String? = RoomKeyShare.ACTION_SHARE_CANCELLATION,
|
||||
|
||||
@Json(name = "requesting_device_id")
|
||||
override val requestingDeviceId: String? = null,
|
||||
|
Loading…
Reference in New Issue
Block a user