fix(@desktop/general): qml warnings caused by undefined context props handled

This commit is contained in:
Sale Djenic 2023-02-14 10:20:53 +01:00 committed by saledjenic
parent 86fb93ecb7
commit 8cc80694e2
10 changed files with 49 additions and 41 deletions

View File

@ -6,7 +6,7 @@ QtObject {
property var stickersModule property var stickersModule
property var walletAccounts: walletSectionAccounts.model property var walletAccounts: Global.appIsReady? walletSectionAccounts.model : null
function getSigningPhrase() { function getSigningPhrase() {
if(!root.stickersModule) if(!root.stickersModule)

View File

@ -7,9 +7,9 @@ QtObject {
property var contactsModule property var contactsModule
property var globalUtilsInst: globalUtils property var globalUtilsInst: globalUtils
property var mainModuleInst: mainModule property var mainModuleInst: Global.appIsReady? mainModule : null
property string myPublicKey: userProfile.pubKey property string myPublicKey: !!Global.userProfile? Global.userProfile.pubKey : ""
property var myContactsModel: contactsModule.myMutualContactsModel property var myContactsModel: contactsModule.myMutualContactsModel
property var blockedContactsModel: contactsModule.blockedContactsModel property var blockedContactsModel: contactsModule.blockedContactsModel

View File

@ -17,14 +17,14 @@ QtObject {
} }
} }
property string pubkey: userProfile.pubKey property string pubkey: !!Global.userProfile? Global.userProfile.pubKey : ""
property string icon: userProfile.icon property string icon: !!Global.userProfile? Global.userProfile.icon : ""
property string preferredUsername: userProfile.preferredName property string preferredUsername: !!Global.userProfile? Global.userProfile.preferredName : ""
readonly property string chainId: ensUsernamesModule.chainId readonly property string chainId: ensUsernamesModule.chainId
property string username: userProfile.username property string username: !!Global.userProfile? Global.userProfile.username : ""
property var walletAccounts: walletSectionAccounts.model property var walletAccounts: Global.appIsReady? walletSectionAccounts.model : null
function setPrefferedEnsUsername(ensName) { function setPrefferedEnsUsername(ensName) {
if(!root.ensUsernamesModule) if(!root.ensUsernamesModule)

View File

@ -67,11 +67,11 @@ QtObject {
stickersModule: stickersModuleInst stickersModule: stickersModuleInst
} }
property bool browserMenuItemEnabled: localAccountSensitiveSettings.isBrowserEnabled property bool browserMenuItemEnabled: Global.appIsReady? localAccountSensitiveSettings.isBrowserEnabled : false
property bool walletMenuItemEnabled: localAccountSensitiveSettings.isWalletEnabled property bool walletMenuItemEnabled: Global.appIsReady? localAccountSensitiveSettings.isWalletEnabled : false
property var communitiesModuleInst: communitiesModule property var communitiesModuleInst: Global.appIsReady? communitiesModule : null
property var communitiesList: communitiesModuleInst.model property var communitiesList: !!communitiesModuleInst? communitiesModuleInst.model : null
property var communitiesProfileModule: profileSectionModuleInst.communitiesModule property var communitiesProfileModule: profileSectionModuleInst.communitiesModule
property ListModel mainMenuItems: ListModel { property ListModel mainMenuItems: ListModel {

View File

@ -6,14 +6,14 @@ QtObject {
property var profileModule property var profileModule
property string pubkey: userProfile.pubKey property string pubkey: !!Global.userProfile? Global.userProfile.pubKey : ""
property string name: userProfile.name property string name: !!Global.userProfile? Global.userProfile.name : ""
property string username: userProfile.username property string username: !!Global.userProfile? Global.userProfile.username : ""
property string displayName: userProfile.displayName property string displayName: !!Global.userProfile? Global.userProfile.displayName : ""
property string preferredName: userProfile.preferredName property string preferredName: !!Global.userProfile? Global.userProfile.preferredName : ""
property string profileLargeImage: userProfile.largeImage property string profileLargeImage: !!Global.userProfile? Global.userProfile.largeImage : ""
property string icon: userProfile.icon property string icon: !!Global.userProfile? Global.userProfile.icon : ""
property bool userDeclinedBackupBanner: localAccountSensitiveSettings.userDeclinedBackupBanner property bool userDeclinedBackupBanner: Global.appIsReady? localAccountSensitiveSettings.userDeclinedBackupBanner : false
property var privacyStore: profileSectionModule.privacyModule property var privacyStore: profileSectionModule.privacyModule
readonly property string bio: profileModule.bio readonly property string bio: profileModule.bio

View File

@ -1,11 +1,12 @@
import QtQuick 2.13 import QtQuick 2.13
import "../../Wallet/stores" import "../../Wallet/stores"
import utils 1.0
QtObject { QtObject {
id: root id: root
property var accountSensitiveSettings: localAccountSensitiveSettings property var accountSensitiveSettings: Global.appIsReady? localAccountSensitiveSettings : null
property var areTestNetworksEnabled: networksModule.areTestNetworksEnabled property var areTestNetworksEnabled: networksModule.areTestNetworksEnabled
property var layer1Networks: networksModule.layer1 property var layer1Networks: networksModule.layer1
@ -16,12 +17,12 @@ QtObject {
networksModule.toggleTestNetworksEnabled() networksModule.toggleTestNetworksEnabled()
} }
property var accounts: walletSectionAccounts.model property var accounts: Global.appIsReady? walletSectionAccounts.model : null
property var importedAccounts: walletSectionAccounts.imported property var importedAccounts: Global.appIsReady? walletSectionAccounts.imported : null
property var generatedAccounts: walletSectionAccounts.generated property var generatedAccounts: Global.appIsReady? walletSectionAccounts.generated : null
property var watchOnlyAccounts: walletSectionAccounts.watchOnly property var watchOnlyAccounts: Global.appIsReady? walletSectionAccounts.watchOnly : null
property var currentAccount: walletSectionCurrent property var currentAccount: Global.appIsReady? walletSectionCurrent : null
function switchAccountByAddress(address) { function switchAccountByAddress(address) {
walletSection.switchAccountByAddress(address) walletSection.switchAccountByAddress(address)
@ -35,7 +36,7 @@ QtObject {
return walletSectionCurrent.update(address, accountName, color, emoji) return walletSectionCurrent.update(address, accountName, color, emoji)
} }
property var dappList: dappPermissionsModule.dapps property var dappList: Global.appIsReady? dappPermissionsModule.dapps : null
function disconnect(dappName) { function disconnect(dappName) {
dappPermissionsModule.disconnect(dappName) dappPermissionsModule.disconnect(dappName)

View File

@ -27,7 +27,7 @@ QtObject {
return 0; return 0;
} }
property string currentCurrency: walletSection.currentCurrency property string currentCurrency: Global.appIsReady? walletSection.currentCurrency : ""
property int currentCurrencyModelIndex: getModelIndexForShortName(currentCurrency) property int currentCurrencyModelIndex: getModelIndexForShortName(currentCurrency)
property string currentCurrencySymbol: currenciesModel.get(currentCurrencyModelIndex).symbol property string currentCurrencySymbol: currenciesModel.get(currentCurrencyModelIndex).symbol

View File

@ -1,6 +1,7 @@
pragma Singleton pragma Singleton
import QtQuick 2.12 import QtQuick 2.12
import utils 1.0
QtObject { QtObject {
id: root id: root
@ -11,10 +12,10 @@ QtObject {
property var profileSectionModuleInst: profileSectionModule property var profileSectionModuleInst: profileSectionModule
property var privacyModule: profileSectionModuleInst.privacyModule property var privacyModule: profileSectionModuleInst.privacyModule
property var userProfileInst: !!userProfile ? userProfile : null property var userProfileInst: !!Global.userProfile? Global.userProfile : null
property var walletSectionInst: !!walletSection ? walletSection : null property var walletSectionInst: Global.appIsReady && !!walletSection? walletSection : null
property var appSettingsInst: !!appSettings ? appSettings : null property var appSettingsInst: Global.appIsReady && !!appSettings? appSettings : null
property var accountSensitiveSettings: !!localAccountSensitiveSettings ? localAccountSensitiveSettings : null property var accountSensitiveSettings: Global.appIsReady && !!localAccountSensitiveSettings? localAccountSensitiveSettings : null
property real volume: !!appSettingsInst ? appSettingsInst.volume * 0.01 : 0.5 property real volume: !!appSettingsInst ? appSettingsInst.volume * 0.01 : 0.5
property bool isWalletEnabled: !!accountSensitiveSettings ? accountSensitiveSettings.isWalletEnabled : false property bool isWalletEnabled: !!accountSensitiveSettings ? accountSensitiveSettings.isWalletEnabled : false
property bool notificationSoundsEnabled: !!appSettingsInst ? appSettingsInst.notificationSoundsEnabled : true property bool notificationSoundsEnabled: !!appSettingsInst ? appSettingsInst.notificationSoundsEnabled : true
@ -28,18 +29,18 @@ QtObject {
// property string gasEthValue: !!walletModelInst ? walletModelInst.gasView.getGasEthValue : "0" // property string gasEthValue: !!walletModelInst ? walletModelInst.gasView.getGasEthValue : "0"
property CurrenciesStore currencyStore: CurrenciesStore {} property CurrenciesStore currencyStore: CurrenciesStore {}
property string currentCurrency: walletSection.currentCurrency property string currentCurrency: Global.appIsReady? walletSection.currentCurrency : ""
// property string defaultCurrency: !!walletModelInst ? walletModelInst.balanceView.defaultCurrency : "0" // property string defaultCurrency: !!walletModelInst ? walletModelInst.balanceView.defaultCurrency : "0"
// property string fiatValue: !!walletModelInst ? walletModelInst.balanceView.getFiatValue : "0" // property string fiatValue: !!walletModelInst ? walletModelInst.balanceView.getFiatValue : "0"
// property string cryptoValue: !!walletModelInst ? walletModelInst.balanceView.getCryptoValue : "0" // property string cryptoValue: !!walletModelInst ? walletModelInst.balanceView.getCryptoValue : "0"
property var history: typeof walletSectionTransactions !== "undefined" ? walletSectionTransactions property var history: typeof walletSectionTransactions !== "undefined" ? walletSectionTransactions
: null : null
property var historyTransactions: walletSectionTransactions.model property var historyTransactions: Global.appIsReady? walletSectionTransactions.model : null
property bool isNonArchivalNode: history ? history.isNonArchivalNode property bool isNonArchivalNode: history ? history.isNonArchivalNode
: false : false
property bool tokensLoading: walletSection.tokensLoading property bool tokensLoading: Global.appIsReady? walletSection.tokensLoading : false
property var currentAccount: walletSectionCurrent property var currentAccount: Global.appIsReady? walletSectionCurrent : null
property var marketValueStore: TokenMarketValuesStore{} property var marketValueStore: TokenMarketValuesStore{}
function getNetworkColor(chainId) { function getNetworkColor(chainId) {
@ -183,7 +184,9 @@ QtObject {
} }
function findTokenSymbolByAddress(address) { function findTokenSymbolByAddress(address) {
return walletSectionAllTokens.findTokenSymbolByAddress(address) if (Global.appIsReady)
return walletSectionAllTokens.findTokenSymbolByAddress(address)
return ""
} }
function getNameForSavedWalletAddress(address) { function getNameForSavedWalletAddress(address) {
@ -223,16 +226,18 @@ QtObject {
} }
function getHistoricalDataForToken(symbol, currency) { function getHistoricalDataForToken(symbol, currency) {
walletSectionAllTokens.getHistoricalDataForToken(symbol,currency) if (Global.appIsReady)
walletSectionAllTokens.getHistoricalDataForToken(symbol,currency)
} }
property bool marketHistoryIsLoading: walletSectionAllTokens.marketHistoryIsLoading property bool marketHistoryIsLoading: Global.appIsReady? walletSectionAllTokens.marketHistoryIsLoading : false
// TODO: range until we optimize to cache the data and abuse the requests // TODO: range until we optimize to cache the data and abuse the requests
function fetchHistoricalBalanceForTokenAsJson(address, tokenSymbol, currencySymbol, timeIntervalEnum) { function fetchHistoricalBalanceForTokenAsJson(address, tokenSymbol, currencySymbol, timeIntervalEnum) {
walletSectionAllTokens.fetchHistoricalBalanceForTokenAsJson(address, tokenSymbol, currencySymbol, timeIntervalEnum) if (Global.appIsReady)
walletSectionAllTokens.fetchHistoricalBalanceForTokenAsJson(address, tokenSymbol, currencySymbol, timeIntervalEnum)
} }
property bool balanceHistoryIsLoading: walletSectionAllTokens.balanceHistoryIsLoading property bool balanceHistoryIsLoading: Global.appIsReady? walletSectionAllTokens.balanceHistoryIsLoading : false
} }

View File

@ -11,6 +11,7 @@ QtObject {
property int settingsSubsection: Constants.settingsSubsection.profile property int settingsSubsection: Constants.settingsSubsection.profile
property var userProfile property var userProfile
property bool appIsReady: false
signal openPinnedMessagesPopupRequested(var store, var messageStore, var pinnedMessagesModel, string messageToPin) signal openPinnedMessagesPopupRequested(var store, var messageStore, var pinnedMessagesModel, string messageToPin)
signal openCommunityProfilePopupRequested(var store, var community, var chatCommunitySectionModule) signal openCommunityProfilePopupRequested(var store, var community, var chatCommunitySectionModule)

View File

@ -165,6 +165,7 @@ StatusWindow {
appLoadingAnimation.active = localAppSettings && localAppSettings.fakeLoadingScreenEnabled appLoadingAnimation.active = localAppSettings && localAppSettings.fakeLoadingScreenEnabled
appLoadingAnimation.runningProgressAnimation = localAppSettings && localAppSettings.fakeLoadingScreenEnabled appLoadingAnimation.runningProgressAnimation = localAppSettings && localAppSettings.fakeLoadingScreenEnabled
Global.userProfile = userProfile Global.userProfile = userProfile
Global.appIsReady = true
loader.sourceComponent = app loader.sourceComponent = app