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 3, 2024
1 parent 55edd94 commit 0a59cf8
Show file tree
Hide file tree
Showing 90 changed files with 309 additions and 199 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
10 changes: 6 additions & 4 deletions ui/app/AppLayouts/Chat/ChatLayout.qml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ import "stores"
import AppLayouts.Communities.views 1.0
import AppLayouts.Communities.popups 1.0
import AppLayouts.Communities.helpers 1.0
import AppLayouts.Communities.stores 1.0 as CommunitiesStores

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,10 +25,10 @@ StackLayout {
id: root

property RootStore rootStore
property var createChatPropertiesStore
readonly property var contactsStore: rootStore.contactsStore
readonly property var permissionsStore: rootStore.permissionsStore
property var communitiesStore
property CreateChatPropertiesStore createChatPropertiesStore
readonly property ContactsStore contactsStore: rootStore.contactsStore
readonly property PermissionsStore permissionsStore: rootStore.permissionsStore
property CommunitiesStores.CommunitiesStore communitiesStore
required property WalletStore.TokensStore tokensStore
required property TransactionStore transactionStore
required property WalletStore.WalletAssetsStore walletAssetsStore
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
2 changes: 2 additions & 0 deletions ui/app/AppLayouts/Chat/stores/qmldir
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ 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
UsersStore 1.0 UsersStore.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
11 changes: 7 additions & 4 deletions ui/app/AppLayouts/Chat/views/ChatMessagesView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,20 @@ import shared.status 1.0
import shared.controls 1.0
import shared.views.chat 1.0

import AppLayouts.Profile.stores 1.0

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

Item {
id: root

property var chatContentModule
property var rootStore
property var messageStore
property var usersStore
property var contactsStore
property RootStore rootStore
property MessageStore messageStore
property UsersStore usersStore
property ContactsStore contactsStore
property string channelEmoji

property var emojiPopup
Expand Down
12 changes: 8 additions & 4 deletions ui/app/AppLayouts/Chat/views/ChatView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,13 @@ import QtQuick.Layouts 1.15

import "."
import "../panels"

import AppLayouts.Communities.controls 1.0
import AppLayouts.Communities.panels 1.0
import AppLayouts.Communities.stores 1.0 as CommunitiesStores
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,13 +37,13 @@ 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 var communitiesStore
property CreateChatPropertiesStore createChatPropertiesStore
property CommunitiesStores.CommunitiesStore communitiesStore
required property WalletStore.WalletAssetsStore walletAssetsStore
required property CurrenciesStore currencyStore
property var sectionItemModel
Expand Down
6 changes: 4 additions & 2 deletions ui/app/AppLayouts/Chat/views/ContactsColumnView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ import SortFilterProxyModel 0.2

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

Item {
id: root
Expand All @@ -31,8 +33,8 @@ Item {
// This module is set from `ChatLayout` (each `ChatLayout` has its own chatSectionModule)
property var chatSectionModule

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

signal openProfileClicked()
Expand Down
6 changes: 4 additions & 2 deletions ui/app/AppLayouts/Chat/views/CreateChatView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@ 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 var createChatPropertiesStore
property ChatStores.RootStore rootStore
property ChatStores.CreateChatPropertiesStore createChatPropertiesStore
property var emojiPopup: null
property var stickersPopup: null

Expand Down
2 changes: 1 addition & 1 deletion ui/app/AppLayouts/Chat/views/MembersEditSelectorView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import SortFilterProxyModel 0.2
MembersSelectorBase {
id: root

property var usersStore
property UsersStore usersStore

onConfirmed: {
usersStore.updateGroupMembers()
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
3 changes: 2 additions & 1 deletion ui/app/AppLayouts/Communities/CommunitiesPortalLayout.qml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@ import AppLayouts.Communities.controls 1.0
import AppLayouts.Communities.popups 1.0
import AppLayouts.Communities.views 1.0
import AppLayouts.Communities.panels 1.0
import AppLayouts.Communities.stores 1.0

StatusSectionLayout {
id: root

property var communitiesStore
property CommunitiesStore communitiesStore

property var assetsModel
property var collectiblesModel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ import QtQuick.Layouts 1.15
import StatusQ.Controls 0.1
import utils 1.0

import AppLayouts.Chat.stores 1.0
import AppLayouts.Communities.layouts 1.0
import AppLayouts.Communities.popups 1.0

SettingsPage {
id: root

property var rootStore
property RootStore rootStore
property var membersModel
property var bannedMembersModel
property var pendingMemberRequestsModel
Expand Down
3 changes: 2 additions & 1 deletion ui/app/AppLayouts/Communities/panels/MembersTabPanel.qml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@ import shared.views.chat 1.0
import shared.controls.chat 1.0
import shared.controls 1.0

import AppLayouts.Chat.stores 1.0
import AppLayouts.Communities.layouts 1.0

Item {
id: root

property string placeholderText
property var model
property var rootStore
property RootStore rootStore
property int memberRole: Constants.memberRole.none

readonly property bool isOwner: memberRole === Constants.memberRole.owner
Expand Down
Loading

0 comments on commit 0a59cf8

Please sign in to comment.