Constant values moved from Utils to Constants

This commit is contained in:
Michał Cieślak 2024-10-21 13:09:35 +02:00 committed by Michał
parent 14226af5a0
commit 094114a77a
2 changed files with 8 additions and 8 deletions

View File

@ -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

View File

@ -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) {