fix: code review + reset sticker pack pending state

This commit is contained in:
Richard Ramos 2020-09-16 13:17:00 -04:00 committed by Iuri Matias
parent d0bca7afa6
commit e4ffc897d7
3 changed files with 7 additions and 1 deletions

View File

@ -80,6 +80,8 @@ proc handleChatEvents(self: ChatController) =
self.view.transactionCompleted(tx.success, tx.transactionHash, tx.revertReason) self.view.transactionCompleted(tx.success, tx.transactionHash, tx.revertReason)
if tx.success: if tx.success:
self.view.installStickerPack(tx.data.parseInt) self.view.installStickerPack(tx.data.parseInt)
else:
self.view.resetStickerPackBuyAttempt(tx.data.parseInt)
proc handleMailserverEvents(self: ChatController) = proc handleMailserverEvents(self: ChatController) =
self.status.events.on("mailserverTopics") do(e: Args): self.status.events.on("mailserverTopics") do(e: Args):

View File

@ -270,6 +270,9 @@ QtObject:
self.status.stickers.installStickerPack(packId) self.status.stickers.installStickerPack(packId)
self.stickerPacks.updateStickerPackInList(packId, true, false) self.stickerPacks.updateStickerPackInList(packId, true, false)
proc resetStickerPackBuyAttempt*(self: ChatsView, packId: int) {.slot.} =
self.stickerPacks.updateStickerPackInList(packId, false, false)
proc uninstallStickerPack*(self: ChatsView, packId: int) {.slot.} = proc uninstallStickerPack*(self: ChatsView, packId: int) {.slot.} =
self.status.stickers.uninstallStickerPack(packId) self.status.stickers.uninstallStickerPack(packId)
self.status.stickers.removeRecentStickers(packId) self.status.stickers.removeRecentStickers(packId)

View File

@ -242,7 +242,8 @@ Item {
id: mouseArea id: mouseArea
anchors.fill: parent anchors.fill: parent
acceptedButtons: Qt.LeftButton | Qt.RightButton acceptedButtons: Qt.LeftButton | Qt.RightButton
cursorShape: root.isPending ? Qt.ArrowCursor : Qt.PointingHandCursor enabled: !root.isPending
cursorShape: Qt.PointingHandCursor
onClicked: { onClicked: {
if (root.isPending) return; if (root.isPending) return;
if (root.isInstalled) return root.uninstallClicked(); if (root.isInstalled) return root.uninstallClicked();