diff --git a/ui/app/AppLayouts/Chat/panels/SuggestionBoxPanel.qml b/ui/app/AppLayouts/Chat/panels/SuggestionBoxPanel.qml index b911c09860..edba85e224 100644 --- a/ui/app/AppLayouts/Chat/panels/SuggestionBoxPanel.qml +++ b/ui/app/AppLayouts/Chat/panels/SuggestionBoxPanel.qml @@ -206,6 +206,8 @@ Rectangle { name: model.name pubkey: model.publicKey + colorHash: model.colorHash + colorId: model.colorId image: model.icon interactive: false } diff --git a/ui/app/AppLayouts/Chat/panels/SuggestionFilterPanel.qml b/ui/app/AppLayouts/Chat/panels/SuggestionFilterPanel.qml index 169c3a7f70..46a38d1ed9 100644 --- a/ui/app/AppLayouts/Chat/panels/SuggestionFilterPanel.qml +++ b/ui/app/AppLayouts/Chat/panels/SuggestionFilterPanel.qml @@ -35,6 +35,8 @@ Item { property string alias: model.alias property string ensName: model.ensName property string icon: model.icon + property var colorHash: model.colorHash + property int colorId: model.colorId } } @@ -73,7 +75,9 @@ Item { name: listItem.name || listItem.alias, nickname: listItem.nickname, ensName: listItem.ensName, - icon: listItem.icon + icon: listItem.icon, + colorHash: listItem.colorHash, + colorId: listItem.colorId } if (all || isAcceptedItem(filter, item)) { filterModel.append(item) diff --git a/ui/app/AppLayouts/Chat/panels/UserListPanel.qml b/ui/app/AppLayouts/Chat/panels/UserListPanel.qml index 182e636be8..c779290412 100644 --- a/ui/app/AppLayouts/Chat/panels/UserListPanel.qml +++ b/ui/app/AppLayouts/Chat/panels/UserListPanel.qml @@ -129,6 +129,8 @@ Item { profileType, trustStatus, contactType, ensVerified, onlineStatus, hasLocalNickname, chatType, isAdmin, publicKey: model.pubKey, emojiHash: model.emojiHash, + colorHash: model.colorHash, + colorId: model.colorId, displayName: nickName || userName, userIcon: model.icon }) @@ -175,35 +177,36 @@ Item { root.store.chatCommunitySectionModule.createOneToOneChat("", profileContextMenu.publicKey, "") } onReviewContactRequest: { - const contactDetails = profileContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(profileContextMenu.publicKey, true, true) + const contactDetails = profileContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(profileContextMenu.publicKey, true, true, true) Global.openReviewContactRequestPopup(profileContextMenu.publicKey, contactDetails, null) } onSendContactRequest: { - const contactDetails = profileContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(profileContextMenu.publicKey, true, true) + const contactDetails = profileContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(profileContextMenu.publicKey, true, true, true) Global.openContactRequestPopup(profileContextMenu.publicKey, contactDetails, null) } onEditNickname: { - const contactDetails = profileContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(profileContextMenu.publicKey, true, true) + const contactDetails = profileContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(profileContextMenu.publicKey, true, true, true) + Global.openNicknamePopupRequested(profileContextMenu.publicKey, contactDetails, null) } onRemoveNickname: (displayName) => { root.store.contactsStore.changeContactNickname(profileContextMenu.publicKey, "", displayName, true) } onUnblockContact: { - const contactDetails = profileContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(profileContextMenu.publicKey, true, true) + const contactDetails = profileContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(profileContextMenu.publicKey, true, true, true) Global.unblockContactRequested(profileContextMenu.publicKey, contactDetails) } onMarkAsUntrusted: { - const contactDetails = profileContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(profileContextMenu.publicKey, true, true) + const contactDetails = profileContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(profileContextMenu.publicKey, true, true, true) Global.markAsUntrustedRequested(profileContextMenu.publicKey, contactDetails) } onRemoveTrustStatus: root.store.contactsStore.removeTrustStatus(profileContextMenu.publicKey) onRemoveContact: { - const contactDetails = profileContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(profileContextMenu.publicKey, true, true) + const contactDetails = profileContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(profileContextMenu.publicKey, true, true, true) Global.removeContactRequested(profileContextMenu.publicKey, contactDetails) } onBlockContact: { - const contactDetails = profileContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(profileContextMenu.publicKey, true, true) + const contactDetails = profileContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(profileContextMenu.publicKey, true, true, true) Global.blockContactRequested(profileContextMenu.publicKey, contactDetails) } onRemoveFromGroup: { diff --git a/ui/app/AppLayouts/Communities/panels/MembersTabPanel.qml b/ui/app/AppLayouts/Communities/panels/MembersTabPanel.qml index bd0a064353..8f3b652dba 100644 --- a/ui/app/AppLayouts/Communities/panels/MembersTabPanel.qml +++ b/ui/app/AppLayouts/Communities/panels/MembersTabPanel.qml @@ -319,6 +319,7 @@ Item { Global.openMenu(memberContextMenuComponent, this, { profileType, trustStatus, contactType, ensVerified, onlineStatus, hasLocalNickname, publicKey: model.pubKey, emojiHash: root.utilsStore.getEmojiHash(model.pubKey), + colorHash: model.colorHash, colorId: model.colorId, displayName: memberItem.title || model.displayName, userIcon: icon.name, }) @@ -342,35 +343,35 @@ Item { root.rootStore.chatCommunitySectionModule.createOneToOneChat("", membersContextMenuView.publicKey, "") } onReviewContactRequest: { - const contactDetails = memberContextMenuView.publicKey === "" ? {} : Utils.getContactDetailsAsJson(memberContextMenuView.publicKey, true, true) + const contactDetails = memberContextMenuView.publicKey === "" ? {} : Utils.getContactDetailsAsJson(memberContextMenuView.publicKey, true, true, true) Global.openReviewContactRequestPopup(memberContextMenuView.publicKey, contactDetails, null) } onSendContactRequest: { - const contactDetails = memberContextMenuView.publicKey === "" ? {} : Utils.getContactDetailsAsJson(memberContextMenuView.publicKey, true, true) + const contactDetails = memberContextMenuView.publicKey === "" ? {} : Utils.getContactDetailsAsJson(memberContextMenuView.publicKey, true, true, true) Global.openContactRequestPopup(memberContextMenuView.publicKey, contactDetails, null) } onEditNickname: { - const contactDetails = memberContextMenuView.publicKey === "" ? {} : Utils.getContactDetailsAsJson(memberContextMenuView.publicKey, true, true) + const contactDetails = memberContextMenuView.publicKey === "" ? {} : Utils.getContactDetailsAsJson(memberContextMenuView.publicKey, true, true, true) Global.openNicknamePopupRequested(memberContextMenuView.publicKey, contactDetails, null) } onRemoveNickname: (displayName) => { root.rootStore.contactsStore.changeContactNickname(memberContextMenuView.publicKey, "", displayName, true) } onUnblockContact: { - const contactDetails = memberContextMenuView.publicKey === "" ? {} : Utils.getContactDetailsAsJson(memberContextMenuView.publicKey, true, true) + const contactDetails = memberContextMenuView.publicKey === "" ? {} : Utils.getContactDetailsAsJson(memberContextMenuView.publicKey, true, true, true) Global.unblockContactRequested(memberContextMenuView.publicKey, contactDetails) } onMarkAsUntrusted: { - const contactDetails = memberContextMenuView.publicKey === "" ? {} : Utils.getContactDetailsAsJson(memberContextMenuView.publicKey, true, true) + const contactDetails = memberContextMenuView.publicKey === "" ? {} : Utils.getContactDetailsAsJson(memberContextMenuView.publicKey, true, true, true) Global.markAsUntrustedRequested(memberContextMenuView.publicKey, contactDetails) } onRemoveTrustStatus: root.rootStore.contactsStore.removeTrustStatus(memberContextMenuView.publicKey) onRemoveContact: { - const contactDetails = memberContextMenuView.publicKey === "" ? {} : Utils.getContactDetailsAsJson(memberContextMenuView.publicKey, true, true) + const contactDetails = memberContextMenuView.publicKey === "" ? {} : Utils.getContactDetailsAsJson(memberContextMenuView.publicKey, true, true, true) Global.removeContactRequested(memberContextMenuView.publicKey, contactDetails) } onBlockContact: { - const contactDetails = memberContextMenuView.publicKey === "" ? {} : Utils.getContactDetailsAsJson(memberContextMenuView.publicKey, true, true) + const contactDetails = memberContextMenuView.publicKey === "" ? {} : Utils.getContactDetailsAsJson(memberContextMenuView.publicKey, true, true, true) Global.blockContactRequested(memberContextMenuView.publicKey, contactDetails) } onClosed: destroy() diff --git a/ui/app/AppLayouts/Profile/panels/ContactsListPanel.qml b/ui/app/AppLayouts/Profile/panels/ContactsListPanel.qml index 58e6b571de..ee05437b7c 100644 --- a/ui/app/AppLayouts/Profile/panels/ContactsListPanel.qml +++ b/ui/app/AppLayouts/Profile/panels/ContactsListPanel.qml @@ -26,7 +26,7 @@ Item { property string searchString: "" readonly property int count: contactsList.count - signal openContactContextMenu(string publicKey, string name, string icon) + signal openContactContextMenu(string publicKey) signal sendMessageActionTriggered(string publicKey) signal showVerificationRequest(string publicKey) signal contactRequestAccepted(string publicKey) @@ -141,8 +141,7 @@ Item { } - onContextMenuRequested: root.openContactContextMenu( - model.pubKey, model.preferredDisplayName, model.icon) + onContextMenuRequested: root.openContactContextMenu(model.pubKey) onSendMessageRequested: root.sendMessageActionTriggered(model.pubKey) onAcceptContactRequested: root.contactRequestAccepted(model.pubKey) onRejectRequestRequested: root.contactRequestRejected(model.pubKey) diff --git a/ui/app/AppLayouts/Profile/popups/SetupSyncingPopup.qml b/ui/app/AppLayouts/Profile/popups/SetupSyncingPopup.qml index 31826c483d..3ff2a8378e 100644 --- a/ui/app/AppLayouts/Profile/popups/SetupSyncingPopup.qml +++ b/ui/app/AppLayouts/Profile/popups/SetupSyncingPopup.qml @@ -215,6 +215,8 @@ StatusDialog { userDisplayName: root.profileStore.displayName userPublicKey: root.profileStore.pubkey userImage: root.profileStore.icon + userColorHash: root.profileStore.colorHash + userColorId: root.profileStore.colorId localPairingState: root.devicesStore.localPairingState localPairingError: root.devicesStore.localPairingError diff --git a/ui/app/AppLayouts/Profile/stores/ProfileStore.qml b/ui/app/AppLayouts/Profile/stores/ProfileStore.qml index 12fab31da5..2ac8427329 100644 --- a/ui/app/AppLayouts/Profile/stores/ProfileStore.qml +++ b/ui/app/AppLayouts/Profile/stores/ProfileStore.qml @@ -24,7 +24,8 @@ QtObject { readonly property var thumbnailImage: userProfile.thumbnailImage readonly property var largeImage: userProfile.largeImage readonly property int colorId: Utils.colorIdForPubkey(root.pubkey) - readonly property var colorHash: Utils.getColorHashAsJson(root.pubkey, name != "") + + readonly property var colorHash: Utils.getColorHashAsJson(root.pubkey) readonly property string defaultDisplayName: ProfileUtils.displayName("", name, displayName, username) readonly property string bio: profileModule.bio diff --git a/ui/app/AppLayouts/Profile/views/ContactsView.qml b/ui/app/AppLayouts/Profile/views/ContactsView.qml index c5bcfe158b..2598174823 100644 --- a/ui/app/AppLayouts/Profile/views/ContactsView.qml +++ b/ui/app/AppLayouts/Profile/views/ContactsView.qml @@ -2,10 +2,11 @@ import QtQuick 2.15 import QtQuick.Controls 2.15 import QtQuick.Layouts 1.15 -import StatusQ.Core 0.1 import StatusQ.Components 0.1 import StatusQ.Controls 0.1 +import StatusQ.Core 0.1 import StatusQ.Core.Theme 0.1 +import StatusQ.Core.Utils 0.1 import utils 1.0 @@ -37,7 +38,7 @@ SettingsContentBase { } } - function openContextMenu(publicKey, name, icon) { + function openContextMenu(publicKey, name, icon, colorHash, colorId) { const { profileType, trustStatus, contactType, ensVerified, onlineStatus, hasLocalNickname } = root.contactsStore.getProfileContext(publicKey) Global.openMenu(contactContextMenuComponent, this, { @@ -46,9 +47,16 @@ SettingsContentBase { emojiHash: root.utilsStore.getEmojiHash(publicKey), displayName: name, userIcon: icon, + colorHash, colorId }) } + function fetchDataAndOpenContextMenu(model, publicKey) { + const entry = ModelUtils.getByKey(model, "pubKey", publicKey) + openContextMenu(publicKey, entry.preferredDisplayName, + entry.icon, entry.colorHash, entry.colorId) + } + Item { id: contentItem width: root.contentWidth @@ -63,35 +71,35 @@ SettingsContentBase { onOpenProfileClicked: Global.openProfilePopup(contactContextMenu.publicKey, null, null) onCreateOneToOneChat: root.contactsStore.joinPrivateChat(contactContextMenu.publicKey) onReviewContactRequest: () => { - const contactDetails = contactContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(contactContextMenu.publicKey, true, true) + const contactDetails = contactContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(contactContextMenu.publicKey, true, true, true) Global.openReviewContactRequestPopup(contactContextMenu.publicKey, contactDetails, null) } onSendContactRequest: () => { - const contactDetails = contactContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(contactContextMenu.publicKey, true, true) + const contactDetails = contactContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(contactContextMenu.publicKey, true, true, true) Global.openContactRequestPopup(contactContextMenu.publicKey, contactDetails, null) } onEditNickname: () => { - const contactDetails = contactContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(contactContextMenu.publicKey, true, true) + const contactDetails = contactContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(contactContextMenu.publicKey, true, true, true) Global.openNicknamePopupRequested(contactContextMenu.publicKey, contactDetails, null) } onRemoveNickname: (displayName) => { root.contactsStore.changeContactNickname(contactContextMenu.publicKey, "", displayName, true) } onUnblockContact: () => { - const contactDetails = contactContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(contactContextMenu.publicKey, true, true) + const contactDetails = contactContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(contactContextMenu.publicKey, true, true, true) Global.unblockContactRequested(contactContextMenu.publicKey, contactDetails) } onMarkAsUntrusted: () => { - const contactDetails = contactContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(contactContextMenu.publicKey, true, true) + const contactDetails = contactContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(contactContextMenu.publicKey, true, true, true) Global.markAsUntrustedRequested(contactContextMenu.publicKey, contactDetails) } onRemoveTrustStatus: root.contactsStore.removeTrustStatus(contactContextMenu.publicKey) onRemoveContact: () => { - const contactDetails = contactContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(contactContextMenu.publicKey, true, true) + const contactDetails = contactContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(contactContextMenu.publicKey, true, true, true) Global.removeContactRequested(contactContextMenu.publicKey, contactDetails) } onBlockContact: () => { - const contactDetails = contactContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(contactContextMenu.publicKey, true, true) + const contactDetails = contactContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(contactContextMenu.publicKey, true, true, true) Global.blockContactRequested(contactContextMenu.publicKey, contactDetails) } onClosed: destroy() @@ -161,9 +169,7 @@ SettingsContentBase { visible: !noFriendsItem.visible && count > 0 contactsModel: root.contactsStore.myContactsModel searchString: searchBox.text - onOpenContactContextMenu: function (publicKey, name, icon) { - root.openContextMenu(publicKey, name, icon) - } + onOpenContactContextMenu: root.fetchDataAndOpenContextMenu(contactsModel, publicKey) panelUsage: Constants.contactsPanelUsage.verifiedMutualContacts onSendMessageActionTriggered: { root.contactsStore.joinPrivateChat(publicKey) @@ -177,9 +183,7 @@ SettingsContentBase { title: qsTr("Contacts") contactsModel: root.contactsStore.myContactsModel searchString: searchBox.text - onOpenContactContextMenu: function (publicKey, name, icon) { - root.openContextMenu(publicKey, name, icon) - } + onOpenContactContextMenu: root.fetchDataAndOpenContextMenu(contactsModel, publicKey) panelUsage: Constants.contactsPanelUsage.mutualContacts onSendMessageActionTriggered: { @@ -218,9 +222,7 @@ SettingsContentBase { title: qsTr("Received") searchString: searchBox.text visible: count > 0 - onOpenContactContextMenu: function (publicKey, name, icon) { - root.openContextMenu(publicKey, name, icon) - } + onOpenContactContextMenu: root.fetchDataAndOpenContextMenu(contactsModel, publicKey) contactsModel: root.contactsStore.receivedContactRequestsModel panelUsage: Constants.contactsPanelUsage.receivedContactRequest @@ -244,9 +246,7 @@ SettingsContentBase { title: qsTr("Sent") searchString: searchBox.text visible: count > 0 - onOpenContactContextMenu: function (publicKey, name, icon) { - root.openContextMenu(publicKey, name, icon) - } + onOpenContactContextMenu: root.fetchDataAndOpenContextMenu(contactsModel, publicKey) contactsModel: root.contactsStore.sentContactRequestsModel panelUsage: Constants.contactsPanelUsage.sentContactRequest } @@ -256,9 +256,7 @@ SettingsContentBase { ContactsListPanel { Layout.fillWidth: true searchString: searchBox.text - onOpenContactContextMenu: function (publicKey, name, icon) { - root.openContextMenu(publicKey, name, icon) - } + onOpenContactContextMenu: root.fetchDataAndOpenContextMenu(contactsModel, publicKey) contactsModel: root.contactsStore.blockedContactsModel panelUsage: Constants.contactsPanelUsage.blockedContacts visible: (stackLayout.currentIndex === 2) diff --git a/ui/app/AppLayouts/Profile/views/MyProfileView.qml b/ui/app/AppLayouts/Profile/views/MyProfileView.qml index 293c637713..4fa721d068 100644 --- a/ui/app/AppLayouts/Profile/views/MyProfileView.qml +++ b/ui/app/AppLayouts/Profile/views/MyProfileView.qml @@ -285,6 +285,8 @@ SettingsContentBase { pubkeyVisible: false emojiHashVisible: false editImageButtonVisible: true + colorHash: root.profileStore.colorHash + colorId: root.profileStore.colorId } ProfileDescriptionPanel { diff --git a/ui/app/mainui/AppMain.qml b/ui/app/mainui/AppMain.qml index ff0be0d876..a101cc73a6 100644 --- a/ui/app/mainui/AppMain.qml +++ b/ui/app/mainui/AppMain.qml @@ -877,6 +877,8 @@ Item { pubKey: appMain.profileStore.pubkey emojiHash: appMain.utilsStore.getEmojiHash(pubKey) + colorHash: appMain.profileStore.colorHash + colorId: appMain.profileStore.colorId name: appMain.profileStore.name icon: appMain.profileStore.icon isEnsVerified: !!appMain.profileStore.preferredName diff --git a/ui/imports/shared/controls/chat/LinkPreviewCard.qml b/ui/imports/shared/controls/chat/LinkPreviewCard.qml index 754c3b696b..32e1b998a8 100644 --- a/ui/imports/shared/controls/chat/LinkPreviewCard.qml +++ b/ui/imports/shared/controls/chat/LinkPreviewCard.qml @@ -78,6 +78,8 @@ CalloutCard { name: root.userData.name pubkey: root.userData.publicKey image: root.userData.image + colorId: Utils.colorIdForPubkey(root.userData.publicKey) + colorHash: Utils.getColorHashAsJson(root.userData.publicKey) } } RowLayout { diff --git a/ui/imports/shared/controls/chat/ProfileHeader.qml b/ui/imports/shared/controls/chat/ProfileHeader.qml index 5832d7fcc8..b5481b920b 100644 --- a/ui/imports/shared/controls/chat/ProfileHeader.qml +++ b/ui/imports/shared/controls/chat/ProfileHeader.qml @@ -32,6 +32,8 @@ Item { property bool isCurrentUser property bool userIsEnsVerified property rect cropRect + property var colorHash: [] + property int colorId property int imageSize: ProfileHeader.ImageSize.Compact property bool displayNameVisible: true @@ -115,9 +117,12 @@ Item { UserImage { id: userImage + objectName: "ProfileHeader_userImage" name: root.displayName pubkey: root.pubkey + colorHash: root.colorHash + colorId: root.colorId image: root.previewIcon interactive: false imageWidth: d.getSize(36, 64, 170) diff --git a/ui/imports/shared/controls/chat/UserImage.qml b/ui/imports/shared/controls/chat/UserImage.qml index 6b9884de95..a4be7c2449 100644 --- a/ui/imports/shared/controls/chat/UserImage.qml +++ b/ui/imports/shared/controls/chat/UserImage.qml @@ -25,8 +25,8 @@ Loader { property bool isBridgedAccount: false property int onlineStatus: Constants.onlineStatus.unknown - property int colorId: Utils.colorIdForPubkey(pubkey) - property var colorHash: Utils.getColorHashAsJson(pubkey, ensVerified) + property int colorId + property var colorHash: [] signal clicked() diff --git a/ui/imports/shared/controls/chat/private/UserData.qml b/ui/imports/shared/controls/chat/private/UserData.qml index 437215277d..bd25df11fb 100644 --- a/ui/imports/shared/controls/chat/private/UserData.qml +++ b/ui/imports/shared/controls/chat/private/UserData.qml @@ -5,5 +5,7 @@ QtObject { property string publicKey property string bio property string image - property bool ensVerified + property bool ensVerified + property int colorId + property var colorHash } diff --git a/ui/imports/shared/popups/CommonContactDialog.qml b/ui/imports/shared/popups/CommonContactDialog.qml index 25c4d84f36..2614f6abb1 100644 --- a/ui/imports/shared/popups/CommonContactDialog.qml +++ b/ui/imports/shared/popups/CommonContactDialog.qml @@ -48,6 +48,8 @@ StatusDialog { UserImage { name: root.mainDisplayName pubkey: root.publicKey + colorHash: contactDetails.colorHash + colorId: contactDetails.colorId image: Utils.addTimestampToURL(contactDetails.largeImage) interactive: false imageWidth: 60 diff --git a/ui/imports/shared/popups/UserStatusContextMenu.qml b/ui/imports/shared/popups/UserStatusContextMenu.qml index 10e132a3bd..5d36ad7abc 100644 --- a/ui/imports/shared/popups/UserStatusContextMenu.qml +++ b/ui/imports/shared/popups/UserStatusContextMenu.qml @@ -12,6 +12,8 @@ StatusMenu { property alias emojiHash: header.emojiHash property alias name: header.displayName property alias icon: header.icon + property alias colorHash: header.colorHash + property alias colorId: header.colorId property alias isEnsVerified: header.userIsEnsVerified diff --git a/ui/imports/shared/views/ProfileDialogView.qml b/ui/imports/shared/views/ProfileDialogView.qml index 1d23979d22..6dff21b8e4 100644 --- a/ui/imports/shared/views/ProfileDialogView.qml +++ b/ui/imports/shared/views/ProfileDialogView.qml @@ -204,6 +204,7 @@ Pane { qrCode: root.profileStore.getQrCodeSource(linkToProfile) displayName: userImage.name largeImage: userImage.image + colorId: root.profileStore.colorId } } @@ -229,6 +230,9 @@ Pane { pubkey: root.publicKey image: root.dirty ? root.dirtyValues.profileLargeImage : Utils.addTimestampToURL(contactDetails.largeImage) + colorId: contactDetails.colorId + colorHash: contactDetails.colorHash + interactive: false imageWidth: 90 imageHeight: imageWidth diff --git a/ui/imports/shared/views/SyncingDeviceView.qml b/ui/imports/shared/views/SyncingDeviceView.qml index fe03689b59..ce418a5cd9 100644 --- a/ui/imports/shared/views/SyncingDeviceView.qml +++ b/ui/imports/shared/views/SyncingDeviceView.qml @@ -46,40 +46,15 @@ Item { anchors.fill: parent spacing: 0 - // This is used in the profile section. The user's pubkey is available - // so we can calculate the hash and colorId - Loader { - id: profileSectionUserImage - active: root.userPublicKey != "" - Layout.alignment: Qt.AlignHCenter - sourceComponent: UserImage { - name: root.userDisplayName - pubkey: root.userPublicKey - image: root.userImage - interactive: false - imageWidth: 80 - imageHeight: 80 - } - } - - // This is used in the onboarding once a sync code is received. The - // user's pubkey is unknown, but we have the multiaccount information - // available (from the plaintext accounts db), so we use the colorHash - // and colorId directly - Loader { - id: colorUserImage - active: root.userPublicKey == "" - Layout.alignment: Qt.AlignHCenter - sourceComponent: UserImage { - name: root.userDisplayName - colorId: root.userColorId - colorHash: root.userColorHash - image: root.userImage - interactive: false - imageWidth: 80 - imageHeight: 80 - loading: name === "" - } + UserImage { + name: root.userDisplayName + colorId: root.userColorId + colorHash: root.userColorHash + image: root.userImage + interactive: false + imageWidth: 80 + imageHeight: 80 + loading: name === "" } StatusBaseText { diff --git a/ui/imports/shared/views/chat/MessageView.qml b/ui/imports/shared/views/chat/MessageView.qml index 48b138c869..413cb7de86 100644 --- a/ui/imports/shared/views/chat/MessageView.qml +++ b/ui/imports/shared/views/chat/MessageView.qml @@ -169,9 +169,11 @@ Loader { const isAdmin = false // chatContentModule.amIChatAdmin() const params = { profileType, trustStatus, contactType, ensVerified, onlineStatus, hasLocalNickname, chatType, isAdmin, - publicKey: isReply ? quotedMessageFrom : root.senderId, + publicKey, displayName: isReply ? quotedMessageAuthorDetailsDisplayName : root.senderDisplayName, userIcon: isReply ? quotedMessageAuthorDetailsThumbnailImage : root.senderIcon, + colorHash: isReply ? quotedMessageAuthorDetailsColorHash : root.senderColorHash, + colorId: Utils.colorIdForPubkey(publicKey) } Global.openMenu(profileContextMenuComponent, sender, params) @@ -1192,35 +1194,35 @@ Loader { root.rootStore.chatCommunitySectionModule.createOneToOneChat("", profileContextMenu.publicKey, "") } onReviewContactRequest: () => { - const contactDetails = profileContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(profileContextMenu.publicKey, true, true) + const contactDetails = profileContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(profileContextMenu.publicKey, true, true, true) Global.openReviewContactRequestPopup(profileContextMenu.publicKey, contactDetails, null) } onSendContactRequest: () => { - const contactDetails = profileContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(profileContextMenu.publicKey, true, true) + const contactDetails = profileContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(profileContextMenu.publicKey, true, true, true) Global.openContactRequestPopup(profileContextMenu.publicKey, contactDetails, null) } onEditNickname: () => { - const contactDetails = profileContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(profileContextMenu.publicKey, true, true) + const contactDetails = profileContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(profileContextMenu.publicKey, true, true, true) Global.openNicknamePopupRequested(profileContextMenu.publicKey, contactDetails, null) } onRemoveNickname: () => { root.rootStore.contactsStore.changeContactNickname(profileContextMenu.publicKey, "", profileContextMenu.displayName, true) } onUnblockContact: () => { - const contactDetails = profileContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(profileContextMenu.publicKey, true, true) + const contactDetails = profileContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(profileContextMenu.publicKey, true, true, true) Global.unblockContactRequested(profileContextMenu.publicKey, contactDetails) } onMarkAsUntrusted: () => { - const contactDetails = profileContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(profileContextMenu.publicKey, true, true) + const contactDetails = profileContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(profileContextMenu.publicKey, true, true, true) Global.markAsUntrustedRequested(profileContextMenu.publicKey, contactDetails) } onRemoveTrustStatus: root.rootStore.contactsStore.removeTrustStatus(profileContextMenu.publicKey) onRemoveContact: () => { - const contactDetails = profileContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(profileContextMenu.publicKey, true, true) + const contactDetails = profileContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(profileContextMenu.publicKey, true, true, true) Global.removeContactRequested(profileContextMenu.publicKey, contactDetails) } onBlockContact: () => { - const contactDetails = profileContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(profileContextMenu.publicKey, true, true) + const contactDetails = profileContextMenu.publicKey === "" ? {} : Utils.getContactDetailsAsJson(profileContextMenu.publicKey, true, true, true) Global.blockContactRequested(profileContextMenu.publicKey, contactDetails) } onRemoveFromGroup: () => { diff --git a/ui/imports/shared/views/chat/ProfileContextMenu.qml b/ui/imports/shared/views/chat/ProfileContextMenu.qml index 52ee3a048b..2e8b786606 100644 --- a/ui/imports/shared/views/chat/ProfileContextMenu.qml +++ b/ui/imports/shared/views/chat/ProfileContextMenu.qml @@ -24,6 +24,8 @@ StatusMenu { property int chatType: Constants.chatType.unknown property bool isAdmin: false property var emojiHash: [] + property var colorHash: [] + property int colorId signal openProfileClicked signal createOneToOneChat @@ -45,6 +47,8 @@ StatusMenu { displayName: StatusQUtils.Emoji.parse(root.displayName, StatusQUtils.Emoji.size.verySmall) pubkey: root.publicKey emojiHash: root.emojiHash + colorHash: root.colorHash + colorId: root.colorId icon: root.userIcon trustStatus: root.profileType === Constants.profileType.regular ? root.trustStatus : Constants.trustStatus.unknown isContact: root.profileType === Constants.profileType.regular ? root.contactType === Constants.contactType.contact : false diff --git a/ui/imports/shared/views/profile/ShareProfileDialog.qml b/ui/imports/shared/views/profile/ShareProfileDialog.qml index c216a30ade..bb258c7939 100644 --- a/ui/imports/shared/views/profile/ShareProfileDialog.qml +++ b/ui/imports/shared/views/profile/ShareProfileDialog.qml @@ -19,6 +19,7 @@ StatusDialog { required property string qrCode required property string linkToProfile required property var emojiHash + required property int colorId required property string displayName required property string largeImage @@ -58,9 +59,12 @@ StatusDialog { UserImage { anchors.centerIn: parent + name: root.displayName pubkey: root.publicKey image: root.largeImage + colorId: root.colorId + interactive: false imageWidth: 78 imageHeight: 78 diff --git a/ui/imports/utils/Utils.qml b/ui/imports/utils/Utils.qml index 9609442a8c..cf0d33bbf1 100644 --- a/ui/imports/utils/Utils.qml +++ b/ui/imports/utils/Utils.qml @@ -721,7 +721,7 @@ QtObject { icon: "", isCurrentUser: "", colorId: "", - colorHash: "", + colorHash: [], displayName: "", publicKey: publicKey, compressedPublicKey: "",