2024-10-15 19:26:12 +00:00
|
|
|
import QtQuick 2.15
|
|
|
|
import QtQuick.Controls 2.15
|
|
|
|
import QtQuick.Layouts 1.15
|
|
|
|
import QtGraphicalEffects 1.15
|
2021-09-28 15:04:06 +00:00
|
|
|
|
2023-01-12 22:39:46 +00:00
|
|
|
import StatusQ.Core 0.1
|
2024-05-20 12:18:44 +00:00
|
|
|
import StatusQ.Core.Utils 0.1 as SQUtils
|
2023-01-12 22:39:46 +00:00
|
|
|
|
2021-09-28 15:04:06 +00:00
|
|
|
import utils 1.0
|
2021-10-27 21:27:49 +00:00
|
|
|
import shared 1.0
|
|
|
|
import shared.popups 1.0
|
|
|
|
import shared.status 1.0
|
2022-02-14 23:27:23 +00:00
|
|
|
import shared.stores 1.0 as SharedStores
|
2023-09-05 15:27:30 +00:00
|
|
|
import shared.popups.send 1.0
|
2023-11-28 19:16:18 +00:00
|
|
|
import shared.stores.send 1.0
|
2022-02-14 23:27:23 +00:00
|
|
|
|
|
|
|
//TODO remove this dependency!
|
2024-05-22 08:13:39 +00:00
|
|
|
import AppLayouts.Chat.stores 1.0 as ChatStores
|
2024-02-05 16:44:49 +00:00
|
|
|
import AppLayouts.Wallet.stores 1.0
|
2021-03-08 19:24:39 +00:00
|
|
|
|
2021-10-14 11:33:34 +00:00
|
|
|
// TODO: replace with StatusModal
|
2021-03-08 19:24:39 +00:00
|
|
|
ModalPopup {
|
|
|
|
id: stickerPackDetailsPopup
|
|
|
|
|
2023-04-12 10:31:35 +00:00
|
|
|
property string packId
|
2021-03-08 19:24:39 +00:00
|
|
|
|
2024-05-22 08:13:39 +00:00
|
|
|
property ChatStores.RootStore store
|
2024-02-05 16:44:49 +00:00
|
|
|
required property WalletAssetsStore walletAssetsStore
|
2021-03-08 19:24:39 +00:00
|
|
|
property string thumbnail: ""
|
|
|
|
property string name: ""
|
|
|
|
property string author: ""
|
2023-04-12 19:08:42 +00:00
|
|
|
property string price
|
2024-05-22 08:13:39 +00:00
|
|
|
property bool installed: false
|
|
|
|
property bool bought: false
|
|
|
|
property bool pending: false
|
|
|
|
property var stickers
|
2023-04-12 10:31:35 +00:00
|
|
|
signal buyClicked(string packId)
|
2021-03-08 19:24:39 +00:00
|
|
|
|
2024-07-23 15:26:13 +00:00
|
|
|
onAboutToShow: {
|
|
|
|
stickersModule.getInstalledStickerPacks()
|
|
|
|
|
2024-05-22 08:13:39 +00:00
|
|
|
const idx = stickersModule.stickerPacks.findIndexById(packId, false)
|
|
|
|
if(idx === -1) close()
|
2024-05-20 12:18:44 +00:00
|
|
|
const item = SQUtils.ModelUtils.get(stickersModule.stickerPacks, idx)
|
|
|
|
name = item.name
|
|
|
|
author = item.author
|
|
|
|
thumbnail = item.thumbnail
|
|
|
|
price = item.price
|
2024-07-23 15:26:13 +00:00
|
|
|
stickers = item.stickers
|
2024-05-20 12:18:44 +00:00
|
|
|
installed = item.installed
|
|
|
|
bought = item.bought
|
|
|
|
pending = item.pending
|
2021-03-08 19:24:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
height: 472
|
|
|
|
header: StatusStickerPackDetails {
|
|
|
|
id: stickerGrid
|
|
|
|
packThumb: thumbnail
|
|
|
|
packName: name
|
|
|
|
packAuthor: author
|
|
|
|
packNameFontSize: 17
|
2024-10-15 19:26:12 +00:00
|
|
|
spacing: Theme.padding / 2
|
2021-03-08 19:24:39 +00:00
|
|
|
}
|
2021-03-26 21:21:50 +00:00
|
|
|
|
|
|
|
contentWrapper.anchors.topMargin: 0
|
|
|
|
contentWrapper.anchors.bottomMargin: 0
|
2023-04-12 12:15:39 +00:00
|
|
|
contentWrapper.anchors.rightMargin: 0
|
2021-03-26 21:21:50 +00:00
|
|
|
StatusStickerList {
|
|
|
|
id: stickerGridInPopup
|
|
|
|
model: stickers
|
|
|
|
anchors.fill: parent
|
2024-10-15 19:26:12 +00:00
|
|
|
anchors.topMargin: Theme.padding
|
2021-12-08 21:20:43 +00:00
|
|
|
packId: stickerPackDetailsPopup.packId
|
2021-03-26 21:21:50 +00:00
|
|
|
}
|
|
|
|
|
2021-03-08 19:24:39 +00:00
|
|
|
footer: StatusStickerButton {
|
|
|
|
anchors.right: parent.right
|
|
|
|
style: StatusStickerButton.StyleType.LargeNoIcon
|
|
|
|
packPrice: price
|
|
|
|
isInstalled: installed
|
|
|
|
isBought: bought
|
|
|
|
isPending: pending
|
2023-04-12 11:23:33 +00:00
|
|
|
greyedOut: !store.networkConnectionStore.stickersNetworkAvailable
|
2023-04-12 10:31:35 +00:00
|
|
|
tooltip.text: store.networkConnectionStore.stickersNetworkUnavailableText
|
2021-03-08 19:24:39 +00:00
|
|
|
onInstallClicked: {
|
2024-05-22 08:13:39 +00:00
|
|
|
stickersModule.install(packId)
|
|
|
|
stickerPackDetailsPopup.close()
|
2021-03-08 19:24:39 +00:00
|
|
|
}
|
|
|
|
onUninstallClicked: {
|
2021-11-25 17:12:19 +00:00
|
|
|
stickersModule.uninstall(packId);
|
2021-03-08 19:24:39 +00:00
|
|
|
stickerPackDetailsPopup.close();
|
|
|
|
}
|
|
|
|
onCancelClicked: function(){}
|
|
|
|
onUpdateClicked: function(){}
|
|
|
|
onBuyClicked: {
|
2024-10-04 07:46:53 +00:00
|
|
|
const token = SQUtils.ModelUtils.getByKey(stickerPackDetailsPopup.walletAssetsStore.groupedAccountAssetsModel, "tokensKey", stickerPackDetailsPopup.store.stickersStore.getStatusTokenKey())
|
2024-11-05 18:51:17 +00:00
|
|
|
Global.launchSendWithParams(Constants.SendType.StickersBuy, //sendType
|
|
|
|
"", //senderAddress
|
|
|
|
!!token && !!token.symbol ? token.symbol : "", //tokenId
|
|
|
|
Constants.TokenType.ERC20, //tokenType
|
|
|
|
LocaleUtils.numberToLocaleString(parseFloat(stickerPackDetailsPopup.price)), //tokenAmount
|
|
|
|
stickerPackDetailsPopup.store.appNetworkId, //chainId
|
|
|
|
stickerPackDetailsPopup.store.stickersStore.getStickersMarketAddress(), //recipientAddress
|
|
|
|
Helpers.RecipientAddressObjectType.Address, //recipientType
|
|
|
|
false, //onlyAssets
|
|
|
|
false, //interactive
|
|
|
|
"", //publicKey
|
|
|
|
"", //ensName
|
|
|
|
stickerPackDetailsPopup.packId, //stickersPackId
|
|
|
|
)
|
2024-10-04 07:46:53 +00:00
|
|
|
|
|
|
|
stickerPackDetailsPopup.buyClicked(stickerPackDetailsPopup.packId)
|
2021-03-08 19:24:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|