fix(@desktop/wallet): Updatebthe new assets models in Token mangement, Activity filters and SharedAddressPanel

This commit is contained in:
Khushboo Mehta 2024-01-24 16:35:53 +00:00 committed by Khushboo-dev-cpp
parent a4097707a3
commit fb4e9a1ed1
32 changed files with 306 additions and 408 deletions

View File

@ -74,10 +74,14 @@ SplitView {
console.warn("activityController:: updateFilter")
}
}
readonly property WalletAssetsStore walletAssetStore: WalletAssetsStore {
assetsWithFilteredBalances: groupedAccountsAssetsModel
}
}
ActivityFiltersStore {
id: actvityStore
tokensList: WalletAssetsModel {}
tokensList: d.walletAssetStore.groupedAccountAssetsModel
collectiblesList: CollectiblesModel {}
savedAddressesModel: d.recipientModel.savedAddresses
activityController: d.activityController

View File

@ -4,6 +4,7 @@ import QtQuick.Controls 2.15
import StatusQ.Core 0.1
import AppLayouts.Profile.views 1.0
import AppLayouts.Wallet.stores 1.0
import mainui 1.0
import utils 1.0
@ -18,6 +19,12 @@ SplitView {
orientation: Qt.Vertical
readonly property WalletAssetsStore walletAssetStore: WalletAssetsStore {
assetsWithFilteredBalances: walletAssetStore.groupedAccountsAssetsModel
}
readonly property var currencyStore: CurrenciesStore {}
Popups {
popupParent: root
rootStore: QtObject {}
@ -165,6 +172,8 @@ SplitView {
logs.logEvent("rootStore::setActiveCommunity", ["communityId"], arguments)
}
}
currencyStore: currencyStore
walletAssetsStore: walletAssetsStore
}
LogsAndControlsPanel {

View File

@ -8,13 +8,21 @@ import Models 1.0
import shared.popups 1.0
import utils 1.0
import AppLayouts.Wallet.stores 1.0
SplitView {
SplitView {
id: root
orientation: Qt.Vertical
SplitView.fillWidth: true
Logs { id: logs }
readonly property WalletAssetsStore walletAssetStore: WalletAssetsStore {
assetsWithFilteredBalances: groupedAccountsAssetsModel
}
Item {
SplitView.fillWidth: true
SplitView.fillHeight: true
@ -48,6 +56,7 @@ Nemo enim 😋 ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit,
requirementsCheckPending: false
walletAccountsModel: WalletAccountsModel {}
walletAssetsModel: root.walletAssetStore.groupedAccountAssetsModel
permissionsModel: dialog.accessType === Constants.communityChatOnRequestAccess ? PermissionsModel.complexPermissionsModel
: null
assetsModel: AssetsModel {}
@ -60,6 +69,14 @@ Nemo enim 😋 ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit,
onSignSharedAddressesForAllNonKeycardKeypairs: logs.logEvent("CommunityIntroDialog::onSignSharedAddressesForAllNonKeycardKeypairs")
onSignSharedAddressesForKeypair: logs.logEvent("CommunityIntroDialog::onSignSharedAddressesForKeypair", ["keyUid"], arguments)
onSharedAddressesUpdated: logs.logEvent("CommunityIntroDialog::onSharedAddressesUpdated", ["sharedAddresses"], arguments)
getCurrencyAmount: function (balance, symbol) {
return ({
amount: balance,
symbol: symbol.toUpperCase(),
displayDecimals: 2,
stripTrailingZeroes: false
})
}
}
}

View File

@ -4,13 +4,14 @@ import QtQuick.Controls 2.15
import StatusQ.Core 0.1
import AppLayouts.Wallet.panels 1.0
import utils 1.0
import Storybook 1.0
import Models 1.0
import AppLayouts.Wallet.panels 1.0
import AppLayouts.Wallet.stores 1.0
SplitView {
id: root
@ -18,8 +19,8 @@ SplitView {
orientation: Qt.Horizontal
ManageTokensModel {
id: assetsModel
readonly property WalletAssetsStore walletAssetStore: WalletAssetsStore {
assetsWithFilteredBalances: groupedAccountsAssetsModel
}
StatusScrollView { // wrapped in a ScrollView on purpose; to simulate SettingsContentBase.qml
@ -29,7 +30,23 @@ SplitView {
ManageAssetsPanel {
id: showcasePanel
width: 500
baseModel: ctrlEmptyModel.checked ? null : assetsModel
baseModel: ctrlEmptyModel.checked ? null : walletAssetStore.groupedAccountAssetsModel
getCurrencyAmount: function (balance, symbol) {
return ({
amount: balance,
symbol: symbol,
displayDecimals: 2,
stripTrailingZeroes: false
})
}
getCurrentCurrencyAmount: function (balance) {
return ({
amount: balance,
symbol: "USD",
displayDecimals: 2,
stripTrailingZeroes: false
})
}
}
}
@ -63,14 +80,6 @@ SplitView {
onClicked: showcasePanel.revert()
}
Button {
text: "Random data"
onClicked: {
assetsModel.clear()
assetsModel.randomizeData()
}
}
Button {
enabled: showcasePanel.hasSettings
text: "Clear settings"

View File

@ -7,6 +7,7 @@ import Storybook 1.0
import Models 1.0
import AppLayouts.Communities.popups 1.0
import AppLayouts.Wallet.stores 1.0
SplitView {
id: root
@ -16,6 +17,10 @@ SplitView {
id: emptyModel
}
readonly property WalletAssetsStore walletAssetStore: WalletAssetsStore {
assetsWithFilteredBalances: walletAssetStore.groupedAccountsAssetsModel
}
Component {
id: dlgComponent
SharedAddressesPopup {
@ -40,6 +45,8 @@ SplitView {
return emptyModel
}
walletAssetsModel: walletAssetStore.groupedAccountAssetsModel
assetsModel: AssetsModel {}
collectiblesModel: CollectiblesModel {}
visible: true
@ -51,6 +58,14 @@ SplitView {
onSignSharedAddressesForAllNonKeycardKeypairs: logs.logEvent("::onSignSharedAddressesForAllNonKeycardKeypairs")
onSignSharedAddressesForKeypair: logs.logEvent("::onSignSharedAddressesForKeypair", ["keyUid"], arguments)
onClosed: destroy()
getCurrencyAmount: function (balance, symbol) {
return ({
amount: balance,
symbol: symbol.toUpperCase(),
displayDecimals: 2,
stripTrailingZeroes: false
})
}
}
}

View File

@ -6,9 +6,17 @@ import Storybook 1.0
import shared.popups.send.views 1.0
import AppLayouts.Wallet.stores 1.0
import StatusQ.Core.Utils 0.1
SplitView {
orientation: Qt.Vertical
readonly property WalletAssetsStore walletAssetStore: WalletAssetsStore {
assetsWithFilteredBalances: groupedAccountsAssetsModel
}
Item {
SplitView.fillWidth: true
SplitView.fillHeight: true
@ -23,9 +31,27 @@ SplitView {
width: 400
assets: WalletAssetsModel {}
assets: walletAssetStore.groupedAccountAssetsModel
collectibles: WalletNestedCollectiblesModel {}
networksModel: NetworksModel.allNetworks
getCurrencyAmountFromBigInt: function(balance, symbol, decimals){
let bigIntBalance = AmountsArithmetic.fromString(balance)
let balance123 = AmountsArithmetic.toNumber(bigIntBalance, decimals)
return ({
amount: balance123,
symbol: symbol,
displayDecimals: 2,
stripTrailingZeroes: false
})
}
getCurrentCurrencyAmount: function(balance){
return ({
amount: balance,
symbol: "USD",
displayDecimals: 2,
stripTrailingZeroes: false
})
}
}
}

View File

@ -1,274 +0,0 @@
import QtQuick 2.15
import QtQml.Models 2.15
import Models 1.0
ListModel {
function randomizeData() {
var data = []
for (let i = 0; i < 100; i++) {
const communityId = i % 2 == 0 ? "" : "communityId%1".arg(Math.round(i))
const enabledNetworkBalance = !!communityId ? Math.round(i)
: {
amount: 1,
symbol: "ZRX"
}
var obj = {
name: "Item %1".arg(i),
symbol: "SYM %1".arg(i),
enabledNetworkBalance: enabledNetworkBalance,
enabledNetworkCurrencyBalance: {
amount: 10.37,
symbol: "EUR",
displayDecimals: 2
},
communityId: communityId,
communityName: "COM %1".arg(i),
communityImage: ""
}
data.push(obj)
}
append(data)
}
readonly property var data: [
{
name: "0x",
symbol: "ZRX",
enabledNetworkBalance: {
amount: 1,
symbol: "ZRX"
},
enabledNetworkCurrencyBalance: {
amount: 10.37,
symbol: "EUR",
displayDecimals: 2
},
currencyPrice: {},
communityId: "ddls",
communityName: "Doodles",
communityImage: ModelsData.collectibles.doodles // FIXME backend
},
{
name: "Omg",
symbol: "OMG",
enabledNetworkBalance: {
amount: 2,
symbol: "OMG"
},
enabledNetworkCurrencyBalance: {
amount: 13.37,
symbol: "EUR",
displayDecimals: 2
},
currencyPrice: {},
communityId: "sox",
communityName: "Socks",
communityImage: ModelsData.icons.socks
},
{
name: "Decentraland",
symbol: "MANA",
enabledNetworkBalance: {
amount: 301,
symbol: "MANA"
},
enabledNetworkCurrencyBalance: {
amount: 75.256,
symbol: "EUR",
displayDecimals: 2
},
currencyPrice: {
amount: 0.25,
symbol: "EUR",
displayDecimals: 2
},
changePct24hour: -2.1,
communityId: "",
communityName: "",
communityImage: ""
},
{
name: "Request",
symbol: "REQ",
enabledNetworkBalance: {
amount: 0.00005,
symbol: "REQ",
displayDecimals: 2
},
enabledNetworkCurrencyBalance: {
amount: 2.335,
symbol: "EUR",
displayDecimals: 2
},
currencyPrice: {
amount: 0.1000001,
symbol: "EUR",
displayDecimals: 2
},
changePct24hour: 4.56,
communityId: "",
communityName: "",
communityImage: ""
},
{
name: "Polymorphism",
symbol: "POLY",
enabledNetworkBalance: {
amount: 3590,
symbol: "POLY"
},
enabledNetworkCurrencyBalance: {
amount: 2.7,
symbol: "EUR",
displayDecimals: 2
},
currencyPrice: {
amount: 0.000752089,
symbol: "EUR",
displayDecimals: 2
},
changePct24hour: -11.6789,
communityId: "",
communityName: "",
communityImage: ""
},
{
name: "Dai",
symbol: "DAI",
enabledNetworkBalance: {
amount: 634.22,
symbol: "DAI",
displayDecimals: 2
},
enabledNetworkCurrencyBalance: {
amount: 594.72,
symbol: "EUR",
displayDecimals: 2
},
currencyPrice: {
amount: 0.937718773,
symbol: "EUR",
displayDecimals: 2
},
changePct24hour: 0,
communityId: "",
communityName: "",
communityImage: ""
},
{
name: "Makers' choice",
symbol: "MKR",
enabledNetworkBalance: {
amount: 1.3,
symbol: "MKR",
displayDecimals: 2
},
enabledNetworkCurrencyBalance: {
amount: 100.37,
symbol: "EUR",
displayDecimals: 2
},
currencyPrice: {},
changePct24hour: -1,
communityId: "",
communityName: "",
communityImage: ""
},
{
name: "Ethereum",
symbol: "ETH",
enabledNetworkBalance: {
amount: 0.123456789,
symbol: "ETH",
displayDecimals: 8,
stripTrailingZeroes: true
},
enabledNetworkCurrencyBalance: {
amount: 182.73004849,
symbol: "EUR",
displayDecimals: 2
},
currencyPrice: {
amount: 1480.113406237,
symbol: "EUR",
displayDecimals: 2
},
changePct24hour: -3.51,
communityId: "",
communityName: "",
communityImage: ""
},
{
name: "GetOuttaHere",
symbol: "InvisibleSYM",
enabledNetworkBalance: {},
enabledNetworkCurrencyBalance: {},
currencyPrice: {},
changePct24hour: NaN,
communityId: "",
communityName: "",
communityImage: ""
},
{
enabledNetworkBalance: ({
displayDecimals: 4,
stripTrailingZeroes: true,
amount: 0,
symbol: "SNT"
}),
enabledNetworkCurrencyBalance: ({
displayDecimals: 4,
stripTrailingZeroes: true,
amount: 0.,
symbol: "EUR"
}),
currencyPrice: {
amount: 1.40627,
symbol: "EUR",
displayDecimals: 2
},
changePct24hour: 1.3,
symbol: "SNT",
name: "Status",
communityId: "",
communityName: "",
communityImage: ""
},
{
name: "Meth",
symbol: "MET",
enabledNetworkBalance: {
amount: 666,
symbol: "MET"
},
enabledNetworkCurrencyBalance: {
amount: 1000.37,
symbol: "EUR",
displayDecimals: 2
},
currencyPrice: {},
communityId: "ddls",
communityName: "Doodles",
communityImage: ModelsData.collectibles.doodles
},
{
name: "Ast",
symbol: "AST",
enabledNetworkBalance: {
amount: 1,
symbol: "AST"
},
enabledNetworkCurrencyBalance: {
amount: 0.374,
symbol: "EUR",
displayDecimals: 2
},
currencyPrice: {},
communityId: "ast",
communityName: "Astafarians",
communityImage: ModelsData.icons.dribble
}
]
Component.onCompleted: append(data)
}

View File

@ -632,7 +632,7 @@ QtObject {
},
{
type: Constants.TokenType.ERC20,
key: "snt",
key: "stt",
amount: 666,
available: true
}
@ -643,7 +643,7 @@ QtObject {
return [
{
type: Constants.TokenType.ERC20,
key: "socks",
key: "eth",
amount: 15,
available: true
},
@ -666,13 +666,13 @@ QtObject {
return [
{
type: Constants.TokenType.ERC20,
key: "socks",
key: "eth",
amount: 15,
available: true
},
{
type: Constants.TokenType.ERC20,
key: "snt",
key: "stt",
amount: 25000,
available: true
},
@ -695,7 +695,7 @@ QtObject {
return [
{
type: Constants.TokenType.ERC20,
key: "socks",
key: "eth",
amount: 15,
available: true
},

View File

@ -1,95 +0,0 @@
import QtQuick 2.15
ListModel {
readonly property var data: [
{
totalRawBalance: "32330",
totalBalance: ({
displayDecimals: true,
stripTrailingZeroes: true,
amount: 323.3,
symbol: "ETH"
}),
decimals: 18,
totalCurrencyBalance: ({
displayDecimals: true,
stripTrailingZeroes: true,
amount: 3.234
}),
symbol: "ETH",
name: "Ethereum",
balances: [
{
chainId: "1",
balance: {
displayDecimals: true,
stripTrailingZeroes: true,
amount: 3.234
}
}
],
checked: true,
allChecked: true
},
{
totalRawBalance: "32434330",
totalBalance: ({
displayDecimals: true,
stripTrailingZeroes: true,
amount: 324343.3,
symbol: "SNT"
}),
decimals: 18,
totalCurrencyBalance: ({
displayDecimals: true,
stripTrailingZeroes: true,
amount: 23333213.234
}),
symbol: "SNT",
name: "Status",
balances: [
{
chainId: "1",
balance: {
displayDecimals: true,
stripTrailingZeroes: true,
amount: 324343.3
}
}
],
checked: true,
allChecked: true
},
{
totalRawBalance: "12434330",
totalBalance: ({
displayDecimals: true,
stripTrailingZeroes: true,
amount: 124343.3,
symbol: "DAI"
}),
decimals: 18,
totalCurrencyBalance: ({
displayDecimals: true,
stripTrailingZeroes: true,
amount: 53333213.234
}),
symbol: "DAI",
name: "DAI Stablecoin",
balances: [
{
chainId: "1",
balance: {
displayDecimals: true,
stripTrailingZeroes: true,
amount: 124343.3
}
}
],
checked: true,
allChecked: true
}
]
Component.onCompleted: append(data)
}

View File

@ -3,7 +3,6 @@ import QtQuick 2.15
import utils 1.0
ListModel {
property ListModel assetsModel: WalletAssetsModel {}
readonly property var data: [
{
name: "helloworld",

View File

@ -10,14 +10,12 @@ IconModel 1.0 IconModel.qml
LinkPreviewModel 1.0 LinkPreviewModel.qml
MintedTokensModel 1.0 MintedTokensModel.qml
ManageCollectiblesModel 1.0 ManageCollectiblesModel.qml
ManageTokensModel 1.0 ManageTokensModel.qml
RecipientModel 1.0 RecipientModel.qml
SourceOfTokensModel 1.0 SourceOfTokensModel.qml
TokenHoldersModel 1.0 TokenHoldersModel.qml
UsersModel 1.0 UsersModel.qml
WalletSendAccountsModel 1.0 WalletSendAccountsModel.qml
WalletAccountsModel 1.0 WalletAccountsModel.qml
WalletAssetsModel 1.0 WalletAssetsModel.qml
WalletCollectiblesModel 1.0 WalletCollectiblesModel.qml
WalletKeyPairModel 1.0 WalletKeyPairModel.qml
WalletNestedCollectiblesModel 1.0 WalletNestedCollectiblesModel.qml

View File

@ -410,6 +410,9 @@ void ManageTokensController::addItem(int index)
token.collectionName = !collectionName.isEmpty() ? collectionName : collectionUid;
token.balance = dataForIndex(srcIndex, kEnabledNetworkBalanceRoleName);
token.currencyBalance = dataForIndex(srcIndex, kEnabledNetworkCurrencyBalanceRoleName);
token.balances = dataForIndex(srcIndex, kBalancesRoleName);
token.decimals = dataForIndex(srcIndex, kDecimalsRoleName);
token.marketDetails = dataForIndex(srcIndex, kMarketDetailsRoleName);
token.customSortOrderNo = m_settingsData.contains(symbol) ? std::get<0>(m_settingsData.value(symbol))
: (visible ? INT_MAX : 0); // append/prepend

View File

@ -115,6 +115,9 @@ QHash<int, QByteArray> ManageTokensModel::roleNames() const
{CustomSortOrderNoRole, kCustomSortOrderNoRoleName},
{TokenImageRole, kTokenImageRoleName},
{TokenBackgroundColorRole, kBackgroundColorRoleName},
{TokenBalancesRole, kBalancesRoleName},
{TokenDecimalsRole, kDecimalsRoleName},
{TokenMarketDetailsRole, kMarketDetailsRoleName}
};
return roles;
@ -141,6 +144,9 @@ QVariant ManageTokensModel::data(const QModelIndex& index, int role) const
case CustomSortOrderNoRole: return token.customSortOrderNo;
case TokenImageRole: return token.image;
case TokenBackgroundColorRole: return token.backgroundColor;
case TokenBalancesRole: return token.balances;
case TokenDecimalsRole: return token.decimals;
case TokenMarketDetailsRole: return token.marketDetails;
}
return {};

View File

@ -23,6 +23,9 @@ const auto kEnabledNetworkCurrencyBalanceRoleName = QByteArrayLiteral("enabledNe
const auto kCustomSortOrderNoRoleName = QByteArrayLiteral("customSortOrderNo");
const auto kTokenImageRoleName = QByteArrayLiteral("imageUrl");
const auto kBackgroundColorRoleName = QByteArrayLiteral("backgroundColor");
const auto kBalancesRoleName = QByteArrayLiteral("balances");
const auto kDecimalsRoleName = QByteArrayLiteral("decimals");
const auto kMarketDetailsRoleName = QByteArrayLiteral("marketDetails");
// TODO add communityPrivilegesLevel for collectibles
} // namespace
@ -30,6 +33,7 @@ struct TokenData {
QString symbol, name, communityId, communityName, communityImage, collectionUid, collectionName, image;
QColor backgroundColor{Qt::transparent};
QVariant balance, currencyBalance;
QVariant balances, marketDetails, decimals;
int customSortOrderNo{INT_MAX};
};
@ -56,6 +60,9 @@ public:
CustomSortOrderNoRole,
TokenImageRole,
TokenBackgroundColorRole,
TokenBalancesRole,
TokenDecimalsRole,
TokenMarketDetailsRole,
};
Q_ENUM(TokenDataRoles)

View File

@ -4,6 +4,7 @@ import QtQuick.Layouts 1.14
import utils 1.0
import shared.popups 1.0
import shared.stores 1.0
import shared.stores.send 1.0
import "views"
@ -28,6 +29,8 @@ StackLayout {
property var communitiesStore
required property WalletStore.TokensStore tokensStore
required property TransactionStore transactionStore
required property WalletStore.WalletAssetsStore walletAssetsStore
required property CurrenciesStore currencyStore
property var sectionItemModel
property var sendModalPopup
@ -144,6 +147,8 @@ StackLayout {
transactionStore: root.transactionStore
createChatPropertiesStore: root.createChatPropertiesStore
communitiesStore: root.communitiesStore
walletAssetsStore: root.walletAssetsStore
currencyStore: root.currencyStore
sectionItemModel: root.sectionItemModel
amIMember: chatItem.amIMember
amISectionAdmin: root.sectionItemModel.memberRole === Constants.memberRole.owner ||
@ -246,6 +251,7 @@ StackLayout {
loginType: root.rootStore.loginType
walletAccountsModel: WalletStore.RootStore.nonWatchAccounts
walletAssetsModel: walletAssetsStore.groupedAccountAssetsModel
requirementsCheckPending: root.rootStore.requirementsCheckPending
permissionsModel: {
root.rootStore.prepareTokenModelForCommunity(communityIntroDialog.communityId)
@ -254,6 +260,10 @@ StackLayout {
assetsModel: root.rootStore.assetsModel
collectiblesModel: root.rootStore.collectiblesModel
getCurrencyAmount: function (balance, symbol){
return currencyStore.getCurrencyAmount(balance, symbol)
}
onPrepareForSigning: {
root.rootStore.prepareKeypairsForSigning(communityIntroDialog.communityId, communityIntroDialog.name, sharedAddresses, airdropAddress)

View File

@ -7,6 +7,7 @@ import shared 1.0
import shared.panels 1.0
import shared.popups 1.0
import shared.status 1.0
import shared.stores 1.0
import shared.views.chat 1.0
import shared.stores.send 1.0
@ -18,6 +19,7 @@ import "."
import "../panels"
import AppLayouts.Communities.panels 1.0
import AppLayouts.Communities.views 1.0
import AppLayouts.Wallet.stores 1.0 as WalletStore
import "../popups"
import "../helpers"
import "../controls"
@ -33,6 +35,8 @@ StatusSectionLayout {
required property TransactionStore transactionStore
property var createChatPropertiesStore
property var communitiesStore
required property WalletStore.WalletAssetsStore walletAssetsStore
required property CurrenciesStore currencyStore
property var sectionItemModel
property var emojiPopup
@ -246,6 +250,8 @@ StatusSectionLayout {
communityData: sectionItemModel
store: root.rootStore
communitiesStore: root.communitiesStore
walletAssetsStore: root.walletAssetsStore
currencyStore: root.currencyStore
emojiPopup: root.emojiPopup
hasAddedContacts: root.hasAddedContacts
isPendingOwnershipRequest: root.isPendingOwnershipRequest

View File

@ -1,6 +1,7 @@
import QtQuick 2.15
import QtQuick.Controls 2.15
import StatusQ 0.1
import StatusQ.Core 0.1
import StatusQ.Components 0.1
import StatusQ.Controls 0.1
@ -14,6 +15,7 @@ import utils 1.0
StatusListView {
id: root
property var walletAssetsModel
property bool hasPermissions
property var uniquePermissionTokenKeys
@ -21,6 +23,8 @@ StatusListView {
property string selectedAirdropAddress
property var selectedSharedAddresses: []
property var getCurrencyAmount: function (balance, symbol){}
signal addressesChanged()
leftMargin: d.absLeftMargin
@ -45,6 +49,15 @@ StatusListView {
function selectFirstAvailableAirdropAddress() {
root.selectedAirdropAddress = ModelUtils.modelToFlatArray(root.model, "address").find(address => selectedSharedAddresses.includes(address))
}
function getTotalBalance(balances, decimals, symbol) {
let totalBalance = 0
for(let i=0; i<balances.count; i++) {
let balancePerAddressPerChain = ModelUtils.get(balances, i)
totalBalance += AmountsArithmetic.toNumber(balancePerAddressPerChain.balance, decimals)
}
return totalBalance
}
}
spacing: Style.current.halfPadding
@ -56,22 +69,42 @@ StatusListView {
statusListItemTitle.font.weight: Font.Medium
title: model.name
tertiaryTitle: !walletAccountAssetsModel.count && root.hasPermissions ? qsTr("No relevant tokens") : ""
property string accountAddress: model.address
SubmodelProxyModel {
id: filteredBalances
sourceModel: root.walletAssetsModel
submodelRoleName: "balances"
delegateModel: SortFilterProxyModel {
sourceModel: submodel
filters: FastExpressionFilter {
expression: listItem.accountAddress === model.account
expectedRoles: ["account"]
}
}
}
tagsModel: SortFilterProxyModel {
id: walletAccountAssetsModel
sourceModel: model.assets
sourceModel: filteredBalances
function filterPredicate(modelData) {
return root.uniquePermissionTokenKeys.includes(modelData.symbol.toUpperCase())
function filterPredicate(symbol) {
return root.uniquePermissionTokenKeys.includes(symbol.toUpperCase())
}
filters: ExpressionFilter {
expression: walletAccountAssetsModel.filterPredicate(model)
proxyRoles: FastExpressionRole {
name: "enabledNetworkBalance"
expression: d.getTotalBalance(model.balances, model.decimals, model.symbol)
expectedRoles: ["balances", "decimals", "symbol"]
}
sorters: ExpressionSorter {
filters: FastExpressionFilter {
expression: walletAccountAssetsModel.filterPredicate(model.symbol)
expectedRoles: ["symbol"]
}
sorters: FastExpressionSorter {
expression: {
return modelLeft.enabledNetworkBalance.amount > modelRight.enabledNetworkBalance.amount // descending, biggest first
return modelLeft.enabledNetworkBalance > modelRight.enabledNetworkBalance // descending, biggest first
}
expectedRoles: ["enabledNetworkBalance"]
}
}
statusListItemInlineTagsSlot.spacing: Style.current.padding
@ -86,7 +119,7 @@ StatusListView {
StatusBaseText {
anchors.verticalCenter: parent.verticalCenter
font.pixelSize: Theme.tertiaryTextFontSize
text: LocaleUtils.currencyAmountToLocaleString(model.enabledNetworkBalance)
text: LocaleUtils.currencyAmountToLocaleString(root.getCurrencyAmount(model.enabledNetworkBalance, model.symbol))
}
}

View File

@ -32,6 +32,7 @@ Control {
required property string communityIcon
property int loginType: Constants.LoginType.Password
required property var walletAssetsModel
required property var walletAccountsModel // name, address, emoji, colorId, assets
required property var permissionsModel // id, key, permissionType, holdingsListModel, channelsListModel, isPrivate, tokenCriteriaMet
required property var assetsModel
@ -77,6 +78,8 @@ Control {
property var selectedSharedAddresses: []
property string selectedAirdropAddress
property var getCurrencyAmount: function (balance, symbol){}
signal sharedAddressesChanged(string airdropAddress, var sharedAddresses)
signal shareSelectedAddressesClicked(string airdropAddress, var sharedAddresses)
signal prepareForSigning(string airdropAddress, var sharedAddresses)
@ -180,6 +183,7 @@ Control {
Layout.maximumHeight: hasPermissions ? permissionsView.implicitHeight > root.availableHeight / 2 ? root.availableHeight / 2 : root.availableHeight : -1
Layout.fillHeight: !hasPermissions
model: root.walletAccountsModel
walletAssetsModel: root.walletAssetsModel
selectedSharedAddresses: d.initialSelectedSharedAddresses
selectedAirdropAddress: d.initialSelectedAirdropAddress
onAddressesChanged: accountSelector.applyChange()
@ -188,6 +192,9 @@ Control {
root.selectedAirdropAddress = selectedAirdropAddress
root.sharedAddressesChanged(selectedAirdropAddress, selectedSharedAddresses)
}
getCurrencyAmount: function (balance, symbol){
return root.getCurrencyAmount(balance, symbol)
}
}
RequirementsCheckPendingLoader {

View File

@ -22,11 +22,14 @@ StatusDialog {
required property string communityIcon
property int loginType: Constants.LoginType.Password
property var walletAssetsModel
required property var walletAccountsModel // name, address, emoji, colorId, assets
required property var permissionsModel // id, key, permissionType, holdingsListModel, channelsListModel, isPrivate, tokenCriteriaMet
required property var assetsModel
required property var collectiblesModel
property var getCurrencyAmount: function (balance, symbol){}
signal shareSelectedAddressesClicked(string airdropAddress, var sharedAddresses)
signal sharedAddressesChanged(string airdropAddress, var sharedAddresses)
@ -121,6 +124,7 @@ StatusDialog {
communityIcon: root.communityIcon
loginType: root.loginType
walletAccountsModel: root.walletAccountsModel
walletAssetsModel: root.walletAssetsModel
permissionsModel: root.permissionsModel
assetsModel: root.assetsModel
collectiblesModel: root.collectiblesModel
@ -133,6 +137,9 @@ StatusDialog {
root.sharedAddressesChanged(airdropAddress, sharedAddresses)
}
onClose: root.close()
getCurrencyAmount: function (balance, symbol){
return root.getCurrencyAmount(balance, symbol)
}
}
}

View File

@ -16,6 +16,7 @@ import shared.popups 1.0
import shared.status 1.0
import shared.controls.chat.menuItems 1.0
import shared.panels 1.0
import shared.stores 1.0
import shared.views.chat 1.0
import AppLayouts.Communities.popups 1.0
@ -37,6 +38,8 @@ Item {
property var store
property var communitiesStore
required property WalletStore.WalletAssetsStore walletAssetsStore
required property CurrenciesStore currencyStore
property bool hasAddedContacts: false
property var communityData
@ -526,6 +529,7 @@ Item {
accessType: communityData.access
loginType: root.store.loginType
walletAccountsModel: WalletStore.RootStore.nonWatchAccounts
walletAssetsModel: walletAssetsStore.groupedAccountAssetsModel
permissionsModel: {
root.store.prepareTokenModelForCommunity(communityData.id)
return root.store.permissionsModel
@ -533,6 +537,10 @@ Item {
assetsModel: root.store.assetsModel
collectiblesModel: root.store.collectiblesModel
getCurrencyAmount: function (balance, symbol){
return currencyStore.getCurrencyAmount(balance, symbol)
}
onPrepareForSigning: {
root.store.prepareKeypairsForSigning(communityData.id, root.store.userProfileInst.name, sharedAddresses, airdropAddress, false)

View File

@ -335,6 +335,8 @@ StatusSectionLayout {
profileSectionStore: root.store
rootStore: root.globalStore
currencyStore: root.currencyStore
walletAssetsStore: root.walletAssetsStore
sectionTitle: root.store.getNameForSubsection(Constants.settingsSubsection.communitiesSettings)
contentWidth: d.contentWidth
}

View File

@ -12,6 +12,7 @@ import shared 1.0
import shared.panels 1.0
import shared.status 1.0
import shared.popups 1.0
import shared.stores 1.0
import SortFilterProxyModel 0.2
@ -26,6 +27,8 @@ SettingsContentBase {
property var profileSectionStore
property var rootStore
required property WalletStore.WalletAssetsStore walletAssetsStore
required property CurrenciesStore currencyStore
clip: true
@ -234,6 +237,7 @@ SettingsContentBase {
loginType: chatStore.loginType
walletAccountsModel: WalletStore.RootStore.nonWatchAccounts
walletAssetsModel: walletAssetsStore.groupedAccountAssetsModel
requirementsCheckPending: root.rootStore.requirementsCheckPending
permissionsModel: {
root.rootStore.prepareTokenModelForCommunity(communityIntroDialog.communityId)
@ -242,6 +246,10 @@ SettingsContentBase {
assetsModel: chatStore.assetsModel
collectiblesModel: chatStore.collectiblesModel
getCurrencyAmount: function (balance, symbol){
return currencyStore.getCurrencyAmount(balance, symbol)
}
onPrepareForSigning: {
chatStore.prepareKeypairsForSigning(communityIntroDialog.communityId, root.rootStore.userProfileInst.name, sharedAddresses, airdropAddress, false)

View File

@ -275,10 +275,17 @@ SettingsContentBase {
id: manageTokensView
sourcesOfTokensModel: tokensStore.sourcesOfTokensModel
tokensListModel: tokensStore.extendedFlatTokensModel
baseWalletAssetsModel: RootStore.assets
baseWalletAssetsModel: RootStore.walletAssetsStore.groupedAccountAssetsModel
baseWalletCollectiblesModel: {
return RootStore.collectiblesStore.allCollectiblesModel
}
getCurrencyAmount: function (balance, symbol) {
return RootStore.currencyStore.getCurrencyAmount(balance, symbol)
}
getCurrentCurrencyAmount: function (balance) {
return RootStore.currencyStore.getCurrentCurrencyAmount(balance)
}
Binding on currentIndex {
value: {

View File

@ -24,6 +24,9 @@ ColumnLayout {
required property var baseWalletAssetsModel
required property var baseWalletCollectiblesModel
property var getCurrencyAmount: function (balance, symbol) {}
property var getCurrentCurrencyAmount: function(balance){}
property alias currentIndex: tabBar.currentIndex
readonly property bool dirty: {
@ -123,6 +126,12 @@ ColumnLayout {
id: tokensPanel
ManageAssetsPanel {
baseModel: root.baseWalletAssetsModel
getCurrencyAmount: function (balance, symbol) {
return root.getCurrencyAmount(balance, symbol)
}
getCurrentCurrencyAmount: function (balance) {
return root.getCurrentCurrencyAmount(balance)
}
}
}

View File

@ -1,6 +1,7 @@
import QtQuick 2.15
import QtQuick.Controls 2.15
import StatusQ 0.1
import StatusQ.Core 0.1
import StatusQ.Components 0.1
import StatusQ.Controls 0.1
@ -13,7 +14,7 @@ DropArea {
objectName: "manageTokensDelegate-%1".arg(index)
// expected roles: symbol, name, communityId, communityName, communityImage, collectionName, imageUrl
// + enabledNetworkBalance, enabledNetworkCurrencyBalance -> TODO might get dropped/renamed in the future!!!
// enabledNetworkCurrencyBalance -> TODO might get dropped/renamed in the future!!!
property var controller
property int visualIndex: index
@ -29,6 +30,7 @@ DropArea {
property bool isCollectible
readonly property alias title: delegate.title
readonly property var balances: model.balances
readonly property var priv: QtObject {
id: priv
@ -36,6 +38,9 @@ DropArea {
readonly property int bgRadius: root.isCollectible ? Style.current.radius : iconSize/2
}
property var getCurrencyAmount: function (balance, symbol) {}
property var getCurrentCurrencyAmount: function(balance){}
ListView.onRemove: SequentialAnimation {
PropertyAction { target: root; property: "ListView.delayRemove"; value: true }
NumberAnimation { target: root; property: "scale"; to: 0; easing.type: Easing.InOutQuad }
@ -66,10 +71,12 @@ DropArea {
width: root.width
title: model.name
readonly property var totalBalance: aggregator.value/(10 ** model.decimals)
secondaryTitle: root.isCollectible ? (!!model.communityId ? qsTr("Community minted") : model.collectionName || model.symbol) :
hovered || menuBtn.menuVisible ? "%1 • %2".arg(LocaleUtils.currencyAmountToLocaleString(model.enabledNetworkBalance))
.arg(LocaleUtils.currencyAmountToLocaleString(model.enabledNetworkCurrencyBalance))
: LocaleUtils.currencyAmountToLocaleString(model.enabledNetworkBalance)
hovered || menuBtn.menuVisible ? "%1 • %2".arg(LocaleUtils.currencyAmountToLocaleString(root.getCurrencyAmount(totalBalance, model.symbol)))
.arg(!model.communityId ? LocaleUtils.currencyAmountToLocaleString(root.getCurrentCurrencyAmount(totalBalance * model.marketDetails.currencyPrice.amount)):
LocaleUtils.currencyAmountToLocaleString(root.getCurrentCurrencyAmount(0)))
: LocaleUtils.currencyAmountToLocaleString(root.getCurrencyAmount(totalBalance, model.symbol))
bgRadius: priv.bgRadius
hasImage: true
icon.source: root.isCollectible ? model.imageUrl : Constants.tokenIcon(model.symbol) // TODO unify via backend model for both assets and collectibles; handle communityPrivilegesLevel
@ -107,5 +114,11 @@ DropArea {
}
}
]
SumAggregator {
id: aggregator
model: root.balances
roleName: "balance"
}
}
}

View File

@ -26,6 +26,9 @@ DropArea {
readonly property int childCount: model.enabledNetworkBalance // NB using "balance" as "count" in m_communityTokenGroupsModel
readonly property alias title: groupedCommunityTokenDelegate.title
property var getCurrencyAmount: function (balance, symbol) {}
property var getCurrentCurrencyAmount: function(balance){}
ListView.onRemove: SequentialAnimation {
PropertyAction { target: root; property: "ListView.delayRemove"; value: true }
NumberAnimation { target: root; property: "scale"; to: 0; easing.type: Easing.InOutQuad }
@ -147,6 +150,12 @@ DropArea {
bottomInset: 2
visible: root.communityId === model.communityId
isCollectible: root.isCollectible
getCurrencyAmount: function (balance, symbol) {
return root.getCurrencyAmount(balance, symbol)
}
getCurrentCurrencyAmount: function (balance) {
return root.getCurrentCurrencyAmount(balance)
}
}
}
}

View File

@ -21,6 +21,9 @@ Control {
readonly property bool dirty: d.controller.dirty
readonly property bool hasSettings: d.controller.hasSettings
property var getCurrencyAmount: function (balance, symbol) {}
property var getCurrentCurrencyAmount: function(balance){}
background: null
function saveSettings() {
@ -72,6 +75,12 @@ Control {
count: d.controller.regularTokensModel.count
dragEnabled: count > 1
keys: ["x-status-draggable-token-item"]
getCurrencyAmount: function (balance, symbol) {
return root.getCurrencyAmount(balance, symbol)
}
getCurrentCurrencyAmount: function (balance) {
return root.getCurrentCurrencyAmount(balance)
}
}
}
@ -140,6 +149,12 @@ Control {
dragEnabled: false
keys: ["x-status-draggable-none"]
isHidden: true
getCurrencyAmount: function (balance, symbol) {
return root.getCurrencyAmount(balance, symbol)
}
getCurrentCurrencyAmount: function (balance) {
return root.getCurrentCurrencyAmount(balance)
}
}
}
}
@ -161,6 +176,12 @@ Control {
count: d.controller.communityTokensModel.count
dragEnabled: count > 1
keys: ["x-status-draggable-community-token-item"]
getCurrencyAmount: function (balance, symbol) {
return root.getCurrencyAmount(balance, symbol)
}
getCurrentCurrencyAmount: function (balance) {
return root.getCurrentCurrencyAmount(balance)
}
}
}
}
@ -182,6 +203,12 @@ Control {
dragParent: root
dragEnabled: d.controller.communityTokenGroupsModel.count > 1
communityGroupsExpanded: d.communityGroupsExpanded
getCurrencyAmount: function (balance, symbol) {
return root.getCurrencyAmount(balance, symbol)
}
getCurrentCurrencyAmount: function (balance) {
return root.getCurrentCurrencyAmount(balance)
}
}
}
}

View File

@ -184,7 +184,7 @@ QtObject {
}
// Tokens Filters
property var tokensList: walletSectionAssets.assets
property var tokensList
property var tokensFilter: []
function toggleToken(symbol) {
// update filters

View File

@ -36,7 +36,6 @@ QtObject {
property string backButtonName: ""
property var overview: walletSectionOverview
property var assets: walletSectionAssets.assets
property bool balanceLoading: overview.balanceLoading
property var accounts: walletSectionAccounts.accounts
property var receiveAccounts: walletSectionSend.accounts
@ -107,7 +106,9 @@ QtObject {
id: d
property var activityFiltersStoreDictionary: ({})
readonly property Component activityFilterStoreComponent: ActivityFiltersStore{}
readonly property Component activityFilterStoreComponent: ActivityFiltersStore{
tokensList: walletAssetsStore.groupedAccountAssetsModel
}
property var chainColors: ({})

View File

@ -254,6 +254,8 @@ Item {
communityTokensStore: appMain.communityTokensStore
communitiesStore: appMain.communitiesStore
devicesStore: appMain.rootStore.profileSectionStore.devicesStore
currencyStore: appMain.currencyStore
walletAssetsStore: appMain.walletAssetsStore
isDevBuild: !production
onOpenExternalLink: globalConns.onOpenLink(link)
@ -1205,6 +1207,8 @@ Item {
createChatPropertiesStore: appMain.createChatPropertiesStore
tokensStore: appMain.tokensStore
transactionStore: appMain.transactionStore
walletAssetsStore: appMain.walletAssetsStore
currencyStore: appMain.currencyStore
emojiPopup: statusEmojiPopup.item
stickersPopup: statusStickersPopupLoader.item
@ -1384,6 +1388,8 @@ Item {
}
tokensStore: appMain.tokensStore
transactionStore: appMain.transactionStore
walletAssetsStore: appMain.walletAssetsStore
currencyStore: appMain.currencyStore
onProfileButtonClicked: {
Global.changeAppSectionBySectionType(Constants.appSection.profile);

View File

@ -21,6 +21,7 @@ import AppLayouts.Chat.stores 1.0 as ChatStore
import shared.popups 1.0
import shared.status 1.0
import shared.stores 1.0
import utils 1.0
@ -32,6 +33,8 @@ QtObject {
required property var communityTokensStore
property var communitiesStore
property var devicesStore
property CurrenciesStore currencyStore
property WalletStore.WalletAssetsStore walletAssetsStore
property bool isDevBuild
signal openExternalLink(string link)
@ -552,12 +555,18 @@ QtObject {
loginType: root.rootStore.loginType
requirementsCheckPending: root.rootStore.requirementsCheckPending
walletAccountsModel: root.rootStore.walletAccountsModel
walletAssetsModel: walletAssetsStore.groupedAccountAssetsModel
permissionsModel: {
root.rootStore.prepareTokenModelForCommunity(communityIntroDialog.communityId)
return root.rootStore.permissionsModel
}
assetsModel: root.rootStore.assetsModel
collectiblesModel: root.rootStore.collectiblesModel
getCurrencyAmount: function (balance, symbol){
return currencyStore.getCurrencyAmount(balance, symbol)
}
onPrepareForSigning: {
root.rootStore.prepareKeypairsForSigning(communityIntroDialog.communityId, communityIntroDialog.name, sharedAddresses, airdropAddress, false)
@ -780,6 +789,7 @@ QtObject {
requirementsCheckPending: root.rootStore.requirementsCheckPending
loginType: chatStore.loginType
walletAccountsModel: root.rootStore.walletAccountsModel
walletAssetsModel: walletAssetsStore.groupedAccountAssetsModel
permissionsModel: {
root.rootStore.prepareTokenModelForCommunity(editSharedAddressesPopup.communityId)
return root.rootStore.permissionsModel
@ -816,6 +826,10 @@ QtObject {
editSharedAddressesPopup.sharedAddressesForAllNonKeycardKeypairsSigned()
}
}
getCurrencyAmount: function (balance, symbol) {
return root.currencyStore.getCurrencyAmount(balance, symbol)
}
}
},

View File

@ -26,6 +26,7 @@ StatusStackModal {
property int loginType: Constants.LoginType.Password
required property var walletAccountsModel // name, address, emoji, colorId
property var walletAssetsModel
required property var permissionsModel // id, key, permissionType, holdingsListModel, channelsListModel, isPrivate, tokenCriteriaMet
required property var assetsModel
required property var collectiblesModel
@ -34,6 +35,8 @@ StatusStackModal {
property var keypairSigningModel
property var getCurrencyAmount: function (balance, symbol){}
signal prepareForSigning(string airdropAddress, var sharedAddresses)
signal joinCommunity()
signal signSharedAddressesForAllNonKeycardKeypairs()
@ -133,6 +136,7 @@ StatusStackModal {
}
]
}
walletAssetsModel: root.walletAssetsModel
permissionsModel: root.permissionsModel
assetsModel: root.assetsModel
collectiblesModel: root.collectiblesModel
@ -144,6 +148,9 @@ StatusStackModal {
onSharedAddressesChanged: {
root.sharedAddressesUpdated(sharedAddresses)
}
getCurrencyAmount: function (balance, symbol){
return root.getCurrencyAmount(balance, symbol)
}
}
}