From 3986839801283abd9278360404e7739c8d6989ee Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 18 Oct 2019 14:25:19 +0200 Subject: [PATCH 1/6] Inject userId --- .../room/model/relation/RelationService.kt | 6 ++---- .../internal/crypto/keysbackup/KeysBackup.kt | 18 ++++++++---------- .../room/relation/DefaultRelationService.kt | 9 ++++----- .../relation/FindReactionEventForUndoTask.kt | 11 ++++++----- .../room/relation/UpdateQuickReactionTask.kt | 15 ++++++++------- .../home/room/detail/RoomDetailViewModel.kt | 4 ++-- 6 files changed, 30 insertions(+), 33 deletions(-) diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/model/relation/RelationService.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/model/relation/RelationService.kt index c6a58eeec1..14f730c2ba 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/model/relation/RelationService.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/model/relation/RelationService.kt @@ -60,11 +60,9 @@ interface RelationService { * Undo a reaction (emoji) to the targetedEvent. * @param reaction the reaction (preferably emoji) * @param targetEventId the id of the event being reacted - * @param myUserId used to know if a reaction event was made by the user */ fun undoReaction(reaction: String, - targetEventId: String, - myUserId: String) // : Cancelable + targetEventId: String) : Cancelable /** * Edit a text message body. Limited to "m.text" contentType @@ -92,7 +90,7 @@ interface RelationService { compatibilityBodyText: String = "* $newBodyText"): Cancelable /** - * Get's the edit history of the given event + * Get the edit history of the given event */ fun fetchEditHistory(eventId: String, callback: MatrixCallback>) diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/keysbackup/KeysBackup.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/keysbackup/KeysBackup.kt index a66d50dfad..51c3527042 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/keysbackup/KeysBackup.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/keysbackup/KeysBackup.kt @@ -50,6 +50,7 @@ import im.vector.matrix.android.internal.crypto.model.OlmInboundGroupSessionWrap import im.vector.matrix.android.internal.crypto.store.IMXCryptoStore import im.vector.matrix.android.internal.crypto.store.db.model.KeysBackupDataEntity import im.vector.matrix.android.internal.di.MoshiProvider +import im.vector.matrix.android.internal.di.UserId import im.vector.matrix.android.internal.extensions.foldToCallback import im.vector.matrix.android.internal.session.SessionScope import im.vector.matrix.android.internal.task.Task @@ -77,6 +78,7 @@ import kotlin.random.Random @SessionScope internal class KeysBackup @Inject constructor( + @UserId private val userId: String, private val credentials: Credentials, private val cryptoStore: IMXCryptoStore, private val olmDevice: MXOlmDevice, @@ -375,8 +377,6 @@ internal class KeysBackup @Inject constructor( */ @WorkerThread private fun getKeysBackupTrustBg(keysBackupVersion: KeysVersionResult): KeysBackupVersionTrust { - val myUserId = credentials.userId - val keysBackupVersionTrust = KeysBackupVersionTrust() val authData = keysBackupVersion.getAuthDataAsMegolmBackupAuthData() @@ -388,7 +388,7 @@ internal class KeysBackup @Inject constructor( return keysBackupVersionTrust } - val mySigs = authData.signatures?.get(myUserId) + val mySigs = authData.signatures?.get(userId) if (mySigs.isNullOrEmpty()) { Timber.v("getKeysBackupTrust: Ignoring key backup because it lacks any signatures from this user") return keysBackupVersionTrust @@ -403,7 +403,7 @@ internal class KeysBackup @Inject constructor( } if (deviceId != null) { - val device = cryptoStore.getUserDevice(deviceId, myUserId) + val device = cryptoStore.getUserDevice(deviceId, userId) var isSignatureValid = false if (device == null) { @@ -450,10 +450,8 @@ internal class KeysBackup @Inject constructor( } else { GlobalScope.launch(coroutineDispatchers.main) { val updateKeysBackupVersionBody = withContext(coroutineDispatchers.crypto) { - val myUserId = credentials.userId - // Get current signatures, or create an empty set - val myUserSignatures = authData.signatures?.get(myUserId)?.toMutableMap() + val myUserSignatures = authData.signatures?.get(userId)?.toMutableMap() ?: HashMap() if (trust) { @@ -462,7 +460,7 @@ internal class KeysBackup @Inject constructor( val deviceSignatures = objectSigner.signObject(canonicalJson) - deviceSignatures[myUserId]?.forEach { entry -> + deviceSignatures[userId]?.forEach { entry -> myUserSignatures[entry.key] = entry.value } } else { @@ -478,7 +476,7 @@ internal class KeysBackup @Inject constructor( val newMegolmBackupAuthData = authData.copy() val newSignatures = newMegolmBackupAuthData.signatures!!.toMutableMap() - newSignatures[myUserId] = myUserSignatures + newSignatures[userId] = myUserSignatures newMegolmBackupAuthData.signatures = newSignatures @@ -1411,5 +1409,5 @@ internal class KeysBackup @Inject constructor( * DEBUG INFO * ========================================================================================== */ - override fun toString() = "KeysBackup for ${credentials.userId}" + override fun toString() = "KeysBackup for $userId" } diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/room/relation/DefaultRelationService.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/room/relation/DefaultRelationService.kt index 6abc7ed60e..9f6500ce51 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/room/relation/DefaultRelationService.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/room/relation/DefaultRelationService.kt @@ -75,13 +75,13 @@ internal class DefaultRelationService @AssistedInject constructor(@Assisted priv return CancelableWork(context, sendRelationWork.id) } - override fun undoReaction(reaction: String, targetEventId: String, myUserId: String)/*: Cancelable*/ { + override fun undoReaction(reaction: String, targetEventId: String): Cancelable { val params = FindReactionEventForUndoTask.Params( roomId, targetEventId, - reaction, - myUserId + reaction ) + // TODO We should avoid using MatrixCallback internally val callback = object : MatrixCallback { override fun onSuccess(data: FindReactionEventForUndoTask.Result) { if (data.redactEventId == null) { @@ -89,7 +89,6 @@ internal class DefaultRelationService @AssistedInject constructor(@Assisted priv // TODO? } data.redactEventId?.let { toRedact -> - val redactEvent = eventFactory.createRedactEvent(roomId, toRedact, null).also { saveLocalEcho(it) } @@ -99,7 +98,7 @@ internal class DefaultRelationService @AssistedInject constructor(@Assisted priv } } } - findReactionEventForUndoTask + return findReactionEventForUndoTask .configureWith(params) { this.retryCount = Int.MAX_VALUE this.callback = callback diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/room/relation/FindReactionEventForUndoTask.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/room/relation/FindReactionEventForUndoTask.kt index 997ed18492..d1abf93c21 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/room/relation/FindReactionEventForUndoTask.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/room/relation/FindReactionEventForUndoTask.kt @@ -20,6 +20,7 @@ import im.vector.matrix.android.internal.database.model.EventAnnotationsSummaryE import im.vector.matrix.android.internal.database.model.EventEntity import im.vector.matrix.android.internal.database.model.ReactionAggregatedSummaryEntityFields import im.vector.matrix.android.internal.database.query.where +import im.vector.matrix.android.internal.di.UserId import im.vector.matrix.android.internal.task.Task import io.realm.Realm import javax.inject.Inject @@ -29,8 +30,7 @@ internal interface FindReactionEventForUndoTask : Task - getReactionToRedact(realm, params.reaction, params.eventId, params.myUserId)?.eventId + getReactionToRedact(realm, params.reaction, params.eventId)?.eventId } return FindReactionEventForUndoTask.Result(eventId) } - private fun getReactionToRedact(realm: Realm, reaction: String, eventId: String, userId: String): EventEntity? { + private fun getReactionToRedact(realm: Realm, reaction: String, eventId: String): EventEntity? { val summary = EventAnnotationsSummaryEntity.where(realm, eventId).findFirst() if (summary != null) { summary.reactionsSummary.where() diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/room/relation/UpdateQuickReactionTask.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/room/relation/UpdateQuickReactionTask.kt index e4b71c0d42..6ec316e9a4 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/room/relation/UpdateQuickReactionTask.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/room/relation/UpdateQuickReactionTask.kt @@ -20,6 +20,7 @@ import im.vector.matrix.android.internal.database.model.EventAnnotationsSummaryE import im.vector.matrix.android.internal.database.model.EventEntity import im.vector.matrix.android.internal.database.model.ReactionAggregatedSummaryEntityFields import im.vector.matrix.android.internal.database.query.where +import im.vector.matrix.android.internal.di.UserId import im.vector.matrix.android.internal.task.Task import io.realm.Realm import javax.inject.Inject @@ -30,8 +31,7 @@ internal interface UpdateQuickReactionTask : Task?>? = null monarchy.doWithRealm { realm -> - res = updateQuickReaction(realm, params.reaction, params.oppositeReaction, params.eventId, params.myUserId) + res = updateQuickReaction(realm, params.reaction, params.oppositeReaction, params.eventId) } return UpdateQuickReactionTask.Result(res?.first, res?.second ?: emptyList()) } - private fun updateQuickReaction(realm: Realm, reaction: String, oppositeReaction: String, eventId: String, myUserId: String): Pair?> { + private fun updateQuickReaction(realm: Realm, reaction: String, oppositeReaction: String, eventId: String): Pair?> { // the emoji reaction has been selected, we need to check if we have reacted it or not val existingSummary = EventAnnotationsSummaryEntity.where(realm, eventId).findFirst() ?: return Pair(reaction, null) @@ -68,7 +69,7 @@ internal class DefaultUpdateQuickReactionTask @Inject constructor(private val mo val toRedact = aggregationForOppositeReaction?.sourceEvents?.mapNotNull { // find source event val entity = EventEntity.where(realm, it).findFirst() - if (entity?.sender == myUserId) entity.eventId else null + if (entity?.sender == userId) entity.eventId else null } return Pair(reaction, toRedact) } else { @@ -77,7 +78,7 @@ internal class DefaultUpdateQuickReactionTask @Inject constructor(private val mo val toRedact = aggregationForReaction.sourceEvents.mapNotNull { // find source event val entity = EventEntity.where(realm, it).findFirst() - if (entity?.sender == myUserId) entity.eventId else null + if (entity?.sender == userId) entity.eventId else null } return Pair(null, toRedact) } diff --git a/vector/src/main/java/im/vector/riotx/features/home/room/detail/RoomDetailViewModel.kt b/vector/src/main/java/im/vector/riotx/features/home/room/detail/RoomDetailViewModel.kt index 7db9fc41d5..9eb11d2019 100644 --- a/vector/src/main/java/im/vector/riotx/features/home/room/detail/RoomDetailViewModel.kt +++ b/vector/src/main/java/im/vector/riotx/features/home/room/detail/RoomDetailViewModel.kt @@ -454,14 +454,14 @@ class RoomDetailViewModel @AssistedInject constructor(@Assisted initialState: Ro } private fun handleUndoReact(action: RoomDetailActions.UndoReaction) { - room.undoReaction(action.key, action.targetEventId, session.myUserId) + room.undoReaction(action.key, action.targetEventId) } private fun handleUpdateQuickReaction(action: RoomDetailActions.UpdateQuickReactAction) { if (action.add) { room.sendReaction(action.selectedReaction, action.targetEventId) } else { - room.undoReaction(action.selectedReaction, action.targetEventId, session.myUserId) + room.undoReaction(action.selectedReaction, action.targetEventId) } } From eff04be2473f1daa20efc64bab93a17cf8547275 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 18 Oct 2019 14:26:24 +0200 Subject: [PATCH 2/6] Change order of class (no effect) --- .../vector/riotx/features/home/room/detail/RoomDetailActions.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vector/src/main/java/im/vector/riotx/features/home/room/detail/RoomDetailActions.kt b/vector/src/main/java/im/vector/riotx/features/home/room/detail/RoomDetailActions.kt index d42af3e50a..ac1e1df51a 100644 --- a/vector/src/main/java/im/vector/riotx/features/home/room/detail/RoomDetailActions.kt +++ b/vector/src/main/java/im/vector/riotx/features/home/room/detail/RoomDetailActions.kt @@ -31,8 +31,8 @@ sealed class RoomDetailActions { data class TimelineEventTurnsInvisible(val event: TimelineEvent) : RoomDetailActions() data class LoadMoreTimelineEvents(val direction: Timeline.Direction) : RoomDetailActions() data class SendReaction(val reaction: String, val targetEventId: String) : RoomDetailActions() - data class RedactAction(val targetEventId: String, val reason: String? = "") : RoomDetailActions() data class UndoReaction(val targetEventId: String, val key: String, val reason: String? = "") : RoomDetailActions() + data class RedactAction(val targetEventId: String, val reason: String? = "") : RoomDetailActions() data class UpdateQuickReactAction(val targetEventId: String, val selectedReaction: String, val add: Boolean) : RoomDetailActions() data class NavigateToEvent(val eventId: String, val highlight: Boolean) : RoomDetailActions() data class SetReadMarkerAction(val eventId: String) : RoomDetailActions() From be94b2f90ae66b2e2e377aa203dc7721e40530fb Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 18 Oct 2019 14:28:12 +0200 Subject: [PATCH 3/6] Change order of parameters (no effect) --- .../riotx/features/home/room/detail/RoomDetailActions.kt | 2 +- .../riotx/features/home/room/detail/RoomDetailFragment.kt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/vector/src/main/java/im/vector/riotx/features/home/room/detail/RoomDetailActions.kt b/vector/src/main/java/im/vector/riotx/features/home/room/detail/RoomDetailActions.kt index ac1e1df51a..91614d5d74 100644 --- a/vector/src/main/java/im/vector/riotx/features/home/room/detail/RoomDetailActions.kt +++ b/vector/src/main/java/im/vector/riotx/features/home/room/detail/RoomDetailActions.kt @@ -30,7 +30,7 @@ sealed class RoomDetailActions { data class TimelineEventTurnsVisible(val event: TimelineEvent) : RoomDetailActions() data class TimelineEventTurnsInvisible(val event: TimelineEvent) : RoomDetailActions() data class LoadMoreTimelineEvents(val direction: Timeline.Direction) : RoomDetailActions() - data class SendReaction(val reaction: String, val targetEventId: String) : RoomDetailActions() + data class SendReaction(val targetEventId: String, val reaction: String) : RoomDetailActions() data class UndoReaction(val targetEventId: String, val key: String, val reason: String? = "") : RoomDetailActions() data class RedactAction(val targetEventId: String, val reason: String? = "") : RoomDetailActions() data class UpdateQuickReactAction(val targetEventId: String, val selectedReaction: String, val add: Boolean) : RoomDetailActions() diff --git a/vector/src/main/java/im/vector/riotx/features/home/room/detail/RoomDetailFragment.kt b/vector/src/main/java/im/vector/riotx/features/home/room/detail/RoomDetailFragment.kt index 6907af9ff6..f09fbff09f 100644 --- a/vector/src/main/java/im/vector/riotx/features/home/room/detail/RoomDetailFragment.kt +++ b/vector/src/main/java/im/vector/riotx/features/home/room/detail/RoomDetailFragment.kt @@ -420,7 +420,7 @@ class RoomDetailFragment : val eventId = data.getStringExtra(EmojiReactionPickerActivity.EXTRA_EVENT_ID) ?: return val reaction = data.getStringExtra(EmojiReactionPickerActivity.EXTRA_REACTION_RESULT) ?: return // TODO check if already reacted with that? - roomDetailViewModel.process(RoomDetailActions.SendReaction(reaction, eventId)) + roomDetailViewModel.process(RoomDetailActions.SendReaction(eventId, reaction)) } } } @@ -909,7 +909,7 @@ class RoomDetailFragment : override fun onClickOnReactionPill(informationData: MessageInformationData, reaction: String, on: Boolean) { if (on) { // we should test the current real state of reaction on this event - roomDetailViewModel.process(RoomDetailActions.SendReaction(reaction, informationData.eventId)) + roomDetailViewModel.process(RoomDetailActions.SendReaction(informationData.eventId, reaction)) } else { // I need to redact a reaction roomDetailViewModel.process(RoomDetailActions.UndoReaction(informationData.eventId, reaction)) From 8078c39d6ed53d30b11e3de2c3588efc8dab65ab Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 18 Oct 2019 14:29:32 +0200 Subject: [PATCH 4/6] Rename parameter --- .../vector/riotx/features/home/room/detail/RoomDetailActions.kt | 2 +- .../riotx/features/home/room/detail/RoomDetailViewModel.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/vector/src/main/java/im/vector/riotx/features/home/room/detail/RoomDetailActions.kt b/vector/src/main/java/im/vector/riotx/features/home/room/detail/RoomDetailActions.kt index 91614d5d74..d032182994 100644 --- a/vector/src/main/java/im/vector/riotx/features/home/room/detail/RoomDetailActions.kt +++ b/vector/src/main/java/im/vector/riotx/features/home/room/detail/RoomDetailActions.kt @@ -31,7 +31,7 @@ sealed class RoomDetailActions { data class TimelineEventTurnsInvisible(val event: TimelineEvent) : RoomDetailActions() data class LoadMoreTimelineEvents(val direction: Timeline.Direction) : RoomDetailActions() data class SendReaction(val targetEventId: String, val reaction: String) : RoomDetailActions() - data class UndoReaction(val targetEventId: String, val key: String, val reason: String? = "") : RoomDetailActions() + data class UndoReaction(val targetEventId: String, val reaction: String, val reason: String? = "") : RoomDetailActions() data class RedactAction(val targetEventId: String, val reason: String? = "") : RoomDetailActions() data class UpdateQuickReactAction(val targetEventId: String, val selectedReaction: String, val add: Boolean) : RoomDetailActions() data class NavigateToEvent(val eventId: String, val highlight: Boolean) : RoomDetailActions() diff --git a/vector/src/main/java/im/vector/riotx/features/home/room/detail/RoomDetailViewModel.kt b/vector/src/main/java/im/vector/riotx/features/home/room/detail/RoomDetailViewModel.kt index 9eb11d2019..58cfb97b87 100644 --- a/vector/src/main/java/im/vector/riotx/features/home/room/detail/RoomDetailViewModel.kt +++ b/vector/src/main/java/im/vector/riotx/features/home/room/detail/RoomDetailViewModel.kt @@ -454,7 +454,7 @@ class RoomDetailViewModel @AssistedInject constructor(@Assisted initialState: Ro } private fun handleUndoReact(action: RoomDetailActions.UndoReaction) { - room.undoReaction(action.key, action.targetEventId) + room.undoReaction(action.reaction, action.targetEventId) } private fun handleUpdateQuickReaction(action: RoomDetailActions.UpdateQuickReactAction) { From 17636019e045cdc820d24a977e02b219df72b32d Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 18 Oct 2019 14:32:34 +0200 Subject: [PATCH 5/6] Change order of parameters --- .../session/room/model/relation/RelationService.kt | 12 ++++++------ .../session/room/relation/DefaultRelationService.kt | 4 ++-- .../android/api/pushrules/PushrulesConditionTest.kt | 2 +- .../features/home/room/detail/RoomDetailViewModel.kt | 8 ++++---- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/model/relation/RelationService.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/model/relation/RelationService.kt index 14f730c2ba..5af5183dfa 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/model/relation/RelationService.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/model/relation/RelationService.kt @@ -50,19 +50,19 @@ interface RelationService { /** * Sends a reaction (emoji) to the targetedEvent. - * @param reaction the reaction (preferably emoji) * @param targetEventId the id of the event being reacted + * @param reaction the reaction (preferably emoji) */ - fun sendReaction(reaction: String, - targetEventId: String): Cancelable + fun sendReaction(targetEventId: String, + reaction: String): Cancelable /** * Undo a reaction (emoji) to the targetedEvent. - * @param reaction the reaction (preferably emoji) * @param targetEventId the id of the event being reacted + * @param reaction the reaction (preferably emoji) */ - fun undoReaction(reaction: String, - targetEventId: String) : Cancelable + fun undoReaction(targetEventId: String, + reaction: String): Cancelable /** * Edit a text message body. Limited to "m.text" contentType diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/room/relation/DefaultRelationService.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/room/relation/DefaultRelationService.kt index 9f6500ce51..68669171c7 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/room/relation/DefaultRelationService.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/room/relation/DefaultRelationService.kt @@ -65,7 +65,7 @@ internal class DefaultRelationService @AssistedInject constructor(@Assisted priv fun create(roomId: String): RelationService } - override fun sendReaction(reaction: String, targetEventId: String): Cancelable { + override fun sendReaction(targetEventId: String, reaction: String): Cancelable { val event = eventFactory.createReactionEvent(roomId, targetEventId, reaction) .also { saveLocalEcho(it) @@ -75,7 +75,7 @@ internal class DefaultRelationService @AssistedInject constructor(@Assisted priv return CancelableWork(context, sendRelationWork.id) } - override fun undoReaction(reaction: String, targetEventId: String): Cancelable { + override fun undoReaction(targetEventId: String, reaction: String): Cancelable { val params = FindReactionEventForUndoTask.Params( roomId, targetEventId, diff --git a/matrix-sdk-android/src/test/java/im/vector/matrix/android/api/pushrules/PushrulesConditionTest.kt b/matrix-sdk-android/src/test/java/im/vector/matrix/android/api/pushrules/PushrulesConditionTest.kt index 36aded79ad..c7543c3a50 100644 --- a/matrix-sdk-android/src/test/java/im/vector/matrix/android/api/pushrules/PushrulesConditionTest.kt +++ b/matrix-sdk-android/src/test/java/im/vector/matrix/android/api/pushrules/PushrulesConditionTest.kt @@ -330,7 +330,7 @@ class PushrulesConditionTest { TODO("not implemented") // To change body of created functions use File | Settings | File Templates. } - override fun sendReaction(reaction: String, targetEventId: String): Cancelable { + override fun sendReaction(targetEventId: String, reaction: String): Cancelable { TODO("not implemented") // To change body of created functions use File | Settings | File Templates. } diff --git a/vector/src/main/java/im/vector/riotx/features/home/room/detail/RoomDetailViewModel.kt b/vector/src/main/java/im/vector/riotx/features/home/room/detail/RoomDetailViewModel.kt index 58cfb97b87..57a2c76f61 100644 --- a/vector/src/main/java/im/vector/riotx/features/home/room/detail/RoomDetailViewModel.kt +++ b/vector/src/main/java/im/vector/riotx/features/home/room/detail/RoomDetailViewModel.kt @@ -445,7 +445,7 @@ class RoomDetailViewModel @AssistedInject constructor(@Assisted initialState: Ro } private fun handleSendReaction(action: RoomDetailActions.SendReaction) { - room.sendReaction(action.reaction, action.targetEventId) + room.sendReaction(action.targetEventId, action.reaction) } private fun handleRedactEvent(action: RoomDetailActions.RedactAction) { @@ -454,14 +454,14 @@ class RoomDetailViewModel @AssistedInject constructor(@Assisted initialState: Ro } private fun handleUndoReact(action: RoomDetailActions.UndoReaction) { - room.undoReaction(action.reaction, action.targetEventId) + room.undoReaction(action.targetEventId, action.reaction) } private fun handleUpdateQuickReaction(action: RoomDetailActions.UpdateQuickReactAction) { if (action.add) { - room.sendReaction(action.selectedReaction, action.targetEventId) + room.sendReaction(action.targetEventId, action.selectedReaction) } else { - room.undoReaction(action.selectedReaction, action.targetEventId) + room.undoReaction(action.targetEventId, action.selectedReaction) } } From cd0a40c18dbb69d20978ce59db9f0634e67935b7 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 18 Oct 2019 14:34:44 +0200 Subject: [PATCH 6/6] Fix compil test issue --- .../matrix/android/api/pushrules/PushrulesConditionTest.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/matrix-sdk-android/src/test/java/im/vector/matrix/android/api/pushrules/PushrulesConditionTest.kt b/matrix-sdk-android/src/test/java/im/vector/matrix/android/api/pushrules/PushrulesConditionTest.kt index c7543c3a50..b2e2bfbf5f 100644 --- a/matrix-sdk-android/src/test/java/im/vector/matrix/android/api/pushrules/PushrulesConditionTest.kt +++ b/matrix-sdk-android/src/test/java/im/vector/matrix/android/api/pushrules/PushrulesConditionTest.kt @@ -334,7 +334,7 @@ class PushrulesConditionTest { TODO("not implemented") // To change body of created functions use File | Settings | File Templates. } - override fun undoReaction(reaction: String, targetEventId: String, myUserId: String) { + override fun undoReaction(targetEventId: String, reaction: String): Cancelable { TODO("not implemented") // To change body of created functions use File | Settings | File Templates. }