From b6ac91580577eb945c992d7c139eb2adfec40078 Mon Sep 17 00:00:00 2001 From: Florian Renaud Date: Thu, 23 Feb 2023 17:43:39 +0100 Subject: [PATCH] Apply push rules on encrypted events --- .../android/sdk/api/session/pushrules/EventMatchCondition.kt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/pushrules/EventMatchCondition.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/pushrules/EventMatchCondition.kt index 15d5cd3153..9fdf848288 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/pushrules/EventMatchCondition.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/pushrules/EventMatchCondition.kt @@ -39,9 +39,8 @@ class EventMatchCondition( override fun technicalDescription() = "'$key' matches '$pattern'" fun isSatisfied(event: Event): Boolean { - // TODO encrypted events? - val rawJson = MoshiProvider.providesMoshi().adapter(Event::class.java).toJsonValue(event) as? Map<*, *> - ?: return false + val rawJson: Map<*, *> = event.mxDecryptionResult?.payload ?: MoshiProvider.providesMoshi().adapter(Event::class.java).toJsonValue(event) as? Map<*, *> + ?: return false val value = extractField(rawJson, key) ?: return false // The match is performed case-insensitively, and must match the entire value of