crypto-service: Use constants when we check the event type

This commit is contained in:
Damir Jelić 2021-06-16 13:21:37 +02:00
parent 5ad596c3bc
commit c0bac69733
1 changed files with 2 additions and 2 deletions

View File

@ -663,14 +663,14 @@ internal class DefaultCryptoService @Inject constructor(
// Notify the our listeners about room keys so decryption is retried. // Notify the our listeners about room keys so decryption is retried.
if (toDeviceEvents.events != null) { if (toDeviceEvents.events != null) {
toDeviceEvents.events.forEach { event -> toDeviceEvents.events.forEach { event ->
if (event.type == "m.room_key") { if (event.type == EventType.ROOM_KEY) {
val content = event.getClearContent().toModel<RoomKeyContent>() ?: return@forEach val content = event.getClearContent().toModel<RoomKeyContent>() ?: return@forEach
val roomId = content.sessionId ?: return@forEach val roomId = content.sessionId ?: return@forEach
val sessionId = content.sessionId val sessionId = content.sessionId
notifyRoomKeyReceival(roomId, sessionId) notifyRoomKeyReceival(roomId, sessionId)
} else if (event.type == "m.forwarded_room_key") { } else if (event.type == EventType.FORWARDED_ROOM_KEY) {
val content = event.getClearContent().toModel<ForwardedRoomKeyContent>() ?: return@forEach val content = event.getClearContent().toModel<ForwardedRoomKeyContent>() ?: return@forEach
val roomId = content.sessionId ?: return@forEach val roomId = content.sessionId ?: return@forEach