fix: `packId` is a string in NIM backend

fixes the currently selected sticker pack not being highlighted in the
popup footer

The strict equality operator would no longer yield true here:
```
property int selectedPackId
...
selected: stickerPackListView.selectedPackId === packId
```
This commit is contained in:
Lukáš Tinkl 2023-04-12 12:31:35 +02:00 committed by Lukáš Tinkl
parent 56633f6ce3
commit 8d322092cf
4 changed files with 18 additions and 21 deletions

View File

@ -11,7 +11,7 @@ import shared.panels 1.0
StatusGridView {
id: root
property int packId: -1
property string packId
property var stickerGrid
visible: count > 0
anchors.fill: parent
@ -19,7 +19,7 @@ StatusGridView {
cellHeight: 88
model: stickerList
focus: true
signal stickerClicked(string hash, int packId, string url)
signal stickerClicked(string hash, string packId, string url)
delegate: Item {
width: root.cellWidth
height: root.cellHeight

View File

@ -21,14 +21,14 @@ Item {
property var store
property var stickerPacks: StickerPackData {}
property int packId: -1
property string packId
signal backClicked
signal uninstallClicked(int packId)
signal installClicked(var stickers, int packId, int index)
signal cancelClicked(int packId)
signal updateClicked(int packId)
signal buyClicked(int packId)
signal uninstallClicked(string packId)
signal installClicked(var stickers, string packId, int index)
signal cancelClicked(string packId)
signal updateClicked(string packId)
signal buyClicked(string packId)
StatusGridView {
id: availableStickerPacks

View File

@ -18,7 +18,7 @@ import "../../../app/AppLayouts/Chat/stores"
ModalPopup {
id: stickerPackDetailsPopup
property int packId: -1
property string packId
property var store
property string thumbnail: ""
@ -29,7 +29,7 @@ ModalPopup {
property bool bought: false;
property bool pending: false;
property var stickers;
signal buyClicked(int packId)
signal buyClicked(string packId)
Component.onCompleted: {
const idx = stickersModule.stickerPacks.findIndexById(packId, false);
@ -126,7 +126,7 @@ ModalPopup {
isBought: bought
isPending: pending
greyedOut: store.networkConnectionStore.stickersNetworkAvailable
tooltip.text: root.store.networkConnectionStore.stickersNetworkUnavailableText
tooltip.text: store.networkConnectionStore.stickersNetworkUnavailableText
onInstallClicked: {
stickersModule.install(packId);
stickerPackDetailsPopup.close();

View File

@ -66,7 +66,7 @@ Popup {
onAboutToShow: {
d.getInstalledStickerPacks()
if (stickerGrid.packId == -1) {
if (!stickerGrid.packId) {
d.getRecentStickers()
}
}
@ -197,7 +197,7 @@ Popup {
StyledText {
id: lblNoRecentStickers
visible: stickerPackListView.selectedPackId === -1 && stickersModule.recent.rowCount() === 0 && !lblNoStickersYet.visible
visible: !stickerPackListView.selectedPackId && stickersModule.recent.rowCount() === 0 && !lblNoStickersYet.visible
anchors.fill: parent
font.pixelSize: 15
text: qsTr("Recently used stickers will appear here")
@ -275,36 +275,33 @@ Popup {
highlighted: true
onClicked: {
highlighted = true
stickerPackListView.selectedPackId = -1
stickerPackListView.selectedPackId = ""
d.getRecentStickers()
stickerGrid.model = d.recentStickers
}
}
StatusScrollView {
height: 40
Layout.fillWidth: true
Layout.fillHeight: true
ScrollBar.vertical.policy: ScrollBar.AlwaysOff
RowLayout {
spacing: Style.current.padding
spacing: footerContent.spacing
Repeater {
id: stickerPackListView
property int selectedPackId: -1
property string selectedPackId
model: d.stickerPackList
visible: d.stickerPacksLoaded
delegate: StatusStickerPackIconWithIndicator {
id: packIconWithIndicator
visible: installed
width: 24
height: 24
Layout.preferredWidth: 24
Layout.preferredHeight: 24
selected: stickerPackListView.selectedPackId === packId
source: thumbnail
Layout.preferredHeight: height
Layout.preferredWidth: width
onClicked: {
btnHistory.highlighted = false
stickerPackListView.selectedPackId = packId