From 11ebab094b6440d20ecf4564daa80a844e45051b Mon Sep 17 00:00:00 2001 From: Maxime NATUREL Date: Mon, 2 May 2022 12:24:30 +0200 Subject: [PATCH] Fixing aggregation and adding debug logs --- .../EventRelationsAggregationProcessor.kt | 20 +++++-------------- ...DefaultLiveLocationAggregationProcessor.kt | 3 +++ 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/EventRelationsAggregationProcessor.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/EventRelationsAggregationProcessor.kt index 62f7282e44..753dd149ae 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/EventRelationsAggregationProcessor.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/EventRelationsAggregationProcessor.kt @@ -173,29 +173,24 @@ internal class EventRelationsAggregationProcessor @Inject constructor( EventType.KEY_VERIFICATION_START, EventType.KEY_VERIFICATION_MAC, EventType.KEY_VERIFICATION_READY, - EventType.KEY_VERIFICATION_KEY -> { + EventType.KEY_VERIFICATION_KEY -> { Timber.v("## SAS REF in room $roomId for event ${event.eventId}") encryptedEventContent.relatesTo.eventId?.let { handleVerification(realm, event, roomId, isLocalEcho, it) } } - in EventType.POLL_RESPONSE -> { + in EventType.POLL_RESPONSE -> { event.getClearContent().toModel(catchError = true)?.let { handleResponse(realm, event, it, roomId, isLocalEcho, event.getRelationContent()?.eventId) } } - in EventType.POLL_END -> { + in EventType.POLL_END -> { event.content.toModel(catchError = true)?.let { handleEndPoll(realm, event, it, roomId, isLocalEcho) } } - in EventType.STATE_ROOM_BEACON_INFO -> { - event.content.toModel(catchError = true)?.let { - liveLocationAggregationProcessor.handleBeaconInfo(realm, event, it, roomId, isLocalEcho) - } - } - in EventType.BEACON_LOCATION_DATA -> { - event.content.toModel(catchError = true)?.let { + in EventType.BEACON_LOCATION_DATA -> { + event.getClearContent().toModel(catchError = true)?.let { liveLocationAggregationProcessor.handleBeaconLocationData(realm, event, it, roomId, isLocalEcho) } } @@ -262,11 +257,6 @@ internal class EventRelationsAggregationProcessor @Inject constructor( liveLocationAggregationProcessor.handleBeaconInfo(realm, event, it, roomId, isLocalEcho) } } - in EventType.BEACON_LOCATION_DATA -> { - event.content.toModel(catchError = true)?.let { - liveLocationAggregationProcessor.handleBeaconLocationData(realm, event, it, roomId, isLocalEcho) - } - } else -> Timber.v("UnHandled event ${event.eventId}") } } catch (t: Throwable) { diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/aggregation/livelocation/DefaultLiveLocationAggregationProcessor.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/aggregation/livelocation/DefaultLiveLocationAggregationProcessor.kt index 1f3db32fcf..5c34b3b5de 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/aggregation/livelocation/DefaultLiveLocationAggregationProcessor.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/aggregation/livelocation/DefaultLiveLocationAggregationProcessor.kt @@ -54,6 +54,8 @@ internal class DefaultLiveLocationAggregationProcessor @Inject constructor() : L eventId = targetEventId ) + Timber.d("updating summary of id=$targetEventId with isLive=${content.isLive}") + aggregatedSummary.endOfLiveTimestampAsMilliseconds = content.getBestTimestampMillis()?.let { it + (content.timeout ?: 0) } aggregatedSummary.isActive = content.isLive } @@ -83,6 +85,7 @@ internal class DefaultLiveLocationAggregationProcessor @Inject constructor() : L ?: 0 if (updatedLocationTimestamp.isMoreRecentThan(currentLocationTimestamp)) { + Timber.d("set last location of summary with id=$targetEventId to ${content.getBestLocationInfo()}") aggregatedSummary.lastLocationContent = ContentMapper.map(content.toContent()) } }