Skip to content

Commit c090b6b

Browse files
committed
localAccountSensitiveSettings usages removed from ChatView
Now the usage of that ctx property is centralized in a single place in AppMain
1 parent a9bdbcf commit c090b6b

File tree

3 files changed

+33
-31
lines changed

3 files changed

+33
-31
lines changed

ui/app/AppLayouts/Chat/ChatLayout.qml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ StackLayout {
6767
readonly property int isInvitationPending: root.rootStore.chatCommunitySectionModule.requestToJoinState !== Constants.RequestToJoinState.None
6868

6969
property bool communitySettingsDisabled
70+
property bool showUsersList
7071

7172
property bool sendViaPersonalChatEnabled
7273
property string disabledTooltipText
@@ -106,9 +107,11 @@ StackLayout {
106107
signal removeTrustStatusRequest(string pubKey)
107108
signal dismissContactRequest(string chatId, string contactRequestId)
108109
signal acceptContactRequest(string chatId, string contactRequestId)
109-
110110
onIsPrivilegedUserChanged: if (root.currentIndex === 1) root.currentIndex = 0
111111

112+
// Navigation
113+
signal showUsersListRequested(bool show)
114+
112115
onCurrentIndexChanged: {
113116
Global.closeCreateChatView()
114117
}
@@ -217,6 +220,7 @@ StackLayout {
217220
sendViaPersonalChatEnabled: root.sendViaPersonalChatEnabled
218221
disabledTooltipText: root.disabledTooltipText
219222
paymentRequestFeatureEnabled: root.paymentRequestFeatureEnabled
223+
showUsersList: root.showUsersList
220224

221225
hasUnrestrictedViewOnlyPermission: {
222226
viewOnlyUnrestrictedPermissionHelper.revision
@@ -342,6 +346,8 @@ StackLayout {
342346
onSpectateCommunityRequested: (communityId) => {
343347
root.communityAccessStore.spectateCommunity(communityId)
344348
}
349+
350+
onShowUsersListRequested: show => root.showUsersListRequested(show)
345351
}
346352
}
347353

ui/app/AppLayouts/Chat/views/ChatView.qml

Lines changed: 16 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ StatusSectionLayout {
6868
property bool amIMember: false
6969
property bool amISectionAdmin: false
7070
property bool allChannelsAreHiddenBecauseNotPermitted: false
71+
property bool showUsersList: false
7172

7273
property int requestToJoinState: Constants.RequestToJoinState.None
7374

@@ -163,6 +164,9 @@ StatusSectionLayout {
163164
// Community access related requests:
164165
signal spectateCommunityRequested(string communityId)
165166

167+
// Navigation
168+
signal showUsersListRequested(bool show)
169+
166170
Connections {
167171
target: root.rootStore.stickersStore.stickersModule
168172

@@ -200,18 +204,10 @@ StatusSectionLayout {
200204
}
201205

202206
showRightPanel: {
203-
if (root.contentLocked) {
207+
if (root.contentLocked || root.rootStore.openCreateChat ||
208+
!root.showUsersList || !root.chatContentModule)
204209
return false
205-
}
206-
207-
if (root.rootStore.openCreateChat ||
208-
!localAccountSensitiveSettings.expandUsersList) {
209-
return false
210-
}
211210

212-
if (!root.chatContentModule) {
213-
return false
214-
}
215211
// Check if user list is available as an option for particular chat content module
216212
return root.chatContentModule.chatDetails.isUsersListAvailable
217213
}
@@ -264,7 +260,7 @@ StatusSectionLayout {
264260

265261
usersModel: root.usersModel
266262
amIChatAdmin: root.amIChatAdmin
267-
showMembersButtonHighlighted: localAccountSensitiveSettings.expandUsersList
263+
showMembersButtonHighlighted: root.showUsersList
268264

269265
onSearchButtonClicked: root.openAppSearch()
270266
onDisplayEditChannelPopup: {
@@ -283,11 +279,7 @@ StatusSectionLayout {
283279
}
284280

285281
onGroupMembersUpdateRequested: root.groupMembersUpdateRequested(membersPubKeysList)
286-
287-
onToggleShowMembersRequested: {
288-
localAccountSensitiveSettings.expandUsersList =
289-
!localAccountSensitiveSettings.expandUsersList;
290-
}
282+
onToggleShowMembersRequested: root.showUsersListRequested(!root.showUsersList)
291283
}
292284
}
293285

@@ -428,17 +420,6 @@ StatusSectionLayout {
428420
}
429421
}
430422

431-
Connections {
432-
target: localAccountSensitiveSettings
433-
434-
function onExpandUsersListChanged() {
435-
Qt.callLater(() => {
436-
if (localAccountSensitiveSettings.expandUsersList)
437-
goToNextPanel()
438-
})
439-
}
440-
}
441-
442423
onSwiped: (previous, current) => {
443424
if (previous !== StatusSectionLayout.RightPanel)
444425
return
@@ -447,8 +428,14 @@ StatusSectionLayout {
447428
// is needed because SwipeView doesn't expose any API to detect completed
448429
// swipe action
449430
Backpressure.setTimeout(this, 300, () => {
450-
localAccountSensitiveSettings.expandUsersList
451-
= !localAccountSensitiveSettings.expandUsersList
431+
root.showUsersList = false
432+
})
433+
}
434+
435+
onShowUsersListChanged: {
436+
Qt.callLater(() => {
437+
if (root.showUsersList)
438+
goToNextPanel()
452439
})
453440
}
454441

ui/app/mainui/AppMain.qml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -822,9 +822,12 @@ Item {
822822
id: d
823823

824824
readonly property int activeSectionType: appMain.rootStore.activeSectionType
825-
826825
readonly property bool isBrowserEnabled: featureFlagsStore.browserEnabled && localAccountSensitiveSettings.isBrowserEnabled
827826

827+
property bool showUsersList: localAccountSensitiveSettings.expandUsersList
828+
829+
onShowUsersListChanged: localAccountSensitiveSettings.expandUsersList = showUsersList
830+
828831
function openHomePage() {
829832
appMain.rootStore.setActiveSectionBySectionType(Constants.appSection.homePage)
830833
homePageLoader.item.focusSearch()
@@ -1895,6 +1898,9 @@ Item {
18951898
ChatLayout {
18961899
id: chatLayoutContainer
18971900

1901+
showUsersList: d.showUsersList
1902+
onShowUsersListRequested: show => d.showUsersList = show
1903+
18981904
isChatView: true
18991905
navBar: appMain.navBar
19001906
rootStore: ChatStores.RootStore {
@@ -2285,6 +2291,9 @@ Item {
22852291
}
22862292
}
22872293

2294+
showUsersList: d.showUsersList
2295+
onShowUsersListRequested: show => d.showUsersList = show
2296+
22882297
isChatView: false // This will be a community view
22892298
navBar: appMain.navBar
22902299
emojiPopup: statusEmojiPopup.item

0 commit comments

Comments
 (0)