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 7, 2024
1 parent 551ae70 commit 2236beb
Show file tree
Hide file tree
Showing 129 changed files with 461 additions and 227 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import mainui 1.0
import Storybook 1.0
import Models 1.0

import AppLayouts.stores 1.0 as AppLayoutStores

SplitView {
id: root

Expand All @@ -20,7 +22,7 @@ SplitView {

Popups {
popupParent: root
rootStore: QtObject {}
rootStore: AppLayoutStores.RootStore {}
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
4 changes: 2 additions & 2 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,7 +79,7 @@ SplitView {

Popups {
popupParent: root
rootStore: QtObject {}
rootStore: AppLayoutStores.RootStore
communityTokensStore: QtObject {}
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
6 changes: 3 additions & 3 deletions storybook/pages/CollectibleDetailViewPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ 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 +85,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 Down
3 changes: 2 additions & 1 deletion storybook/pages/CollectiblesViewPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ 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.Wallet.views 1.0
import AppLayouts.Wallet.stores 1.0

Expand Down Expand Up @@ -47,7 +48,7 @@ SplitView {

Popups {
popupParent: root
rootStore: QtObject {}
rootStore: AppLayoutStores.RootStore
communityTokensStore: QtObject {}
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.helpers 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.CommunitiesStores {
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
3 changes: 2 additions & 1 deletion 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 @@ -17,7 +18,7 @@ SplitView {

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

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
3 changes: 2 additions & 1 deletion storybook/pages/OverviewSettingsPanelPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ 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

SplitView {
Expand All @@ -11,7 +12,7 @@ SplitView {

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

Expand Down
3 changes: 2 additions & 1 deletion storybook/pages/ProfileDialogViewPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ 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.Wallet.stores 1.0

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

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

Expand Down
11 changes: 7 additions & 4 deletions storybook/pages/ProfilePopupInviteFriendsPanelPage.qml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import QtQuick 2.14
import QtQuick.Controls 2.14
import QtQuick 2.15
import QtQuick.Controls 2.15

import AppLayouts.Communities.panels 1.0
import AppLayouts.Profile.stores 1.0 as ProfileStores
import AppLayouts.stores 1.0 as AppLayoutStores

import utils 1.0

Item {
Expand Down Expand Up @@ -56,13 +59,13 @@ Item {

community: ({ id: "communityId" })

rootStore: QtObject {
rootStore: AppLayoutStores.RootStore {
function communityHasMember(communityId, pubKey) {
return false
}
}

contactsStore: QtObject {
contactsStore: ProfileStores.ContactsStore {
readonly property ListModel myContactsModel: ListModel {
Component.onCompleted: {
const keys = []
Expand Down
4 changes: 3 additions & 1 deletion storybook/pages/ProfilePopupInviteMessagePanelPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import QtQuick 2.14
import QtQuick.Controls 2.14

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

import utils 1.0

Item {
Expand Down Expand Up @@ -63,7 +65,7 @@ Item {
sourceComponent: ProfilePopupInviteMessagePanel {
id: panel

contactsStore: QtObject {
contactsStore: ProfileStores.ContactsStore {
readonly property ListModel myContactsModel: ListModel {
Component.onCompleted: {
const keys = []
Expand Down
3 changes: 2 additions & 1 deletion storybook/pages/ProfileSocialLinksPanelPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import StatusQ.Core 0.1
import StatusQ.Core.Utils 0.1 as CoreUtils

import mainui 1.0
import AppLayouts.stores 1.0 as AppLayoutStores
import AppLayouts.Profile.panels 1.0
import shared.stores 1.0

Expand All @@ -21,7 +22,7 @@ SplitView {

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

Expand Down
3 changes: 2 additions & 1 deletion storybook/pages/ReceiveModalPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import StatusQ.Core.Utils 0.1
import Storybook 1.0
import Models 1.0
import AppLayouts.Wallet.popups 1.0
import AppLayouts.Wallet.stores 1.0 as WalletStores

SplitView {
orientation: Qt.Horizontal
Expand Down Expand Up @@ -61,7 +62,7 @@ SplitView {

property string networksNames: "oeth:arb1:eth:"

store: QtObject {
store: WalletStores.RootStore {
property var filteredFlatModel: SortFilterProxyModel {
sourceModel: NetworksModel.flatNetworks
filters: ValueFilter { roleName: "isTest"; value: false }
Expand Down
Loading

0 comments on commit 2236beb

Please sign in to comment.