diff --git a/ui/app/AppLayouts/Chat/stores/StickersStore.qml b/ui/app/AppLayouts/Chat/stores/StickersStore.qml index 9637015a8e..831115691f 100644 --- a/ui/app/AppLayouts/Chat/stores/StickersStore.qml +++ b/ui/app/AppLayouts/Chat/stores/StickersStore.qml @@ -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) diff --git a/ui/app/AppLayouts/Profile/stores/ContactsStore.qml b/ui/app/AppLayouts/Profile/stores/ContactsStore.qml index ff7dd3275d..d098530242 100644 --- a/ui/app/AppLayouts/Profile/stores/ContactsStore.qml +++ b/ui/app/AppLayouts/Profile/stores/ContactsStore.qml @@ -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 diff --git a/ui/app/AppLayouts/Profile/stores/EnsUsernamesStore.qml b/ui/app/AppLayouts/Profile/stores/EnsUsernamesStore.qml index c4053d2df1..d9b900985e 100644 --- a/ui/app/AppLayouts/Profile/stores/EnsUsernamesStore.qml +++ b/ui/app/AppLayouts/Profile/stores/EnsUsernamesStore.qml @@ -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) diff --git a/ui/app/AppLayouts/Profile/stores/ProfileSectionStore.qml b/ui/app/AppLayouts/Profile/stores/ProfileSectionStore.qml index 400c6d0680..b197383c00 100644 --- a/ui/app/AppLayouts/Profile/stores/ProfileSectionStore.qml +++ b/ui/app/AppLayouts/Profile/stores/ProfileSectionStore.qml @@ -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 { diff --git a/ui/app/AppLayouts/Profile/stores/ProfileStore.qml b/ui/app/AppLayouts/Profile/stores/ProfileStore.qml index 22285c67c3..70022f49e2 100644 --- a/ui/app/AppLayouts/Profile/stores/ProfileStore.qml +++ b/ui/app/AppLayouts/Profile/stores/ProfileStore.qml @@ -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 diff --git a/ui/app/AppLayouts/Profile/stores/WalletStore.qml b/ui/app/AppLayouts/Profile/stores/WalletStore.qml index 9569e98765..6684a8ad61 100644 --- a/ui/app/AppLayouts/Profile/stores/WalletStore.qml +++ b/ui/app/AppLayouts/Profile/stores/WalletStore.qml @@ -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) diff --git a/ui/imports/shared/stores/CurrenciesStore.qml b/ui/imports/shared/stores/CurrenciesStore.qml index 6ace49ff88..8e4f419356 100644 --- a/ui/imports/shared/stores/CurrenciesStore.qml +++ b/ui/imports/shared/stores/CurrenciesStore.qml @@ -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 diff --git a/ui/imports/shared/stores/RootStore.qml b/ui/imports/shared/stores/RootStore.qml index 93e473d0cb..462d89ae1a 100644 --- a/ui/imports/shared/stores/RootStore.qml +++ b/ui/imports/shared/stores/RootStore.qml @@ -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 } diff --git a/ui/imports/utils/Global.qml b/ui/imports/utils/Global.qml index f443b96ee2..1433515f20 100644 --- a/ui/imports/utils/Global.qml +++ b/ui/imports/utils/Global.qml @@ -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) diff --git a/ui/main.qml b/ui/main.qml index e1dc558dec..4147da8984 100644 --- a/ui/main.qml +++ b/ui/main.qml @@ -165,6 +165,7 @@ StatusWindow { appLoadingAnimation.active = localAppSettings && localAppSettings.fakeLoadingScreenEnabled appLoadingAnimation.runningProgressAnimation = localAppSettings && localAppSettings.fakeLoadingScreenEnabled Global.userProfile = userProfile + Global.appIsReady = true loader.sourceComponent = app