From 69f872f1302c9e9af8ea912a61bf4e2899cd4b7a Mon Sep 17 00:00:00 2001 From: Godfrain Jacques Date: Thu, 21 Dec 2023 11:49:55 -0800 Subject: [PATCH] Fix recent stickers displayed after sticker packs are deleted (#13066) * fix(@desktop/stickers): Fix sticker showing uninstalled sticker pack fixes #12677 * chore: bump status-go --- src/app/modules/main/stickers/controller.nim | 1 + src/app/modules/main/stickers/io_interface.nim | 3 +++ src/app/modules/main/stickers/models/sticker_list.nim | 5 +++++ src/app/modules/main/stickers/module.nim | 3 +++ src/app/modules/main/stickers/view.nim | 3 +++ vendor/status-go | 2 +- 6 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/app/modules/main/stickers/controller.nim b/src/app/modules/main/stickers/controller.nim index a703df221b..4b4cecf4da 100644 --- a/src/app/modules/main/stickers/controller.nim +++ b/src/app/modules/main/stickers/controller.nim @@ -56,6 +56,7 @@ proc delete*(self: Controller) = proc init*(self: Controller) = self.events.on(SIGNAL_LOAD_RECENT_STICKERS_DONE) do(e: Args): + self.delegate.clearStickers() let args = StickersArgs(e) for sticker in args.stickers: self.delegate.addRecentStickerToList(sticker) diff --git a/src/app/modules/main/stickers/io_interface.nim b/src/app/modules/main/stickers/io_interface.nim index 279c0312ef..549fcf718d 100644 --- a/src/app/modules/main/stickers/io_interface.nim +++ b/src/app/modules/main/stickers/io_interface.nim @@ -42,6 +42,9 @@ method obtainMarketStickerPacks*(self: AccessInterface) {.base.} = method addRecentStickerToList*(self: AccessInterface, sticker: StickerDto) {.base.} = raise newException(ValueError, "No implementation available") +method clearStickers*(self: AccessInterface) {.base.} = + raise newException(ValueError, "No implementation available") + method clearStickerPacks*(self: AccessInterface) {.base.} = raise newException(ValueError, "No implementation available") diff --git a/src/app/modules/main/stickers/models/sticker_list.nim b/src/app/modules/main/stickers/models/sticker_list.nim index d1b7c28d02..076dd01c20 100644 --- a/src/app/modules/main/stickers/models/sticker_list.nim +++ b/src/app/modules/main/stickers/models/sticker_list.nim @@ -45,6 +45,11 @@ QtObject: StickerRoles.PackId.int:"packId" }.toTable + proc clear*(self: StickerList) = + self.beginResetModel() + self.stickers = @[] + self.endResetModel() + proc addStickerToList*(self: StickerList, sticker: Item) = if(self.stickers.any(proc(existingSticker: Item): bool = return existingSticker.getHash == sticker.getHash)): return diff --git a/src/app/modules/main/stickers/module.nim b/src/app/modules/main/stickers/module.nim index de58abb850..2f45811c0d 100644 --- a/src/app/modules/main/stickers/module.nim +++ b/src/app/modules/main/stickers/module.nim @@ -232,6 +232,9 @@ method getInstalledStickerPacks*(self: Module) = method clearStickerPacks*(self: Module) = self.view.clearStickerPacks() +method clearStickers*(self: Module) = + self.view.clearStickers() + method allPacksLoaded*(self: Module) = self.view.allPacksLoaded() diff --git a/src/app/modules/main/stickers/view.nim b/src/app/modules/main/stickers/view.nim index 2eeeca0e4d..ca89c8f613 100644 --- a/src/app/modules/main/stickers/view.nim +++ b/src/app/modules/main/stickers/view.nim @@ -74,6 +74,9 @@ QtObject: proc installedStickerPacksUpdated*(self: View) {.signal.} + proc clearStickers*(self: View) = + self.recentStickers.clear() + proc clearStickerPacks*(self: View) = self.stickerPacks.clear() diff --git a/vendor/status-go b/vendor/status-go index 8cbdc80758..29ade0f817 160000 --- a/vendor/status-go +++ b/vendor/status-go @@ -1 +1 @@ -Subproject commit 8cbdc807584d2c88186d7f43664183738dc86ef6 +Subproject commit 29ade0f817051fe4ba2a6995a8ac20c509877d97