Skip to content

Commit

Permalink
fix(Stored): Make stores typed
Browse files Browse the repository at this point in the history
adding types instead of var for stores used in qml components
fixes: #14801
  • Loading branch information
Seitseman committed Jun 10, 2024
1 parent 551ae70 commit 4ae51ad
Show file tree
Hide file tree
Showing 173 changed files with 665 additions and 334 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ import mainui 1.0
import Storybook 1.0
import Models 1.0

import AppLayouts.stores 1.0 as AppLayoutStores
import shared.stores 1.0

SplitView {
id: root

Expand All @@ -20,8 +23,8 @@ SplitView {

Popups {
popupParent: root
rootStore: QtObject {}
communityTokensStore: QtObject {}
rootStore: AppLayoutStores.RootStore {}
communityTokensStore: CommunityTokensStore {}
}

QtObject {
Expand Down
1 change: 1 addition & 0 deletions storybook/pages/AddEditSavedAddressPopupPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import SortFilterProxyModel 0.2

import Storybook 1.0
import Models 1.0
import AppLayouts.stores 1.0
import AppLayouts.Wallet.popups 1.0

import utils 1.0
Expand Down
6 changes: 3 additions & 3 deletions storybook/pages/AssetsViewPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ import shared.stores 1.0
import Storybook 1.0
import Models 1.0

import AppLayouts.stores 1.0 as AppLayoutStores
import AppLayouts.Wallet.views 1.0
import AppLayouts.Wallet.stores 1.0


SplitView {
id: root

Expand Down Expand Up @@ -79,8 +79,8 @@ SplitView {

Popups {
popupParent: root
rootStore: QtObject {}
communityTokensStore: QtObject {}
rootStore: AppLayoutStores.RootStore
communityTokensStore: CommunityTokensStore {}
walletAssetsStore: d.walletAssetStore
}

Expand Down
3 changes: 2 additions & 1 deletion storybook/pages/ChangePasswordViewPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import QtQuick.Layouts 1.15
import QtQuick.Extras 1.4

import shared.views 1.0
import AppLayouts.Profile.stores 1.0
import AppLayouts.Profile.views 1.0

import utils 1.0
Expand Down Expand Up @@ -31,7 +32,7 @@ SplitView {

passwordStrengthScoreFunction: (newPass) => Math.min(newPass.length, 4)

privacyStore: QtObject{
privacyStore: PrivacyStore {
property QtObject privacyModule: QtObject {
signal passwordChanged(success: bool, errorMsg: string)
signal storeToKeychainError(errorDescription: string)
Expand Down
11 changes: 6 additions & 5 deletions storybook/pages/CollectibleDetailViewPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ import QtQuick.Layouts 1.15

import Storybook 1.0

import AppLayouts.Communities.stores 1.0 as CommunitiesStores
import AppLayouts.Wallet 1.0
import AppLayouts.Wallet.stores 1.0 as WalletStores
import AppLayouts.Wallet.views.collectibles 1.0

import StatusQ.Core.Utils 0.1

import shared.controls 1.0
import shared.stores 1.0
import shared.stores 1.0 as SharedStores

import Models 1.0
import utils 1.0
Expand Down Expand Up @@ -85,8 +86,8 @@ SplitView {
isCollectibleLoading: isLoadingCheckbox.checked
activityModel: d.transactionsModel
addressFilters: d.addressesSelected
rootStore: QtObject {
readonly property string currentCurrency: "EUR"
rootStore: SharedStores.RootStore {
currentCurrency: "EUR"

function getFiatValue(cryptoValue, symbol) {
return cryptoValue * 0.1;
Expand All @@ -96,7 +97,7 @@ SplitView {
return "%L1 %2".arg(cryptoValue).arg(symbol)
}
}
walletRootStore: QtObject {
walletRootStore: WalletStores.RootStore {
function getNameForAddress(address) {
return "NAMEFOR: %1".arg(address)
}
Expand Down Expand Up @@ -127,7 +128,7 @@ SplitView {
return "%1/assets/%2/%3/%4".arg(baseLink).arg(networkShortName).arg(contractAddress).arg(tokenId)
}
}
communitiesStore: QtObject {
communitiesStore: CommunitiesStores.CommunitiesStore {
function getCommunityDetailsAsJson(communityId) {
if (communityId.indexOf("unknown") >= 0) {
return { name : "", image : "", color : "" }
Expand Down
7 changes: 5 additions & 2 deletions storybook/pages/CollectiblesViewPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@ import StatusQ.Core.Utils 0.1 as SQUtils
import mainui 1.0
import utils 1.0

import AppLayouts.stores 1.0 as AppLayoutStores
import AppLayouts.Communities.stores 1.0 as CommunitiesStore
import AppLayouts.Wallet.views 1.0
import AppLayouts.Wallet.stores 1.0

import shared.stores 1.0
import shared.views 1.0

import Storybook 1.0
Expand Down Expand Up @@ -47,8 +50,8 @@ SplitView {

Popups {
popupParent: root
rootStore: QtObject {}
communityTokensStore: QtObject {}
rootStore: AppLayoutStores.RootStore
communityTokensStore: CommunityTokensStore {}
walletCollectiblesStore: CollectiblesStore {
collectiblesController: collectiblesView.controller
}
Expand Down
4 changes: 3 additions & 1 deletion storybook/pages/CommunitiesPortalLayoutPage.qml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import QtQuick 2.14
import QtQuick.Controls 2.14

import AppLayouts.stores 1.0 as AppLayoutStores
import AppLayouts.Communities 1.0
import AppLayouts.Communities.stores 1.0

import StatusQ 0.1
import SortFilterProxyModel 0.2

import Storybook 1.0
Expand All @@ -19,7 +21,7 @@ SplitView {

Popups {
popupParent: root
rootStore: QtObject {}
rootStore: AppLayoutStores.RootStore
communityTokensStore: CommunityTokensStore {}
}

Expand Down
5 changes: 3 additions & 2 deletions storybook/pages/CommunitiesViewPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import QtQuick.Controls 2.15

import StatusQ.Core 0.1

import AppLayouts.stores 1.0 as AppLayoutsStores
import AppLayouts.Profile.views 1.0
import AppLayouts.Wallet.stores 1.0
import AppLayouts.Profile.stores 1.0
Expand All @@ -28,7 +29,7 @@ SplitView {

Popups {
popupParent: root
rootStore: QtObject {}
rootStore: AppLayoutsStores.RootStore
communityTokensStore: CommunityTokensStore {}
}

Expand Down Expand Up @@ -56,7 +57,7 @@ SplitView {
}
property var communitiesList: ctrlEmptyView.checked ? emptyModel : communitiesModel
}
rootStore: QtObject {
rootStore: AppLayoutsStores.RootStore {
function isMyCommunityRequestPending(communityId) {
return communityId === "0x0006"
}
Expand Down
3 changes: 2 additions & 1 deletion storybook/pages/CreateChannelPopupPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import Storybook 1.0
import Models 1.0

import AppLayouts.Communities.popups 1.0
import AppLayouts.Communities.stores 1.0 as CommunitiesStores

SplitView {
id: root
Expand Down Expand Up @@ -77,7 +78,7 @@ SplitView {
}
}

communitiesStore: QtObject {
communitiesStore: CommunitiesStores.CommunitiesStore {
property string discordImportChannelName
readonly property bool discordImportInProgress: false
readonly property bool discordDataExtractionInProgress: false
Expand Down
3 changes: 2 additions & 1 deletion storybook/pages/EditSettingsPanelPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import QtQuick.Layouts 1.15

import mainui 1.0
import shared.stores 1.0
import AppLayouts.stores 1.0 as AppLayoutsStores
import AppLayouts.Communities.panels 1.0

import Storybook 1.0
Expand All @@ -14,7 +15,7 @@ SplitView {

Popups {
popupParent: root
rootStore: QtObject {}
rootStore: AppLayoutsStores.RootStore {}
communityTokensStore: CommunityTokensStore {}
}

Expand Down
3 changes: 2 additions & 1 deletion storybook/pages/ExportControlNodePopupPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import QtQuick 2.15
import QtQuick.Controls 2.15

import AppLayouts.Communities.popups 1.0
import AppLayouts.Profile.stores 1.0 as ProfileStores

import utils 1.0

Expand Down Expand Up @@ -91,7 +92,7 @@ SplitView {
property string image: Style.png("tokens/UNI")
property string color: "orchid"
}
devicesStore: QtObject {
devicesStore: ProfileStores.DevicesStore {
function loadDevices() {}

property bool isDeviceSetup: true
Expand Down
3 changes: 2 additions & 1 deletion storybook/pages/FirstTokenReceivedPopupPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import Models 1.0

import AppLayouts.Communities.popups 1.0
import AppLayouts.Communities.helpers 1.0
import AppLayouts.Communities.stores 1.0 as CommunitiesStores

import utils 1.0

Expand Down Expand Up @@ -43,7 +44,7 @@ SplitView {
communityId: "123"
communityName: communityNameText.text
communityLogo: ModelsData.collectibles.doodles
communitiesStore: QtObject {
communitiesStore: CommunitiesStores.CommunitiesStore {
function navigateToCommunity(id) {
logs.logEvent("FirstTokenReceivedPopup::onNavigateToCommunity: " + id)
}
Expand Down
6 changes: 4 additions & 2 deletions storybook/pages/InviteFriendsToCommunityPopupPage.qml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import QtQuick 2.14
import QtQuick.Controls 2.14

import AppLayouts.stores 1.0 as AppLayoutStores
import AppLayouts.Communities.popups 1.0
import AppLayouts.Profile.stores 1.0 as ProfileStores
import utils 1.0

import Storybook 1.0
Expand Down Expand Up @@ -106,7 +108,7 @@ SplitView {
name: "community-name"
})

rootStore: QtObject {
rootStore: AppLayoutStores.RootStore {
function communityHasMember(communityId, pubKey) {
return false
}
Expand All @@ -119,7 +121,7 @@ SplitView {
}
}

contactsStore: QtObject {
contactsStore: ProfileStores.ContactsStore {
readonly property ListModel myContactsModel: ListModel {
Component.onCompleted: {
for (let i = 0; i < 20; i++) {
Expand Down
9 changes: 6 additions & 3 deletions storybook/pages/LanguageViewPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import QtQuick 2.14
import QtQuick.Controls 2.14
import QtQuick.Layouts 1.14

import AppLayouts.stores 1.0 as AppLayoutStores
import AppLayouts.Profile.views 1.0
import AppLayouts.Profile.stores 1.0

Expand All @@ -10,15 +11,17 @@ import Storybook 1.0
import utils 1.0
import mainui 1.0

import shared.stores 1.0

SplitView {
id: root

Logs { id: logs }

Popups {
popupParent: root
rootStore: QtObject {}
communityTokensStore: QtObject {}
rootStore: AppLayoutStores.RootStore {}
communityTokensStore: CommunityTokensStore {}
}

SplitView {
Expand Down Expand Up @@ -67,7 +70,7 @@ SplitView {
}
}

currencyStore: QtObject {
currencyStore: CurrenciesStore {
property string currentCurrency: "USD"
property string currentCurrencySymbol: "$"

Expand Down
3 changes: 2 additions & 1 deletion storybook/pages/MembersSelectorPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import QtQuick.Controls 2.14
import QtQuick.Layouts 1.14

import AppLayouts.Chat.views 1.0
import AppLayouts.Chat.stores 1.0 as ChatStores

import Storybook 1.0
import utils 1.0
Expand Down Expand Up @@ -63,7 +64,7 @@ SplitView {
}
}

QtObject {
ChatStores.RootStore {
id: rootStoreMock

readonly property var contactsModel: ListModel {
Expand Down
7 changes: 5 additions & 2 deletions storybook/pages/OverviewSettingsPanelPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,19 @@ import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15

import mainui 1.0
import AppLayouts.stores 1.0 as AppLayoutStores
import AppLayouts.Communities.panels 1.0

import shared.stores 1.0

SplitView {
id: root
SplitView.fillWidth: true

Popups {
popupParent: root
rootStore: QtObject {}
communityTokensStore: QtObject {}
rootStore: AppLayoutStores.RootStore {}
communityTokensStore: CommunityTokensStore {}
}

OverviewSettingsPanel {
Expand Down
8 changes: 5 additions & 3 deletions storybook/pages/ProfileDialogViewPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import mainui 1.0
import StatusQ 0.1
import StatusQ.Core.Utils 0.1 as StatusQUtils

import AppLayouts.stores 1.0 as AppLayoutStores
import AppLayouts.Profile.stores 1.0 as ProfileStores
import AppLayouts.Wallet.stores 1.0

import Storybook 1.0
Expand Down Expand Up @@ -174,7 +176,7 @@ SplitView {

Popups {
popupParent: root
rootStore: QtObject {
rootStore: AppLayoutStores.RootStore {
property var contactStore: QtObject {
property var contactsModule: null

Expand Down Expand Up @@ -352,7 +354,7 @@ SplitView {
assetsModel: AssetsModel {}
collectiblesModel: CollectiblesModel {}

profileStore: QtObject {
profileStore: ProfileStores.ProfileStore {
readonly property string pubkey: "0xdeadbeef"
readonly property string ensName: name.text

Expand All @@ -364,7 +366,7 @@ SplitView {
}
}

contactsStore: QtObject {
contactsStore: ProfileStores.ContactsStore {
readonly property string myPublicKey: "0xdeadbeef"

function joinPrivateChat(publicKey) {
Expand Down
Loading

0 comments on commit 4ae51ad

Please sign in to comment.