Utils.getCompressedPk removed from multiple components
This commit is contained in:
parent
0f98244e1f
commit
28f6bee90e
|
@ -26,13 +26,8 @@ SplitView {
|
|||
|
||||
// globalUtilsInst mock
|
||||
QtObject {
|
||||
function getEmojiHashAsJson(publicKey) {
|
||||
return JSON.stringify(["👨🏻🍼", "🏃🏿♂️", "🌇", "🤶🏿", "🏮","🤷🏻♂️", "🤦🏻", "📣", "🤎", "👷🏽", "😺", "🥞", "🔃", "🧝🏽♂️"])
|
||||
}
|
||||
function getColorId(publicKey) { return colorId.value }
|
||||
|
||||
function getCompressedPk(publicKey) { return "zx3sh" + publicKey }
|
||||
|
||||
function getColorHashAsJson(publicKey, skipEnsVerification=false) {
|
||||
if (skipEnsVerification)
|
||||
return
|
||||
|
@ -40,16 +35,10 @@ SplitView {
|
|||
{colorId: 19, segmentLength: 2}])
|
||||
}
|
||||
|
||||
function isCompressedPubKey(publicKey) { return true }
|
||||
|
||||
function addTimestampToURL(url) {
|
||||
return url
|
||||
}
|
||||
|
||||
function isAlias(name) {
|
||||
return false
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
Utils.globalUtilsInst = this
|
||||
root.globalUtilsReady = true
|
||||
|
@ -408,6 +397,24 @@ SplitView {
|
|||
logs.logEvent("contactsStore::requestProfileShowcase", ["publicKey"], arguments)
|
||||
}
|
||||
}
|
||||
|
||||
utilsStore: SharedStores.UtilsStore {
|
||||
function getEmojiHash(publicKey) {
|
||||
return ["👨🏻🍼", "🏃🏿♂️", "🌇", "🤶🏿", "🏮","🤷🏻♂️", "🤦🏻",
|
||||
"📣", "🤎", "👷🏽", "😺", "🥞", "🔃", "🧝🏽♂️"]
|
||||
}
|
||||
|
||||
function getCompressedPk(publicKey) { return "zx3sh" + publicKey }
|
||||
|
||||
|
||||
function isCompressedPubKey(publicKey) { return true }
|
||||
|
||||
function isAlias(name) {
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -100,7 +100,7 @@ Item {
|
|||
objectName: "profileChatKeyViewChatKeyTxt"
|
||||
Layout.preferredHeight: 22
|
||||
color: Theme.palette.secondaryText
|
||||
text: qsTr("Chatkey:") + " " + Utils.getCompressedPk(d.publicKey)
|
||||
text: qsTr("Chatkey:") + " " + root.utilsStore.getCompressedPk(d.publicKey)
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
wrapMode: Text.WordWrap
|
||||
Layout.alignment: Qt.AlignHCenter | Qt.AlignTop
|
||||
|
|
|
@ -3,13 +3,15 @@ import QtQuick.Controls 2.15
|
|||
import QtQuick.Layouts 1.15
|
||||
import QtQml.Models 2.15
|
||||
|
||||
import StatusQ 0.1
|
||||
import StatusQ.Core 0.1
|
||||
import StatusQ.Core.Theme 0.1
|
||||
|
||||
import utils 1.0
|
||||
import shared 1.0
|
||||
import shared.popups 1.0
|
||||
import shared.panels 1.0
|
||||
import shared.popups 1.0
|
||||
import shared.stores 1.0 as SharedStores
|
||||
import utils 1.0
|
||||
|
||||
import SortFilterProxyModel 0.2
|
||||
|
||||
|
@ -18,6 +20,7 @@ Item {
|
|||
implicitHeight: (title.height + contactsList.height)
|
||||
|
||||
property var contactsModel
|
||||
property SharedStores.UtilsStore utilsStore
|
||||
|
||||
property int panelUsage: Constants.contactsPanelUsage.unknownPosition
|
||||
|
||||
|
@ -60,14 +63,17 @@ Item {
|
|||
sourceModel: root.contactsModel
|
||||
|
||||
function panelUsagePredicate(isVerified) {
|
||||
if (panelUsage === Constants.contactsPanelUsage.verifiedMutualContacts) return isVerified
|
||||
if (panelUsage === Constants.contactsPanelUsage.mutualContacts) return !isVerified
|
||||
if (panelUsage === Constants.contactsPanelUsage.verifiedMutualContacts)
|
||||
return isVerified
|
||||
if (panelUsage === Constants.contactsPanelUsage.mutualContacts)
|
||||
return !isVerified
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
function searchPredicate(name, pubkey) {
|
||||
const lowerCaseSearchString = root.searchString.toLowerCase()
|
||||
const compressedPubkey = Utils.getCompressedPk(pubkey)
|
||||
const compressedPubkey = root.utilsStore.getCompressedPk(pubkey)
|
||||
|
||||
return name.toLowerCase().includes(lowerCaseSearchString) ||
|
||||
pubkey.toLowerCase().includes(lowerCaseSearchString) ||
|
||||
|
@ -75,7 +81,10 @@ Item {
|
|||
}
|
||||
|
||||
filters: [
|
||||
ExpressionFilter { expression: filteredModel.panelUsagePredicate(model.isVerified) },
|
||||
FastExpressionFilter {
|
||||
expression: filteredModel.panelUsagePredicate(model.isVerified)
|
||||
expectedRoles: ["isVerified"]
|
||||
},
|
||||
ExpressionFilter {
|
||||
enabled: root.searchString !== ""
|
||||
expression: {
|
||||
|
@ -85,12 +94,10 @@ Item {
|
|||
}
|
||||
]
|
||||
|
||||
sorters: [
|
||||
StringSorter {
|
||||
sorters: StringSorter {
|
||||
roleName: "preferredDisplayName"
|
||||
caseSensitivity: Qt.CaseInsensitive
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
delegate: ContactPanel {
|
||||
|
|
|
@ -168,6 +168,7 @@ SettingsContentBase {
|
|||
title: qsTr("Trusted Contacts")
|
||||
visible: !noFriendsItem.visible && count > 0
|
||||
contactsModel: root.contactsStore.myContactsModel
|
||||
utilsStore: root.utilsStore
|
||||
searchString: searchBox.text
|
||||
onOpenContactContextMenu: function (publicKey, name, icon) {
|
||||
root.openContextMenu(publicKey, name, icon)
|
||||
|
@ -184,6 +185,7 @@ SettingsContentBase {
|
|||
visible: !noFriendsItem.visible && count > 0
|
||||
title: qsTr("Contacts")
|
||||
contactsModel: root.contactsStore.myContactsModel
|
||||
utilsStore: root.utilsStore
|
||||
searchString: searchBox.text
|
||||
onOpenContactContextMenu: function (publicKey, name, icon) {
|
||||
root.openContextMenu(publicKey, name, icon)
|
||||
|
@ -230,6 +232,7 @@ SettingsContentBase {
|
|||
root.openContextMenu(publicKey, name, icon)
|
||||
}
|
||||
contactsModel: root.contactsStore.receivedContactRequestsModel
|
||||
utilsStore: root.utilsStore
|
||||
panelUsage: Constants.contactsPanelUsage.receivedContactRequest
|
||||
|
||||
onSendMessageActionTriggered: {
|
||||
|
@ -256,6 +259,7 @@ SettingsContentBase {
|
|||
root.openContextMenu(publicKey, name, icon)
|
||||
}
|
||||
contactsModel: root.contactsStore.sentContactRequestsModel
|
||||
utilsStore: root.utilsStore
|
||||
panelUsage: Constants.contactsPanelUsage.sentContactRequest
|
||||
}
|
||||
}
|
||||
|
@ -314,6 +318,7 @@ SettingsContentBase {
|
|||
root.openContextMenu(publicKey, name, icon)
|
||||
}
|
||||
contactsModel: root.contactsStore.blockedContactsModel
|
||||
utilsStore: root.utilsStore
|
||||
panelUsage: Constants.contactsPanelUsage.blockedContacts
|
||||
visible: (stackLayout.currentIndex === 2)
|
||||
onVisibleChanged: {
|
||||
|
|
|
@ -7,12 +7,11 @@ import utils 1.0
|
|||
import shared 1.0
|
||||
import shared.panels 1.0
|
||||
import shared.popups 1.0
|
||||
import shared.stores 1.0
|
||||
import shared.stores 1.0 as SharedStores
|
||||
import shared.validators 1.0
|
||||
import shared.controls.chat 1.0
|
||||
|
||||
import "../popups"
|
||||
import "../stores"
|
||||
import "../controls"
|
||||
import "./profile"
|
||||
|
||||
|
@ -22,18 +21,19 @@ import StatusQ.Core.Utils 0.1
|
|||
import StatusQ.Components 0.1
|
||||
import StatusQ.Controls 0.1
|
||||
|
||||
import AppLayouts.Communities.stores 1.0 as CommunitiesStores
|
||||
import AppLayouts.Profile.helpers 1.0
|
||||
import AppLayouts.Profile.panels 1.0
|
||||
import AppLayouts.Wallet.stores 1.0
|
||||
import AppLayouts.Communities.stores 1.0
|
||||
import AppLayouts.Profile.stores 1.0 as ProfileStores
|
||||
import AppLayouts.Wallet.stores 1.0 as WalletStores
|
||||
|
||||
SettingsContentBase {
|
||||
id: root
|
||||
|
||||
property ProfileStore profileStore
|
||||
property ContactsStore contactsStore
|
||||
property CommunitiesStore communitiesStore
|
||||
property UtilsStore utilsStore
|
||||
property ProfileStores.ProfileStore profileStore
|
||||
property ProfileStores.ContactsStore contactsStore
|
||||
property CommunitiesStores.CommunitiesStore communitiesStore
|
||||
property SharedStores.UtilsStore utilsStore
|
||||
|
||||
property bool sendToAccountEnabled: false
|
||||
|
||||
|
@ -406,6 +406,7 @@ SettingsContentBase {
|
|||
publicKey: root.contactsStore.myPublicKey
|
||||
profileStore: root.profileStore
|
||||
contactsStore: root.contactsStore
|
||||
walletStore: WalletStores.RootStore
|
||||
utilsStore: root.utilsStore
|
||||
sendToAccountEnabled: root.sendToAccountEnabled
|
||||
onClosed: destroy()
|
||||
|
|
|
@ -2,11 +2,11 @@ import QtQuick 2.15
|
|||
import QtQuick.Layouts 1.15
|
||||
import QtGraphicalEffects 1.15
|
||||
|
||||
import shared.views 1.0 as SharedViews
|
||||
|
||||
import StatusQ.Core.Theme 0.1
|
||||
|
||||
import AppLayouts.Wallet.stores 1.0 as WalletStores
|
||||
import shared.controls 1.0
|
||||
import shared.views 1.0 as SharedViews
|
||||
|
||||
Item {
|
||||
property alias profileStore: profilePreview.profileStore
|
||||
|
@ -51,9 +51,13 @@ Item {
|
|||
|
||||
SharedViews.ProfileDialogView {
|
||||
id: profilePreview
|
||||
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
Layout.maximumHeight: implicitHeight
|
||||
|
||||
walletStore: WalletStores.RootStore
|
||||
|
||||
readOnly: true
|
||||
}
|
||||
Item { Layout.fillHeight: true }
|
||||
|
|
|
@ -25,7 +25,7 @@ import AppLayouts.Wallet.popups.buy 1.0
|
|||
import AppLayouts.Wallet.popups 1.0
|
||||
import AppLayouts.Communities.stores 1.0
|
||||
|
||||
import AppLayouts.Wallet.stores 1.0 as WalletStore
|
||||
import AppLayouts.Wallet.stores 1.0 as WalletStores
|
||||
import AppLayouts.Chat.stores 1.0 as ChatStores
|
||||
|
||||
import shared.popups 1.0
|
||||
|
@ -51,10 +51,10 @@ QtObject {
|
|||
property ProfileStores.ProfileStore profileStore
|
||||
property ProfileStores.DevicesStore devicesStore
|
||||
property CurrenciesStore currencyStore
|
||||
property WalletStore.WalletAssetsStore walletAssetsStore
|
||||
property WalletStore.CollectiblesStore walletCollectiblesStore
|
||||
property WalletStores.WalletAssetsStore walletAssetsStore
|
||||
property WalletStores.CollectiblesStore walletCollectiblesStore
|
||||
property NetworkConnectionStore networkConnectionStore
|
||||
property WalletStore.BuyCryptoStore buyCryptoStore
|
||||
property WalletStores.BuyCryptoStore buyCryptoStore
|
||||
property bool isDevBuild
|
||||
|
||||
signal openExternalLink(string link)
|
||||
|
@ -528,6 +528,7 @@ QtObject {
|
|||
|
||||
profileStore: rootStore.profileSectionStore.profileStore
|
||||
contactsStore: rootStore.profileSectionStore.contactsStore
|
||||
walletStore: WalletStores.RootStore
|
||||
utilsStore: root.utilsStore
|
||||
|
||||
sendToAccountEnabled: root.networkConnectionStore.sendBuyBridgeEnabled
|
||||
|
@ -695,9 +696,9 @@ QtObject {
|
|||
joinPermissionsCheckCompletedWithoutErrors: root.rootStore.joinPermissionsCheckCompletedWithoutErrors
|
||||
|
||||
walletAccountsModel: root.rootStore.walletAccountsModel
|
||||
walletCollectiblesModel: WalletStore.RootStore.collectiblesStore.allCollectiblesModel
|
||||
walletCollectiblesModel: WalletStores.RootStore.collectiblesStore.allCollectiblesModel
|
||||
|
||||
canProfileProveOwnershipOfProvidedAddressesFn: WalletStore.RootStore.canProfileProveOwnershipOfProvidedAddresses
|
||||
canProfileProveOwnershipOfProvidedAddressesFn: WalletStores.RootStore.canProfileProveOwnershipOfProvidedAddresses
|
||||
|
||||
walletAssetsModel: walletAssetsStore.groupedAccountAssetsModel
|
||||
permissionsModel: {
|
||||
|
@ -947,12 +948,12 @@ QtObject {
|
|||
|
||||
introMessage: chatStore.sectionDetails.introMessage
|
||||
|
||||
canProfileProveOwnershipOfProvidedAddressesFn: WalletStore.RootStore.canProfileProveOwnershipOfProvidedAddresses
|
||||
canProfileProveOwnershipOfProvidedAddressesFn: WalletStores.RootStore.canProfileProveOwnershipOfProvidedAddresses
|
||||
|
||||
walletAccountsModel: root.rootStore.walletAccountsModel
|
||||
|
||||
walletAssetsModel: walletAssetsStore.groupedAccountAssetsModel
|
||||
walletCollectiblesModel: WalletStore.RootStore.collectiblesStore.allCollectiblesModel
|
||||
walletCollectiblesModel: WalletStores.RootStore.collectiblesStore.allCollectiblesModel
|
||||
|
||||
permissionsModel: {
|
||||
root.rootStore.prepareTokenModelForCommunity(editSharedAddressesPopup.communityId)
|
||||
|
@ -1054,7 +1055,7 @@ QtObject {
|
|||
feeErrorText: feeSubscriber.feeErrorText
|
||||
isFeeLoading: !feeSubscriber.feesResponse
|
||||
|
||||
accounts: WalletStore.RootStore.nonWatchAccounts
|
||||
accounts: WalletStores.RootStore.nonWatchAccounts
|
||||
|
||||
destroyOnClose: true
|
||||
|
||||
|
@ -1200,7 +1201,7 @@ QtObject {
|
|||
id: swapModal
|
||||
SwapModal {
|
||||
swapAdaptor: SwapModalAdaptor {
|
||||
swapStore: WalletStore.SwapStore {}
|
||||
swapStore: WalletStores.SwapStore {}
|
||||
walletAssetsStore: root.walletAssetsStore
|
||||
currencyStore: root.currencyStore
|
||||
swapFormData: swapInputParamsForm
|
||||
|
|
|
@ -110,7 +110,7 @@ StatusDialog {
|
|||
id: keyHoverHandler
|
||||
}
|
||||
StatusToolTip {
|
||||
text: Utils.getCompressedPk(root.publicKey)
|
||||
text: root.utilsStore.getCompressedPk(root.publicKey)
|
||||
visible: keyHoverHandler.hovered
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ StatusDialog {
|
|||
|
||||
property alias profileStore: profileView.profileStore
|
||||
property alias contactsStore: profileView.contactsStore
|
||||
property alias walletStore: profileView.walletStore
|
||||
property alias utilsStore: profileView.utilsStore
|
||||
|
||||
property alias sendToAccountEnabled: profileView.sendToAccountEnabled
|
||||
|
|
|
@ -38,6 +38,7 @@ Pane {
|
|||
property ProfileStores.ProfileStore profileStore
|
||||
property ProfileStores.ContactsStore contactsStore
|
||||
property SharedStores.UtilsStore utilsStore
|
||||
property WalletStores.RootStore walletStore
|
||||
|
||||
property alias sendToAccountEnabled: showcaseView.sendToAccountEnabled
|
||||
|
||||
|
@ -448,7 +449,7 @@ Pane {
|
|||
id: keyHoverHandler
|
||||
}
|
||||
StatusToolTip {
|
||||
text: Utils.getCompressedPk(root.publicKey)
|
||||
text: root.utilsStore.getCompressedPk(root.publicKey)
|
||||
visible: keyHoverHandler.hovered
|
||||
}
|
||||
}
|
||||
|
@ -456,7 +457,7 @@ Pane {
|
|||
Layout.leftMargin: -4
|
||||
Layout.preferredWidth: 16
|
||||
Layout.preferredHeight: 16
|
||||
textToCopy: Utils.getCompressedPk(root.publicKey)
|
||||
textToCopy: root.utilsStore.getCompressedPk(root.publicKey)
|
||||
StatusToolTip {
|
||||
text: qsTr("Copy Chat Key")
|
||||
visible: parent.hovered
|
||||
|
@ -549,7 +550,7 @@ Pane {
|
|||
socialLinksModel: root.showcaseSocialLinksModel
|
||||
// assetsModel: root.showcaseAssetsModel
|
||||
|
||||
walletStore: WalletStores.RootStore
|
||||
walletStore: root.walletStore
|
||||
|
||||
onCloseRequested: root.closeRequested()
|
||||
onCopyToClipboard: ClipboardUtils.setText(text)
|
||||
|
|
|
@ -846,7 +846,7 @@ Loader {
|
|||
albumCount: root.albumCount
|
||||
|
||||
amISender: root.amISender
|
||||
sender.id: root.senderIsEnsVerified ? "" : Utils.getCompressedPk(root.senderId)
|
||||
sender.id: root.senderIsEnsVerified ? "" : root.utilsStore.getCompressedPk(root.senderId)
|
||||
sender.displayName: root.senderDisplayName
|
||||
sender.secondaryName: root.senderOptionalName
|
||||
sender.isEnsVerified: root.isBridgeMessage ? false : root.senderIsEnsVerified
|
||||
|
|
Loading…
Reference in New Issue