diff --git a/matrix-sdk-android-rx/src/main/java/im/vector/matrix/rx/RxRoom.kt b/matrix-sdk-android-rx/src/main/java/im/vector/matrix/rx/RxRoom.kt index 42720fcaa5..7779bd1a0e 100644 --- a/matrix-sdk-android-rx/src/main/java/im/vector/matrix/rx/RxRoom.kt +++ b/matrix-sdk-android-rx/src/main/java/im/vector/matrix/rx/RxRoom.kt @@ -34,6 +34,7 @@ import im.vector.matrix.android.internal.crypto.model.CryptoDeviceInfo import io.reactivex.Observable import io.reactivex.Single import io.reactivex.functions.BiFunction +import timber.log.Timber class RxRoom(private val room: Room, private val session: Session) { @@ -41,6 +42,7 @@ class RxRoom(private val room: Room, private val session: Session) { val summaryObservable = room.getRoomSummaryLive() .asObservable() .startWith(room.roomSummary().toOptional()) + .doOnNext { Timber.d("RX: summary emitted for: ${it.getOrNull()?.roomId}") } val memberIdsChangeObservable = summaryObservable .map { @@ -54,6 +56,7 @@ class RxRoom(private val room: Room, private val session: Session) { } }.orEmpty() }.distinctUntilChanged() + .doOnNext { Timber.d("RX: memberIds emitted. Size: ${it.size}") } // Observe the device info of the users in the room val cryptoDeviceInfoObservable = memberIdsChangeObservable @@ -64,7 +67,10 @@ class RxRoom(private val room: Room, private val session: Session) { // If any key change, emit the userIds list membersIds } + .startWith(membersIds) + .doOnNext { Timber.d("RX: CryptoDeviceInfo emitted. Size: ${it.size}") } } + .doOnNext { Timber.d("RX: cryptoDeviceInfo emitted 2. Size: ${it.size}") } val roomEncryptionTrustLevelObservable = cryptoDeviceInfoObservable .map { userIds -> @@ -74,6 +80,7 @@ class RxRoom(private val room: Room, private val session: Session) { session.getCrossSigningService().getTrustLevelForUsers(userIds).toOptional() } } + .doOnNext { Timber.d("RX: roomEncryptionTrustLevel emitted: ${it.getOrNull()?.name}") } return Observable .combineLatest, Optional, Optional>( @@ -85,15 +92,18 @@ class RxRoom(private val room: Room, private val session: Session) { ).toOptional() } ) + .doOnNext { Timber.d("RX: final room summary emitted for ${it.getOrNull()?.roomId}") } } fun liveRoomMembers(queryParams: RoomMemberQueryParams): Observable> { val roomMembersObservable = room.getRoomMembersLive(queryParams).asObservable() .startWith(room.getRoomMembers(queryParams)) + .doOnNext { Timber.d("RX: room members emitted. Size: ${it.size}") } // TODO Do it only for room members of the room (switchMap) val cryptoDeviceInfoObservable = session.getLiveCryptoDeviceInfo().asObservable() .startWith(emptyList()) + .doOnNext { Timber.d("RX: cryptoDeviceInfo emitted. Size: ${it.size}") } return Observable .combineLatest, List, List>( @@ -112,6 +122,7 @@ class RxRoom(private val room: Room, private val session: Session) { } } ) + .doOnNext { Timber.d("RX: final room members emitted. Size: ${it.size}") } } fun liveAnnotationSummary(eventId: String): Observable> { diff --git a/matrix-sdk-android-rx/src/main/java/im/vector/matrix/rx/RxSession.kt b/matrix-sdk-android-rx/src/main/java/im/vector/matrix/rx/RxSession.kt index 0bddf8b685..705e8cf19f 100644 --- a/matrix-sdk-android-rx/src/main/java/im/vector/matrix/rx/RxSession.kt +++ b/matrix-sdk-android-rx/src/main/java/im/vector/matrix/rx/RxSession.kt @@ -34,15 +34,18 @@ import im.vector.matrix.android.internal.crypto.model.CryptoDeviceInfo import io.reactivex.Observable import io.reactivex.Single import io.reactivex.functions.BiFunction +import timber.log.Timber class RxSession(private val session: Session) { fun liveRoomSummaries(queryParams: RoomSummaryQueryParams): Observable> { val summariesObservable = session.getRoomSummariesLive(queryParams).asObservable() .startWith(session.getRoomSummaries(queryParams)) + .doOnNext { Timber.d("RX: summaries emitted: size: ${it.size}") } val cryptoDeviceInfoObservable = session.getLiveCryptoDeviceInfo().asObservable() .startWith(emptyList()) + .doOnNext { Timber.d("RX: crypto device info emitted: size: ${it.size}") } return Observable .combineLatest, List, List>( @@ -60,6 +63,7 @@ class RxSession(private val session: Session) { } } ) + .doOnNext { Timber.d("RX: final summaries emitted: size: ${it.size}") } } fun liveGroupSummaries(queryParams: GroupSummaryQueryParams): Observable> {