Utils.isCommunityPublicKey moved to UtilsStore

This commit is contained in:
Michał Cieślak 2024-10-21 13:28:57 +02:00 committed by Michał
parent 094114a77a
commit 356275f2b3
3 changed files with 9 additions and 5 deletions

View File

@ -6,6 +6,7 @@ import QtQml.Models 2.15
import utils 1.0 import utils 1.0
import shared.controls 1.0 import shared.controls 1.0
import shared.stores 1.0
import StatusQ.Core 0.1 import StatusQ.Core 0.1
import StatusQ.Core.Theme 0.1 import StatusQ.Core.Theme 0.1
@ -18,6 +19,8 @@ StatusDialog {
id: root id: root
property CommunitiesStores.CommunitiesStore store property CommunitiesStores.CommunitiesStore store
property UtilsStore utilsStore
property alias text: keyInput.text property alias text: keyInput.text
signal joinCommunityRequested(string communityId, var communityDetails) signal joinCommunityRequested(string communityId, var communityDetails)
@ -53,7 +56,7 @@ StatusDialog {
} }
return linkData.communityId return linkData.communityId
} }
if (!Utils.isCommunityPublicKey(inputKey)) if (!root.utilsStore.isCommunityPublicKey(inputKey))
return "" return ""
if (!Utils.isCompressedPubKey(inputKey)) if (!Utils.isCompressedPubKey(inputKey))
return inputKey return inputKey

View File

@ -15,4 +15,9 @@ QtObject {
return (Utils.startsWith0x(value) && Utils.isHex(value) && value.length === 132) return (Utils.startsWith0x(value) && Utils.isHex(value) && value.length === 132)
|| d.globalUtilsInst.isCompressedPubKey(value) || d.globalUtilsInst.isCompressedPubKey(value)
} }
function isCommunityPublicKey(value) {
return (Utils.startsWith0x(value) && Utils.isHex(value) && value.length === Constants.communityIdLength)
|| d.globalUtilsInst.isCompressedPubKey(value)
}
} }

View File

@ -725,10 +725,6 @@ QtObject {
return (startsWith0x(value) && isHex(value) && value.length === 132) || globalUtilsInst.isCompressedPubKey(value) 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) { function isCompressedPubKey(pubKey) {
return globalUtilsInst.isCompressedPubKey(pubKey) return globalUtilsInst.isCompressedPubKey(pubKey)
} }