diff --git a/ui/imports/utils/Constants.qml b/ui/imports/utils/Constants.qml index 94e8e921dc..b1259f5be7 100644 --- a/ui/imports/utils/Constants.qml +++ b/ui/imports/utils/Constants.qml @@ -810,6 +810,8 @@ QtObject { Error = 3 } + readonly property int communityIdLength: 68 + readonly property int communityImported: 0 readonly property int communityImportingInProgress: 1 readonly property int communityImportingError: 2 @@ -968,6 +970,7 @@ QtObject { readonly property int maxUploadFiles: 6 readonly property double maxUploadFilesizeMB: 10 + readonly property int maxImgSizeBytes: maxUploadFilesizeMB * 1048576 /* 1 MB in bytes */ readonly property int maxNumberOfPins: 3 diff --git a/ui/imports/utils/Utils.qml b/ui/imports/utils/Utils.qml index 5152f976be..420cc260d5 100644 --- a/ui/imports/utils/Utils.qml +++ b/ui/imports/utils/Utils.qml @@ -9,9 +9,6 @@ import StatusQ.Core.Theme 0.1 import StatusQ.Core.Utils 0.1 as StatusQUtils QtObject { - readonly property int maxImgSizeBytes: Constants.maxUploadFilesizeMB * 1048576 /* 1 MB in bytes */ - readonly property int communityIdLength: 68 - function isDigit(value) { return /^\d$/.test(value); } @@ -25,11 +22,11 @@ QtObject { } function getCommunityIdFromFullChatId(fullChatId) { - return fullChatId.substr(0, communityIdLength) + return fullChatId.substr(0, Constants.communityIdLength) } function getChannelUuidFromFullChatId(fullChatId) { - return fullChatId.substr(communityIdLength, fullChatId.length) + return fullChatId.substr(Constants.communityIdLength, fullChatId.length) } function isValidETHNamePrefix(value) { @@ -285,10 +282,10 @@ QtObject { function isFilesizeValid(img) { if (img.startsWith(Constants.dataImagePrefix)) { - return img.length < maxImgSizeBytes + return img.length < Constants.maxImgSizeBytes } const size = UrlUtils.getFileSize(img) - return size <= maxImgSizeBytes + return size <= Constants.maxImgSizeBytes } function deduplicate(array) { @@ -729,7 +726,7 @@ QtObject { } function isCommunityPublicKey(value) { - return (startsWith0x(value) && isHex(value) && value.length === communityIdLength) || globalUtilsInst.isCompressedPubKey(value) + return (startsWith0x(value) && isHex(value) && value.length === Constants.communityIdLength) || globalUtilsInst.isCompressedPubKey(value) } function isCompressedPubKey(pubKey) {