From 36f1ea8832785af96f22c1b92ad91826e2f022e9 Mon Sep 17 00:00:00 2001 From: Alexandra Betouni <31625338+alexandraB99@users.noreply.github.com> Date: Fri, 29 Oct 2021 20:29:50 +0300 Subject: [PATCH] fix: make user profile images work again --- ui/app/AppLayouts/Chat/popups/GroupChatPopup.qml | 3 ++- ui/app/AppLayouts/Chat/popups/PrivateChatPopup.qml | 2 +- ui/app/AppLayouts/Chat/stores/RootStore.qml | 1 + ui/app/AppLayouts/Chat/views/ChatColumnView.qml | 3 ++- ui/app/AppMain.qml | 8 +++++--- ui/imports/shared/popups/UserStatusContextMenu.qml | 7 ++++--- ui/imports/shared/status/StatusChatInput.qml | 3 ++- 7 files changed, 17 insertions(+), 10 deletions(-) diff --git a/ui/app/AppLayouts/Chat/popups/GroupChatPopup.qml b/ui/app/AppLayouts/Chat/popups/GroupChatPopup.qml index 73b34a0cd9..a6e3dbff78 100644 --- a/ui/app/AppLayouts/Chat/popups/GroupChatPopup.qml +++ b/ui/app/AppLayouts/Chat/popups/GroupChatPopup.qml @@ -42,7 +42,8 @@ ModalPopup { pubKey: popup.store.profileModelInst.profile.pubKey, address: "", identicon: popup.store.profileModelInst.profile.identicon, - thumbnailImage: popup.store.profileModelInst.profile.thumbnailImage, + //TODO move to store + thumbnailImage: profileModule.model.thumbnailImage, isUser: true }); noContactsRect.visible = !popup.store.profileModelInst.contacts.list.hasAddedContacts(); diff --git a/ui/app/AppLayouts/Chat/popups/PrivateChatPopup.qml b/ui/app/AppLayouts/Chat/popups/PrivateChatPopup.qml index efa39631bf..041eac6029 100644 --- a/ui/app/AppLayouts/Chat/popups/PrivateChatPopup.qml +++ b/ui/app/AppLayouts/Chat/popups/PrivateChatPopup.qml @@ -64,7 +64,7 @@ ModalPopup { anchors.left: parent.left anchors.leftMargin: 2 anchors.verticalCenter: parent.verticalCenter - source: appMain.getProfileImage(popup.store.profileModelInst.profile.pubKey) + source: appMain.getProfileImage(popup.store.profileModuleInst.model.pubKey) } StyledText { diff --git a/ui/app/AppLayouts/Chat/stores/RootStore.qml b/ui/app/AppLayouts/Chat/stores/RootStore.qml index 56e338cab0..c3dba3d2a3 100644 --- a/ui/app/AppLayouts/Chat/stores/RootStore.qml +++ b/ui/app/AppLayouts/Chat/stores/RootStore.qml @@ -12,6 +12,7 @@ QtObject { property var utilsModelInst: utilsModel property var walletModelInst: walletModel property var profileModelInst: profileModel + property var profileModuleInst: profileModule property var activeCommunity: chatsModelInst.communities.activeCommunity diff --git a/ui/app/AppLayouts/Chat/views/ChatColumnView.qml b/ui/app/AppLayouts/Chat/views/ChatColumnView.qml index 271a0cdb7e..5d146e55d6 100644 --- a/ui/app/AppLayouts/Chat/views/ChatColumnView.qml +++ b/ui/app/AppLayouts/Chat/views/ChatColumnView.qml @@ -427,7 +427,8 @@ Item { } EmptyChatPanel { - onShareChatKeyClicked: openProfilePopup(root.rootStore.profileModelInst.profile.username, root.rootStore.profileModelInst.profile.pubKey, root.rootStore.profileModelInst.profile.thumbnailImage); + //TODO move profileModule to store + onShareChatKeyClicked: openProfilePopup(root.rootStore.profileModelInst.profile.username, root.rootStore.profileModelInst.profile.pubKey, profileModule.model.thumbnailImage); } Loader { diff --git a/ui/app/AppMain.qml b/ui/app/AppMain.qml index fc7f4f7463..03ef81fdac 100644 --- a/ui/app/AppMain.qml +++ b/ui/app/AppMain.qml @@ -48,7 +48,8 @@ Item { function getProfileImage(pubkey, isCurrentUser, useLargeImage) { if (isCurrentUser || (isCurrentUser === undefined && pubkey === profileModel.profile.pubKey)) { - return profileModel.profile.thumbnailImage + //TODO move profileModule to store + return profileModule.model.thumbnailImage } const index = profileModel.contacts.list.getContactIndexByPubkey(pubkey) @@ -354,7 +355,8 @@ Item { navBarProfileButton: StatusNavBarTabButton { id: profileButton property bool opened: false - icon.source: profileModule.thumbnailImage || "" + //TODO move profileModule to store + icon.source: profileModule.model.thumbnailImage || "" badge.visible: true badge.anchors.rightMargin: 4 badge.anchors.topMargin: 25 @@ -362,7 +364,7 @@ Item { badge.implicitWidth: 15 badge.border.color: hovered ? Theme.palette.statusBadge.hoverBorderColor : Theme.palette.statusAppNavBar.backgroundColor badge.color: { - return profileModel.profile.sendUserStatus ? Style.current.green : Style.current.midGrey + return profileModule.model.sendUserStatus ? Style.current.green : Style.current.midGrey /* // Use this code once support for custom user status is added switch(profileModel.profile.currentUserStatus){ diff --git a/ui/imports/shared/popups/UserStatusContextMenu.qml b/ui/imports/shared/popups/UserStatusContextMenu.qml index ad2f5cd94d..75b2b1332f 100644 --- a/ui/imports/shared/popups/UserStatusContextMenu.qml +++ b/ui/imports/shared/popups/UserStatusContextMenu.qml @@ -29,12 +29,12 @@ PopupMenu { anchors.top: parent.top anchors.topMargin: 4 anchors.horizontalCenter: parent.horizontalCenter - image.source: profileModule.thumbnailImage || "" + image.source: profileModule.model.thumbnailImage || "" image.isIdenticon: true } StyledText { id: username - text: Utils.removeStatusEns(profileModel.ens.preferredUsername || profileModel.profile.username) + text: Utils.removeStatusEns(profileModel.ens.preferredUsername || profileModule.model.username) elide: Text.ElideRight maximumLineCount: 3 horizontalAlignment: Text.AlignHCenter @@ -70,7 +70,8 @@ PopupMenu { hoverEnabled: true cursorShape: Qt.PointingHandCursor onClicked: { - openProfilePopup(profileModule.username, profileModule.pubKey, profileModule.thumbnailImage || ""); + //TODO move profileModule to store + openProfilePopup(profileModule.model.username, profileModule.model.pubKey, profileModule.model.thumbnailImage || ""); root.close() } } diff --git a/ui/imports/shared/status/StatusChatInput.qml b/ui/imports/shared/status/StatusChatInput.qml index 2e622bc069..c59a764799 100644 --- a/ui/imports/shared/status/StatusChatInput.qml +++ b/ui/imports/shared/status/StatusChatInput.qml @@ -859,7 +859,8 @@ Rectangle { anchors.leftMargin: Style.current.smallPadding anchors.top: parent.top anchors.topMargin: Style.current.halfPadding - image.source: profileModel.profile.thumbnailImage || profileModel.profile.identicon + //TODO move thumbnail image to store + image.source: profileModule.model.thumbnailImage || profileModule.model.identicon image.isIdenticon: true visible: control.isStatusUpdateInput }