From 7ba55d97d5d8aa5ba6c41728b63a01867106abf4 Mon Sep 17 00:00:00 2001 From: Karol Kosek Date: Mon, 19 Oct 2020 22:05:13 +0200 Subject: [PATCH] Update pleroma status cache on reaction --- .../java/com/keylesspalace/tusky/appstore/CacheUpdater.kt | 4 ++++ app/src/main/java/com/keylesspalace/tusky/db/TimelineDao.kt | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/app/src/main/java/com/keylesspalace/tusky/appstore/CacheUpdater.kt b/app/src/main/java/com/keylesspalace/tusky/appstore/CacheUpdater.kt index d0da9091..2b3a9b72 100644 --- a/app/src/main/java/com/keylesspalace/tusky/appstore/CacheUpdater.kt +++ b/app/src/main/java/com/keylesspalace/tusky/appstore/CacheUpdater.kt @@ -32,6 +32,10 @@ class CacheUpdater @Inject constructor( timelineDao.removeAllByUser(accountId, event.accountId) is StatusDeletedEvent -> timelineDao.delete(accountId, event.statusId) + is EmojiReactEvent -> { + val pleromaString = gson.toJson(event.newStatus.pleroma) + timelineDao.setPleroma(accountId, event.newStatus.id, pleromaString) + } is PollVoteEvent -> { val pollString = gson.toJson(event.poll) timelineDao.setVoted(accountId, event.statusId, pollString) diff --git a/app/src/main/java/com/keylesspalace/tusky/db/TimelineDao.kt b/app/src/main/java/com/keylesspalace/tusky/db/TimelineDao.kt index a4880141..1c9f4e13 100644 --- a/app/src/main/java/com/keylesspalace/tusky/db/TimelineDao.kt +++ b/app/src/main/java/com/keylesspalace/tusky/db/TimelineDao.kt @@ -104,4 +104,8 @@ AND serverId = :statusId""") @Query("""UPDATE TimelineStatusEntity SET poll = :poll WHERE timelineUserId = :accountId AND (serverId = :statusId OR reblogServerId = :statusId)""") abstract fun setVoted(accountId: Long, statusId: String, poll: String) + + @Query("""UPDATE TimelineStatusEntity SET pleroma = :pleroma +WHERE timelineUserId = :accountId AND (serverId = :statusId OR reblogServerId = :statusId)""") + abstract fun setPleroma(accountId: Long, statusId: String, pleroma: String) } \ No newline at end of file