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 May 23, 2024
1 parent 55edd94 commit 0868a3c
Show file tree
Hide file tree
Showing 43 changed files with 149 additions and 119 deletions.
12 changes: 7 additions & 5 deletions ui/app/AppLayouts/Browser/BrowserLayout.qml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@ import shared.controls 1.0
import shared 1.0
import shared.status 1.0
import shared.popups.send 1.0
import shared.stores 1.0
import shared.stores.send 1.0

import "../Wallet/stores"

import "popups"
import "controls"
import "views"
Expand All @@ -29,12 +32,11 @@ import "stores"
StatusSectionLayout {
id: root

property var globalStore
property var sendTransactionModal
required property TransactionStore transactionStore
required property var assetsStore
required property var currencyStore
required property var tokensStore
required property TokensStore tokensStore
required property WalletAssetsStore walletAssetsStore
required property CurrenciesStore currencyStore

function openUrlInNewTab(url) {
var tab = _internal.addNewTab()
Expand Down Expand Up @@ -433,7 +435,7 @@ StatusSectionLayout {
Component {
id: browserWalletMenu
BrowserWalletMenu {
assetsStore: root.assetsStore
walletAssetsStore: root.walletAssetsStore
currencyStore: root.currencyStore
tokensStore: root.tokensStore
property point headerPoint: Qt.point(browserHeader.x, browserHeader.y)
Expand Down
10 changes: 6 additions & 4 deletions ui/app/AppLayouts/Browser/popups/BrowserWalletMenu.qml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,20 @@ import StatusQ.Controls 0.1
import StatusQ.Core 0.1

import shared.controls 1.0
import shared.stores 1.0
import shared.views 1.0
import utils 1.0

import "../stores"
import "../../Wallet/stores"

// TODO: replace with StatusMenu
Dialog {
id: popup

required property var assetsStore
required property var currencyStore
required property var tokensStore
required property WalletAssetsStore walletAssetsStore
required property CurrenciesStore currencyStore
required property TokensStore tokensStore

signal sendTriggered(var selectedAccount)
signal disconnect()
Expand Down Expand Up @@ -208,7 +210,7 @@ Dialog {

AssetsView {
id: assetsTab
controller: popup.assetsStore.assetsController
controller: popup.walletAssetsStore.assetsController
currencyStore: popup.currencyStore
tokensStore: popup.tokensStore
}
Expand Down
5 changes: 3 additions & 2 deletions ui/app/AppLayouts/Chat/ChatLayout.qml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import AppLayouts.Communities.popups 1.0
import AppLayouts.Communities.helpers 1.0

import AppLayouts.Chat.stores 1.0
import AppLayouts.Profile.stores 1.0
import AppLayouts.Wallet.stores 1.0 as WalletStore

import StatusQ.Core.Utils 0.1
Expand All @@ -23,8 +24,8 @@ StackLayout {
id: root

property RootStore rootStore
property var createChatPropertiesStore
readonly property var contactsStore: rootStore.contactsStore
property CreateChatPropertiesStore createChatPropertiesStore
readonly property ContactsStore contactsStore: rootStore.contactsStore
readonly property var permissionsStore: rootStore.permissionsStore
property var communitiesStore
required property WalletStore.TokensStore tokensStore
Expand Down
4 changes: 3 additions & 1 deletion ui/app/AppLayouts/Chat/panels/UserListPanel.qml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ import utils 1.0

import SortFilterProxyModel 0.2

import "../stores" as ChatStores

Item {
id: root

property var store
property ChatStores.RootStore store
property var usersModel
property string label
property int communityMemberReevaluationStatus: Constants.CommunityMemberReevaluationStatus.None
Expand Down
6 changes: 4 additions & 2 deletions ui/app/AppLayouts/Chat/popups/PinnedMessagesPopup.qml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@ import StatusQ.Popups.Dialog 0.1
import utils 1.0
import shared.views.chat 1.0

import "../stores"

StatusDialog {
id: root

property var store
property var messageStore
property RootStore store
property MessageStore messageStore
property var pinnedMessagesModel //this doesn't belong to the messageStore, it is a part of the ChatContentStore, but we didn't introduce it yet.
property string messageToPin
property string messageToUnpin
Expand Down
15 changes: 9 additions & 6 deletions ui/app/AppLayouts/Chat/stores/RootStore.qml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,17 @@ import SortFilterProxyModel 0.2
import StatusQ.Core.Utils 0.1 as StatusQUtils
import shared.stores 1.0

import AppLayouts.Profile.stores 1.0
import AppLayouts.Wallet.stores 1.0 as WalletStore

QtObject {
id: root

property var contactsStore
property var communityTokensStore
property var walletStore
property ContactsStore contactsStore
property CommunityTokensStore communityTokensStore
property WalletStore.RootStore walletStore

property var networkConnectionStore
property NetworkConnectionStore networkConnectionStore

readonly property PermissionsStore permissionsStore: PermissionsStore {
activeSectionId: mainModuleInst.activeSection.id
Expand Down Expand Up @@ -202,7 +205,7 @@ QtObject {
}
}

property var messageStore: MessageStore { }
property MessageStore messageStore: MessageStore { }

property var emojiReactionsModel

Expand Down Expand Up @@ -231,7 +234,7 @@ QtObject {

readonly property int loginType: getLoginType()

property var stickersStore: StickersStore {
property StickersStore stickersStore: StickersStore {
stickersModule: stickersModuleInst
}

Expand Down
1 change: 1 addition & 0 deletions ui/app/AppLayouts/Chat/stores/qmldir
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ RootStore 1.0 RootStore.qml
StickerData 1.0 StickerData.qml
StickerPackData 1.0 StickerPackData.qml
StickersStore 1.0 StickersStore.qml
MessageStore 1.0 MessageStore.qml
7 changes: 4 additions & 3 deletions ui/app/AppLayouts/Chat/views/ChatColumnView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import SortFilterProxyModel 0.2

import AppLayouts.Communities.popups 1.0
import AppLayouts.Communities.panels 1.0
import AppLayouts.Profile.stores 1.0

import "../helpers"
import "../controls"
Expand All @@ -35,9 +36,9 @@ Item {
// don't follow struct we have on the backend.
property var parentModule

property var rootStore
property var createChatPropertiesStore
property var contactsStore
property RootStore rootStore
property CreateChatPropertiesStore createChatPropertiesStore
property ContactsStore contactsStore
property var emojiPopup
property var stickersPopup

Expand Down
8 changes: 5 additions & 3 deletions ui/app/AppLayouts/Chat/views/ChatContentView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import shared.status 1.0
import shared.controls 1.0
import shared.views.chat 1.0

import AppLayouts.Profile.stores 1.0

import "../helpers"
import "../controls"
import "../popups"
Expand All @@ -28,8 +30,8 @@ ColumnLayout {
// Important: each chat/channel has its own ChatContentModule
property var chatContentModule
property var chatSectionModule
property var rootStore
property var contactsStore
property RootStore rootStore
property ContactsStore contactsStore
property string chatId
property int chatType: Constants.chatType.unknown

Expand All @@ -45,7 +47,7 @@ ColumnLayout {
property bool isUserAllowedToSendMessage: root.rootStore.isUserAllowedToSendMessage
property bool stickersLoaded: false

readonly property var messageStore: MessageStore {
readonly property MessageStore messageStore: MessageStore {
messageModule: chatContentModule ? chatContentModule.messagesModule : null
chatSectionModule: root.rootStore.chatCommunitySectionModule
}
Expand Down
2 changes: 1 addition & 1 deletion ui/app/AppLayouts/Chat/views/ChatHeaderContentView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Item {
property alias membersButton: membersButton
property alias searchButton: searchButton

property var rootStore
required property RootStore rootStore
property var chatContentModule: root.rootStore.currentChatContentModule() || null
property var emojiPopup
property int padding: Style.current.halfPadding
Expand Down
5 changes: 3 additions & 2 deletions ui/app/AppLayouts/Chat/views/ChatMessagesView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@ import shared.views.chat 1.0

import "../controls"
import "../panels"
import "../stores"

Item {
id: root

property var chatContentModule
property var rootStore
property var messageStore
property RootStore rootStore
property MessageStore messageStore
property var usersStore
property var contactsStore
property string channelEmoji
Expand Down
5 changes: 3 additions & 2 deletions ui/app/AppLayouts/Chat/views/ChatView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import "../panels"
import AppLayouts.Communities.panels 1.0
import AppLayouts.Communities.views 1.0
import AppLayouts.Communities.controls 1.0
import AppLayouts.Profile.stores 1.0
import AppLayouts.Wallet.stores 1.0 as WalletStore
import "../popups"
import "../helpers"
Expand All @@ -33,12 +34,12 @@ import "../stores"
StatusSectionLayout {
id: root

property var contactsStore
property ContactsStore contactsStore
property bool hasAddedContacts: contactsStore.myContactsModel.count > 0

property RootStore rootStore
required property TransactionStore transactionStore
property var createChatPropertiesStore
property CreateChatPropertiesStore createChatPropertiesStore
property var communitiesStore
required property WalletStore.WalletAssetsStore walletAssetsStore
required property CurrenciesStore currencyStore
Expand Down
3 changes: 2 additions & 1 deletion ui/app/AppLayouts/Chat/views/ContactsColumnView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import SortFilterProxyModel 0.2

import "../panels"
import "../popups"
import "../stores"
import AppLayouts.Communities.popups 1.0

Item {
Expand All @@ -31,7 +32,7 @@ Item {
// This module is set from `ChatLayout` (each `ChatLayout` has its own chatSectionModule)
property var chatSectionModule

property var store
property RootStore store
property var contactsStore
property var emojiPopup

Expand Down
4 changes: 3 additions & 1 deletion ui/app/AppLayouts/Chat/views/CreateChatView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ import utils 1.0
import shared.status 1.0
import shared.controls.delegates 1.0

import AppLayouts.Chat.stores 1.0 as ChatStores

Page {
id: root

property var rootStore
property ChatStores.RootStore rootStore
property var createChatPropertiesStore
property var emojiPopup: null
property var stickersPopup: null
Expand Down
3 changes: 2 additions & 1 deletion ui/app/AppLayouts/Chat/views/private/MembersSelectorBase.qml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import StatusQ.Controls 0.1
import StatusQ.Components 0.1

import "../../panels"
import "../../stores" as ChatStores

import utils 1.0
import shared.controls.delegates 1.0
Expand All @@ -18,7 +19,7 @@ import SortFilterProxyModel 0.2
InlineSelectorPanel {
id: root

property var rootStore
property ChatStores.RootStore rootStore

readonly property int membersLimit: 20 // see: https://github.com/status-im/status-mobile/issues/13066
property bool limitReached: model.count >= membersLimit
Expand Down
4 changes: 3 additions & 1 deletion ui/app/AppLayouts/Communities/panels/WelcomeBannerPanel.qml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import StatusQ.Core 0.1
import StatusQ.Core.Theme 0.1
import StatusQ.Controls 0.1

import AppLayouts.Chat.stores 1.0

import shared.panels 1.0
import shared.status 1.0

Expand All @@ -13,7 +15,7 @@ Rectangle {
id: root

property var activeCommunity
property var store
property RootStore store
property var communitySectionModule
property bool hasAddedContacts

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ import StatusQ.Popups.Dialog 0.1
import utils 1.0
import shared.views.chat 1.0

import AppLayouts.Chat.stores 1.0 as ChatStores

StatusDialog {
id: root

property var store
property ChatStores.RootStore rootStore
property var chatCommunitySectionModule
property var memberMessagesModel: chatCommunitySectionModule.memberMessagesModel
property string memberPubKey: ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ import AppLayouts.Communities.panels 1.0
StatusModal {
id: root

property var store
property var community
property var contactsStore
property bool hasAddedContacts
property var communitySectionModule

Expand Down
4 changes: 3 additions & 1 deletion ui/app/AppLayouts/Communities/popups/CreateCategoryPopup.qml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ import shared.popups 1.0

import SortFilterProxyModel 0.2

import AppLayouts.Chat.stores 1.0

StatusModal {
id: root

property var store
property RootStore store
property string communityId
property string categoryId
property string categoryName: ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@ import StatusQ.Popups 0.1

import AppLayouts.Communities.controls 1.0
import AppLayouts.Communities.panels 1.0
import AppLayouts.Communities.stores 1.0

StatusStackModal {
id: root

property var store
property CommunitiesStore store
property bool isDiscordImport // creating new or importing from discord?
property bool isDevBuild

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@ import StatusQ.Popups.Dialog 0.1

import SortFilterProxyModel 0.2

import AppLayouts.Communities.stores 1.0

import "../controls"

StatusScrollView {
id: root

property var store
property CommunitiesStore store

property bool importingSingleChannel

Expand Down
Loading

0 comments on commit 0868a3c

Please sign in to comment.