From 356275f2b36310aeba527987248c154ece827316 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Cie=C5=9Blak?= Date: Mon, 21 Oct 2024 13:28:57 +0200 Subject: [PATCH] Utils.isCommunityPublicKey moved to UtilsStore --- ui/imports/shared/popups/ImportCommunityPopup.qml | 5 ++++- ui/imports/shared/stores/UtilsStore.qml | 5 +++++ ui/imports/utils/Utils.qml | 4 ---- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/ui/imports/shared/popups/ImportCommunityPopup.qml b/ui/imports/shared/popups/ImportCommunityPopup.qml index 71a3d20952..b8d67d2d49 100644 --- a/ui/imports/shared/popups/ImportCommunityPopup.qml +++ b/ui/imports/shared/popups/ImportCommunityPopup.qml @@ -6,6 +6,7 @@ import QtQml.Models 2.15 import utils 1.0 import shared.controls 1.0 +import shared.stores 1.0 import StatusQ.Core 0.1 import StatusQ.Core.Theme 0.1 @@ -18,6 +19,8 @@ StatusDialog { id: root property CommunitiesStores.CommunitiesStore store + property UtilsStore utilsStore + property alias text: keyInput.text signal joinCommunityRequested(string communityId, var communityDetails) @@ -53,7 +56,7 @@ StatusDialog { } return linkData.communityId } - if (!Utils.isCommunityPublicKey(inputKey)) + if (!root.utilsStore.isCommunityPublicKey(inputKey)) return "" if (!Utils.isCompressedPubKey(inputKey)) return inputKey diff --git a/ui/imports/shared/stores/UtilsStore.qml b/ui/imports/shared/stores/UtilsStore.qml index 49e42e7bcb..f178d93fb3 100644 --- a/ui/imports/shared/stores/UtilsStore.qml +++ b/ui/imports/shared/stores/UtilsStore.qml @@ -15,4 +15,9 @@ QtObject { return (Utils.startsWith0x(value) && Utils.isHex(value) && value.length === 132) || d.globalUtilsInst.isCompressedPubKey(value) } + + function isCommunityPublicKey(value) { + return (Utils.startsWith0x(value) && Utils.isHex(value) && value.length === Constants.communityIdLength) + || d.globalUtilsInst.isCompressedPubKey(value) + } } diff --git a/ui/imports/utils/Utils.qml b/ui/imports/utils/Utils.qml index 420cc260d5..04d0f95550 100644 --- a/ui/imports/utils/Utils.qml +++ b/ui/imports/utils/Utils.qml @@ -725,10 +725,6 @@ QtObject { return (startsWith0x(value) && isHex(value) && value.length === 132) || globalUtilsInst.isCompressedPubKey(value) } - function isCommunityPublicKey(value) { - return (startsWith0x(value) && isHex(value) && value.length === Constants.communityIdLength) || globalUtilsInst.isCompressedPubKey(value) - } - function isCompressedPubKey(pubKey) { return globalUtilsInst.isCompressedPubKey(pubKey) }