From e4ffc897d756f044df8ea495b6ca5db9ef373bad Mon Sep 17 00:00:00 2001 From: Richard Ramos Date: Wed, 16 Sep 2020 13:17:00 -0400 Subject: [PATCH] fix: code review + reset sticker pack pending state --- src/app/chat/event_handling.nim | 2 ++ src/app/chat/view.nim | 3 +++ ui/app/AppLayouts/Chat/components/StickerButton.qml | 3 ++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/app/chat/event_handling.nim b/src/app/chat/event_handling.nim index 32122a5d85..da476b1e8f 100644 --- a/src/app/chat/event_handling.nim +++ b/src/app/chat/event_handling.nim @@ -80,6 +80,8 @@ proc handleChatEvents(self: ChatController) = self.view.transactionCompleted(tx.success, tx.transactionHash, tx.revertReason) if tx.success: self.view.installStickerPack(tx.data.parseInt) + else: + self.view.resetStickerPackBuyAttempt(tx.data.parseInt) proc handleMailserverEvents(self: ChatController) = self.status.events.on("mailserverTopics") do(e: Args): diff --git a/src/app/chat/view.nim b/src/app/chat/view.nim index 7b1e629614..8a0f228eae 100644 --- a/src/app/chat/view.nim +++ b/src/app/chat/view.nim @@ -269,6 +269,9 @@ QtObject: proc installStickerPack*(self: ChatsView, packId: int) {.slot.} = self.status.stickers.installStickerPack(packId) 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.} = self.status.stickers.uninstallStickerPack(packId) diff --git a/ui/app/AppLayouts/Chat/components/StickerButton.qml b/ui/app/AppLayouts/Chat/components/StickerButton.qml index 48fd1ad1d6..3a652cb6cd 100644 --- a/ui/app/AppLayouts/Chat/components/StickerButton.qml +++ b/ui/app/AppLayouts/Chat/components/StickerButton.qml @@ -242,7 +242,8 @@ Item { id: mouseArea anchors.fill: parent acceptedButtons: Qt.LeftButton | Qt.RightButton - cursorShape: root.isPending ? Qt.ArrowCursor : Qt.PointingHandCursor + enabled: !root.isPending + cursorShape: Qt.PointingHandCursor onClicked: { if (root.isPending) return; if (root.isInstalled) return root.uninstallClicked();