From fa11b3bf672ac220d22fc29cec9d488330b0b638 Mon Sep 17 00:00:00 2001 From: Patryk Osmaczko Date: Wed, 30 Mar 2022 09:09:39 +0200 Subject: [PATCH] fix(@desktop): show compressed multiformat public keys closes: #5181 --- .../Chat/panels/communities/CommunityMembersSettingsPanel.qml | 2 +- ui/app/AppLayouts/Onboarding/views/InsertDetailsView.qml | 3 ++- ui/app/AppLayouts/Profile/views/MyProfileView.qml | 2 +- ui/imports/shared/controls/chat/ProfileHeader.qml | 3 +-- ui/imports/shared/popups/ProfilePopup.qml | 4 ++-- ui/imports/utils/Utils.qml | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ui/app/AppLayouts/Chat/panels/communities/CommunityMembersSettingsPanel.qml b/ui/app/AppLayouts/Chat/panels/communities/CommunityMembersSettingsPanel.qml index 688d8f0845..e0463af6d8 100644 --- a/ui/app/AppLayouts/Chat/panels/communities/CommunityMembersSettingsPanel.qml +++ b/ui/app/AppLayouts/Chat/panels/communities/CommunityMembersSettingsPanel.qml @@ -110,7 +110,7 @@ SettingsPageLayout { } return !model.name.endsWith(".eth") ? model.name : Utils.removeStatusEns(model.name) } - subTitle: model.id.substring(0, 5) + "..." + model.id.substring(model.id.length - 3) + subTitle: Utils.getElidedCompressedPk(model.id) statusListItemIcon { name: model.name diff --git a/ui/app/AppLayouts/Onboarding/views/InsertDetailsView.qml b/ui/app/AppLayouts/Onboarding/views/InsertDetailsView.qml index 7984f0c589..48230edb9c 100644 --- a/ui/app/AppLayouts/Onboarding/views/InsertDetailsView.qml +++ b/ui/app/AppLayouts/Onboarding/views/InsertDetailsView.qml @@ -80,6 +80,7 @@ Item { icon.letterSize: 32 icon.color: Theme.palette.miscColor5 icon.charactersLen: 2 + image.isIdenticon: false image.source: uploadProfilePicPopup.selectedImage ringSettings { ringSpecModel: Utils.getColorHashAsJson(root.pubKey) } } @@ -122,7 +123,7 @@ Item { StyledText { id: chatKeyTxt color: Style.current.secondaryText - text: "Chatkey:" + root.pubKey + text: qsTr("Chatkey:") + " " + Utils.getCompressedPk(root.pubKey) horizontalAlignment: Text.AlignHCenter wrapMode: Text.WordWrap Layout.alignment: Qt.AlignHCenter diff --git a/ui/app/AppLayouts/Profile/views/MyProfileView.qml b/ui/app/AppLayouts/Profile/views/MyProfileView.qml index 5bc3e90382..a11e208083 100644 --- a/ui/app/AppLayouts/Profile/views/MyProfileView.qml +++ b/ui/app/AppLayouts/Profile/views/MyProfileView.qml @@ -130,7 +130,7 @@ ColumnLayout { Layout.preferredWidth: root.profileContentWidth title: qsTr("Chat key") - subTitle: root.profileStore.pubkey + subTitle: Utils.getCompressedPk(root.profileStore.pubkey) subTitleComponent.elide: Text.ElideMiddle subTitleComponent.width: 320 subTitleComponent.font.family: Theme.palette.monoFont.name diff --git a/ui/imports/shared/controls/chat/ProfileHeader.qml b/ui/imports/shared/controls/chat/ProfileHeader.qml index cdd83f46e1..d66567e7e5 100644 --- a/ui/imports/shared/controls/chat/ProfileHeader.qml +++ b/ui/imports/shared/controls/chat/ProfileHeader.qml @@ -79,8 +79,7 @@ Item { visible: root.pubkeyVisible - text: pubkey.substring(0, 10) + "..." + pubkey.substring( - pubkey.length - 4) + text: Utils.getElidedCompressedPk(pubkey) horizontalAlignment: Text.AlignHCenter font.pixelSize: Style.current.asideTextFontSize diff --git a/ui/imports/shared/popups/ProfilePopup.qml b/ui/imports/shared/popups/ProfilePopup.qml index 3e165f1157..f248a683f8 100644 --- a/ui/imports/shared/popups/ProfilePopup.qml +++ b/ui/imports/shared/popups/ProfilePopup.qml @@ -71,7 +71,7 @@ StatusModal { } header.title: userDisplayName - header.subTitle: userIsEnsVerified ? userName : userPublicKey + header.subTitle: userIsEnsVerified ? userName : Utils.getElidedCompressedPk(userPublicKey) header.subTitleElide: Text.ElideMiddle headerActionButton: StatusFlatRoundButton { @@ -171,7 +171,7 @@ StatusModal { StatusDescriptionListItem { title: qsTr("Chat key") - subTitle: userPublicKey + subTitle: Utils.getCompressedPk(userPublicKey) subTitleComponent.elide: Text.ElideMiddle subTitleComponent.width: 320 subTitleComponent.font.family: Theme.palette.monoFont.name diff --git a/ui/imports/utils/Utils.qml b/ui/imports/utils/Utils.qml index c405ee5809..b9731acc5f 100644 --- a/ui/imports/utils/Utils.qml +++ b/ui/imports/utils/Utils.qml @@ -630,7 +630,7 @@ QtObject { return "" } let compressedPk = getCompressedPk(publicKey) - return compressedPk.substr(3, 3) + "..." + compressedPk.substr(compressedPk.length - 3) + return compressedPk.substr(0, 6) + "..." + compressedPk.substr(compressedPk.length - 3) } function getTimeDifference(d1, d2) {