From a2e8655835594854c8c81d07b5d23186756e4c38 Mon Sep 17 00:00:00 2001 From: Igor Sirotin Date: Mon, 20 Nov 2023 16:04:11 +0000 Subject: [PATCH] chore: fix nim build warnings (#12796) * chore: turn off 'generic methods are deprecated' warnings * chore: fix homebrew bottles version and macos-min-version * chore: suppress dotherside deprecation warnings * chore: fix more nim unused import warnings * chore(qt.nim): explicit cstring conversion to fix warning * chore: fix all baseless methods --- Makefile | 16 +++++++++------- config.nims | 4 ++-- scripts/fetch-brew-bottle.sh | 9 +++------ src/app/core/tasks/qt.nim | 4 ++-- src/app/modules/main/activity_center/view.nim | 2 +- .../chat_content/input_area/controller.nim | 2 +- .../chat_content/input_area/io_interface.nim | 14 +++++++------- .../chat_content/input_area/module.nim | 2 +- .../modules/main/chat_section/io_interface.nim | 9 --------- src/app/modules/main/chat_section/module.nim | 2 +- .../modules/main/communities/io_interface.nim | 3 +++ src/app/modules/main/communities/module.nim | 6 +++--- src/app/modules/main/module.nim | 4 ++++ .../profile_section/communities/controller.nim | 2 +- .../main/profile_section/communities/view.nim | 6 +++--- .../main/profile_section/keycard/module.nim | 2 +- .../main/profile_section/privacy/controller.nim | 6 +++--- .../profile_section/wallet/accounts/module.nim | 6 +++--- .../main/profile_section/wallet/io_interface.nim | 5 ++++- .../profile_section/wallet/networks/module.nim | 2 +- .../modules/main/shared_urls/io_interface.nim | 3 +++ .../wallet_section/all_tokens/controller.nim | 6 +++--- .../main/wallet_section/all_tokens/module.nim | 6 +++--- src/app/modules/main/wallet_section/module.nim | 2 +- .../main/wallet_section/networks/module.nim | 2 +- .../main/wallet_section/send/accounts_model.nim | 4 ++-- .../main/wallet_section/send/io_interface.nim | 12 ++++++------ .../modules/main/wallet_section/send/module.nim | 14 +++++++------- .../shared_modules/add_account/controller.nim | 2 +- .../shared_modules/add_account/module.nim | 4 ++++ .../shared_modules/keycard_popup/module.nim | 4 ++++ .../shared_modules/keypair_import/module.nim | 4 ++++ src/app/modules/startup/module.nim | 4 ++++ src/backend/collectibles.nim | 2 +- vendor/DOtherSide/lib/CMakeLists.txt | 5 +++++ 35 files changed, 102 insertions(+), 78 deletions(-) diff --git a/Makefile b/Makefile index 41b384c2e3..f1b6cfce67 100644 --- a/Makefile +++ b/Makefile @@ -74,12 +74,13 @@ else endif ifeq ($(detected_OS),Darwin) - CFLAGS := -mmacosx-version-min=10.14 + CFLAGS := -mmacosx-version-min=11.0 export CFLAGS - CGO_CFLAGS := -mmacosx-version-min=10.14 + CGO_CFLAGS := -mmacosx-version-min=11.0 export CGO_CFLAGS LIBSTATUS_EXT := dylib - MACOSX_DEPLOYMENT_TARGET := 10.14 + # keep in sync with BOTTLE_MACOS_VERSION + MACOSX_DEPLOYMENT_TARGET := 11.0 export MACOSX_DEPLOYMENT_TARGET PKG_TARGET := pkg-macos RUN_TARGET := run-macos @@ -123,13 +124,14 @@ ifeq ($(detected_OS),Darwin) BOTTLES_DIR := $(shell pwd)/bottles BOTTLES := $(addprefix $(BOTTLES_DIR)/,openssl@1.1 pcre) ifeq ($(QT_ARCH),arm64) - EXCLUDE_BOTTLES := 'linux' +# keep in sync with MACOSX_DEPLOYMENT_TARGET + BOTTLE_MACOS_VERSION := 'arm64_big_sur' else - EXCLUDE_BOTTLES := 'arm|linux' + BOTTLE_MACOS_VERSION := 'big_sur' endif $(BOTTLES): | $(BOTTLES_DIR) - echo -e "\033[92mFetching:\033[39m $(notdir $@) bottle arch $(QT_ARCH)" - ./scripts/fetch-brew-bottle.sh $(notdir $@) $(EXCLUDE_BOTTLES) + echo -e "\033[92mFetching:\033[39m $(notdir $@) bottle arch $(QT_ARCH) $(BOTTLE_MACOS_VERSION)" + ./scripts/fetch-brew-bottle.sh $(notdir $@) $(BOTTLE_MACOS_VERSION) $(HANDLE_OUTPUT) $(BOTTLES_DIR): echo -e "\033[92mUpdating:\033[39m macOS Homebrew" diff --git a/config.nims b/config.nims index 26983ecc0a..8506c80391 100644 --- a/config.nims +++ b/config.nims @@ -23,8 +23,8 @@ if defined(macosx): switch("passL", "bottles/pcre/lib/libpcre.a") # https://code.videolan.org/videolan/VLCKit/-/issues/232 switch("passL", "-Wl,-no_compact_unwind") - # set the minimum supported macOS version to 10.14 - switch("passC", "-mmacosx-version-min=10.14") + # set the minimum supported macOS version to 11.0 + switch("passC", "-mmacosx-version-min=11.0") elif defined(windows): --app:gui --tlsEmulation:off diff --git a/scripts/fetch-brew-bottle.sh b/scripts/fetch-brew-bottle.sh index 56c646824f..5046c78845 100755 --- a/scripts/fetch-brew-bottle.sh +++ b/scripts/fetch-brew-bottle.sh @@ -10,10 +10,7 @@ function get_gh_pkgs_token() { } function get_bottle_json() { - brew info --json=v1 "${1}" | jq " - .[0].bottle.stable.files | to_entries - | map(select(.key | test(\"${2}\") | not)) - | first.value" + brew info --json=v1 "${1}" | jq ".[0].bottle.stable.files[\"${2}\"]" } function fetch_bottle() { @@ -50,7 +47,7 @@ else fi echo "${BOTTLE_NAME} - Finding bottle URL" -echo "Excluding: ${BOTTLE_FILTER}" +echo "${BOTTLE_NAME} - Selecting: ${BOTTLE_FILTER}" BOTTLE_JSON=$(get_bottle_json "${BOTTLE_NAME}" "${BOTTLE_FILTER}") BOTTLE_URL=$(echo "${BOTTLE_JSON}" | jq -r .url) @@ -61,7 +58,7 @@ if [[ -z "${BOTTLE_URL}" ]] || [[ -z "${BOTTLE_SHA}" ]]; then exit 1 fi -echo "${BOTTLE_NAME} - Fetching bottle for macOS" +echo "${BOTTLE_NAME} - Fetching bottle for macOS, bottle sha256: ${BOTTLE_SHA}" fetch_bottle "${BOTTLE_PATH}" "${BOTTLE_URL}" trap "rm -fr ${BOTTLE_PATH}" EXIT ERR INT QUIT diff --git a/src/app/core/tasks/qt.nim b/src/app/core/tasks/qt.nim index 06d11ad648..e19a0cfc23 100644 --- a/src/app/core/tasks/qt.nim +++ b/src/app/core/tasks/qt.nim @@ -10,7 +10,7 @@ type slot*: string proc finish*[T](arg: QObjectTaskArg, payload: T) = - signal_handler(cast[pointer](arg.vptr), Json.encode(payload), arg.slot) + signal_handler(cast[pointer](arg.vptr), cstring(Json.encode(payload)), cstring(arg.slot)) proc finish*(arg: QObjectTaskArg, payload: string) = - signal_handler(cast[pointer](arg.vptr), payload, arg.slot) + signal_handler(cast[pointer](arg.vptr), cstring(payload), cstring(arg.slot)) diff --git a/src/app/modules/main/activity_center/view.nim b/src/app/modules/main/activity_center/view.nim index 7637bbf5e2..a1adc14e56 100644 --- a/src/app/modules/main/activity_center/view.nim +++ b/src/app/modules/main/activity_center/view.nim @@ -1,4 +1,4 @@ -import NimQml, json, strutils, sequtils, strformat, std/tables +import NimQml, json, strutils, sequtils, std/tables import ../../../../app_service/service/activity_center/service as activity_center_service import ./model diff --git a/src/app/modules/main/chat_section/chat_content/input_area/controller.nim b/src/app/modules/main/chat_section/chat_content/input_area/controller.nim index 859860ba4b..3c58f15f7f 100644 --- a/src/app/modules/main/chat_section/chat_content/input_area/controller.nim +++ b/src/app/modules/main/chat_section/chat_content/input_area/controller.nim @@ -1,4 +1,4 @@ -import io_interface, tables, sequtils, strutils, sugar, sets +import io_interface, tables, sets import ../../../../../../app_service/service/settings/service as settings_service diff --git a/src/app/modules/main/chat_section/chat_content/input_area/io_interface.nim b/src/app/modules/main/chat_section/chat_content/input_area/io_interface.nim index 7ec8a689f0..a03db50845 100644 --- a/src/app/modules/main/chat_section/chat_content/input_area/io_interface.nim +++ b/src/app/modules/main/chat_section/chat_content/input_area/io_interface.nim @@ -1,4 +1,4 @@ -import NimQml, tables, sets +import NimQml, tables import ../../../../../../app_service/service/gif/dto import ../../../../../../app_service/service/message/dto/link_preview @@ -99,7 +99,7 @@ method viewDidLoad*(self: AccessInterface) {.base.} = method setText*(self: AccessInterface, text: string, unfurlUrls: bool) {.base.} = raise newException(ValueError, "No implementation available") -method getPlainText*(self: AccessInterface): string = +method getPlainText*(self: AccessInterface): string {.base.} = raise newException(ValueError, "No implementation available") method setLinkPreviewUrls*(self: AccessInterface, urls: seq[string]) {.base.} = @@ -114,22 +114,22 @@ method clearLinkPreviewCache*(self: AccessInterface) {.base.} = method linkPreviewsFromCache*(self: AccessInterface, urls: seq[string]): Table[string, LinkPreview] {.base.} = raise newException(ValueError, "No implementation available") -method reloadUnfurlingPlan*(self: AccessInterface) = +method reloadUnfurlingPlan*(self: AccessInterface) {.base.} = raise newException(ValueError, "No implementation available") method loadLinkPreviews*(self: AccessInterface, urls: seq[string]) {.base.} = raise newException(ValueError, "No implementation available") -method getLinkPreviewEnabled*(self: AccessInterface): bool = +method getLinkPreviewEnabled*(self: AccessInterface): bool {.base.} = raise newException(ValueError, "No implementation available") -method setLinkPreviewEnabled*(self: AccessInterface, enabled: bool) = +method setLinkPreviewEnabled*(self: AccessInterface, enabled: bool) {.base.} = raise newException(ValueError, "No implementation available") -method setAskToEnableLinkPreview*(self: AccessInterface, value: bool) = +method setAskToEnableLinkPreview*(self: AccessInterface, value: bool) {.base.} = raise newException(ValueError, "No implementation available") -method setLinkPreviewEnabledForThisMessage*(self: AccessInterface, enabled: bool) = +method setLinkPreviewEnabledForThisMessage*(self: AccessInterface, enabled: bool) {.base.} = raise newException(ValueError, "No implementation available") method setUrls*(self: AccessInterface, urls: seq[string]) {.base.} = diff --git a/src/app/modules/main/chat_section/chat_content/input_area/module.nim b/src/app/modules/main/chat_section/chat_content/input_area/module.nim index 18d8e2ce5b..980100666f 100644 --- a/src/app/modules/main/chat_section/chat_content/input_area/module.nim +++ b/src/app/modules/main/chat_section/chat_content/input_area/module.nim @@ -1,4 +1,4 @@ -import NimQml, tables, sets +import NimQml, tables import io_interface import ../io_interface as delegate_interface import view, controller diff --git a/src/app/modules/main/chat_section/io_interface.nim b/src/app/modules/main/chat_section/io_interface.nim index 44ec936f21..b2d97ea617 100644 --- a/src/app/modules/main/chat_section/io_interface.nim +++ b/src/app/modules/main/chat_section/io_interface.nim @@ -13,7 +13,6 @@ import ../../../../app_service/service/shared_urls/service as shared_urls_servic import model as chats_model import item as chat_item -import ../../../core/eventemitter import ../../../core/unique_event_emitter type @@ -64,14 +63,6 @@ method activeItemSet*(self: AccessInterface, itemId: string) {.base.} = method makeChatWithIdActive*(self: AccessInterface, chatId: string) {.base.} = raise newException(ValueError, "No implementation available") -method addNewChat*(self: AccessInterface, chatDto: ChatDto, belongsToCommunity: bool, events: EventEmitter, - settingsService: settings_service.Service, contactService: contact_service.Service, - chatService: chat_service.Service, communityService: community_service.Service, - messageService: message_service.Service, gifService: gif_service.Service, - mailserversService: mailservers_service.Service, sharedUrlsService: shared_urls_service.Service, - setChatAsActive: bool = true, insertIntoModel: bool = true): Item {.base.} = - raise newException(ValueError, "No implementation available") - method doesCatOrChatExist*(self: AccessInterface, chatId: string): bool {.base.} = raise newException(ValueError, "No implementation available") diff --git a/src/app/modules/main/chat_section/module.nim b/src/app/modules/main/chat_section/module.nim index efa7b4b994..412845db21 100644 --- a/src/app/modules/main/chat_section/module.nim +++ b/src/app/modules/main/chat_section/module.nim @@ -516,7 +516,7 @@ method onActiveSectionChange*(self: Module, sectionId: string) = method chatsModel*(self: Module): chats_model.Model = return self.view.chatsModel() -method addNewChat*( +proc addNewChat*( self: Module, chatDto: ChatDto, channelGroup: ChannelGroupDto, diff --git a/src/app/modules/main/communities/io_interface.nim b/src/app/modules/main/communities/io_interface.nim index 4eddb7a43b..bfd4444017 100644 --- a/src/app/modules/main/communities/io_interface.nim +++ b/src/app/modules/main/communities/io_interface.nim @@ -123,6 +123,9 @@ method communityInfoRequestFailed*(self: AccessInterface, communityId: string, e method onImportCommunityErrorOccured*(self: AccessInterface, communityId: string, error: string) {.base.} = raise newException(ValueError, "No implementation available") +method onImportCommunityCancelled*(self: AccessInterface, communityId: string) {.base.} = + raise newException(ValueError, "No implementation available") + method viewDidLoad*(self: AccessInterface) {.base.} = raise newException(ValueError, "No implementation available") diff --git a/src/app/modules/main/communities/module.nim b/src/app/modules/main/communities/module.nim index e84e386287..2f30645e52 100644 --- a/src/app/modules/main/communities/module.nim +++ b/src/app/modules/main/communities/module.nim @@ -421,7 +421,7 @@ method importCommunity*(self: Module, communityId: string) = method onImportCommunityErrorOccured*(self: Module, communityId: string, error: string) = self.view.emitImportingCommunityStateChangedSignal(communityId, ImportCommunityState.ImportingError.int, error) -method onImportCommunityCanceled*(self: Module, communityId: string) = +method onImportCommunityCancelled*(self: Module, communityId: string) = self.view.emitImportingCommunityStateChangedSignal(communityId, ImportCommunityState.ImportingCanceled.int, errorMsg = "") method requestExtractDiscordChannelsAndCategories*(self: Module, filesToImport: seq[string]) = @@ -656,7 +656,7 @@ method shareCommunityChannelUrlWithChatKey*(self: Module, communityId: string, c method shareCommunityChannelUrlWithData*(self: Module, communityId: string, chatId: string): string = return self.controller.shareCommunityChannelUrlWithData(communityId, chatId) -method signRevealedAddressesThatBelongToRegularKeypairs(self: Module): bool = +proc signRevealedAddressesThatBelongToRegularKeypairs(self: Module): bool = var signingParams: seq[SignParamsDto] for address, details in self.joiningCommunityDetails.addressesToShare.pairs: if details.signature.len > 0: @@ -923,4 +923,4 @@ method onCommunityMemberRevealedAccountsLoaded*(self: Module, communityId, membe if revealedAccount.isAirdropAddress: airdropAddress = revealedAccount.address - self.view.setMyRevealedAddressesForCurrentCommunity($(%*addresses), airdropAddress) \ No newline at end of file + self.view.setMyRevealedAddressesForCurrentCommunity($(%*addresses), airdropAddress) diff --git a/src/app/modules/main/module.nim b/src/app/modules/main/module.nim index cd528e1380..414a622dac 100644 --- a/src/app/modules/main/module.nim +++ b/src/app/modules/main/module.nim @@ -118,6 +118,8 @@ type pendingSpectateRequest: SpectateRequest statusDeepLinkToActivate: string +{.push warning[Deprecated]: off.} + # Forward declaration method calculateProfileSectionHasNotification*[T](self: Module[T]): bool proc switchToContactOrDisplayUserProfile[T](self: Module[T], publicKey: string) @@ -1567,3 +1569,5 @@ method insertMockedKeycardAction*[T](self: Module[T], cardIndex: int) = method removeMockedKeycardAction*[T](self: Module[T]) = self.keycardService.removeMockedKeycardAction() + +{.pop.} diff --git a/src/app/modules/main/profile_section/communities/controller.nim b/src/app/modules/main/profile_section/communities/controller.nim index 64e4e1b95b..a4a8572d9f 100644 --- a/src/app/modules/main/profile_section/communities/controller.nim +++ b/src/app/modules/main/profile_section/communities/controller.nim @@ -23,6 +23,6 @@ proc shareCommunityToUsers*(self: Controller, communityID: string, pubKeys: stri proc leaveCommunity*(self: Controller, communityID: string) = self.communityService.leaveCommunity(communityID) -method setCommunityMuted*(self: Controller, communityID: string, mutedType: int) = +proc setCommunityMuted*(self: Controller, communityID: string, mutedType: int) = self.communityService.setCommunityMuted(communityID, mutedType) diff --git a/src/app/modules/main/profile_section/communities/view.nim b/src/app/modules/main/profile_section/communities/view.nim index f9eec3b77d..c0bc9c8d3d 100644 --- a/src/app/modules/main/profile_section/communities/view.nim +++ b/src/app/modules/main/profile_section/communities/view.nim @@ -19,11 +19,11 @@ QtObject: proc load*(self: View) = self.delegate.viewDidLoad() - method shareCommunityToUsers*(self: View, communityID: string, pubKeysJSON: string, inviteMessage: string): string {.slot.} = + proc shareCommunityToUsers*(self: View, communityID: string, pubKeysJSON: string, inviteMessage: string): string {.slot.} = result = self.delegate.shareCommunityToUsers(communityID, pubKeysJSON, inviteMessage) - method leaveCommunity*(self: View, communityID: string) {.slot.} = + proc leaveCommunity*(self: View, communityID: string) {.slot.} = self.delegate.leaveCommunity(communityID) - method setCommunityMuted*(self: View, communityID: string, mutedType: int) {.slot.} = + proc setCommunityMuted*(self: View, communityID: string, mutedType: int) {.slot.} = self.delegate.setCommunityMuted(communityID, mutedType) diff --git a/src/app/modules/main/profile_section/keycard/module.nim b/src/app/modules/main/profile_section/keycard/module.nim index 3fd228e8bd..c0de31b981 100644 --- a/src/app/modules/main/profile_section/keycard/module.nim +++ b/src/app/modules/main/profile_section/keycard/module.nim @@ -304,7 +304,7 @@ method onLoggedInUserImageChanged*(self: Module) = return self.view.keycardDetailsModel().setImage(singletonInstance.userProfile.getKeyUid(), singletonInstance.userProfile.getIcon()) -method resolveRelatedKeycardsForKeypair(self: Module, keypair: KeypairDto) = +proc resolveRelatedKeycardsForKeypair(self: Module, keypair: KeypairDto) = if keypair.keyUid.len == 0: error "cannot rebuild keycards for a keypair with empty keyUid" return diff --git a/src/app/modules/main/profile_section/privacy/controller.nim b/src/app/modules/main/profile_section/privacy/controller.nim index 7f2d19c5af..67ffb0e884 100644 --- a/src/app/modules/main/profile_section/privacy/controller.nim +++ b/src/app/modules/main/profile_section/privacy/controller.nim @@ -95,10 +95,10 @@ proc getMessagesFromContactsOnly*(self: Controller): bool = proc setMessagesFromContactsOnly*(self: Controller, value: bool): bool = return self.settingsService.saveMessagesFromContactsOnly(value) -method urlUnfurlingMode*(self: Controller): int {.base.} = +proc urlUnfurlingMode*(self: Controller): int = return int(self.settingsService.urlUnfurlingMode()) -method setUrlUnfurlingMode*(self: Controller, value: int) {.base.} = +proc setUrlUnfurlingMode*(self: Controller, value: int) = let mode = toUrlUnfurlingMode(value) if not self.settingsService.saveUrlUnfurlingMode(mode): error "failed to save url unfurling mode setting", value @@ -106,7 +106,7 @@ method setUrlUnfurlingMode*(self: Controller, value: int) {.base.} = proc validatePassword*(self: Controller, password: string): bool = return self.privacyService.validatePassword(password) -method getPasswordStrengthScore*(self: Controller, password, userName: string): int = +proc getPasswordStrengthScore*(self: Controller, password, userName: string): int = return self.generalService.getPasswordStrengthScore(password, userName) proc storeToKeychain*(self: Controller, data: string) = diff --git a/src/app/modules/main/profile_section/wallet/accounts/module.nim b/src/app/modules/main/profile_section/wallet/accounts/module.nim index 3f6dc0dc5d..94f3335432 100644 --- a/src/app/modules/main/profile_section/wallet/accounts/module.nim +++ b/src/app/modules/main/profile_section/wallet/accounts/module.nim @@ -63,7 +63,7 @@ method getModuleAsVariant*(self: Module): QVariant = method getCollectiblesModel*(self: Module): QVariant = return self.collectiblesController.getModelAsVariant() -method convertWalletAccountDtoToKeyPairAccountItem(self: Module, account: WalletAccountDto): KeyPairAccountItem = +proc convertWalletAccountDtoToKeyPairAccountItem(self: Module, account: WalletAccountDto): KeyPairAccountItem = result = newKeyPairAccountItem( name = account.name, path = account.path, @@ -81,7 +81,7 @@ method convertWalletAccountDtoToKeyPairAccountItem(self: Module, account: Wallet testPreferredChainIds = account.testPreferredChainIds, hideFromTotalBalance = account.hideFromTotalBalance) -method setBalance(self: Module, accountsTokens: OrderedTable[string, seq[WalletTokenDto]]) = +proc setBalance(self: Module, accountsTokens: OrderedTable[string, seq[WalletTokenDto]]) = let enabledChainIds = self.controller.getEnabledChainIds() let currency = self.controller.getCurrentCurrency() let currencyFormat = self.controller.getCurrencyFormat(currency) @@ -89,7 +89,7 @@ method setBalance(self: Module, accountsTokens: OrderedTable[string, seq[WalletT let balance = currencyAmountToItem(tokens.map(t => t.getCurrencyBalance(enabledChainIds, currency)).foldl(a + b, 0.0),currencyFormat) self.view.setBalanceForKeyPairs(address, balance) -method createKeypairItems*(self: Module, walletAccounts: seq[WalletAccountDto]): seq[KeyPairItem] = +proc createKeypairItems(self: Module, walletAccounts: seq[WalletAccountDto]): seq[KeyPairItem] = var keyPairItems = keypairs.buildKeyPairsList(self.controller.getKeypairs(), excludeAlreadyMigratedPairs = false, excludePrivateKeyKeypairs = false, self.controller.areTestNetworksEnabled()) diff --git a/src/app/modules/main/profile_section/wallet/io_interface.nim b/src/app/modules/main/profile_section/wallet/io_interface.nim index d45b384d54..dc637db09a 100644 --- a/src/app/modules/main/profile_section/wallet/io_interface.nim +++ b/src/app/modules/main/profile_section/wallet/io_interface.nim @@ -15,6 +15,9 @@ method load*(self: AccessInterface) {.base.} = method isLoaded*(self: AccessInterface): bool {.base.} = raise newException(ValueError, "No implementation available") +method viewDidLoad*(self: AccessInterface) {.base.} = + raise newException(ValueError, "No implementation available") + # View Delegate Interface # Delegate for the view must be declared here due to use of QtObject and multi # inheritance, which is not well supported in Nim. @@ -53,4 +56,4 @@ method hasPairedDevices*(self: AccessInterface): bool {.base.} = raise newException(ValueError, "No implementation available") method onLocalPairingStatusUpdate*(self: AccessInterface, data: LocalPairingStatus) {.base.} = - raise newException(ValueError, "No implementation available") \ No newline at end of file + raise newException(ValueError, "No implementation available") diff --git a/src/app/modules/main/profile_section/wallet/networks/module.nim b/src/app/modules/main/profile_section/wallet/networks/module.nim index 021a4ebe92..6d99588b6e 100644 --- a/src/app/modules/main/profile_section/wallet/networks/module.nim +++ b/src/app/modules/main/profile_section/wallet/networks/module.nim @@ -93,7 +93,7 @@ proc checkIfModuleDidLoad(self: Module) = method viewDidLoad*(self: Module) = self.checkIfModuleDidLoad() -method areTestNetworksEnabled*(self: Module): bool = +proc areTestNetworksEnabled*(self: Module): bool = return self.controller.areTestNetworksEnabled() method toggleTestNetworksEnabled*(self: Module) = diff --git a/src/app/modules/main/shared_urls/io_interface.nim b/src/app/modules/main/shared_urls/io_interface.nim index 437d56eb03..93bb9c6013 100644 --- a/src/app/modules/main/shared_urls/io_interface.nim +++ b/src/app/modules/main/shared_urls/io_interface.nim @@ -9,6 +9,9 @@ method delete*(self: AccessInterface) {.base.} = method load*(self: AccessInterface) {.base.} = raise newException(ValueError, "No implementation available") +method isLoaded*(self: AccessInterface): bool {.base.} = + raise newException(ValueError, "No implementation available") + method viewDidLoad*(self: AccessInterface) {.base.} = raise newException(ValueError, "No implementation available") diff --git a/src/app/modules/main/wallet_section/all_tokens/controller.nim b/src/app/modules/main/wallet_section/all_tokens/controller.nim index 4cd6a95f1c..15411dcdca 100644 --- a/src/app/modules/main/wallet_section/all_tokens/controller.nim +++ b/src/app/modules/main/wallet_section/all_tokens/controller.nim @@ -35,13 +35,13 @@ proc init*(self: Controller) = let args = TokenBalanceHistoryDataArgs(e) self.delegate.tokenBalanceHistoryDataResolved(args.result) -method findTokenSymbolByAddress*(self: Controller, address: string): string = +proc findTokenSymbolByAddress*(self: Controller, address: string): string = return self.walletAccountService.findTokenSymbolByAddress(address) -method getHistoricalDataForToken*(self: Controller, symbol: string, currency: string, range: int) = +proc getHistoricalDataForToken*(self: Controller, symbol: string, currency: string, range: int) = self.tokenService.getHistoricalDataForToken(symbol, currency, range) -method fetchHistoricalBalanceForTokenAsJson*(self: Controller, address: string, tokenSymbol: string, currencySymbol: string, timeIntervalEnum: int) = +proc fetchHistoricalBalanceForTokenAsJson*(self: Controller, address: string, tokenSymbol: string, currencySymbol: string, timeIntervalEnum: int) = self.tokenService.fetchHistoricalBalanceForTokenAsJson(address, tokenSymbol, currencySymbol, BalanceHistoryTimeInterval(timeIntervalEnum)) proc getSourcesOfTokensList*(self: Controller): var seq[SupportedSourcesItem] = diff --git a/src/app/modules/main/wallet_section/all_tokens/module.nim b/src/app/modules/main/wallet_section/all_tokens/module.nim index 1933fdadf4..619a41ebde 100644 --- a/src/app/modules/main/wallet_section/all_tokens/module.nim +++ b/src/app/modules/main/wallet_section/all_tokens/module.nim @@ -74,13 +74,13 @@ method fetchHistoricalBalanceForTokenAsJson*(self: Module, address: string, toke method tokenBalanceHistoryDataResolved*(self: Module, balanceHistoryJson: string) = self.view.setTokenBalanceHistoryDataReady(balanceHistoryJson) -method getFlatTokensList*(self: Module): var seq[TokenItem] = +proc getFlatTokensList*(self: Module): var seq[TokenItem] = return self.controller.getFlatTokensList() -method getTokenBySymbolList*(self: Module): var seq[TokenBySymbolItem] = +proc getTokenBySymbolList*(self: Module): var seq[TokenBySymbolItem] = return self.controller.getTokenBySymbolList() -method getSourcesOfTokensList*(self: Module): var seq[SupportedSourcesItem] = +proc getSourcesOfTokensList*(self: Module): var seq[SupportedSourcesItem] = return self.controller.getSourcesOfTokensList() # Interfaces for getting lists from the service files into the abstract models diff --git a/src/app/modules/main/wallet_section/module.nim b/src/app/modules/main/wallet_section/module.nim index 8de6c42cf4..26580342aa 100644 --- a/src/app/modules/main/wallet_section/module.nim +++ b/src/app/modules/main/wallet_section/module.nim @@ -176,7 +176,7 @@ method setTotalCurrencyBalance*(self: Module) = var addresses = walletAccounts.filter(a => not a.hideFromTotalBalance).map(a => a.address) self.view.setTotalCurrencyBalance(self.controller.getCurrencyBalance(addresses)) -method notifyFilterChanged(self: Module) = +proc notifyFilterChanged(self: Module) = self.overviewModule.filterChanged(self.filter.addresses, self.filter.chainIds, self.filter.allAddresses) self.assetsModule.filterChanged(self.filter.addresses, self.filter.chainIds) self.accountsModule.filterChanged(self.filter.addresses, self.filter.chainIds) diff --git a/src/app/modules/main/wallet_section/networks/module.nim b/src/app/modules/main/wallet_section/networks/module.nim index 1f70bc004d..e0fa69d860 100644 --- a/src/app/modules/main/wallet_section/networks/module.nim +++ b/src/app/modules/main/wallet_section/networks/module.nim @@ -50,7 +50,7 @@ method load*(self: Module) = method isLoaded*(self: Module): bool = return self.moduleLoaded -method areTestNetworksEnabled*(self: Module): bool = +proc areTestNetworksEnabled*(self: Module): bool = return self.controller.areTestNetworksEnabled() proc checkIfModuleDidLoad(self: Module) = diff --git a/src/app/modules/main/wallet_section/send/accounts_model.nim b/src/app/modules/main/wallet_section/send/accounts_model.nim index 750f1bcb7d..7c7fdbd352 100644 --- a/src/app/modules/main/wallet_section/send/accounts_model.nim +++ b/src/app/modules/main/wallet_section/send/accounts_model.nim @@ -96,12 +96,12 @@ QtObject: of ModelRole.PreferredSharingChainIds: result = newQVariant(item.preferredSharingChainIds()) - method getItemByIndex*(self: AccountsModel, index: int): AccountItem = + proc getItemByIndex*(self: AccountsModel, index: int): AccountItem = if index < 0 or index >= self.items.len: return return self.items[index] -method getItemByAddress*(self: AccountsModel, address: string): tuple[account: AccountItem, index: int] = +proc getItemByAddress*(self: AccountsModel, address: string): tuple[account: AccountItem, index: int] = for i in 0 ..< self.items.len: if self.items[i].address() == address: return (self.items[i], i) diff --git a/src/app/modules/main/wallet_section/send/io_interface.nim b/src/app/modules/main/wallet_section/send/io_interface.nim index 6239546301..e94b1bcf3e 100644 --- a/src/app/modules/main/wallet_section/send/io_interface.nim +++ b/src/app/modules/main/wallet_section/send/io_interface.nim @@ -50,19 +50,19 @@ method authenticateUser*(self: AccessInterface) {.base.} = method onUserAuthenticated*(self: AccessInterface, pin: string, password: string, keyUid: string) {.base.} = raise newException(ValueError, "No implementation available") -method setSelectedSenderAccountIndex*(self: AccessInterface, index: int) = +method setSelectedSenderAccountIndex*(self: AccessInterface, index: int) {.base.} = raise newException(ValueError, "No implementation available") -method setSelectedReceiveAccountIndex*(self: AccessInterface, index: int) = +method setSelectedReceiveAccountIndex*(self: AccessInterface, index: int) {.base.} = raise newException(ValueError, "No implementation available") -method filterChanged*(self: AccessInterface, addresses: seq[string], chainIds: seq[int]) = +method filterChanged*(self: AccessInterface, addresses: seq[string], chainIds: seq[int]) {.base.} = raise newException(ValueError, "No implementation available") -method getCollectiblesModel*(self: AccessInterface): collectibles.Model = +method getCollectiblesModel*(self: AccessInterface): collectibles.Model {.base.} = raise newException(ValueError, "No implementation available") -method getNestedCollectiblesModel*(self: AccessInterface): nested_collectibles.Model = +method getNestedCollectiblesModel*(self: AccessInterface): nested_collectibles.Model {.base.} = raise newException(ValueError, "No implementation available") method splitAndFormatAddressPrefix*(self: AccessInterface, text : string, updateInStore: bool): string {.base.} = @@ -72,4 +72,4 @@ method prepareSignaturesForTransactions*(self: AccessInterface, txHashes: seq[st raise newException(ValueError, "No implementation available") method onTransactionSigned*(self: AccessInterface, keycardFlowType: string, keycardEvent: KeycardEvent) {.base.} = - raise newException(ValueError, "No implementation available") \ No newline at end of file + raise newException(ValueError, "No implementation available") diff --git a/src/app/modules/main/wallet_section/send/module.nim b/src/app/modules/main/wallet_section/send/module.nim index e1f1a71a22..280eed4ad0 100644 --- a/src/app/modules/main/wallet_section/send/module.nim +++ b/src/app/modules/main/wallet_section/send/module.nim @@ -90,7 +90,7 @@ method delete*(self: Module) = self.nestedCollectiblesModel.delete self.collectiblesController.delete -method convertSendToNetworkToNetworkItem(self: Module, network: SendToNetwork): NetworkItem = +proc convertSendToNetworkToNetworkItem(self: Module, network: SendToNetwork): NetworkItem = result = initNetworkItem( network.chainId, network.chainName, @@ -110,7 +110,7 @@ method convertSendToNetworkToNetworkItem(self: Module, network: SendToNetwork): amountIn = "", $network.amountOut) -method convertNetworkDtoToNetworkItem(self: Module, network: NetworkDto): NetworkItem = +proc convertNetworkDtoToNetworkItem(self: Module, network: NetworkDto): NetworkItem = result = initNetworkItem( network.chainId, network.chainName, @@ -127,7 +127,7 @@ method convertNetworkDtoToNetworkItem(self: Module, network: NetworkDto): Networ self.getTokenBalanceOnChain(self.view.getSelectedSenderAccountAddress(), network.chainId, self.view.getSelectedAssetSymbol()) ) -method convertSuggestedFeesDtoToGasFeesItem(self: Module, gasFees: SuggestedFeesDto): GasFeesItem = +proc convertSuggestedFeesDtoToGasFeesItem(self: Module, gasFees: SuggestedFeesDto): GasFeesItem = result = newGasFeesItem( gasPrice = gasFees.gasPrice, baseFee = gasFees.baseFee, @@ -138,14 +138,14 @@ method convertSuggestedFeesDtoToGasFeesItem(self: Module, gasFees: SuggestedFees eip1559Enabled = gasFees.eip1559Enabled ) -method convertFeesDtoToGasEstimateItem(self: Module, fees: FeesDto): GasEstimateItem = +proc convertFeesDtoToGasEstimateItem(self: Module, fees: FeesDto): GasEstimateItem = result = newGasEstimateItem( totalFeesInEth = fees.totalFeesInEth, totalTokenFees = fees.totalTokenFees, totalTime = fees.totalTime ) -method convertTransactionPathDtoToSuggestedRouteItem(self: Module, path: TransactionPathDto): SuggestedRouteItem = +proc convertTransactionPathDtoToSuggestedRouteItem(self: Module, path: TransactionPathDto): SuggestedRouteItem = result = newSuggestedRouteItem( bridgeName = path.bridgeName, fromNetwork = path.fromNetwork.chainId, @@ -196,7 +196,7 @@ method refreshWalletAccounts*(self: Module) = self.view.switchSenderAccount(self.senderCurrentAccountIndex) self.view.switchReceiveAccount(self.receiveCurrentAccountIndex) -method refreshNetworks*(self: Module) = +proc refreshNetworks*(self: Module) = let networks = self.controller.getNetworks() let fromNetworks = networks.map(x => self.convertNetworkDtoToNetworkItem(x)) let toNetworks = networks.map(x => self.convertNetworkDtoToNetworkItem(x)) @@ -289,7 +289,7 @@ method onUserAuthenticated*(self: Module, password: string, pin: string) = self.tmpSendTransactionDetails.paths, password, self.tmpSendTransactionDetails.sendType, usePassword, doHashing ) -method signOnKeycard*(self: Module) = +proc signOnKeycard(self: Module) = self.tmpTxHashBeingProcessed = "" for h, (r, s, v) in self.tmpSendTransactionDetails.resolvedSignatures.pairs: if r.len != 0 and s.len != 0 and v.len != 0: diff --git a/src/app/modules/shared_modules/add_account/controller.nim b/src/app/modules/shared_modules/add_account/controller.nim index ab86966d90..d95fde31ff 100644 --- a/src/app/modules/shared_modules/add_account/controller.nim +++ b/src/app/modules/shared_modules/add_account/controller.nim @@ -131,7 +131,7 @@ proc authenticateOrigin*(self: Controller, keyUid = "") = keyUid: keyUid) self.events.emit(SIGNAL_SHARED_KEYCARD_MODULE_AUTHENTICATE_USER, data) -method fetchDerivedAddresses*(self: Controller, derivedFrom: string, paths: seq[string])= +proc fetchDerivedAddresses*(self: Controller, derivedFrom: string, paths: seq[string])= var hashPassword = true if self.getPin().len > 0: hashPassword = false diff --git a/src/app/modules/shared_modules/add_account/module.nim b/src/app/modules/shared_modules/add_account/module.nim index 90ab68bee1..b1095c77fd 100644 --- a/src/app/modules/shared_modules/add_account/module.nim +++ b/src/app/modules/shared_modules/add_account/module.nim @@ -70,6 +70,8 @@ proc newModule*[T](delegate: T, result.authenticationReason = AuthenticationReason.AddingAccount result.fetchingAddressesIsInProgress = false +{.push warning[Deprecated]: off.} + method delete*[T](self: Module[T]) = self.view.delete self.viewVariant.delete @@ -741,3 +743,5 @@ method buildNewSeedPhraseKeypairAndAddItToOrigin*[T](self: Module[T]) = pairType = KeyPairType.SeedImport, derivedFrom = genAcc.address) self.setItemForSelectedOrigin(item) + +{.pop.} diff --git a/src/app/modules/shared_modules/keycard_popup/module.nim b/src/app/modules/shared_modules/keycard_popup/module.nim index 9982005db5..7d3069f315 100644 --- a/src/app/modules/shared_modules/keycard_popup/module.nim +++ b/src/app/modules/shared_modules/keycard_popup/module.nim @@ -56,6 +56,8 @@ proc newModule*[T](delegate: T, result.authenticationPopupIsAlreadyRunning = false result.runningFlow = FlowType.General +{.push warning[Deprecated]: off.} + method delete*[T](self: Module[T]) = self.view.delete self.viewVariant.delete @@ -739,3 +741,5 @@ method keychainObtainedDataSuccess*[T](self: Module[T], data: string) = self.controller.enterKeycardPin(data) else: self.view.setCurrentState(newBiometricsPinInvalidState(self.runningFlow, nil)) + +{.pop.} diff --git a/src/app/modules/shared_modules/keypair_import/module.nim b/src/app/modules/shared_modules/keypair_import/module.nim index 52ccb9ce59..2419f68128 100644 --- a/src/app/modules/shared_modules/keypair_import/module.nim +++ b/src/app/modules/shared_modules/keypair_import/module.nim @@ -38,6 +38,8 @@ proc newModule*[T](delegate: T, result.viewVariant = newQVariant(result.view) result.controller = controller.newController(result, events, accountsService, walletAccountService, devicesService) +{.push warning[Deprecated]: off.} + method delete*[T](self: Module[T]) = self.view.delete self.viewVariant.delete @@ -270,3 +272,5 @@ method onUserAuthenticated*[T](self: Module[T], pin: string, password: string, k error "ki_unable to make a keypair operable", errDesription=res return self.closeKeypairImportPopup() + +{.pop.} diff --git a/src/app/modules/startup/module.nim b/src/app/modules/startup/module.nim index e1b1cd00ab..464c388972 100644 --- a/src/app/modules/startup/module.nim +++ b/src/app/modules/startup/module.nim @@ -81,6 +81,8 @@ proc newModule*[T](delegate: T, result.controller = controller.newController(result, events, generalService, accountsService, keychainService, profileService, keycardService, devicesService) +{.push warning[Deprecated]: off.} + method delete*[T](self: Module[T]) = singletonInstance.engine.setRootContextProperty("startupModule", newQVariant()) self.view.delete @@ -571,3 +573,5 @@ method insertMockedKeycardAction*[T](self: Module[T], cardIndex: int) = method removeMockedKeycardAction*[T](self: Module[T]) = self.keycardService.removeMockedKeycardAction() + +{.pop.} diff --git a/src/backend/collectibles.nim b/src/backend/collectibles.nim index 46f7fb69cf..8d67198e59 100644 --- a/src/backend/collectibles.nim +++ b/src/backend/collectibles.nim @@ -1,4 +1,4 @@ -import json, json_serialization, strformat +import json, strformat import stint, Tables, strutils import core import response_type, collectibles_types diff --git a/vendor/DOtherSide/lib/CMakeLists.txt b/vendor/DOtherSide/lib/CMakeLists.txt index c1990e428c..6e060b14d9 100644 --- a/vendor/DOtherSide/lib/CMakeLists.txt +++ b/vendor/DOtherSide/lib/CMakeLists.txt @@ -29,6 +29,11 @@ macro(add_target name type) if (WIN32) target_compile_definitions(${name} PRIVATE -DWIN32) + target_compile_options(${name} PRIVATE /wd4996) + endif() + + if (UNIX) + target_compile_options(${name} PRIVATE -Wno-deprecated) endif() set_target_properties(${name} PROPERTIES CXX_STANDARD 17 AUTOMOC ON)