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 walletAccounts: walletSectionAccounts.model
property var walletAccounts: Global.appIsReady? walletSectionAccounts.model : null
function getSigningPhrase() {
if(!root.stickersModule)

View File

@ -7,9 +7,9 @@ QtObject {
property var contactsModule
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 blockedContactsModel: contactsModule.blockedContactsModel

View File

@ -17,14 +17,14 @@ QtObject {
}
}
property string pubkey: userProfile.pubKey
property string icon: userProfile.icon
property string preferredUsername: userProfile.preferredName
property string pubkey: !!Global.userProfile? Global.userProfile.pubKey : ""
property string icon: !!Global.userProfile? Global.userProfile.icon : ""
property string preferredUsername: !!Global.userProfile? Global.userProfile.preferredName : ""
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) {
if(!root.ensUsernamesModule)

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,7 @@
pragma Singleton
import QtQuick 2.12
import utils 1.0
QtObject {
id: root
@ -11,10 +12,10 @@ QtObject {
property var profileSectionModuleInst: profileSectionModule
property var privacyModule: profileSectionModuleInst.privacyModule
property var userProfileInst: !!userProfile ? userProfile : null
property var walletSectionInst: !!walletSection ? walletSection : null
property var appSettingsInst: !!appSettings ? appSettings : null
property var accountSensitiveSettings: !!localAccountSensitiveSettings ? localAccountSensitiveSettings : null
property var userProfileInst: !!Global.userProfile? Global.userProfile : null
property var walletSectionInst: Global.appIsReady && !!walletSection? walletSection : null
property var appSettingsInst: Global.appIsReady && !!appSettings? appSettings : null
property var accountSensitiveSettings: Global.appIsReady && !!localAccountSensitiveSettings? localAccountSensitiveSettings : null
property real volume: !!appSettingsInst ? appSettingsInst.volume * 0.01 : 0.5
property bool isWalletEnabled: !!accountSensitiveSettings ? accountSensitiveSettings.isWalletEnabled : false
property bool notificationSoundsEnabled: !!appSettingsInst ? appSettingsInst.notificationSoundsEnabled : true
@ -28,18 +29,18 @@ QtObject {
// property string gasEthValue: !!walletModelInst ? walletModelInst.gasView.getGasEthValue : "0"
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 fiatValue: !!walletModelInst ? walletModelInst.balanceView.getFiatValue : "0"
// property string cryptoValue: !!walletModelInst ? walletModelInst.balanceView.getCryptoValue : "0"
property var history: typeof walletSectionTransactions !== "undefined" ? walletSectionTransactions
: null
property var historyTransactions: walletSectionTransactions.model
property var historyTransactions: Global.appIsReady? walletSectionTransactions.model : null
property bool isNonArchivalNode: history ? history.isNonArchivalNode
: false
property bool tokensLoading: walletSection.tokensLoading
property var currentAccount: walletSectionCurrent
property bool tokensLoading: Global.appIsReady? walletSection.tokensLoading : false
property var currentAccount: Global.appIsReady? walletSectionCurrent : null
property var marketValueStore: TokenMarketValuesStore{}
function getNetworkColor(chainId) {
@ -183,7 +184,9 @@ QtObject {
}
function findTokenSymbolByAddress(address) {
return walletSectionAllTokens.findTokenSymbolByAddress(address)
if (Global.appIsReady)
return walletSectionAllTokens.findTokenSymbolByAddress(address)
return ""
}
function getNameForSavedWalletAddress(address) {
@ -223,16 +226,18 @@ QtObject {
}
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
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 var userProfile
property bool appIsReady: false
signal openPinnedMessagesPopupRequested(var store, var messageStore, var pinnedMessagesModel, string messageToPin)
signal openCommunityProfilePopupRequested(var store, var community, var chatCommunitySectionModule)

View File

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