fix(stickers): fix stickers appearing as loading when on a new account

This commit is contained in:
Jonathan Rainville 2021-12-01 16:42:42 -05:00 committed by Sale Djenic
parent 05eb8abf04
commit d8a90eda6c
2 changed files with 27 additions and 5 deletions

View File

@ -7,6 +7,7 @@ QtObject:
type
View* = ref object of QObject
delegate: io_interface.AccessInterface
packsLoaded*: bool
stickerPacks*: StickerPackList
recentStickers*: StickerList
@ -100,7 +101,15 @@ QtObject:
proc addRecentStickerToList*(self: View, sticker: Item) =
self.recentStickers.addStickerToList(sticker)
proc getAllPacksLoaded(self: View): bool {.slot.} =
self.packsLoaded
QtProperty[bool] packsLoaded:
read = getAllPacksLoaded
notify = stickerPacksLoaded
proc allPacksLoaded*(self: View) =
self.packsLoaded = true
self.stickerPacksLoaded()
self.installedStickerPacksUpdated()

View File

@ -47,6 +47,21 @@ Popup {
root.close()
}
}
Component.onCompleted: {
if (stickersModule.packsLoaded) {
root.setStickersReady()
}
}
function setStickersReady() {
root.stickerPacksLoaded = true
stickerPackListView.visible = true
loadingGrid.active = false
loadingStickerPackListView.model = []
noStickerPacks.visible = installedPacksCount === 0 || stickersModule.recent.rowCount() === 0
}
contentItem: ColumnLayout {
anchors.fill: parent
spacing: 0
@ -268,13 +283,11 @@ Popup {
}
}
Connections {
id: loadedConnection
target: stickersModule
onStickerPacksLoaded: {
root.stickerPacksLoaded = true
stickerPackListView.visible = true
loadingGrid.active = false
loadingStickerPackListView.model = []
noStickerPacks.visible = installedPacksCount === 0 || stickersModule.recent.rowCount() === 0
root.setStickersReady()
loadedConnection.enabled = false
}
}
}