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:
parent
56633f6ce3
commit
8d322092cf
|
@ -11,7 +11,7 @@ import shared.panels 1.0
|
||||||
|
|
||||||
StatusGridView {
|
StatusGridView {
|
||||||
id: root
|
id: root
|
||||||
property int packId: -1
|
property string packId
|
||||||
property var stickerGrid
|
property var stickerGrid
|
||||||
visible: count > 0
|
visible: count > 0
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
@ -19,7 +19,7 @@ StatusGridView {
|
||||||
cellHeight: 88
|
cellHeight: 88
|
||||||
model: stickerList
|
model: stickerList
|
||||||
focus: true
|
focus: true
|
||||||
signal stickerClicked(string hash, int packId, string url)
|
signal stickerClicked(string hash, string packId, string url)
|
||||||
delegate: Item {
|
delegate: Item {
|
||||||
width: root.cellWidth
|
width: root.cellWidth
|
||||||
height: root.cellHeight
|
height: root.cellHeight
|
||||||
|
|
|
@ -21,14 +21,14 @@ Item {
|
||||||
|
|
||||||
property var store
|
property var store
|
||||||
property var stickerPacks: StickerPackData {}
|
property var stickerPacks: StickerPackData {}
|
||||||
property int packId: -1
|
property string packId
|
||||||
|
|
||||||
signal backClicked
|
signal backClicked
|
||||||
signal uninstallClicked(int packId)
|
signal uninstallClicked(string packId)
|
||||||
signal installClicked(var stickers, int packId, int index)
|
signal installClicked(var stickers, string packId, int index)
|
||||||
signal cancelClicked(int packId)
|
signal cancelClicked(string packId)
|
||||||
signal updateClicked(int packId)
|
signal updateClicked(string packId)
|
||||||
signal buyClicked(int packId)
|
signal buyClicked(string packId)
|
||||||
|
|
||||||
StatusGridView {
|
StatusGridView {
|
||||||
id: availableStickerPacks
|
id: availableStickerPacks
|
||||||
|
|
|
@ -18,7 +18,7 @@ import "../../../app/AppLayouts/Chat/stores"
|
||||||
ModalPopup {
|
ModalPopup {
|
||||||
id: stickerPackDetailsPopup
|
id: stickerPackDetailsPopup
|
||||||
|
|
||||||
property int packId: -1
|
property string packId
|
||||||
|
|
||||||
property var store
|
property var store
|
||||||
property string thumbnail: ""
|
property string thumbnail: ""
|
||||||
|
@ -29,7 +29,7 @@ ModalPopup {
|
||||||
property bool bought: false;
|
property bool bought: false;
|
||||||
property bool pending: false;
|
property bool pending: false;
|
||||||
property var stickers;
|
property var stickers;
|
||||||
signal buyClicked(int packId)
|
signal buyClicked(string packId)
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
const idx = stickersModule.stickerPacks.findIndexById(packId, false);
|
const idx = stickersModule.stickerPacks.findIndexById(packId, false);
|
||||||
|
@ -126,7 +126,7 @@ ModalPopup {
|
||||||
isBought: bought
|
isBought: bought
|
||||||
isPending: pending
|
isPending: pending
|
||||||
greyedOut: store.networkConnectionStore.stickersNetworkAvailable
|
greyedOut: store.networkConnectionStore.stickersNetworkAvailable
|
||||||
tooltip.text: root.store.networkConnectionStore.stickersNetworkUnavailableText
|
tooltip.text: store.networkConnectionStore.stickersNetworkUnavailableText
|
||||||
onInstallClicked: {
|
onInstallClicked: {
|
||||||
stickersModule.install(packId);
|
stickersModule.install(packId);
|
||||||
stickerPackDetailsPopup.close();
|
stickerPackDetailsPopup.close();
|
||||||
|
|
|
@ -66,7 +66,7 @@ Popup {
|
||||||
|
|
||||||
onAboutToShow: {
|
onAboutToShow: {
|
||||||
d.getInstalledStickerPacks()
|
d.getInstalledStickerPacks()
|
||||||
if (stickerGrid.packId == -1) {
|
if (!stickerGrid.packId) {
|
||||||
d.getRecentStickers()
|
d.getRecentStickers()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -197,7 +197,7 @@ Popup {
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
id: lblNoRecentStickers
|
id: lblNoRecentStickers
|
||||||
visible: stickerPackListView.selectedPackId === -1 && stickersModule.recent.rowCount() === 0 && !lblNoStickersYet.visible
|
visible: !stickerPackListView.selectedPackId && stickersModule.recent.rowCount() === 0 && !lblNoStickersYet.visible
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
font.pixelSize: 15
|
font.pixelSize: 15
|
||||||
text: qsTr("Recently used stickers will appear here")
|
text: qsTr("Recently used stickers will appear here")
|
||||||
|
@ -275,36 +275,33 @@ Popup {
|
||||||
highlighted: true
|
highlighted: true
|
||||||
onClicked: {
|
onClicked: {
|
||||||
highlighted = true
|
highlighted = true
|
||||||
stickerPackListView.selectedPackId = -1
|
stickerPackListView.selectedPackId = ""
|
||||||
d.getRecentStickers()
|
d.getRecentStickers()
|
||||||
stickerGrid.model = d.recentStickers
|
stickerGrid.model = d.recentStickers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
StatusScrollView {
|
StatusScrollView {
|
||||||
height: 40
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
ScrollBar.vertical.policy: ScrollBar.AlwaysOff
|
ScrollBar.vertical.policy: ScrollBar.AlwaysOff
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
spacing: Style.current.padding
|
spacing: footerContent.spacing
|
||||||
|
|
||||||
Repeater {
|
Repeater {
|
||||||
id: stickerPackListView
|
id: stickerPackListView
|
||||||
property int selectedPackId: -1
|
property string selectedPackId
|
||||||
model: d.stickerPackList
|
model: d.stickerPackList
|
||||||
visible: d.stickerPacksLoaded
|
visible: d.stickerPacksLoaded
|
||||||
|
|
||||||
delegate: StatusStickerPackIconWithIndicator {
|
delegate: StatusStickerPackIconWithIndicator {
|
||||||
id: packIconWithIndicator
|
id: packIconWithIndicator
|
||||||
visible: installed
|
visible: installed
|
||||||
width: 24
|
Layout.preferredWidth: 24
|
||||||
height: 24
|
Layout.preferredHeight: 24
|
||||||
selected: stickerPackListView.selectedPackId === packId
|
selected: stickerPackListView.selectedPackId === packId
|
||||||
source: thumbnail
|
source: thumbnail
|
||||||
Layout.preferredHeight: height
|
|
||||||
Layout.preferredWidth: width
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
btnHistory.highlighted = false
|
btnHistory.highlighted = false
|
||||||
stickerPackListView.selectedPackId = packId
|
stickerPackListView.selectedPackId = packId
|
||||||
|
|
Loading…
Reference in New Issue