From 7821ca12fdb599422a4c43aa16e4f6451f129834 Mon Sep 17 00:00:00 2001 From: Valere Date: Mon, 24 Jun 2019 10:12:11 +0200 Subject: [PATCH] Fix / fetch from realm without copy (proxy error) --- .../internal/session/notification/DefaultPushRuleService.kt | 3 ++- .../matrix/android/internal/session/room/DefaultRoom.kt | 6 ++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/notification/DefaultPushRuleService.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/notification/DefaultPushRuleService.kt index b2a6b9b1..eb828de2 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/notification/DefaultPushRuleService.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/notification/DefaultPushRuleService.kt @@ -30,6 +30,7 @@ import im.vector.matrix.android.internal.database.query.where import im.vector.matrix.android.internal.session.pushers.GetPushRulesTask import im.vector.matrix.android.internal.task.TaskExecutor import im.vector.matrix.android.internal.task.configureWith +import timber.log.Timber internal class DefaultPushRuleService( @@ -170,7 +171,7 @@ internal class DefaultPushRuleService( it.onMatchRule(event, Action.mapFrom(rule) ?: emptyList()) } } catch (e: Throwable) { - + Timber.e(e, "Error while dispatching bing") } } diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/room/DefaultRoom.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/room/DefaultRoom.kt index 68f5f892..3715e370 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/room/DefaultRoom.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/room/DefaultRoom.kt @@ -33,6 +33,7 @@ import im.vector.matrix.android.internal.database.mapper.asDomain import im.vector.matrix.android.internal.database.model.RoomSummaryEntity import im.vector.matrix.android.internal.database.model.RoomSummaryEntityFields import im.vector.matrix.android.internal.database.query.where +import im.vector.matrix.android.internal.util.fetchCopied internal class DefaultRoom( override val roomId: String, @@ -70,10 +71,7 @@ internal class DefaultRoom( override val roomSummary: RoomSummary? get() { - var sum: RoomSummaryEntity? = null - monarchy.runTransactionSync { - sum = RoomSummaryEntity.where(it, roomId).isNotEmpty(RoomSummaryEntityFields.DISPLAY_NAME).findFirst() - } + var sum: RoomSummaryEntity? = monarchy.fetchCopied { RoomSummaryEntity.where(it, roomId).isNotEmpty(RoomSummaryEntityFields.DISPLAY_NAME).findFirst() } return sum?.asDomain() }