fix(ProfileSectionStore): Only instanciated once

- Removed `ProfileSectionStore` instance from `CurrenciesStore`. Only needed some certain accesses to the `profileSectionModule`.
- Added strict type in `CommunitiesView`.
This commit is contained in:
Noelia 2024-03-15 17:03:15 +01:00 committed by Noelia
parent 5ba0ad8ef4
commit 1d15398ea7
3 changed files with 8 additions and 6 deletions

View File

@ -5,6 +5,7 @@ import StatusQ.Core 0.1
import AppLayouts.Profile.views 1.0
import AppLayouts.Wallet.stores 1.0
import AppLayouts.Profile.stores 1.0
import mainui 1.0
import utils 1.0
@ -44,7 +45,7 @@ SplitView {
SplitView.preferredHeight: 400
contentWidth: 664
profileSectionStore: QtObject {
profileSectionStore: ProfileSectionStore {
property var communitiesProfileModule: QtObject {
function setCommunityMuted(communityId, mutedType) {
logs.logEvent("profileSectionStore::communitiesProfileModule::setCommunityMuted", ["communityId", "mutedType"], arguments)

View File

@ -19,13 +19,14 @@ import SortFilterProxyModel 0.2
import "../panels"
import AppLayouts.Communities.popups 1.0
import AppLayouts.Communities.panels 1.0
import AppLayouts.Profile.stores 1.0
import AppLayouts.Wallet.stores 1.0 as WalletStore
import AppLayouts.Chat.stores 1.0 as ChatStore
SettingsContentBase {
id: root
property var profileSectionStore
property ProfileSectionStore profileSectionStore
property var rootStore
required property WalletStore.WalletAssetsStore walletAssetsStore
required property CurrenciesStore currencyStore

View File

@ -10,7 +10,7 @@ QtObject {
// Some token+currency-related functions are implemented in the profileSectionModule.
// We should probably refactor this and move those functions to some Wallet module.
property ProfileSectionStore profileSectionStore: ProfileSectionStore {}
property var _profileSectionModuleInst: profileSectionModule
function getModelIndexForKey(key) {
for (var i=0; i<currenciesModel.count; i++) {
@ -989,17 +989,17 @@ QtObject {
}
function getFiatValue(cryptoAmount, cryptoSymbol) {
var amount = profileSectionStore.profileSectionModuleInst.ensUsernamesModule.getFiatValue(cryptoAmount, cryptoSymbol)
var amount = _profileSectionModuleInst.ensUsernamesModule.getFiatValue(cryptoAmount, cryptoSymbol)
return parseFloat(amount)
}
function getCryptoValue(fiatAmount, cryptoSymbol) {
var amount = profileSectionStore.profileSectionModuleInst.ensUsernamesModule.getCryptoValue(fiatAmount, cryptoSymbol)
var amount = _profileSectionModuleInst.ensUsernamesModule.getCryptoValue(fiatAmount, cryptoSymbol)
return parseFloat(amount)
}
function getGasEthValue(gweiValue, gasLimit) {
var amount = profileSectionStore.profileSectionModuleInst.ensUsernamesModule.getGasEthValue(gweiValue, gasLimit)
var amount = _profileSectionModuleInst.ensUsernamesModule.getGasEthValue(gweiValue, gasLimit)
return parseFloat(amount)
}