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
This commit is contained in:
Godfrain Jacques 2023-12-21 11:49:55 -08:00 committed by GitHub
parent 39095cc737
commit 69f872f130
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 16 additions and 1 deletions

View File

@ -56,6 +56,7 @@ proc delete*(self: Controller) =
proc init*(self: Controller) = proc init*(self: Controller) =
self.events.on(SIGNAL_LOAD_RECENT_STICKERS_DONE) do(e: Args): self.events.on(SIGNAL_LOAD_RECENT_STICKERS_DONE) do(e: Args):
self.delegate.clearStickers()
let args = StickersArgs(e) let args = StickersArgs(e)
for sticker in args.stickers: for sticker in args.stickers:
self.delegate.addRecentStickerToList(sticker) self.delegate.addRecentStickerToList(sticker)

View File

@ -42,6 +42,9 @@ method obtainMarketStickerPacks*(self: AccessInterface) {.base.} =
method addRecentStickerToList*(self: AccessInterface, sticker: StickerDto) {.base.} = method addRecentStickerToList*(self: AccessInterface, sticker: StickerDto) {.base.} =
raise newException(ValueError, "No implementation available") raise newException(ValueError, "No implementation available")
method clearStickers*(self: AccessInterface) {.base.} =
raise newException(ValueError, "No implementation available")
method clearStickerPacks*(self: AccessInterface) {.base.} = method clearStickerPacks*(self: AccessInterface) {.base.} =
raise newException(ValueError, "No implementation available") raise newException(ValueError, "No implementation available")

View File

@ -45,6 +45,11 @@ QtObject:
StickerRoles.PackId.int:"packId" StickerRoles.PackId.int:"packId"
}.toTable }.toTable
proc clear*(self: StickerList) =
self.beginResetModel()
self.stickers = @[]
self.endResetModel()
proc addStickerToList*(self: StickerList, sticker: Item) = proc addStickerToList*(self: StickerList, sticker: Item) =
if(self.stickers.any(proc(existingSticker: Item): bool = return existingSticker.getHash == sticker.getHash)): if(self.stickers.any(proc(existingSticker: Item): bool = return existingSticker.getHash == sticker.getHash)):
return return

View File

@ -232,6 +232,9 @@ method getInstalledStickerPacks*(self: Module) =
method clearStickerPacks*(self: Module) = method clearStickerPacks*(self: Module) =
self.view.clearStickerPacks() self.view.clearStickerPacks()
method clearStickers*(self: Module) =
self.view.clearStickers()
method allPacksLoaded*(self: Module) = method allPacksLoaded*(self: Module) =
self.view.allPacksLoaded() self.view.allPacksLoaded()

View File

@ -74,6 +74,9 @@ QtObject:
proc installedStickerPacksUpdated*(self: View) {.signal.} proc installedStickerPacksUpdated*(self: View) {.signal.}
proc clearStickers*(self: View) =
self.recentStickers.clear()
proc clearStickerPacks*(self: View) = proc clearStickerPacks*(self: View) =
self.stickerPacks.clear() self.stickerPacks.clear()

2
vendor/status-go vendored

@ -1 +1 @@
Subproject commit 8cbdc807584d2c88186d7f43664183738dc86ef6 Subproject commit 29ade0f817051fe4ba2a6995a8ac20c509877d97