diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 406cf03f0..15f69642a 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -2,4 +2,4 @@ # Each line is a file pattern followed by one or more owners. # These owners will be the default owners for everything in the repo. -* @tureck1y @tangem/ios-team +* @tureck1y @tangem/ios-sdk-reviewers diff --git a/CHANGELOG b/CHANGELOG index 5c3555098..f1a4410f4 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,49 +1,50 @@ -* 5ba5f600 - (HEAD -> release/3.10.0, tag: develop-290, origin/develop, develop) Merge pull request #351 from tangem/IOS-6522_fix_alert_message -|\ -| * 89e12add - IOS-6522 Fix alert message +* 80482b11 - (HEAD -> release/3.11.0, tag: develop-315, origin/develop, develop) Bundle update fastlane +* e8d1df69 - (tag: develop-314) Bundle update +* 673b4979 - (tag: develop-313) Merge pull request #378 from tangem/306.2_into_develop_sync +|\ +| * b9175580 - Merge branch 'releases/develop-306' into 306.2_into_develop_sync +|/| +| * fb405124 - (tag: develop-306.2, origin/releases/develop-306) IOS-7734 Ring logic (#377) +| * fbea81eb - (tag: develop-306.1) IOS-8188 Open backup cards data (#375) +* | 9647e7b3 - (tag: develop-312) IOS-8114 Fix key window ios15 (#374) +* | 6e6f6ece - (tag: develop-311) Fix min target for example +* | 59943dfa - (tag: develop-310, tag: 42) IOS-7818 Bump deployment target up to 15 (#370) +* | 8df589c7 - (tag: develop-309) IOS-7148 Handle finalized card (#368) +* | 655fa816 - (tag: develop-308) IOS-7043 Return partial response (#367) +* | 1bcdef8f - (tag: develop-307) IOS-7867 Remove Published from services (#369) |/ -* d3f79b59 - (tag: develop-289, tag: 39) Merge pull request #349 from tangem/IOS-6620_update_privacy_manifest -|\ -| * 22f5bcd5 - IOS-6620 Remove unsupported devices -| * 35c8b3d1 - IOS-6620 Add Privacy Manifest into example -| * 9cde2028 - IOS-6620 Update privacy manifest +* b9111e33 - (tag: develop-306) IOS-7810 Add es and sync fr (#366) +* 1b70a89e - (tag: develop-305) IOS-7652 Return the card in the callback (#365) +* 22272c7e - (tag: develop-304) Bump rexml from 3.2.8 to 3.3.6 in /Example (#363) +* 0858064b - (tag: develop-303) Bump rexml from 3.2.8 to 3.3.6 (#364) +* f999a446 - (tag: develop-302) IOS-7595 Sync localizations (#362) +* 883381f4 - (tag: develop-301) Feature/ios 7218 localize (#361) +* c932eefd - (tag: develop-300) Update README.md +* e011ee6f - (tag: develop-299) Update README.md +* d47b7ab6 - (tag: develop-298) Merge pull request #360 from tangem/IOS-6807_add_backupCount +|\ +| * 98500c5f - IOS-6807 Add backup cards count |/ -* 7a1ff80a - (tag: develop-288) Merge pull request #347 from tangem/IOS-5193_refactor_extension +* 564a3c01 - (tag: develop-297) Bunldle update +* 1f78dc23 - (tag: develop-296) Merge pull request #358 from tangem/IOS-6859_fix_backup_condition |\ -| * 9cab3b95 - IOS-5193 Refactor extensions +| * 743c1aff - IOS-6859 Check for cards count |/ -* b2b15a41 - (tag: develop-287) Merge pull request #346 from tangem/IOS-5193_add_convenience_method +* d098ce04 - (tag: develop-295) Merge pull request #357 from tangem/IOS-6764_write_backup_data_update |\ -| * 5a77a2f3 - IOS-5193 Add convenience method +| * f66edef6 - IOS-6764 typo +| * 5a847ea9 - IOS-6764 Fix write backup data logic |/ -* 151522de - (tag: develop-286) Merge pull request #344 from tangem/feature/IOS-6296_backup_errors_update +* 659e6ee9 - (tag: develop-294) Merge pull request #356 from tangem/IOS-6784_add_interface_for_key_recovery |\ -| * 36fc8529 - Show separate messages for backupFailedAlreadyCreated and noActiveBackup errors +| * 40207a39 - IOS-6784 Add public key recovery interface |/ -* 24d07f57 - (tag: develop-285, tag: 37) Merge pull request #343 from tangem/IOS-6210_add_logs_backup +* bf339b48 - (tag: develop-293) Merge pull request #355 from tangem/tureck1y-patch-1 |\ -| * d2fb40ea - IOS-6210 Add backup logs +| * f33afdcc - Update CODEOWNERS |/ -* 68fcf888 - (tag: develop-284) Merge pull request #341 from tangem/IOS-5986_skip_derivation_errors -|\ -| * a205aca6 - Merge branch 'develop' into IOS-5986_skip_derivation_errors -| |\ -| |/ -|/| -* | 94c1a699 - (tag: develop-283) Merge pull request #342 from tangem/feature/IOS-6085-seed-make-words-count-public -|\ \ -| * | 63546fbf - IOS-6085: Make EntropyLength words count public -|/ / -| * 25e83ac5 - IOS-5986 Ignore only concrete errors -| * 2ffb346e - IOS-5986 Skip derivation errors -|/ -* 7ddce67f - (tag: develop-282) Merge pull request #338 from tangem/IOS-5674_fix_reader -|\ -| * b6fadf9e - Merge branch 'develop' into IOS-5674_fix_reader -| |\ -| |/ -|/| -* | 5d860b54 - (tag: develop-281, origin/release/0.0.2) Merge pull request #339 from tangem/master - / -* 1517748d - IOS-5674 Refactor code -* 5c1a6ed1 - (origin/release/0.0.3, origin/release/0.0.1) IOS-5674 Fix reader \ No newline at end of file +* ddb32bec - (tag: develop-292) Merge pull request #354 from tangem/master +* 7af7d454 - (tag: develop-291) Merge pull request #353 from tangem/bugfix/IOS-6680_backup_error_text +* 8303991c - Move internalCode check login into main switch +* a58f93f1 - Update noActiveBackup error display logic +* 60602b07 - Update error text for ru locale \ No newline at end of file diff --git a/Example/Gemfile b/Example/Gemfile index 207036529..80ad775f0 100644 --- a/Example/Gemfile +++ b/Example/Gemfile @@ -1,3 +1,3 @@ source "https://rubygems.org" -gem "cocoapods", "~> 1.14.0" +gem "cocoapods", "~> 1.15.2" diff --git a/Example/Gemfile.lock b/Example/Gemfile.lock index 66a4411ab..35df7324b 100644 --- a/Example/Gemfile.lock +++ b/Example/Gemfile.lock @@ -1,31 +1,34 @@ GEM remote: https://rubygems.org/ specs: - CFPropertyList (3.0.6) + CFPropertyList (3.0.7) + base64 + nkf rexml - activesupport (7.1.2) + activesupport (7.2.1) base64 bigdecimal - concurrent-ruby (~> 1.0, >= 1.0.2) + concurrent-ruby (~> 1.0, >= 1.3.1) connection_pool (>= 2.2.5) drb i18n (>= 1.6, < 2) + logger (>= 1.4.2) minitest (>= 5.1) - mutex_m - tzinfo (~> 2.0) - addressable (2.8.6) - public_suffix (>= 2.0.2, < 6.0) + securerandom (>= 0.3) + tzinfo (~> 2.0, >= 2.0.5) + addressable (2.8.7) + public_suffix (>= 2.0.2, < 7.0) algoliasearch (1.27.5) httpclient (~> 2.8, >= 2.8.3) json (>= 1.5.1) atomos (0.1.3) base64 (0.2.0) - bigdecimal (3.1.5) + bigdecimal (3.1.8) claide (1.1.0) - cocoapods (1.14.3) + cocoapods (1.15.2) addressable (~> 2.8) claide (>= 1.0.2, < 2.0) - cocoapods-core (= 1.14.3) + cocoapods-core (= 1.15.2) cocoapods-deintegrate (>= 1.0.3, < 2.0) cocoapods-downloader (>= 2.1, < 3.0) cocoapods-plugins (>= 1.0.0, < 2.0) @@ -40,7 +43,7 @@ GEM nap (~> 1.0) ruby-macho (>= 2.3.0, < 3.0) xcodeproj (>= 1.23.0, < 2.0) - cocoapods-core (1.14.3) + cocoapods-core (1.15.2) activesupport (>= 5.0, < 8) addressable (~> 2.8) algoliasearch (~> 1.0) @@ -60,48 +63,50 @@ GEM netrc (~> 0.11) cocoapods-try (1.2.0) colored2 (3.1.2) - concurrent-ruby (1.2.2) + concurrent-ruby (1.3.4) connection_pool (2.4.1) - drb (2.2.0) - ruby2_keywords + drb (2.2.1) escape (0.0.4) ethon (0.16.0) ffi (>= 1.15.0) - ffi (1.16.3) + ffi (1.17.0) fourflusher (2.3.1) fuzzy_match (2.0.4) gh_inspector (1.1.3) httpclient (2.8.3) - i18n (1.14.1) + i18n (1.14.5) concurrent-ruby (~> 1.0) - json (2.7.1) - minitest (5.20.0) + json (2.7.2) + logger (1.6.1) + minitest (5.25.1) molinillo (0.8.0) - mutex_m (0.2.0) nanaimo (0.3.0) nap (1.1.0) netrc (0.11.0) + nkf (0.2.0) public_suffix (4.0.7) - rexml (3.2.6) + rexml (3.3.7) ruby-macho (2.5.1) - ruby2_keywords (0.0.5) + securerandom (0.3.1) typhoeus (1.4.1) ethon (>= 0.9.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) - xcodeproj (1.23.0) + xcodeproj (1.25.0) CFPropertyList (>= 2.3.3, < 4.0) atomos (~> 0.1.3) claide (>= 1.0.2, < 2.0) colored2 (~> 3.1) nanaimo (~> 0.3.0) - rexml (~> 3.2.4) + rexml (>= 3.3.2, < 4.0) PLATFORMS arm64-darwin-21 + arm64-darwin-22 + x86_64-linux DEPENDENCIES - cocoapods (~> 1.14.0) + cocoapods (~> 1.15.2) BUNDLED WITH 2.4.22 diff --git a/Example/Podfile b/Example/Podfile index f8170b2cc..0220ca236 100644 --- a/Example/Podfile +++ b/Example/Podfile @@ -1,7 +1,7 @@ use_frameworks! install! 'cocoapods', :disable_input_output_paths => true -platform :ios, '13.0' +platform :ios, '15.0' target 'TangemSdkExample' do pod 'TangemSdk', :path => '../' diff --git a/Example/Podfile.lock b/Example/Podfile.lock index 81f290ee9..c22f85e2f 100644 --- a/Example/Podfile.lock +++ b/Example/Podfile.lock @@ -1,5 +1,5 @@ PODS: - - TangemSdk (3.8.0) + - TangemSdk (3.10.0) DEPENDENCIES: - TangemSdk (from `../`) @@ -9,8 +9,8 @@ EXTERNAL SOURCES: :path: "../" SPEC CHECKSUMS: - TangemSdk: 61e07ff112d4095cfa688fa7d4694e59fa29f76d + TangemSdk: 943099314a07e448307f994dca6217bb27366b66 -PODFILE CHECKSUM: fb4745483d8583db4c8ae8aa3ccbde86ca112a6b +PODFILE CHECKSUM: 2d95b9bdd729cea3714086cfd92024ae5b1bb1af -COCOAPODS: 1.14.3 +COCOAPODS: 1.15.2 diff --git a/Example/TangemSdkExample.xcodeproj/project.pbxproj b/Example/TangemSdkExample.xcodeproj/project.pbxproj index 14202b819..b4f5c1d0b 100644 --- a/Example/TangemSdkExample.xcodeproj/project.pbxproj +++ b/Example/TangemSdkExample.xcodeproj/project.pbxproj @@ -293,7 +293,7 @@ attributes = { BuildIndependentTargetsInParallel = YES; LastSwiftUpdateCheck = 1120; - LastUpgradeCheck = 1510; + LastUpgradeCheck = 1540; ORGANIZATIONNAME = "Tangem AG"; TargetAttributes = { 5D78C1B5234F435B008D7478 = { @@ -522,7 +522,6 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 13.0; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; ONLY_ACTIVE_ARCH = YES; @@ -578,7 +577,6 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 13.0; MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; SDKROOT = iphoneos; @@ -598,12 +596,17 @@ CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = 4897UJ6D8C; INFOPLIST_FILE = TangemSDKExample/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", ); PRODUCT_BUNDLE_IDENTIFIER = com.tangem.TangemSDKExample; PRODUCT_NAME = "$(TARGET_NAME)"; + SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; + SUPPORTS_MACCATALYST = NO; + SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; + SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO; SWIFT_INCLUDE_PATHS = "$(inherited)"; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = 1; @@ -620,12 +623,17 @@ CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = 4897UJ6D8C; INFOPLIST_FILE = TangemSDKExample/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", ); PRODUCT_BUNDLE_IDENTIFIER = com.tangem.TangemSDKExample; PRODUCT_NAME = "$(TARGET_NAME)"; + SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; + SUPPORTS_MACCATALYST = NO; + SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; + SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO; SWIFT_INCLUDE_PATHS = "$(inherited)"; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = 1; @@ -641,6 +649,7 @@ CURRENT_PROJECT_VERSION = 15; DEVELOPMENT_TEAM = 4897UJ6D8C; INFOPLIST_FILE = "TangemSdkExample/Info-Development.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -665,6 +674,7 @@ CURRENT_PROJECT_VERSION = 15; DEVELOPMENT_TEAM = 4897UJ6D8C; INFOPLIST_FILE = "TangemSdkExample/Info-Development.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", diff --git a/Example/TangemSdkExample.xcodeproj/xcshareddata/xcschemes/TangemSdkExample.xcscheme b/Example/TangemSdkExample.xcodeproj/xcshareddata/xcschemes/TangemSdkExample.xcscheme index 6018bf456..f4cf39abd 100644 --- a/Example/TangemSdkExample.xcodeproj/xcshareddata/xcschemes/TangemSdkExample.xcscheme +++ b/Example/TangemSdkExample.xcodeproj/xcshareddata/xcschemes/TangemSdkExample.xcscheme @@ -1,6 +1,6 @@ + ReferencedContainer = "container:TangemSDKExample.xcodeproj"> @@ -47,7 +47,7 @@ BlueprintIdentifier = "5D78C1B5234F435B008D7478" BuildableName = "TangemSdkExample.app" BlueprintName = "TangemSdkExample" - ReferencedContainer = "container:TangemSdkExample.xcodeproj"> + ReferencedContainer = "container:TangemSDKExample.xcodeproj"> @@ -64,7 +64,7 @@ BlueprintIdentifier = "5D78C1B5234F435B008D7478" BuildableName = "TangemSdkExample.app" BlueprintName = "TangemSdkExample" - ReferencedContainer = "container:TangemSdkExample.xcodeproj"> + ReferencedContainer = "container:TangemSDKExample.xcodeproj"> diff --git a/Example/TangemSdkExample.xcodeproj/xcshareddata/xcschemes/TangemSdkExampleDev.xcscheme b/Example/TangemSdkExample.xcodeproj/xcshareddata/xcschemes/TangemSdkExampleDev.xcscheme index 46c924e7e..29f7f970b 100644 --- a/Example/TangemSdkExample.xcodeproj/xcshareddata/xcschemes/TangemSdkExampleDev.xcscheme +++ b/Example/TangemSdkExample.xcodeproj/xcshareddata/xcschemes/TangemSdkExampleDev.xcscheme @@ -1,6 +1,6 @@ some View { if let service = self.backupService { - BackupView().environmentObject(service) + BackupView(backupService: service) } else { - BackupView() + EmptyView() } } @ViewBuilder func makePinResetDestination() -> some View { if let service = self.resetPinService { - ResetPinView().environmentObject(service) + ResetPinView(resetPinService: service) } else { - ResetPinView() + EmptyView() } } } diff --git a/Example/TangemSdkExample/ContentView.swift b/Example/TangemSdkExample/ContentView.swift index 338ce61a9..f95ac0558 100644 --- a/Example/TangemSdkExample/ContentView.swift +++ b/Example/TangemSdkExample/ContentView.swift @@ -188,25 +188,15 @@ struct ContentView: View { .font(.headline) .bold() - if #available(iOS 14.0, *) { - TextEditor(text: $model.editorData) - .frame(height: 100) - - HStack { - Spacer() - Button("Paste json", action: model.pasteEditor) - Spacer() - Button("End editing", action: model.endEditing) - Spacer() - } - } else { - HStack { - Spacer() - Button("Print json", action: model.printEditor) - Spacer() - Button("Paste json", action: model.pasteEditor) - Spacer() - } + TextEditor(text: $model.editorData) + .frame(height: 100) + + HStack { + Spacer() + Button("Paste json", action: model.pasteEditor) + Spacer() + Button("End editing", action: model.endEditing) + Spacer() } } .autocapitalization(.none) diff --git a/Example/TangemSdkExample/Developer/BackupView.swift b/Example/TangemSdkExample/Developer/BackupView.swift index a34b91d75..cb0bb494c 100644 --- a/Example/TangemSdkExample/Developer/BackupView.swift +++ b/Example/TangemSdkExample/Developer/BackupView.swift @@ -10,7 +10,7 @@ import SwiftUI import TangemSdk struct BackupView: View { - @EnvironmentObject var backupService: BackupService + var backupService: BackupService @State private var count: Int = 2 @State private var accessCode: String = "" @@ -158,10 +158,7 @@ struct BackupView: View { } struct BackupView_Previews: PreviewProvider { - static let sdk = TangemSdk() - static var previews: some View { - BackupView() - .environmentObject(BackupService(sdk: sdk)) + BackupView(backupService: BackupService(sdk: TangemSdk())) } } diff --git a/Example/TangemSdkExample/Developer/ResetPinView.swift b/Example/TangemSdkExample/Developer/ResetPinView.swift index 0941c0d52..240b5111a 100644 --- a/Example/TangemSdkExample/Developer/ResetPinView.swift +++ b/Example/TangemSdkExample/Developer/ResetPinView.swift @@ -10,7 +10,7 @@ import SwiftUI import TangemSdk struct ResetPinView: View { - @EnvironmentObject var resetPinService: ResetPinService + var resetPinService: ResetPinService private var stateTitle: String { "Current state is: \(resetPinService.currentState)" } @State private var accessCode: String = "" @@ -80,10 +80,7 @@ struct ResetPinView: View { } struct ResetPinView_Previews: PreviewProvider { - static let sdk = TangemSdk() - static var previews: some View { - ResetPinView() - .environmentObject(ResetPinService(config: Config())) + ResetPinView(resetPinService: ResetPinService(config: Config())) } } diff --git a/Gemfile b/Gemfile index 410fe74e9..b551b997c 100644 --- a/Gemfile +++ b/Gemfile @@ -1,4 +1,4 @@ source "https://rubygems.org" -gem "fastlane", "~> 2.217.0" -gem "cocoapods", "~> 1.14.0" +gem "fastlane", "~> 2.225.0" +gem "cocoapods", "~> 1.15.2" diff --git a/Gemfile.lock b/Gemfile.lock index 8b6afa339..b840895e9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,43 +1,46 @@ GEM remote: https://rubygems.org/ specs: - CFPropertyList (3.0.6) + CFPropertyList (3.0.7) + base64 + nkf rexml - activesupport (6.1.7.6) + activesupport (6.1.7.9) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) tzinfo (~> 2.0) zeitwerk (~> 2.3) - addressable (2.8.6) - public_suffix (>= 2.0.2, < 6.0) + addressable (2.8.7) + public_suffix (>= 2.0.2, < 7.0) algoliasearch (1.27.5) httpclient (~> 2.8, >= 2.8.3) json (>= 1.5.1) - artifactory (3.0.15) + artifactory (3.0.17) atomos (0.1.3) aws-eventstream (1.3.0) - aws-partitions (1.868.0) - aws-sdk-core (3.190.0) + aws-partitions (1.993.0) + aws-sdk-core (3.211.0) aws-eventstream (~> 1, >= 1.3.0) - aws-partitions (~> 1, >= 1.651.0) - aws-sigv4 (~> 1.8) + aws-partitions (~> 1, >= 1.992.0) + aws-sigv4 (~> 1.9) jmespath (~> 1, >= 1.6.1) - aws-sdk-kms (1.75.0) - aws-sdk-core (~> 3, >= 3.188.0) - aws-sigv4 (~> 1.1) - aws-sdk-s3 (1.141.0) - aws-sdk-core (~> 3, >= 3.189.0) + aws-sdk-kms (1.95.0) + aws-sdk-core (~> 3, >= 3.210.0) + aws-sigv4 (~> 1.5) + aws-sdk-s3 (1.169.0) + aws-sdk-core (~> 3, >= 3.210.0) aws-sdk-kms (~> 1) - aws-sigv4 (~> 1.8) - aws-sigv4 (1.8.0) + aws-sigv4 (~> 1.5) + aws-sigv4 (1.10.1) aws-eventstream (~> 1, >= 1.0.2) babosa (1.0.4) + base64 (0.2.0) claide (1.1.0) - cocoapods (1.14.3) + cocoapods (1.15.2) addressable (~> 2.8) claide (>= 1.0.2, < 2.0) - cocoapods-core (= 1.14.3) + cocoapods-core (= 1.15.2) cocoapods-deintegrate (>= 1.0.3, < 2.0) cocoapods-downloader (>= 2.1, < 3.0) cocoapods-plugins (>= 1.0.0, < 2.0) @@ -52,7 +55,7 @@ GEM nap (~> 1.0) ruby-macho (>= 2.3.0, < 3.0) xcodeproj (>= 1.23.0, < 2.0) - cocoapods-core (1.14.3) + cocoapods-core (1.15.2) activesupport (>= 5.0, < 8) addressable (~> 2.8) algoliasearch (~> 1.0) @@ -75,7 +78,7 @@ GEM colored2 (3.1.2) commander (4.6.0) highline (~> 2.0.0) - concurrent-ruby (1.2.2) + concurrent-ruby (1.3.4) declarative (0.0.20) digest-crc (0.6.5) rake (>= 12.0.0, < 14.0.0) @@ -86,8 +89,8 @@ GEM escape (0.0.4) ethon (0.16.0) ffi (>= 1.15.0) - excon (0.108.0) - faraday (1.10.3) + excon (0.109.0) + faraday (1.10.4) faraday-em_http (~> 1.0) faraday-em_synchrony (~> 1.0) faraday-excon (~> 1.1) @@ -108,22 +111,22 @@ GEM faraday-httpclient (1.0.1) faraday-multipart (1.0.4) multipart-post (~> 2) - faraday-net_http (1.0.1) + faraday-net_http (1.0.2) faraday-net_http_persistent (1.2.0) faraday-patron (1.0.0) faraday-rack (1.0.0) faraday-retry (1.0.3) - faraday_middleware (1.2.0) + faraday_middleware (1.2.1) faraday (~> 1.0) - fastimage (2.2.7) - fastlane (2.217.0) + fastimage (2.3.1) + fastlane (2.225.0) CFPropertyList (>= 2.3, < 4.0.0) addressable (>= 2.8, < 3.0.0) artifactory (~> 3.0) aws-sdk-s3 (~> 1.0) babosa (>= 1.0.3, < 2.0.0) bundler (>= 1.12.0, < 3.0.0) - colored + colored (~> 1.2) commander (~> 4.6) dotenv (>= 2.1.1, < 3.0.0) emoji_regex (>= 0.1, < 4.0) @@ -132,9 +135,11 @@ GEM faraday-cookie_jar (~> 0.0.6) faraday_middleware (~> 1.0) fastimage (>= 2.1.0, < 3.0.0) + fastlane-sirp (>= 1.0.0) gh_inspector (>= 1.1.2, < 2.0.0) google-apis-androidpublisher_v3 (~> 0.3) google-apis-playcustomapp_v1 (~> 0.1) + google-cloud-env (>= 1.6.0, < 2.0.0) google-cloud-storage (~> 1.31) highline (~> 2.0) http-cookie (~> 1.0.5) @@ -143,10 +148,10 @@ GEM mini_magick (>= 4.9.4, < 5.0.0) multipart-post (>= 2.0.0, < 3.0.0) naturally (~> 2.2) - optparse (~> 0.1.1) + optparse (>= 0.1.1, < 1.0.0) plist (>= 3.1.0, < 4.0.0) rubyzip (>= 2.0.0, < 3.0.0) - security (= 0.1.3) + security (= 0.1.5) simctl (~> 1.6.3) terminal-notifier (>= 2.0.0, < 3.0.0) terminal-table (~> 3) @@ -155,8 +160,10 @@ GEM word_wrap (~> 1.0.0) xcodeproj (>= 1.13.0, < 2.0.0) xcpretty (~> 0.3.0) - xcpretty-travis-formatter (>= 0.0.3) - ffi (1.16.3) + xcpretty-travis-formatter (>= 0.0.3, < 2.0.0) + fastlane-sirp (1.0.0) + sysrandom (~> 1.0) + ffi (1.17.0) fourflusher (2.3.1) fuzzy_match (2.0.4) gh_inspector (1.1.3) @@ -174,7 +181,7 @@ GEM google-apis-core (>= 0.11.0, < 2.a) google-apis-playcustomapp_v1 (0.13.0) google-apis-core (>= 0.11.0, < 2.a) - google-apis-storage_v1 (0.29.0) + google-apis-storage_v1 (0.32.0) google-apis-core (>= 0.11.0, < 2.a) google-cloud-core (1.6.1) google-cloud-env (>= 1.0, < 3.a) @@ -182,11 +189,11 @@ GEM google-cloud-env (1.6.0) faraday (>= 0.17.3, < 3.0) google-cloud-errors (1.3.1) - google-cloud-storage (1.45.0) + google-cloud-storage (1.37.0) addressable (~> 2.8) digest-crc (~> 0.4) google-apis-iamcredentials_v1 (~> 0.1) - google-apis-storage_v1 (~> 0.29.0) + google-apis-storage_v1 (~> 0.1) google-cloud-core (~> 1.6) googleauth (>= 0.16.2, < 2.a) mini_mime (~> 1.0) @@ -197,40 +204,42 @@ GEM os (>= 0.9, < 2.0) signet (>= 0.16, < 2.a) highline (2.0.3) - http-cookie (1.0.5) + http-cookie (1.0.7) domain_name (~> 0.5) httpclient (2.8.3) - i18n (1.14.1) + i18n (1.14.6) concurrent-ruby (~> 1.0) jmespath (1.6.2) - json (2.7.1) - jwt (2.7.1) - mini_magick (4.12.0) + json (2.7.2) + jwt (2.9.3) + base64 + mini_magick (4.13.2) mini_mime (1.1.5) - minitest (5.20.0) + minitest (5.25.1) molinillo (0.8.0) multi_json (1.15.0) - multipart-post (2.3.0) + multipart-post (2.4.1) nanaimo (0.3.0) nap (1.1.0) naturally (2.2.1) netrc (0.11.0) - optparse (0.1.1) + nkf (0.2.0) + optparse (0.5.0) os (1.1.4) - plist (3.7.0) + plist (3.7.1) public_suffix (4.0.7) - rake (13.1.0) + rake (13.2.1) representable (3.2.0) declarative (< 0.1.0) trailblazer-option (>= 0.1.1, < 0.2.0) uber (< 0.2.0) retriable (3.1.2) - rexml (3.2.6) + rexml (3.3.8) rouge (2.0.7) ruby-macho (2.5.1) ruby2_keywords (0.0.5) rubyzip (2.3.2) - security (0.1.3) + security (0.1.5) signet (0.18.0) addressable (~> 2.8) faraday (>= 0.17.5, < 3.a) @@ -239,6 +248,7 @@ GEM simctl (1.6.10) CFPropertyList naturally + sysrandom (1.0.5) terminal-notifier (2.0.0) terminal-table (3.0.2) unicode-display_width (>= 1.1.1, < 3) @@ -252,31 +262,30 @@ GEM tzinfo (2.0.6) concurrent-ruby (~> 1.0) uber (0.1.0) - unf (0.1.4) - unf_ext - unf_ext (0.0.9.1) - unicode-display_width (2.5.0) + unf (0.2.0) + unicode-display_width (2.6.0) word_wrap (1.0.0) - xcodeproj (1.23.0) + xcodeproj (1.25.1) CFPropertyList (>= 2.3.3, < 4.0) atomos (~> 0.1.3) claide (>= 1.0.2, < 2.0) colored2 (~> 3.1) nanaimo (~> 0.3.0) - rexml (~> 3.2.4) + rexml (>= 3.3.6, < 4.0) xcpretty (0.3.0) rouge (~> 2.0.7) xcpretty-travis-formatter (1.0.1) xcpretty (~> 0.2, >= 0.0.7) - zeitwerk (2.6.12) + zeitwerk (2.6.18) PLATFORMS arm64-darwin-21 + arm64-darwin-22 x86_64-linux DEPENDENCIES - cocoapods (~> 1.14.0) - fastlane (~> 2.217.0) + cocoapods (~> 1.15.2) + fastlane (~> 2.225.0) BUNDLED WITH 2.4.22 diff --git a/Package.swift b/Package.swift index 9a16680b7..f0e558b73 100644 --- a/Package.swift +++ b/Package.swift @@ -7,7 +7,7 @@ let package = Package( name: "TangemSdk", defaultLocalization: "en", platforms: [ - .iOS(.v11) + .iOS("15.0") ], products: [ // Products define the executables and libraries a package produces, making them visible to other packages. @@ -39,6 +39,7 @@ let package = Package( .copy("Haptics"), .copy("Crypto/BIP39/Wordlists/english.txt"), .copy("PrivacyInfo.xcprivacy"), + .copy("Assets"), ] ), .target( diff --git a/README.md b/README.md index 47ef3cd83..ef31f22f3 100644 --- a/README.md +++ b/README.md @@ -11,14 +11,8 @@ The Tangem card is a self-custodial hardware wallet that works via NFC. The main Tangem SDK is needed to facilitate support for Tangem cards in third-party applications. -Supported platforms: **iOS** | [Android](https://github.com/tangem/tangem-sdk-android) | [JVM](https://github.com/tangem/tangem-sdk-android) | [Flutter](https://github.com/tangem/tangem-sdk-flutter) | [React Native ](https://github.com/tangem/tangem-sdk-react-native) | [Cordova](https://github.com/tangem/tangem-sdk-cordova) | [Capacitor](https://github.com/tangem/tangem-sdk-cordova) +Supported platforms: **iOS** | [Android](https://github.com/tangem/tangem-sdk-android) | [JVM](https://github.com/tangem/tangem-sdk-android) -# Documentation - -For exhaustive documentation, see [Tangem Developers Portal](https://developers.tangem.com). - -To kick off the development process you can start with [Getting started](https://developers.tangem.com/getting-started/ios) page. - # License Tangem SDK is available under the MIT license. See the [LICENSE](LICENSE) file for more info. diff --git a/TangemSdk.podspec b/TangemSdk.podspec index bc12fb0f1..838e326aa 100644 --- a/TangemSdk.podspec +++ b/TangemSdk.podspec @@ -8,7 +8,7 @@ Pod::Spec.new do |s| s.name = 'TangemSdk' - s.version = '3.10.0' + s.version = '3.11.0' s.summary = 'Use TangemSdk for Tangem cards integration' s.description = <<-DESC Tangem is a Swiss-based secure hardware wallet manufacturer that enables blockchain-based assets to be kept in custody within smart physical banknotes and accessed via NFC technology. Tangem’s mission is to make digital assets accessible, affordable and convenient for consumers. @@ -20,7 +20,7 @@ Tangem is a Swiss-based secure hardware wallet manufacturer that enables blockch s.source = { :git => 'https://github.com/Tangem/tangem-sdk-ios.git', :tag => s.version.to_s } s.social_media_url = 'https://twitter.com/Tangem' s.platform = :ios - s.ios.deployment_target = '11.0' + s.ios.deployment_target = '15.0' s.swift_version = '5.0' s.source_files = 'TangemSdk/TangemSdk/**/*.{swift}', @@ -48,6 +48,7 @@ Tangem is a Swiss-based secure hardware wallet manufacturer that enables blockch 'TangemSdk/TangemSdk/Haptics/*.ahap', 'TangemSdk/TangemSdk/**/Wordlists/*.txt', 'TangemSdk/TangemSdk/PrivacyInfo.xcprivacy', + 'TangemSdk/TangemSdk/Assets/*.xcassets', ] } diff --git a/TangemSdk/TangemSdk.xcodeproj/project.pbxproj b/TangemSdk/TangemSdk.xcodeproj/project.pbxproj index d9b6cc37a..8927e9113 100644 --- a/TangemSdk/TangemSdk.xcodeproj/project.pbxproj +++ b/TangemSdk/TangemSdk.xcodeproj/project.pbxproj @@ -38,8 +38,6 @@ 5D2B798626BC3DBF002A78D4 /* DeriveWalletPublicKeyTask.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5D2B798526BC3DBF002A78D4 /* DeriveWalletPublicKeyTask.swift */; }; 5D2BDF8626DD4869002F7E19 /* TestParseRequest.json in Resources */ = {isa = PBXBuildFile; fileRef = 5D2BDF8526DD4869002F7E19 /* TestParseRequest.json */; }; 5D2BDF8826DD64DB002F7E19 /* RunnablesTask.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5D2BDF8726DD64DB002F7E19 /* RunnablesTask.swift */; }; - 5D2F3EE426CBDAA100779CAC /* KeyboardHeightPublisher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5D2F3EE226CBDAA000779CAC /* KeyboardHeightPublisher.swift */; }; - 5D2F3EE526CBDAA100779CAC /* KeyboardAdaptive.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5D2F3EE326CBDAA000779CAC /* KeyboardAdaptive.swift */; }; 5D2FE06324DD82750086B5E8 /* AttestCardKeyCommand.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5D2FE06224DD82750086B5E8 /* AttestCardKeyCommand.swift */; }; 5D2FE06524DD82BA0086B5E8 /* VerifyCardRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5D2FE06424DD82BA0086B5E8 /* VerifyCardRequest.swift */; }; 5D2FE06724DDA3080086B5E8 /* NetworkService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5D2FE06624DDA3080086B5E8 /* NetworkService.swift */; }; @@ -292,6 +290,7 @@ DC7254902A03E20A0003FE1B /* DerivedKeys.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC72548F2A03E20A0003FE1B /* DerivedKeys.swift */; }; DC8B0E3F286F221D009D64F7 /* BiometricsUtil.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC8B0E3E286F221D009D64F7 /* BiometricsUtil.swift */; }; DCA9706628E35EAD0046E62E /* GenerateOTPCommand.swift in Sources */ = {isa = PBXBuildFile; fileRef = DCA9706528E35EAD0046E62E /* GenerateOTPCommand.swift */; }; + DCACA0402CB51FF400A3DD51 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = DCACA03F2CB51FF400A3DD51 /* Assets.xcassets */; }; DCB5A4E02A1F969F0021E12D /* HKDFUtil.swift in Sources */ = {isa = PBXBuildFile; fileRef = DCB5A4DF2A1F969F0021E12D /* HKDFUtil.swift */; }; DCB5A4E32A1FAB330021E12D /* BLSUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = DCB5A4E22A1FAB330021E12D /* BLSUtils.swift */; }; DCB5A4E52A1FAC190021E12D /* BLSTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DCB5A4E42A1FAC190021E12D /* BLSTests.swift */; }; @@ -421,8 +420,6 @@ 5D2B798526BC3DBF002A78D4 /* DeriveWalletPublicKeyTask.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeriveWalletPublicKeyTask.swift; sourceTree = ""; }; 5D2BDF8526DD4869002F7E19 /* TestParseRequest.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = TestParseRequest.json; sourceTree = ""; }; 5D2BDF8726DD64DB002F7E19 /* RunnablesTask.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnablesTask.swift; sourceTree = ""; }; - 5D2F3EE226CBDAA000779CAC /* KeyboardHeightPublisher.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KeyboardHeightPublisher.swift; sourceTree = ""; }; - 5D2F3EE326CBDAA000779CAC /* KeyboardAdaptive.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KeyboardAdaptive.swift; sourceTree = ""; }; 5D2FE06224DD82750086B5E8 /* AttestCardKeyCommand.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AttestCardKeyCommand.swift; sourceTree = ""; }; 5D2FE06424DD82BA0086B5E8 /* VerifyCardRequest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VerifyCardRequest.swift; sourceTree = ""; }; 5D2FE06624DDA3080086B5E8 /* NetworkService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkService.swift; sourceTree = ""; }; @@ -670,6 +667,8 @@ DC3D98052A7927A2001EEE7A /* SLIP10Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SLIP10Tests.swift; sourceTree = ""; }; DC3D98092A792804001EEE7A /* KeysImportTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeysImportTests.swift; sourceTree = ""; }; DC44C5892B4DC1B200888BED /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = ""; }; + DC47728C2C2B0C4000D2459D /* ja */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ja; path = ja.lproj/Localizable.strings; sourceTree = ""; }; + DC47728D2C2B0C4E00D2459D /* uk-UA */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "uk-UA"; path = "uk-UA.lproj/Localizable.strings"; sourceTree = ""; }; DC4E442829BF42630088617C /* Base58Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Base58Tests.swift; sourceTree = ""; }; DC59CB0329AF597900EC14E1 /* Wordlist.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Wordlist.swift; sourceTree = ""; }; DC59CB0929AF6F9C00EC14E1 /* EntropyLength.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EntropyLength.swift; sourceTree = ""; }; @@ -682,6 +681,7 @@ DC72548F2A03E20A0003FE1B /* DerivedKeys.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DerivedKeys.swift; sourceTree = ""; }; DC8B0E3E286F221D009D64F7 /* BiometricsUtil.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BiometricsUtil.swift; sourceTree = ""; }; DCA9706528E35EAD0046E62E /* GenerateOTPCommand.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GenerateOTPCommand.swift; sourceTree = ""; }; + DCACA03F2CB51FF400A3DD51 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; DCB5A4DF2A1F969F0021E12D /* HKDFUtil.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HKDFUtil.swift; sourceTree = ""; }; DCB5A4E22A1FAB330021E12D /* BLSUtils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BLSUtils.swift; sourceTree = ""; }; DCB5A4E42A1FAC190021E12D /* BLSTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BLSTests.swift; sourceTree = ""; }; @@ -760,6 +760,7 @@ DCD2D91E2A1CF87200AB00B6 /* libsecp256k1-config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "libsecp256k1-config.h"; sourceTree = ""; }; DCD2D9212A1CFA8400AB00B6 /* precomputed_ecmult_gen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = precomputed_ecmult_gen.h; sourceTree = ""; }; DCD2D9242A1D15A300AB00B6 /* SchnorrSignature.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SchnorrSignature.swift; sourceTree = ""; }; + DCDECB8F2C88A81200E10564 /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = es.lproj/Localizable.strings; sourceTree = ""; }; DCEA3ABB2875AEBA00B0B0DA /* BiometricsStorage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BiometricsStorage.swift; sourceTree = ""; }; DCEA3ABD2875AF0F00B0B0DA /* SecureStorageKey.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecureStorageKey.swift; sourceTree = ""; }; DCF6188329F069DB001BE133 /* AttestCardKey.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = AttestCardKey.json; sourceTree = ""; }; @@ -867,15 +868,6 @@ path = IssuerAndUserData; sourceTree = ""; }; - 5D2F3EE126CBDAA000779CAC /* KeyboardAvoidance */ = { - isa = PBXGroup; - children = ( - 5D2F3EE226CBDAA000779CAC /* KeyboardHeightPublisher.swift */, - 5D2F3EE326CBDAA000779CAC /* KeyboardAdaptive.swift */, - ); - path = KeyboardAvoidance; - sourceTree = ""; - }; 5D2F3EE626CBE2E700779CAC /* Scan */ = { isa = PBXGroup; children = ( @@ -1199,7 +1191,6 @@ 5D2F3EE826CBE31F00779CAC /* UserCodes */, 5D2F3EE726CBE30800779CAC /* Common */, 5D2F3EE626CBE2E700779CAC /* Scan */, - 5D2F3EE126CBDAA000779CAC /* KeyboardAvoidance */, 5D0243BD26CACACD00B76F37 /* IndicatorView.swift */, ); path = Views; @@ -1254,6 +1245,7 @@ 5DA80C9C231D247A00A50A10 /* TangemSdk */ = { isa = PBXGroup; children = ( + DCACA03E2CB51FDF00A3DD51 /* Assets */, 5DA80C9D231D247A00A50A10 /* TangemSdk.h */, 5D5369D124461F62002886E0 /* module.modulemap */, DC44C5892B4DC1B200888BED /* PrivacyInfo.xcprivacy */, @@ -1569,6 +1561,14 @@ path = PreflightReadFilter; sourceTree = ""; }; + DCACA03E2CB51FDF00A3DD51 /* Assets */ = { + isa = PBXGroup; + children = ( + DCACA03F2CB51FF400A3DD51 /* Assets.xcassets */, + ); + path = Assets; + sourceTree = ""; + }; DCB5A4E12A1FAB190021E12D /* BLS */ = { isa = PBXGroup; children = ( @@ -1833,7 +1833,7 @@ attributes = { BuildIndependentTargetsInParallel = YES; LastSwiftUpdateCheck = 1120; - LastUpgradeCheck = 1510; + LastUpgradeCheck = 1540; ORGANIZATIONNAME = "Tangem AG"; TargetAttributes = { 5DA80C99231D247A00A50A10 = { @@ -1857,6 +1857,9 @@ it, ru, "zh-Hant", + ja, + "uk-UA", + es, ); mainGroup = 5DA80C90231D247A00A50A10; packageReferences = ( @@ -1880,6 +1883,7 @@ DC1244B529B60E480037BC05 /* english.txt in Resources */, 5DD5368C2476B3FB00F5DE88 /* Error.ahap in Resources */, 5D5369D224461F62002886E0 /* module.modulemap in Resources */, + DCACA0402CB51FF400A3DD51 /* Assets.xcassets in Resources */, 5D6A92D82344E2D700158457 /* Localizable.strings in Resources */, 5DD5368B2476B3FB00F5DE88 /* Success.ahap in Resources */, ); @@ -2059,7 +2063,6 @@ DC1244E829BB9E0C0037BC05 /* ExtendedKeySerializer.swift in Sources */, 5DA5B61C233E12B30058C720 /* Tlv.swift in Sources */, 5D0E56032757C11F00D46F54 /* CardDataResponse.swift in Sources */, - 5D2F3EE526CBDAA100779CAC /* KeyboardAdaptive.swift in Sources */, 5D7D5FB223449D4000058D69 /* SessionEnvironment.swift in Sources */, 5D2FE06324DD82750086B5E8 /* AttestCardKeyCommand.swift in Sources */, DC7254902A03E20A0003FE1B /* DerivedKeys.swift in Sources */, @@ -2141,7 +2144,6 @@ DCD2D8BF2A1CF64A00AB00B6 /* precomputed_ecmult_gen.c in Sources */, 5DAAF3A026E2668500187AA9 /* UIApplication+.swift in Sources */, 5D0F8D0626C6C363002E84A4 /* Binding+.swift in Sources */, - 5D2F3EE426CBDAA100779CAC /* KeyboardHeightPublisher.swift in Sources */, 5DE43A5C26D4DC6400ECA36A /* StartBackupCardLinkingCommand.swift in Sources */, 5DE5550E2458409E000E1816 /* WriteUserDataCommand.swift in Sources */, 5D379C2D268FA53D00C7F473 /* KeyPair.swift in Sources */, @@ -2245,6 +2247,9 @@ 5DD1D62D25557E7F007910EF /* it */, 5D384E0F27B5355600869C0D /* ru */, DADB544F298BAFBC00491102 /* zh-Hant */, + DC47728C2C2B0C4000D2459D /* ja */, + DC47728D2C2B0C4E00D2459D /* uk-UA */, + DCDECB8F2C88A81200E10564 /* es */, ); name = Localizable.strings; sourceTree = ""; @@ -2306,7 +2311,6 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; MODULEMAP_FILE = "$(SRCROOT)/TangemSdk/module.modulemap"; MODULEMAP_PRIVATE_FILE = ""; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; @@ -2380,7 +2384,6 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; MODULEMAP_FILE = "$(SRCROOT)/TangemSdk/module.modulemap"; MODULEMAP_PRIVATE_FILE = ""; MTL_ENABLE_DEBUG_INFO = NO; @@ -2421,7 +2424,7 @@ HEADER_SEARCH_PATHS = ""; INFOPLIST_FILE = Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -2474,7 +2477,7 @@ HEADER_SEARCH_PATHS = ""; INFOPLIST_FILE = Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -2518,6 +2521,7 @@ CODE_SIGN_STYLE = Automatic; DEVELOPMENT_TEAM = 4897UJ6D8C; INFOPLIST_FILE = TangemSdkTests/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 17.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -2535,6 +2539,10 @@ ); PRODUCT_BUNDLE_IDENTIFIER = com.tangem.tangemSdk.TangemSdkTests; PRODUCT_NAME = "$(TARGET_NAME)"; + SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; + SUPPORTS_MACCATALYST = NO; + SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; + SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = 1; }; @@ -2547,6 +2555,7 @@ CODE_SIGN_STYLE = Automatic; DEVELOPMENT_TEAM = 4897UJ6D8C; INFOPLIST_FILE = TangemSdkTests/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 17.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -2564,6 +2573,10 @@ ); PRODUCT_BUNDLE_IDENTIFIER = com.tangem.tangemSdk.TangemSdkTests; PRODUCT_NAME = "$(TARGET_NAME)"; + SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; + SUPPORTS_MACCATALYST = NO; + SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; + SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = 1; }; diff --git a/TangemSdk/TangemSdk.xcodeproj/xcshareddata/xcschemes/TangemSdk.xcscheme b/TangemSdk/TangemSdk.xcodeproj/xcshareddata/xcschemes/TangemSdk.xcscheme index 5ba81f39d..d23df0691 100644 --- a/TangemSdk/TangemSdk.xcodeproj/xcshareddata/xcschemes/TangemSdk.xcscheme +++ b/TangemSdk/TangemSdk.xcodeproj/xcshareddata/xcschemes/TangemSdk.xcscheme @@ -1,6 +1,6 @@ WalletSettingsMask { return .init(rawValue: rawValue) @@ -121,7 +116,6 @@ extension CardSettingsMask { // MARK: - CardSettingsMask Constants -@available(iOS 13.0, *) extension CardSettingsMask { static let useActivation = CardSettingsMask(rawValue: 0x0002) static let useBlock = CardSettingsMask(rawValue: 0x0008) @@ -154,7 +148,6 @@ extension CardSettingsMask { // MARK: - CardSettingsMask OptionSetCodable conformance -@available(iOS 13.0, *) extension CardSettingsMask: OptionSetCodable { enum OptionKeys: String, OptionKey { case useActivation diff --git a/TangemSdk/TangemSdk/Common/Card/DerivedKeys.swift b/TangemSdk/TangemSdk/Common/Card/DerivedKeys.swift index c68f93869..e4b962e2c 100644 --- a/TangemSdk/TangemSdk/Common/Card/DerivedKeys.swift +++ b/TangemSdk/TangemSdk/Common/Card/DerivedKeys.swift @@ -9,7 +9,6 @@ import Foundation // We can't use CodingKeyRepresentable because of iOS 15 version -@available(iOS 13.0, *) public struct DerivedKeys: JSONStringConvertible { public private(set) var keys: [DerivationPath:ExtendedPublicKey] @@ -27,7 +26,6 @@ public struct DerivedKeys: JSONStringConvertible { } } -@available(iOS 13.0, *) extension DerivedKeys: Codable { public init(from decoder: Decoder) throws { let container = try decoder.singleValueContainer() @@ -51,8 +49,6 @@ extension DerivedKeys: Codable { } } - -@available(iOS 13.0, *) extension DerivedKeys: ExpressibleByDictionaryLiteral { public init(dictionaryLiteral elements: (DerivationPath, ExtendedPublicKey)...) { let dictionary = elements.reduce(into: [:]) { partialResult, item in diff --git a/TangemSdk/TangemSdk/Common/Card/EllipticCurve.swift b/TangemSdk/TangemSdk/Common/Card/EllipticCurve.swift index 58e58fc0a..f36a6a287 100644 --- a/TangemSdk/TangemSdk/Common/Card/EllipticCurve.swift +++ b/TangemSdk/TangemSdk/Common/Card/EllipticCurve.swift @@ -9,7 +9,6 @@ import Foundation /// Elliptic curve used for wallet key operations. -@available(iOS 13.0, *) public enum EllipticCurve: String, StringCodable, CaseIterable { case secp256k1 case ed25519 @@ -21,7 +20,6 @@ public enum EllipticCurve: String, StringCodable, CaseIterable { case bip0340 } -@available(iOS 13.0, *) extension EllipticCurve { public var supportsDerivation: Bool { switch self { diff --git a/TangemSdk/TangemSdk/Common/Card/EncryptionMode.swift b/TangemSdk/TangemSdk/Common/Card/EncryptionMode.swift index 16df43080..1c2899abe 100644 --- a/TangemSdk/TangemSdk/Common/Card/EncryptionMode.swift +++ b/TangemSdk/TangemSdk/Common/Card/EncryptionMode.swift @@ -9,7 +9,6 @@ import Foundation /// All available encryption modes -@available(iOS 13.0, *) public enum EncryptionMode: String, StringCodable { case none case fast diff --git a/TangemSdk/TangemSdk/Common/Card/FirmwareVersion.swift b/TangemSdk/TangemSdk/Common/Card/FirmwareVersion.swift index ec3bfa0f5..f73f1d45c 100644 --- a/TangemSdk/TangemSdk/Common/Card/FirmwareVersion.swift +++ b/TangemSdk/TangemSdk/Common/Card/FirmwareVersion.swift @@ -10,7 +10,6 @@ import Foundation /// Holds information about card firmware version included version saved on card `version`, /// splitted to `major`, `minor` and `patch` and `FirmwareType` -@available(iOS 13.0, *) public struct FirmwareVersion: Codable { /// Version that saved on card public let stringValue: String @@ -65,7 +64,6 @@ public struct FirmwareVersion: Codable { } } -@available(iOS 13.0, *) extension FirmwareVersion: Comparable { public static func < (lhs: FirmwareVersion, rhs: FirmwareVersion) -> Bool { if lhs.major != rhs.major { @@ -105,7 +103,6 @@ extension FirmwareVersion: Comparable { } //MARK: - Constants -@available(iOS 13.0, *) public extension FirmwareVersion { //todo: move all doubleValue checks to constants, group production cos /// Multi-wallet static let multiwalletAvailable = FirmwareVersion(major: 4, minor: 0) @@ -133,7 +130,6 @@ public extension FirmwareVersion { //todo: move all doubleValue checks to consta static let ed25519Slip0010Available = FirmwareVersion(major: 6, minor: 33) } -@available(iOS 13.0, *) public extension FirmwareVersion { enum FirmwareType: String, StringCodable, CaseIterable, JSONStringConvertible { case sdk = "d SDK" //todo fix diff --git a/TangemSdk/TangemSdk/Common/Card/SigningMethod.swift b/TangemSdk/TangemSdk/Common/Card/SigningMethod.swift index 41282e974..b9d2cbd1e 100644 --- a/TangemSdk/TangemSdk/Common/Card/SigningMethod.swift +++ b/TangemSdk/TangemSdk/Common/Card/SigningMethod.swift @@ -9,7 +9,6 @@ import Foundation /// Determines which type of data is required for signing. -@available(iOS 13.0, *) struct SigningMethod: OptionSet, OptionSetCustomStringConvertible { let rawValue: Byte @@ -19,7 +18,7 @@ struct SigningMethod: OptionSet, OptionSetCustomStringConvertible { } //MARK: - Constants -@available(iOS 13.0, *) + extension SigningMethod { static let signHash = SigningMethod(rawValue: 0b10000000|(1 << 0)) static let signRaw = SigningMethod(rawValue: 0b10000000|(1 << 1)) //todo: dv @@ -31,7 +30,7 @@ extension SigningMethod { } //MARK: - OptionSetCodable conformance -@available(iOS 13.0, *) + extension SigningMethod: OptionSetCodable { enum OptionKeys: String, OptionKey { case signHash diff --git a/TangemSdk/TangemSdk/Common/Card/UserSettings.swift b/TangemSdk/TangemSdk/Common/Card/UserSettings.swift index 325e62402..6c8dd3acf 100644 --- a/TangemSdk/TangemSdk/Common/Card/UserSettings.swift +++ b/TangemSdk/TangemSdk/Common/Card/UserSettings.swift @@ -8,7 +8,6 @@ import Foundation -@available(iOS 13.0, *) public extension Card { struct UserSettings: Codable { /// Is allowed to recover user codes @@ -16,7 +15,6 @@ public extension Card { } } -@available(iOS 13.0, *) extension Card.UserSettings { var mask: UserSettingsMask { let builder = MaskBuilder() @@ -35,7 +33,6 @@ extension Card.UserSettings { // MARK: - UserSettingsMask -@available(iOS 13.0, *) struct UserSettingsMask: OptionSet, OptionSetCustomStringConvertible { let rawValue: Int @@ -44,14 +41,12 @@ struct UserSettingsMask: OptionSet, OptionSetCustomStringConvertible { } } -@available(iOS 13.0, *) extension UserSettingsMask { static let forbidResetPIN = UserSettingsMask(rawValue: 0x00000001) } // MARK: - OptionSetCodable conformance -@available(iOS 13.0, *) extension UserSettingsMask: OptionSetCodable { enum OptionKeys: String, OptionKey { case forbidResetPIN diff --git a/TangemSdk/TangemSdk/Common/Card/Wallet.swift b/TangemSdk/TangemSdk/Common/Card/Wallet.swift index 21c4345dd..963ea3381 100644 --- a/TangemSdk/TangemSdk/Common/Card/Wallet.swift +++ b/TangemSdk/TangemSdk/Common/Card/Wallet.swift @@ -8,7 +8,6 @@ import Foundation -@available(iOS 13.0, *) public extension Card { /// Describing wallets created on card struct Wallet: Codable { @@ -39,7 +38,6 @@ public extension Card { } } -@available(iOS 13.0, *) public extension Card.Wallet { struct Settings: Codable { /// if true, erasing the wallet will be prohibited @@ -47,7 +45,6 @@ public extension Card.Wallet { } } -@available(iOS 13.0, *) public extension Card.Wallet { /// Status of the wallet. enum Status: Int, StatusType, JSONStringConvertible { //TODO: Specify @@ -70,7 +67,6 @@ public extension Card.Wallet { } } -@available(iOS 13.0, *) extension Card.Wallet.Status { var isBackedUp: Bool { switch self { @@ -100,7 +96,6 @@ extension Card.Wallet.Status { } } -@available(iOS 13.0, *) extension Card.Wallet.Settings { /// Stores and maps Wallet settings /// - Note: Available only for cards with COS v.4.0 @@ -116,17 +111,14 @@ extension Card.Wallet.Settings { } } -@available(iOS 13.0, *) extension Card.Wallet.Settings { init(mask: WalletSettingsMask) { self.isPermanent = mask.contains(.isPermanent) } } -@available(iOS 13.0, *) typealias WalletSettingsMask = Card.Wallet.Settings.Mask -@available(iOS 13.0, *) extension WalletSettingsMask: OptionSetCodable { enum OptionKeys: String, OptionKey { case isPermanent diff --git a/TangemSdk/TangemSdk/Common/CardFilter.swift b/TangemSdk/TangemSdk/Common/CardFilter.swift index 69d345c3a..a870bdaa8 100644 --- a/TangemSdk/TangemSdk/Common/CardFilter.swift +++ b/TangemSdk/TangemSdk/Common/CardFilter.swift @@ -8,7 +8,6 @@ import Foundation -@available(iOS 13.0, *) public struct CardFilter { /// Filter that can be used to limit cards that can be interacted with in TangemSdk. public var allowedCardTypes: [FirmwareVersion.FirmwareType] = [.release, .sdk] @@ -96,8 +95,6 @@ public struct CardIdRange { } } - -@available(iOS 13.0, *) public extension CardFilter { enum ItemFilter { case allow(_ items: Set) diff --git a/TangemSdk/TangemSdk/Common/CardIdFormatter.swift b/TangemSdk/TangemSdk/Common/CardIdFormatter.swift index 921271584..3375ff376 100644 --- a/TangemSdk/TangemSdk/Common/CardIdFormatter.swift +++ b/TangemSdk/TangemSdk/Common/CardIdFormatter.swift @@ -9,7 +9,6 @@ import Foundation /// Formatting CID in more readable manner -@available(iOS 13.0, *) public struct CardIdFormatter { public var style: CardIdDisplayFormat diff --git a/TangemSdk/TangemSdk/Common/CompletionResult.swift b/TangemSdk/TangemSdk/Common/CompletionResult.swift index a9ec9fed9..50aeab811 100644 --- a/TangemSdk/TangemSdk/Common/CompletionResult.swift +++ b/TangemSdk/TangemSdk/Common/CompletionResult.swift @@ -8,5 +8,4 @@ import Foundation -@available(iOS 13.0, *) public typealias CompletionResult = (Result) -> Void diff --git a/TangemSdk/TangemSdk/Common/Core/CardSession.swift b/TangemSdk/TangemSdk/Common/Core/CardSession.swift index 68e57ab48..c2734f216 100644 --- a/TangemSdk/TangemSdk/Common/Core/CardSession.swift +++ b/TangemSdk/TangemSdk/Common/Core/CardSession.swift @@ -11,7 +11,6 @@ import Combine import CommonCrypto /// Allows interaction with Tangem cards. Should be open before sending commands -@available(iOS 13.0, *) public class CardSession { enum CardSessionState { case inactive @@ -50,6 +49,10 @@ public class CardSession { private var accessCodeRepository: AccessCodeRepository? = nil private let filter: SessionFilter? + private var defaultScanMessage: String { + "view_delegate_scan_description_format".localized(environment.config.productType.localizedDescription) + } + private var shouldRequestBiometrics: Bool { guard let accessCodeRepository = self.accessCodeRepository else { return false @@ -191,7 +194,7 @@ public class CardSession { self.viewDelegate.tagConnected() self.viewDelegate.setState(.default) case .tagLost: - self.viewDelegate.tagLost() + self.viewDelegate.tagLost(message: defaultScanMessage) self.viewDelegate.setState(.scan) } }) @@ -227,7 +230,7 @@ public class CardSession { }) .store(in: &nfcReaderSubscriptions) - reader.startSession(with: initialMessage?.alertMessage) + reader.startSession(with: initialMessage?.alertMessage ?? defaultScanMessage) } // MARK: - Session stop and pause @@ -511,7 +514,7 @@ public class CardSession { func continueRunnable(code: String) { self.updateEnvironment(with: type, code: code) self.viewDelegate.setState(.default) - self.viewDelegate.showAlertMessage("view_delegate_scan_description".localized) + self.viewDelegate.showAlertMessage(defaultScanMessage) completion(.success(())) } @@ -585,7 +588,6 @@ public class CardSession { } } //MARK: - JSON RPC -@available(iOS 13.0, *) extension CardSession { /// Convinience method for jsonrpc requests running /// - Parameters: diff --git a/TangemSdk/TangemSdk/Common/Core/CardSessionRunnable.swift b/TangemSdk/TangemSdk/Common/Core/CardSessionRunnable.swift index 4a2cf56e9..5d5f5dfda 100644 --- a/TangemSdk/TangemSdk/Common/Core/CardSessionRunnable.swift +++ b/TangemSdk/TangemSdk/Common/Core/CardSessionRunnable.swift @@ -9,7 +9,6 @@ import Foundation /// Base protocol for run tasks in a card session -@available(iOS 13.0, *) public protocol CardSessionRunnable { /// Mode for preflight read. Change this property only if you understand what to do var preflightReadMode: PreflightReadMode { get } @@ -33,7 +32,6 @@ public protocol CardSessionRunnable { func run(in session: CardSession, completion: @escaping CompletionResult) } -@available(iOS 13.0, *) extension CardSessionRunnable { public var preflightReadMode: PreflightReadMode { .fullCardRead } @@ -44,7 +42,6 @@ extension CardSessionRunnable { } } -@available(iOS 13.0, *) extension CardSessionRunnable where Response: JSONStringConvertible { public func eraseToAnyRunnable() -> AnyJSONRPCRunnable { AnyJSONRPCRunnable(self) diff --git a/TangemSdk/TangemSdk/Common/Core/Config.swift b/TangemSdk/TangemSdk/Common/Core/Config.swift index 9b2d67a95..3d56b86b5 100644 --- a/TangemSdk/TangemSdk/Common/Core/Config.swift +++ b/TangemSdk/TangemSdk/Common/Core/Config.swift @@ -8,7 +8,6 @@ import Foundation -@available(iOS 13.0, *) public struct Config { public init() {} /** @@ -40,7 +39,10 @@ public struct Config { /// Card id display format. Full card id will be displayed by default public var cardIdDisplayFormat: CardIdDisplayFormat = .full - + + /// Product to work with. Affect animations and texts. + public var productType: ProductType = .any + /// Logger configuration public var logConfig: Log.Config = .default @@ -67,6 +69,23 @@ public struct Config { /// Localized reason for Touch ID. DO NOT leave it empty. public var biometricsLocalizedReason: String = "touch_id_localized_reason".localized + + public mutating func setupForProduct(_ product: ProductType) { + switch product { + case .card: + productType = .card + cardIdDisplayFormat = .full + style.scanTagImage = .genericCard + case .ring: + productType = .ring + cardIdDisplayFormat = .none + style.scanTagImage = .genericRing + case .any: + productType = .any + cardIdDisplayFormat = .full + style.scanTagImage = .genericCard + } + } } public enum CardIdDisplayFormat { @@ -90,3 +109,21 @@ public enum AccessCodeRequestPolicy: String, CaseIterable { /// User code will be requested only if set on the card. Need scan the card twice. case `default` } + +public enum ProductType { + case any + case card + case ring + + @available(iOS 13.0, *) + var localizedDescription: String { + switch self { + case .card: + "common_card".localized + case .ring: + "common_ring".localized + case .any: + "common_card_or_ring".localized + } + } +} diff --git a/TangemSdk/TangemSdk/Common/Core/SessionEnvironment.swift b/TangemSdk/TangemSdk/Common/Core/SessionEnvironment.swift index 1ff78ee76..b85d23cec 100644 --- a/TangemSdk/TangemSdk/Common/Core/SessionEnvironment.swift +++ b/TangemSdk/TangemSdk/Common/Core/SessionEnvironment.swift @@ -10,7 +10,6 @@ import Foundation /// Contains data relating to a Tangem card. It is used in constructing all the commands, /// and commands can return modified `SessionEnvironment`. -@available(iOS 13.0, *) public struct SessionEnvironment { /// Current card, read by preflight `Read` command public internal(set) var card: Card? = nil diff --git a/TangemSdk/TangemSdk/Common/Core/SessionFilter.swift b/TangemSdk/TangemSdk/Common/Core/SessionFilter.swift index ee274e729..3770789c7 100644 --- a/TangemSdk/TangemSdk/Common/Core/SessionFilter.swift +++ b/TangemSdk/TangemSdk/Common/Core/SessionFilter.swift @@ -8,13 +8,11 @@ import Foundation -@available(iOS 13.0, *) public enum SessionFilter { case cardId(String) case custom(PreflightReadFilter) } -@available(iOS 13.0, *) extension SessionFilter { var preflightReadFilter: PreflightReadFilter { switch self { diff --git a/TangemSdk/TangemSdk/Common/Core/TangemSdkError.swift b/TangemSdk/TangemSdk/Common/Core/TangemSdkError.swift index a8acfaa13..672d83949 100644 --- a/TangemSdk/TangemSdk/Common/Core/TangemSdkError.swift +++ b/TangemSdk/TangemSdk/Common/Core/TangemSdkError.swift @@ -13,7 +13,6 @@ import CoreNFC * An error class that represent typical errors that may occur when performing Tangem SDK tasks. * Errors are propagated back to the caller in callbacks. */ -@available(iOS 13.0, *) public enum TangemSdkError: Error, LocalizedError, Encodable { //MARK: NFC processing errors @@ -515,10 +514,13 @@ public enum TangemSdkError: Error, LocalizedError, Encodable { return "error_backup_wrong_card".localized("\(self.code)") case .backupFailedAlreadyCreated: return "error_backup_failed_already_created".localized - case .noActiveBackup: - return "error_no_active_backup".localized - case .resetPinWrongCard: - return "error_reset_wrong_card".localized("\(self.code)") + case .resetPinWrongCard(let internalCode): + switch internalCode { + case TangemSdkError.noActiveBackup.code: + return "error_no_active_backup".localized + default: + return "error_reset_wrong_card".localized("\(self.code)") + } case .oldCard: return "error_old_card".localized case .userCodeRecoveryDisabled: return "error_user_code_recovery_disabled".localized diff --git a/TangemSdk/TangemSdk/Common/Deserialization/CardDeserializer.swift b/TangemSdk/TangemSdk/Common/Deserialization/CardDeserializer.swift index 3914732a3..c9070ed93 100644 --- a/TangemSdk/TangemSdk/Common/Deserialization/CardDeserializer.swift +++ b/TangemSdk/TangemSdk/Common/Deserialization/CardDeserializer.swift @@ -8,7 +8,6 @@ import Foundation -@available(iOS 13.0, *) struct CardDeserializer { var allowNotPersonalized: Bool = false diff --git a/TangemSdk/TangemSdk/Common/Deserialization/WalletDataDeserializer.swift b/TangemSdk/TangemSdk/Common/Deserialization/WalletDataDeserializer.swift index de1b61c74..de66cda47 100644 --- a/TangemSdk/TangemSdk/Common/Deserialization/WalletDataDeserializer.swift +++ b/TangemSdk/TangemSdk/Common/Deserialization/WalletDataDeserializer.swift @@ -8,7 +8,6 @@ import Foundation -@available(iOS 13.0, *) public struct WalletDataDeserializer { public init() {} diff --git a/TangemSdk/TangemSdk/Common/Deserialization/WalletDeserializer.swift b/TangemSdk/TangemSdk/Common/Deserialization/WalletDeserializer.swift index b030729d7..7f493aec4 100644 --- a/TangemSdk/TangemSdk/Common/Deserialization/WalletDeserializer.swift +++ b/TangemSdk/TangemSdk/Common/Deserialization/WalletDeserializer.swift @@ -8,7 +8,6 @@ import Foundation -@available(iOS 13.0, *) /// Deserialize v4 walelts only class WalletDeserializer { private let isDefaultPermanentWallet: Bool diff --git a/TangemSdk/TangemSdk/Common/Extensions/Array+CardWallet.swift b/TangemSdk/TangemSdk/Common/Extensions/Array+CardWallet.swift index c88256746..16ef096c3 100644 --- a/TangemSdk/TangemSdk/Common/Extensions/Array+CardWallet.swift +++ b/TangemSdk/TangemSdk/Common/Extensions/Array+CardWallet.swift @@ -8,7 +8,6 @@ import Foundation -@available(iOS 13.0, *) public extension Array where Element == Card.Wallet { subscript(publicKey: Data) -> Element? { get { diff --git a/TangemSdk/TangemSdk/Common/Extensions/Array+Tlv.swift b/TangemSdk/TangemSdk/Common/Extensions/Array+Tlv.swift index 9eb97e0e0..211b7a015 100644 --- a/TangemSdk/TangemSdk/Common/Extensions/Array+Tlv.swift +++ b/TangemSdk/TangemSdk/Common/Extensions/Array+Tlv.swift @@ -8,7 +8,6 @@ import Foundation -@available(iOS 13.0, *) extension Array where Element == Tlv { /// Serialize array of tlv items to Data /// - Parameter array: tlv array diff --git a/TangemSdk/TangemSdk/Common/Extensions/Binding+.swift b/TangemSdk/TangemSdk/Common/Extensions/Binding+.swift index e4a1f3fca..652e4fd78 100644 --- a/TangemSdk/TangemSdk/Common/Extensions/Binding+.swift +++ b/TangemSdk/TangemSdk/Common/Extensions/Binding+.swift @@ -9,7 +9,6 @@ import Foundation import SwiftUI -@available(iOS 13.0, *) extension Binding { /// When the `Binding`'s `wrappedValue` changes, the given closure is executed. diff --git a/TangemSdk/TangemSdk/Common/Extensions/Bundle+.swift b/TangemSdk/TangemSdk/Common/Extensions/Bundle+.swift index e0ec6a0ef..8b4aa5918 100644 --- a/TangemSdk/TangemSdk/Common/Extensions/Bundle+.swift +++ b/TangemSdk/TangemSdk/Common/Extensions/Bundle+.swift @@ -7,7 +7,6 @@ import Foundation -@available(iOS 13.0, *) extension Bundle { static var sdkBundle: Bundle { #if SWIFT_PACKAGE diff --git a/TangemSdk/TangemSdk/Common/Extensions/Byte+.swift b/TangemSdk/TangemSdk/Common/Extensions/Byte+.swift index 306f4b3a5..d07a78dea 100644 --- a/TangemSdk/TangemSdk/Common/Extensions/Byte+.swift +++ b/TangemSdk/TangemSdk/Common/Extensions/Byte+.swift @@ -48,7 +48,6 @@ extension UInt16 { } } -@available(iOS 13.0, *) extension Array where Element == UInt8 { public func getSha256() -> Data { let digest = SHA256.hash(data: self) diff --git a/TangemSdk/TangemSdk/Common/Extensions/Color+.swift b/TangemSdk/TangemSdk/Common/Extensions/Color+.swift index 6a6812211..38657405e 100644 --- a/TangemSdk/TangemSdk/Common/Extensions/Color+.swift +++ b/TangemSdk/TangemSdk/Common/Extensions/Color+.swift @@ -9,7 +9,6 @@ import Foundation import SwiftUI -@available(iOS 13.0, *) extension Color { static func adaptiveColor(dark: UIColor, light: UIColor) -> Color { Color(UIColor.init { $0.userInterfaceStyle == .dark ? dark : light }) diff --git a/TangemSdk/TangemSdk/Common/Extensions/Data+.swift b/TangemSdk/TangemSdk/Common/Extensions/Data+.swift index bceed0a4d..0a0466994 100644 --- a/TangemSdk/TangemSdk/Common/Extensions/Data+.swift +++ b/TangemSdk/TangemSdk/Common/Extensions/Data+.swift @@ -39,7 +39,6 @@ extension Data { return calendar.date(from: components) } - @available(iOS 13.0, *) public var sha256Ripemd160: Data { var md = RIPEMD160() let hash = getSha256() @@ -120,19 +119,16 @@ extension Data { self = Data(bytes) } - @available(iOS 13.0, *) public func getSha256() -> Data { let digest = SHA256.hash(data: self) return Data(digest) } - - @available(iOS 13.0, *) + public func getSha512() -> Data { let digest = SHA512.hash(data: self) return Data(digest) } - @available(iOS 13.0, *) public func getDoubleSha256() -> Data { return getSha256().getSha256() } @@ -144,8 +140,7 @@ extension Data { func toBits() -> [String] { return flatMap { $0.toBits() } } - - @available(iOS 13.0, *) + func decodeTlv(tag: TlvTag) -> T? { guard let tlv = Tlv.deserialize(self) else{ return nil @@ -154,8 +149,7 @@ extension Data { let decoder = TlvDecoder(tlv: tlv) return try? decoder.decode(tag) } - - @available(iOS 13.0, *) + public func pbkdf2(hash: CCPBKDFAlgorithm, salt: Data, keyByteCount: Int, @@ -189,13 +183,11 @@ extension Data { throw TangemSdkError.cryptoUtilsError("Failed to pbkdf2") } - - @available(iOS 13.0, *) + public func pbkdf2sha256(salt: Data, rounds: Int, keyByteCount: Int = 32) throws -> Data { return try pbkdf2(hash: CCPBKDFAlgorithm(kCCPRFHmacAlgSHA256), salt: salt, keyByteCount: keyByteCount, rounds: rounds) } - @available(iOS 13.0, *) public func pbkdf2sha512(salt: Data, rounds: Int, keyByteCount: Int = 64) throws -> Data { return try pbkdf2(hash: CCPBKDFAlgorithm(kCCPRFHmacAlgSHA512), salt: salt, keyByteCount: keyByteCount, rounds: rounds) } @@ -219,7 +211,6 @@ extension Data { /// - Parameter encryptionKey: key to encrypt /// - Throws: encription errors /// - Returns: Encripted data - @available(iOS 13.0, *) public func encrypt(with encryptionKey: Data) throws -> Data { return try CryptoUtils.crypt(operation: kCCEncrypt, algorithm: kCCAlgorithmAES, @@ -232,7 +223,6 @@ extension Data { /// - Parameter encryptionKey: key to decrypt /// - Throws: decryption errors /// - Returns: Decrypted data - @available(iOS 13.0, *) public func decrypt(with encryptionKey: Data) throws -> Data { return try CryptoUtils.crypt(operation: kCCDecrypt, algorithm: kCCAlgorithmAES, @@ -242,7 +232,6 @@ extension Data { } - @available(iOS 13.0, *) public func sign(privateKey: Data, curve: EllipticCurve = .secp256k1) throws -> Data { switch curve { case .secp256k1: diff --git a/TangemSdk/TangemSdk/Common/Extensions/Error+.swift b/TangemSdk/TangemSdk/Common/Extensions/Error+.swift index 0516b8301..8b74d4175 100644 --- a/TangemSdk/TangemSdk/Common/Extensions/Error+.swift +++ b/TangemSdk/TangemSdk/Common/Extensions/Error+.swift @@ -8,7 +8,6 @@ import Foundation -@available(iOS 13.0, *) public extension Error { func toTangemSdkError() -> TangemSdkError { return TangemSdkError.parse(self) diff --git a/TangemSdk/TangemSdk/Common/Extensions/HexConvertible.swift b/TangemSdk/TangemSdk/Common/Extensions/HexConvertible.swift index 56619ed78..5191b00c5 100644 --- a/TangemSdk/TangemSdk/Common/Extensions/HexConvertible.swift +++ b/TangemSdk/TangemSdk/Common/Extensions/HexConvertible.swift @@ -25,3 +25,4 @@ public extension HexConvertible where Self: FixedWidthInteger { extension Int: HexConvertible {} extension UInt64: HexConvertible {} +extension Int32: HexConvertible {} diff --git a/TangemSdk/TangemSdk/Common/Extensions/NFCTag+.swift b/TangemSdk/TangemSdk/Common/Extensions/NFCTag+.swift index 24ad4cb91..99ac616fe 100644 --- a/TangemSdk/TangemSdk/Common/Extensions/NFCTag+.swift +++ b/TangemSdk/TangemSdk/Common/Extensions/NFCTag+.swift @@ -9,7 +9,6 @@ import Foundation import CoreNFC -@available(iOS 13.0, *) extension NFCTag { var tagType: NFCTagType { switch self { diff --git a/TangemSdk/TangemSdk/Common/Extensions/Publisher+.swift b/TangemSdk/TangemSdk/Common/Extensions/Publisher+.swift index 6fca0f93a..55f09d9c7 100644 --- a/TangemSdk/TangemSdk/Common/Extensions/Publisher+.swift +++ b/TangemSdk/TangemSdk/Common/Extensions/Publisher+.swift @@ -9,7 +9,6 @@ import Foundation import Combine -@available(iOS 13.0, *) extension Publisher where Failure == Never { func weakAssign(to keyPath: ReferenceWritableKeyPath, on root: Root) -> AnyCancellable { sink { [weak root] in diff --git a/TangemSdk/TangemSdk/Common/Extensions/Result+RAPDU.swift b/TangemSdk/TangemSdk/Common/Extensions/Result+RAPDU.swift index 5e3a45f87..b9e322b8f 100644 --- a/TangemSdk/TangemSdk/Common/Extensions/Result+RAPDU.swift +++ b/TangemSdk/TangemSdk/Common/Extensions/Result+RAPDU.swift @@ -8,7 +8,6 @@ import Foundation -@available(iOS 13.0, *) extension Result where Success == ResponseApdu, Failure == TangemSdkError { func getResponse() throws -> Success { switch self { diff --git a/TangemSdk/TangemSdk/Common/Extensions/SLIX+.swift b/TangemSdk/TangemSdk/Common/Extensions/SLIX+.swift index 84b8de3e4..86f9c2d94 100644 --- a/TangemSdk/TangemSdk/Common/Extensions/SLIX+.swift +++ b/TangemSdk/TangemSdk/Common/Extensions/SLIX+.swift @@ -9,12 +9,10 @@ import Foundation import CoreNFC -@available(iOS 13.0, *) private protocol SlixTagReader { func readSlix2Tag(_ tag: NFCISO15693Tag, completion: @escaping (Result) -> Void) } -@available(iOS 13.0, *) extension NFCReader: SlixTagReader { func readSlix2Tag(_ tag: NFCISO15693Tag, completion: @escaping (Result) -> Void) { tag.readMultipleBlocks(requestFlags: [.highDataRate], blockRange: NSRange(location: 0, length: 40)) { [weak self] data1, error in @@ -39,7 +37,6 @@ extension NFCReader: SlixTagReader { } //Slix2 tag support. TODO: Refactor. Useful for payload retrieve -@available(iOS 13.0, *) private extension ResponseApdu { init?(slix2Data: Data) { let ndefTlvData = slix2Data[4...] //cut e1402801 (CC) diff --git a/TangemSdk/TangemSdk/Common/Extensions/String+.swift b/TangemSdk/TangemSdk/Common/Extensions/String+.swift index 56dbe7799..1c388d62c 100644 --- a/TangemSdk/TangemSdk/Common/Extensions/String+.swift +++ b/TangemSdk/TangemSdk/Common/Extensions/String+.swift @@ -9,13 +9,11 @@ import Foundation public extension String { - @available(iOS 13.0, *) func sha256() -> Data { let data = Data(Array(utf8)) return data.getSha256() } - - @available(iOS 13.0, *) + func sha512() -> Data { let data = Data(Array(utf8)) return data.getSha512() @@ -37,19 +35,16 @@ public extension String { internal func lowercasingFirst() -> String { return prefix(1).lowercased() + dropFirst() } - - @available(iOS 13.0, *) + internal var localized: String { Localization.getFormat(for: self) } - - @available(iOS 13.0, *) + internal func localized(_ arguments: [CVarArg]) -> String { let format = Localization.getFormat(for: self) return String(format: format, arguments: arguments) } - - @available(iOS 13.0, *) + internal func localized(_ arguments: CVarArg) -> String { let format = Localization.getFormat(for: self) return String(format: format, arguments) @@ -67,7 +62,6 @@ public extension String { } } -@available(iOS 13.0, *) extension DefaultStringInterpolation { mutating func appendInterpolation(_ data: Data) { appendLiteral(data.hexString) diff --git a/TangemSdk/TangemSdk/Common/Extensions/TangemSdk+Combine.swift b/TangemSdk/TangemSdk/Common/Extensions/TangemSdk+Combine.swift index f63d67861..6bcbef8cb 100644 --- a/TangemSdk/TangemSdk/Common/Extensions/TangemSdk+Combine.swift +++ b/TangemSdk/TangemSdk/Common/Extensions/TangemSdk+Combine.swift @@ -10,7 +10,6 @@ import Foundation import Combine import CoreNFC -@available(iOS 13.0, *) extension ResponseApdu { func decryptPublisher(encryptionKey: Data?) -> AnyPublisher { return Deferred {Future() { promise in @@ -24,7 +23,6 @@ extension ResponseApdu { } } -@available(iOS 13.0, *) extension CommandApdu { func encryptPublisher(encryptionMode: EncryptionMode, encryptionKey: Data?) -> AnyPublisher { return Deferred {Future() { promise in @@ -38,7 +36,6 @@ extension CommandApdu { } } -@available(iOS 13.0, *) extension NFCISO7816Tag { func sendCommandPublisher(cApdu: CommandApdu) -> AnyPublisher, TangemSdkError> { return Deferred { Future() { promise in @@ -65,7 +62,6 @@ extension NFCISO7816Tag { } } -@available(iOS 13.0, *) extension NFCTagReaderSession { func connectPublisher(tag: NFCTag) -> AnyPublisher { return Deferred { Future() { promise in @@ -80,7 +76,6 @@ extension NFCTagReaderSession { } } -@available(iOS 13.0, *) public extension TangemSdk { /// Combine wrapper for `startSession` method. /// - Parameters: diff --git a/TangemSdk/TangemSdk/Common/Extensions/UIViewController.swift b/TangemSdk/TangemSdk/Common/Extensions/UIViewController.swift index d32113a21..7a79f42c3 100644 --- a/TangemSdk/TangemSdk/Common/Extensions/UIViewController.swift +++ b/TangemSdk/TangemSdk/Common/Extensions/UIViewController.swift @@ -42,7 +42,10 @@ extension UIWindow { extension UIApplication { var topMostViewController : UIViewController? { - let keyWindow = UIApplication.shared.windows.filter {$0.isKeyWindow}.first - return keyWindow?.topmostViewController + let scene = UIApplication.shared.connectedScenes + .filter { $0.activationState == .foregroundActive || $0.activationState == .foregroundInactive } + .first as? UIWindowScene + + return scene?.keyWindow?.topmostViewController } } diff --git a/TangemSdk/TangemSdk/Common/JSON/AnyJSONRPCRunnable.swift b/TangemSdk/TangemSdk/Common/JSON/AnyJSONRPCRunnable.swift index bf7e08eee..04917daee 100644 --- a/TangemSdk/TangemSdk/Common/JSON/AnyJSONRPCRunnable.swift +++ b/TangemSdk/TangemSdk/Common/JSON/AnyJSONRPCRunnable.swift @@ -9,7 +9,6 @@ import Foundation /// Type erased CardSessionRunnable which Response conforms to JSONStringConvertible -@available(iOS 13.0, *) public class AnyJSONRPCRunnable: CardSessionRunnable { public var preflightReadMode: PreflightReadMode = .fullCardRead /// Request Id @@ -49,7 +48,6 @@ public class AnyJSONRPCRunnable: CardSessionRunnable { } } -@available(iOS 13.0, *) public struct AnyJSONRPCResponse: JSONStringConvertible { let response: JSONStringConvertible diff --git a/TangemSdk/TangemSdk/Common/JSON/Codable+.swift b/TangemSdk/TangemSdk/Common/JSON/Codable+.swift index 5d8d33578..1db1c1dac 100644 --- a/TangemSdk/TangemSdk/Common/JSON/Codable+.swift +++ b/TangemSdk/TangemSdk/Common/JSON/Codable+.swift @@ -8,7 +8,6 @@ import Foundation -@available(iOS 13.0, *) extension JSONDecoder { public static var tangemSdkDecoder: JSONDecoder { let decoder = JSONDecoder() @@ -23,7 +22,6 @@ extension JSONDecoder { } } -@available(iOS 13.0, *) extension JSONEncoder { public static var tangemSdkEncoder: JSONEncoder { let encoder = JSONEncoder() @@ -44,7 +42,7 @@ extension JSONEncoder { } } -@available(iOS 13.0, *) + fileprivate extension DateFormatter { static var tangemSdkDateFormatter: DateFormatter { let dateFormatter = DateFormatter() diff --git a/TangemSdk/TangemSdk/Common/JSON/Handlers.swift b/TangemSdk/TangemSdk/Common/JSON/Handlers.swift index ff8ce8c62..6322a2760 100644 --- a/TangemSdk/TangemSdk/Common/JSON/Handlers.swift +++ b/TangemSdk/TangemSdk/Common/JSON/Handlers.swift @@ -8,7 +8,6 @@ import Foundation -@available(iOS 13.0, *) class ScanHandler: JSONRPCHandler { var method: String { "SCAN" } var requiresCardId: Bool { false } @@ -19,7 +18,6 @@ class ScanHandler: JSONRPCHandler { } } -@available(iOS 13.0, *) class SignHashesHandler: JSONRPCHandler { var method: String { "SIGN_HASHES" } @@ -37,7 +35,6 @@ class SignHashesHandler: JSONRPCHandler { } } -@available(iOS 13.0, *) class SignHashHandler: JSONRPCHandler { var method: String { "SIGN_HASH" } @@ -55,7 +52,6 @@ class SignHashHandler: JSONRPCHandler { } } -@available(iOS 13.0, *) class CreateWalletHandler: JSONRPCHandler { var method: String { "CREATE_WALLET" } @@ -66,7 +62,6 @@ class CreateWalletHandler: JSONRPCHandler { } } -@available(iOS 13.0, *) class ImportWalletHandler: JSONRPCHandler { var method: String { "IMPORT_WALLET" } @@ -83,7 +78,6 @@ class ImportWalletHandler: JSONRPCHandler { } } -@available(iOS 13.0, *) class PurgeWalletHandler: JSONRPCHandler { var method: String { "PURGE_WALLET" } @@ -94,7 +88,6 @@ class PurgeWalletHandler: JSONRPCHandler { } } -@available(iOS 13.0, *) class PersonalizeHandler: JSONRPCHandler { var method: String { "PERSONALIZE" } @@ -112,7 +105,6 @@ class PersonalizeHandler: JSONRPCHandler { } } -@available(iOS 13.0, *) class DepersonalizeHandler: JSONRPCHandler { var method: String { "DEPERSONALIZE" } @@ -122,7 +114,6 @@ class DepersonalizeHandler: JSONRPCHandler { } } -@available(iOS 13.0, *) class SetAccessCodeHandler: JSONRPCHandler { var method: String { "SET_ACCESSCODE" } @@ -133,7 +124,6 @@ class SetAccessCodeHandler: JSONRPCHandler { } } -@available(iOS 13.0, *) class SetPasscodeHandler: JSONRPCHandler { var method: String { "SET_PASSCODE" } @@ -144,7 +134,6 @@ class SetPasscodeHandler: JSONRPCHandler { } } -@available(iOS 13.0, *) class ResetUserCodesHandler: JSONRPCHandler { var method: String { "RESET_USERCODES" } @@ -153,7 +142,6 @@ class ResetUserCodesHandler: JSONRPCHandler { } } -@available(iOS 13.0, *) class ReadFilesHandler: JSONRPCHandler { var method: String { "READ_FILES" } @@ -169,7 +157,6 @@ class ReadFilesHandler: JSONRPCHandler { } } -@available(iOS 13.0, *) class WriteFilesHandler: JSONRPCHandler { var method: String { "WRITE_FILES" } @@ -180,7 +167,6 @@ class WriteFilesHandler: JSONRPCHandler { } } -@available(iOS 13.0, *) class DeleteFilesHandler: JSONRPCHandler { var method: String { "DELETE_FILES" } @@ -191,7 +177,6 @@ class DeleteFilesHandler: JSONRPCHandler { } } -@available(iOS 13.0, *) class ChangeFileSettingsHandler: JSONRPCHandler { var method: String { "CHANGE_FILE_SETTINGS" } @@ -202,7 +187,6 @@ class ChangeFileSettingsHandler: JSONRPCHandler { } } -@available(iOS 13.0, *) class DeriveWalletPublicKeyHandler: JSONRPCHandler { var method: String { "DERIVE_WALLET_PUBLIC_KEY" } @@ -217,7 +201,6 @@ class DeriveWalletPublicKeyHandler: JSONRPCHandler { } } -@available(iOS 13.0, *) class DeriveWalletPublicKeysHandler: JSONRPCHandler { var method: String { "DERIVE_WALLET_PUBLIC_KEYS" } @@ -232,7 +215,6 @@ class DeriveWalletPublicKeysHandler: JSONRPCHandler { } } -@available(iOS 13.0, *) class SetUserCodeRecoveryAllowedHandler: JSONRPCHandler { var method: String { "SET_USERCODE_RECOVERY_ALLOWED" } @@ -244,7 +226,6 @@ class SetUserCodeRecoveryAllowedHandler: JSONRPCHandler { } } -@available(iOS 13.0, *) class AttestCardKeyHandler: JSONRPCHandler { var method: String { "ATTEST_CARD_KEY" } diff --git a/TangemSdk/TangemSdk/Common/JSON/JSONRPC.swift b/TangemSdk/TangemSdk/Common/JSON/JSONRPC.swift index 4512dab40..f6130a765 100644 --- a/TangemSdk/TangemSdk/Common/JSON/JSONRPC.swift +++ b/TangemSdk/TangemSdk/Common/JSON/JSONRPC.swift @@ -8,7 +8,6 @@ import Foundation -@available(iOS 13.0, *) public final class JSONRPCConverter { public static let shared: JSONRPCConverter = { let converter = JSONRPCConverter() @@ -62,7 +61,6 @@ public final class JSONRPCConverter { } } -@available(iOS 13.0, *) public protocol JSONRPCHandler { var method: String { get } @@ -71,7 +69,6 @@ public protocol JSONRPCHandler { // MARK: - JSONRPC Specification -@available(iOS 13.0, *) public struct JSONRPCRequest { public let jsonrpc: String public let id: Int? @@ -118,7 +115,6 @@ public struct JSONRPCRequest { } } -@available(iOS 13.0, *) struct JSONRPCRequestParser { func parse(jsonString: String) throws -> ParseResult { guard let data = jsonString.data(using: .utf8) else { @@ -152,7 +148,6 @@ struct JSONRPCRequestParser { } } -@available(iOS 13.0, *) public struct JSONRPCResponse: JSONStringConvertible { public let jsonrpc: String public let result: AnyJSONRPCResponse? @@ -167,10 +162,8 @@ public struct JSONRPCResponse: JSONStringConvertible { } } -@available(iOS 13.0, *) extension Array: JSONStringConvertible where Element: JSONStringConvertible {} -@available(iOS 13.0, *) public struct JSONRPCError: Error, JSONStringConvertible, Equatable { public let code: Int public let message: String @@ -189,13 +182,11 @@ public struct JSONRPCError: Error, JSONStringConvertible, Equatable { } } -@available(iOS 13.0, *) public struct JSONRPCErrorData: Encodable, Equatable, JSONStringConvertible { public let code: Int public let message: String } -@available(iOS 13.0, *) extension JSONRPCErrorData { public init(_ code: JSONRPCError.Code, message: String) { self.code = code.rawValue @@ -203,7 +194,6 @@ extension JSONRPCErrorData { } } -@available(iOS 13.0, *) extension JSONRPCError { public enum Code: Int { case parseError = -32700 @@ -233,7 +223,6 @@ extension JSONRPCError { } // MARK: - JSONRPC Helper extensions -@available(iOS 13.0, *) extension Result where Success: JSONStringConvertible, Failure == TangemSdkError { func toJsonResponse(id: Int? = nil) -> JSONRPCResponse { switch self { @@ -245,7 +234,6 @@ extension Result where Success: JSONStringConvertible, Failure == TangemSdkError } } -@available(iOS 13.0, *) extension Error { func toJsonResponse(id: Int? = nil) -> JSONRPCResponse { return JSONRPCResponse(id: id, result: nil, error: toJsonError()) @@ -262,7 +250,6 @@ extension Error { } } -@available(iOS 13.0, *) extension Dictionary where Key == String, Value == Any { func value(for key: String) throws -> T where T: ExpressibleByNilLiteral { let value = self[key] diff --git a/TangemSdk/TangemSdk/Common/JSON/JSONStringConvertible.swift b/TangemSdk/TangemSdk/Common/JSON/JSONStringConvertible.swift index 83b720061..b03187cd3 100644 --- a/TangemSdk/TangemSdk/Common/JSON/JSONStringConvertible.swift +++ b/TangemSdk/TangemSdk/Common/JSON/JSONStringConvertible.swift @@ -9,12 +9,10 @@ import Foundation /// The basic protocol for command response -@available(iOS 13.0, *) public protocol JSONStringConvertible: Encodable { var json: String {get} } -@available(iOS 13.0, *) public extension JSONStringConvertible { var json: String { let data = (try? JSONEncoder.tangemSdkEncoder.encode(self)) ?? Data() diff --git a/TangemSdk/TangemSdk/Common/JSON/RunnablesTask.swift b/TangemSdk/TangemSdk/Common/JSON/RunnablesTask.swift index f157e4033..f1069cfa9 100644 --- a/TangemSdk/TangemSdk/Common/JSON/RunnablesTask.swift +++ b/TangemSdk/TangemSdk/Common/JSON/RunnablesTask.swift @@ -8,10 +8,8 @@ import Foundation -@available(iOS 13.0, *) typealias RunnablesTaskResponse = [JSONRPCResponse] -@available(iOS 13.0, *) final class RunnablesTask: CardSessionRunnable { private let runnables: [AnyJSONRPCRunnable] private var responses: RunnablesTaskResponse = .init() diff --git a/TangemSdk/TangemSdk/Common/JSON/StringCodable.swift b/TangemSdk/TangemSdk/Common/JSON/StringCodable.swift index 345dc6578..3386ee1db 100644 --- a/TangemSdk/TangemSdk/Common/JSON/StringCodable.swift +++ b/TangemSdk/TangemSdk/Common/JSON/StringCodable.swift @@ -8,10 +8,8 @@ import Foundation -@available(iOS 13.0, *) protocol StringCodable: Codable & RawRepresentable where RawValue == String {} -@available(iOS 13.0, *) extension StringCodable { public init(from decoder: Decoder) throws { let values = try decoder.singleValueContainer() diff --git a/TangemSdk/TangemSdk/Common/Localization/Localization.swift b/TangemSdk/TangemSdk/Common/Localization/Localization.swift index b20ef3dfd..80d6ce69e 100644 --- a/TangemSdk/TangemSdk/Common/Localization/Localization.swift +++ b/TangemSdk/TangemSdk/Common/Localization/Localization.swift @@ -8,7 +8,6 @@ import Foundation -@available(iOS 13.0, *) public final class Localization { public static var localizationsBundle: Bundle? diff --git a/TangemSdk/TangemSdk/Common/Localization/Resources/de.lproj/Localizable.strings b/TangemSdk/TangemSdk/Common/Localization/Resources/de.lproj/Localizable.strings index 5af26c609..779dfddc6 100644 --- a/TangemSdk/TangemSdk/Common/Localization/Resources/de.lproj/Localizable.strings +++ b/TangemSdk/TangemSdk/Common/Localization/Resources/de.lproj/Localizable.strings @@ -1,70 +1,77 @@ -"attestation_failed_card" = "This card may be production sample or counterfeit. You can continue at your own risk."; -"attestation_failed_dev_card" = "This is a development card. Its authenticity cannot be verified. Do not accept this card as a means of payment."; -"attestation_online_failed_body" = "At the moment, online attestation of the card cannot be performed. You can continue at your own risk or try again later."; -"attestation_online_failed_title" = "Online attestation failed"; -"attestation_warning_attest_wallets" = "Suspicious use of the wallet on the card has been detected."; -"backup_add_backup_card_message" = "Connect your phone and the card you want to use as a backup exactly as it shown above."; -"backup_finalize_backup_card_message_format" = "Tap the card with number %@ to your phone exactly as shown above."; -"backup_finalize_primary_card_message_format" = "Connect your phone and the primary card with number %@ exactly as it shown above."; -"backup_prepare_primary_card_message" = "Connect your phone and the primary card exactly as it shown above."; -"backup_prepare_primary_card_message_format" = "Connect your phone and the primary card with number %@ exactly as it shown above."; -"cid_format" = "Card #%@"; +"attestation_failed_card" = "Diese Karte könnte ein Produktionsmuster oder eine Fälschung sein. Du kannst auf eigenem Risiko fortfahren."; +"attestation_failed_dev_card" = "Dies ist eine Entwicklungskarte. Ihre Authentizität kann nicht überprüft werden. Akzeptiere diese Karte nicht als Zahlungsmittel."; +"attestation_online_failed_body" = "Der Online-Nachweis/ Prüfung der Karte kann derzeit nicht durchgeführt werden. Du kannst auf eigenem Risiko fortfahren oder es später erneut versuchen."; +"attestation_online_failed_title" = "Online-Nachweis/Prüfung fehlgeschlagen"; +"attestation_warning_attest_wallets" = "Eine verdächtige Verwendung der Wallet auf der Karte wurde festgestellt."; +"backup_add_backup_card_message" = "Verbinde dein Telefon und die Karte oder den Ring, die du als Backup verwenden möchten, genau wie oben gezeigt."; +"backup_finalize_backup_card_message_format" = "Halte die Karte mit der Nummer %@ genau wie oben gezeigt, auf deinem Telefon."; +"backup_finalize_backup_ring_message" = "Tippe mit dem Ring genau wie oben gezeigt auf Dein Smartphone."; +"backup_finalize_primary_card_message_format" = "Verbinde dein Telefon und die vorherige Karte mit der Nummer %@ genau wie oben gezeigt."; +"backup_finalize_primary_ring_message" = "Verbinde Dein Telefon und den primären Ring wie oben gezeigt."; +"backup_prepare_primary_card_message" = "Verbinde dein Telefon und die primäre Karte genau wie oben gezeigt."; +"backup_prepare_primary_card_message_format" = "Verbinde dein Telefon und die primäre Karte mit der Nummer %@ genau wie oben gezeigt."; +"cid_format" = "Karte Nr.%@"; "common_cancel" = "Abbrechen"; +"common_card" = "card"; +"common_card_or_ring" = "card or ring"; "common_continue" = "Fortsetzen"; "common_error" = "Fehler"; "common_ok" = "OK"; -"common_retry" = "Retry"; +"common_retry" = "Wiederholen"; +"common_ring" = "ring"; "common_success" = "Erfolg"; -"common_understand" = "I understand"; -"common_warning" = "Warning"; -"error_already_created" = "Ein Wallet ist bereits erstellt worden"; -"error_backup_card_already_added" = "This card has already been added to the list"; -"error_backup_failed_already_created" = "This card cannot be used as a backup because it already contains a wallet. Ensure that no funds are stored on the card by scanning it in the app. Then, reset it to factory settings."; -"error_backup_not_empty_wallets" = "This card already has a wallet. If you want to proceed you have to reset it to factory settings first."; -"error_backup_wrong_card" = "This card can't be used as a backup card. Error code: %@."; -"error_card_verification_failed" = "Die Kartenverifizierung ist fehlgeschlagen"; -"error_file_not_found" = "File not found"; -"error_no_active_backup" = "The selected card cannot be used to reset the card access code, because there is no backup on it. Please contact support team."; -"error_old_card" = "Tangem cards issued before September 2019 cannot sign data using an iPhone due to iOS restrictions"; -"error_pin_cannot_be_changed_format" = "%@ cannot be changed"; -"error_pin_cannot_be_default_format" = "%@ cannot be changed to this value. Please, enter another one."; -"error_pin_required_format" = "%@ is required"; -"error_pin_too_short_format" = "%1$@ must be at least %2$li characters long"; -"error_purge_prohibited" = "The wallet cannot be erased"; -"error_reset_wrong_card" = "This card can't be used for code recovery. Error code: %@."; +"common_understand" = "Ich verstehe"; +"common_warning" = "Warnung"; +"error_already_created" = "Eine Wallet wurde bereits erstellt"; +"error_backup_card_already_added" = "Diese Karte wurde bereits zur Liste hinzugefügt"; +"error_backup_failed_already_created" = "Diese Karte kann nicht als Backup verwendet werden, da sie bereits eine Wallet enthält. Stelle sicher, dass kein Guthaben auf der Karte gespeichert ist, indem du sie in der App scannst. Setze sie dann auf die Werkseinstellungen zurück."; +"error_backup_not_empty_wallets" = "Diese Karte verfügt bereits über ein Wallet. Wenn du fortfahren möchtest, musst du sie zunächst auf die Werkseinstellungen zurücksetzen."; +"error_backup_wrong_card" = "Diese Karte kann nicht als Backup-Karte verwendet werden. Fehlercode: %@."; +"error_card_verification_failed" = "Kartenprüfung fehlgeschlagen"; +"error_file_not_found" = "Datei nicht gefunden"; +"error_no_active_backup" = "Die ausgewählte Karte kann nicht zum Zurücksetzen des Kartenzugangscodes verwendet werden, da sie nicht gesichert ist. Bitte wende dich an das Support-Team."; +"error_old_card" = "Vor September 2019 ausgestellte Tangem-Karten können aufgrund von iOS-Einschränkungen keine Daten mit einem iPhone signieren"; +"error_pin_cannot_be_changed_format" = "%@ kann nicht geändert werden"; +"error_pin_cannot_be_default_format" = "%@ kann nicht auf diesen Wert geändert werden. Bitte gebe eine andere ein."; +"error_pin_required_format" = "%@ ist erforderlich"; +"error_pin_too_short_format" = "%1$@ muss mindestens %2$li Zeichen lang sein"; +"error_purge_prohibited" = "Die Wallet kann nicht gelöscht werden"; +"error_reset_wrong_card" = "Diese Karte kann nicht zur Codewiederherstellung verwendet werden. Fehlercode: %@ ."; "error_user_cancelled" = "Der Benutzer hat den Vorgang unterbrochen"; -"error_user_code_recovery_disabled" = "Unable to reset the access code using this card"; -"error_wrong_card_number_with_card_id" = "You tapped a different card. Please tap card %@."; -"error_wrong_card_number_without_card_id" = "You tapped a different card"; -"error_wrong_card_type" = "This application is not designed to work with this card or needs to be updated"; -"error_wrong_pin_format" = "Wrong %@"; +"error_user_code_recovery_disabled" = "Mit dieser Karte kann der Zugangscode nicht zurückgesetzt werden"; +"error_wrong_card_number_with_card_id" = "Du hast eine andere Karte dran gehalten. Bitte halte Karte %@."; +"error_wrong_card_number_without_card_id" = "Du hast eine andere Karte dran gehalten"; +"error_wrong_card_type" = "Diese Anwendung ist nicht für die Verwendung mit dieser Karte vorgesehen oder, sie muss aktualisiert werden"; +"error_wrong_pin_format" = "Falsch %@"; "generic_error_code" = "Während des Vorgangs ist ein Fehler aufgetreten. Code: %@."; -"issuer_signature_loading_failed" = "Couldn't load the card's certificate. Please try again later."; +"issuer_signature_loading_failed" = "Das Zertifikat der Karte konnte nicht geladen werden. Bitte versuche es später erneut."; "nfc_alert_default_done" = "Erledigt"; -"nfc_session_timeout" = "Incomplete process. To finalize the operation, kindly tap the card again"; -"nfc_stuck_error" = "It seems that NFC does not work properly on your iPhone. Try to reboot your phone."; +"nfc_session_timeout" = "Unvollständiger Prozess. Um den Vorgang abzuschließen,halte die Karte bitte erneut an."; +"nfc_stuck_error" = "Es scheint, dass NFC auf deinem iPhone nicht richtig funktioniert. Versuche, dein Telefon neu zu starten."; "pin1" = "Zugangscode"; "pin2" = "Passcode"; "pin_change_new_code_format" = "Neu %@"; "pin_confirm_error_format" = "Die Codes stimmen nicht überein"; -"pin_enter" = "Anmelden %@"; -"pin_reset_code_format" = "Reset %@"; +"pin_enter" = "Eingabe %@"; +"pin_reset_code_format" = "Zurücksetzen %@"; "pin_set_code_confirm_format" = "Bestätigen %@"; -"pin_set_code_format" = "Ändern %@"; -"reset_codes_btn_forgot_your_code" = "Forgot your code?"; -"reset_codes_current_card" = "Current card"; -"reset_codes_linked_card" = "Linked card"; -"reset_codes_message_body_backup" = "Tap the linked card"; -"reset_codes_message_body_restore" = "First, prepare the card for restore process"; -"reset_codes_message_body_restore_final" = "Tap again the card on which you want to restore the access code"; -"reset_codes_message_title_backup" = "Tap a backup card"; -"reset_codes_message_title_restore" = "Tap the card you want to restore"; -"reset_codes_scan_confirmation_card" = "Scan another linked card"; -"reset_codes_scan_first_card" = "Scan the card on which you want to reset the %@"; -"reset_codes_scan_to_reset" = "Scan card to reset user codes"; -"reset_codes_success_message" = "Code was reset successfully"; -"sign_multiple_chunks_part" = "Signing part %1$li of %2$li"; -"touch_id_localized_reason" = "Use Touch ID to save access codes in the app"; -"view_delegate_scan_description" = "Tap the card as shown above and hold until the end of the operation"; -"view_delegate_security_delay_description" = "To ensure security please hold the card until the operation complete"; -"wallet_not_found" = "Looks like you got the wrong card. The operation cannot be performed with this card."; +"pin_set_code_format" = "Festlegen von %@"; +"reset_codes_btn_forgot_your_code" = "Code vergessen?"; +"reset_codes_current_card" = "Aktuelle Karte"; +"reset_codes_linked_card" = "Verknüpfte Karte"; +"reset_codes_message_body_backup" = "Halte die verknüpfte Karte dran"; +"reset_codes_message_body_restore" = "Bereite zunächst die Karte oder den Ring für den Wiederherstellungsprozess vor"; +"reset_codes_message_body_restore_final" = "Halte die Karte erneut dran, auf der du den Zugangscode wiederherstellen möchtest"; +"reset_codes_message_title_backup" = "Halte eine Backup-Karte oder Ring dran"; +"reset_codes_message_title_restore" = "Halte die Karte oder den Ring dran, die du wiederherstellen möchtest"; +"reset_codes_scan_confirmation_card" = "Eine andere verknüpfte Karte oder Ring scannen"; +"reset_codes_scan_first_card" = "Scanne die Karte, auf der du %@ zurücksetzen möchtest"; +"reset_codes_scan_to_reset" = "Scanne die Karte oder den Ring, um Benutzercodes zurückzusetzen"; +"reset_codes_success_message" = "Code wurde erfolgreich zurückgesetzt"; +"sign_multiple_chunks_part" = "Unterzeichnung von Teil %1$li von %2$li"; +"touch_id_localized_reason" = "Verwende Touch ID, um Zugangscodes in der App zu speichern"; +"view_delegate_scan_description" = "Halte die Karte oder den Ring bis zum Ende des Vorgangs gedrückt, wie oben gezeigt"; +"view_delegate_scan_description_format" = "Tap the %@ as shown above and hold until the end of the operation"; +"view_delegate_security_delay_description" = "Um die Sicherheit zu gewährleisten, halte die Karte oder den Ring bitte bis zum Abschluss des Vorgangs angedrückt."; +"view_delegate_security_delay_description_format" = "To ensure security please hold the %@ until the operation is complete"; +"wallet_not_found" = "Sieht so aus, als hättest du die falsche Karte. Der Vorgang kann mit dieser Karte nicht durchgeführt werden."; diff --git a/TangemSdk/TangemSdk/Common/Localization/Resources/en.lproj/Localizable.strings b/TangemSdk/TangemSdk/Common/Localization/Resources/en.lproj/Localizable.strings index 0b1c9e7a2..33aafaa24 100644 --- a/TangemSdk/TangemSdk/Common/Localization/Resources/en.lproj/Localizable.strings +++ b/TangemSdk/TangemSdk/Common/Localization/Resources/en.lproj/Localizable.strings @@ -3,17 +3,22 @@ "attestation_online_failed_body" = "At the moment, online attestation of the card cannot be performed. You can continue at your own risk or try again later."; "attestation_online_failed_title" = "Online attestation failed"; "attestation_warning_attest_wallets" = "Suspicious use of the wallet on the card has been detected."; -"backup_add_backup_card_message" = "Connect your phone and the card you want to use as a backup exactly as it shown above."; +"backup_add_backup_card_message" = "Connect your phone to the card or ring you want to use as a backup, exactly as shown above."; "backup_finalize_backup_card_message_format" = "Tap the card with number %@ to your phone exactly as shown above."; +"backup_finalize_backup_ring_message" = "Tap the ring to your phone exactly as shown above."; "backup_finalize_primary_card_message_format" = "Connect your phone and the primary card with number %@ exactly as it shown above."; +"backup_finalize_primary_ring_message" = "Connect your phone and the primary ring as it shown above."; "backup_prepare_primary_card_message" = "Connect your phone and the primary card exactly as it shown above."; "backup_prepare_primary_card_message_format" = "Connect your phone and the primary card with number %@ exactly as it shown above."; "cid_format" = "Card #%@"; "common_cancel" = "Cancel"; +"common_card" = "card"; +"common_card_or_ring" = "card or ring"; "common_continue" = "Continue"; "common_error" = "Error"; "common_ok" = "OK"; "common_retry" = "Retry"; +"common_ring" = "ring"; "common_success" = "Success"; "common_understand" = "I understand"; "common_warning" = "Warning"; @@ -55,16 +60,18 @@ "reset_codes_current_card" = "Current card"; "reset_codes_linked_card" = "Linked card"; "reset_codes_message_body_backup" = "Tap the linked card"; -"reset_codes_message_body_restore" = "First, prepare the card for restore process"; +"reset_codes_message_body_restore" = "First, prepare the card or ring for restore process"; "reset_codes_message_body_restore_final" = "Tap again the card on which you want to restore the access code"; -"reset_codes_message_title_backup" = "Tap a backup card"; -"reset_codes_message_title_restore" = "Tap the card you want to restore"; -"reset_codes_scan_confirmation_card" = "Scan another linked card"; +"reset_codes_message_title_backup" = "Tap a backup card or ring"; +"reset_codes_message_title_restore" = "Tap the card or ring you want to restore"; +"reset_codes_scan_confirmation_card" = "Scan another linked card or ring"; "reset_codes_scan_first_card" = "Scan the card on which you want to reset the %@"; -"reset_codes_scan_to_reset" = "Scan card to reset user codes"; +"reset_codes_scan_to_reset" = "Scan card or ring to reset user codes"; "reset_codes_success_message" = "Code was reset successfully"; "sign_multiple_chunks_part" = "Signing part %1$li of %2$li"; "touch_id_localized_reason" = "Use Touch ID to save access codes in the app"; -"view_delegate_scan_description" = "Tap the card as shown above and hold until the end of the operation"; -"view_delegate_security_delay_description" = "To ensure security please hold the card until the operation complete"; +"view_delegate_scan_description" = "Tap the card or ring as shown above and hold until the end of the operation"; +"view_delegate_scan_description_format" = "Tap the %@ as shown above and hold until the end of the operation"; +"view_delegate_security_delay_description" = "To ensure security please hold the card or ring until the operation complete"; +"view_delegate_security_delay_description_format" = "To ensure security please hold the %@ until the operation is complete"; "wallet_not_found" = "Looks like you got the wrong card. The operation cannot be performed with this card."; diff --git a/TangemSdk/TangemSdk/Common/Localization/Resources/es.lproj/Localizable.strings b/TangemSdk/TangemSdk/Common/Localization/Resources/es.lproj/Localizable.strings new file mode 100644 index 000000000..c2ae53ec4 --- /dev/null +++ b/TangemSdk/TangemSdk/Common/Localization/Resources/es.lproj/Localizable.strings @@ -0,0 +1,77 @@ +"attestation_failed_card" = "Esta tarjeta puede ser una muestra de producción o una falsificación. Puede continuar usándola bajo su propio riesgo."; +"attestation_failed_dev_card" = "Esta es una tarjeta en desarrollo. No se puede verificar su autenticidad. No acepte esta tarjeta como medio de pago."; +"attestation_online_failed_body" = "En estos momentos no es posible realizar la certificación online de la tarjeta. Puede continuar por su cuenta y riesgo o volver a intentarlo más tarde."; +"attestation_online_failed_title" = "La certificación en línea falló"; +"attestation_warning_attest_wallets" = "Se ha detectado un uso sospechoso del monedero de la tarjeta."; +"backup_add_backup_card_message" = "Conecte su teléfono y la tarjeta que desea usar como respaldo exactamente como se muestra arriba."; +"backup_finalize_backup_card_message_format" = "Toque la tarjeta con el número %@ en su teléfono exactamente como se muestra arriba."; +"backup_finalize_backup_ring_message" = "Tap the ring to your phone exactly as shown above."; +"backup_finalize_primary_card_message_format" = "Conecte su teléfono y la placa principal con el número %@ exactamente como se muestra arriba."; +"backup_finalize_primary_ring_message" = "Connect your phone and the primary ring as it shown above."; +"backup_prepare_primary_card_message" = "Conecte su teléfono y la placa principal exactamente como se muestra arriba."; +"backup_prepare_primary_card_message_format" = "Conecte su teléfono y la placa principal con el número %@ exactamente como se muestra arriba."; +"cid_format" = "Tarjeta no. %@"; +"common_cancel" = "Cancelar"; +"common_card" = "card"; +"common_card_or_ring" = "card or ring"; +"common_continue" = "Continuar"; +"common_error" = "Error"; +"common_ok" = "OK"; +"common_retry" = "Inténtalo de nuevo"; +"common_ring" = "ring"; +"common_success" = "Con éxito"; +"common_understand" = "Entiendo"; +"common_warning" = "Cuidado"; +"error_already_created" = "La billetera ya ha sido creada"; +"error_backup_card_already_added" = "Esta tarjeta ya ha sido agregada a la lista."; +"error_backup_failed_already_created" = "Esta tarjeta no se puede usar como respaldo porque ya contiene una billetera. Asegúrese de que no haya fondos almacenados en la tarjeta escaneándola en la aplicación. Luego, restáurela a la configuración de fábrica."; +"error_backup_not_empty_wallets" = "Esta tarjeta ya tiene billetera. Si quiere continuar, primero deba restablecerlo a la configuración de fábrica."; +"error_backup_wrong_card" = "Esta tarjeta no se puede utilizar como tarjeta de respaldo. Código de error: %@."; +"error_card_verification_failed" = "Error de validación de tarjeta"; +"error_file_not_found" = "Archivo no encontrado"; +"error_no_active_backup" = "La tarjeta seleccionada no se puede utilizar para restablecer el código de acceso de la tarjeta porque no tiene una copia de seguridad. Comuníquese con el equipo de soporte."; +"error_old_card" = "Las tarjetas Tangem emitidas antes de septiembre de 2019 no pueden firmar datos usando un iPhone debido a restricciones de iOS"; +"error_pin_cannot_be_changed_format" = "%@ no se puede modificar"; +"error_pin_cannot_be_default_format" = "%@ no se puede cambiar a este valor. Por favor ingrese otro."; +"error_pin_required_format" = "%@ es obligatorio"; +"error_pin_too_short_format" = "%1$@ debe contener al menos %2$li caracteres"; +"error_purge_prohibited" = "La billetera no se puede eliminar"; +"error_reset_wrong_card" = "Esta tarjeta no se puede utilizar para recuperar códigos. Código de error: %@."; +"error_user_cancelled" = "El usuario canceló la operación."; +"error_user_code_recovery_disabled" = "No se puede restablecer el código de acceso con esta tarjeta"; +"error_wrong_card_number_with_card_id" = "Tocó otra tarjeta. Por favor toque la tarjeta %@"; +"error_wrong_card_number_without_card_id" = "Tocó otra tarjeta"; +"error_wrong_card_type" = "Esta aplicación no está diseñada para funcionar con esta tarjeta o necesita ser actualizada"; +"error_wrong_pin_format" = "Incorrecto %@"; +"generic_error_code" = "Se produjo un error durante la operación. Código: %@."; +"issuer_signature_loading_failed" = "No se pudo cargar el certificado de la tarjeta. Inténtelo nuevamente más tarde."; +"nfc_alert_default_done" = "Realizado"; +"nfc_session_timeout" = "Proceso incompleto. Para finalizar la operación, toque la tarjeta nuevamente."; +"nfc_stuck_error" = "Parece que NFC no funciona correctamente en su iPhone. Intente reiniciar su teléfono."; +"pin1" = "Código de acceso"; +"pin2" = "Contraseña"; +"pin_change_new_code_format" = "Nuevo %@"; +"pin_confirm_error_format" = "Los códigos no coinciden"; +"pin_enter" = "Escribir %@"; +"pin_reset_code_format" = "Reiniciar %@"; +"pin_set_code_confirm_format" = "Confirmar %@"; +"pin_set_code_format" = "Establecer %@"; +"reset_codes_btn_forgot_your_code" = "¿Ha olvidado su código?"; +"reset_codes_current_card" = "Tarjeta actual"; +"reset_codes_linked_card" = "Tarjeta vinculada"; +"reset_codes_message_body_backup" = "Toque la tarjeta vinculada"; +"reset_codes_message_body_restore" = "Primero, prepare la tarjeta para el proceso de restauración"; +"reset_codes_message_body_restore_final" = "Toque nuevamente la tarjeta en la que desea restaurar el código de acceso"; +"reset_codes_message_title_backup" = "Toque una tarjeta de respaldo"; +"reset_codes_message_title_restore" = "Toque la tarjeta que desea restaurar"; +"reset_codes_scan_confirmation_card" = "Escanee otra tarjeta vinculada"; +"reset_codes_scan_first_card" = "Escanee la tarjeta en la que desea restablecer la %@"; +"reset_codes_scan_to_reset" = "Escanee la tarjeta para restablecer los códigos de usuario"; +"reset_codes_success_message" = "El código se restableció correctamente"; +"sign_multiple_chunks_part" = "Parte de firma %1$li de %2$li"; +"touch_id_localized_reason" = "Use Touch ID para guardar códigos de acceso en la aplicación"; +"view_delegate_scan_description" = "Presione la tarjeta como se muestra arriba y manténgala presionada hasta que se complete la operación."; +"view_delegate_scan_description_format" = "Tap the %@ as shown above and hold until the end of the operation"; +"view_delegate_security_delay_description" = "Para garantizar la seguridad, conserve la tarjeta hasta que se complete la transacción."; +"view_delegate_security_delay_description_format" = "To ensure security please hold the %@ until the operation is complete"; +"wallet_not_found" = "Parece que se equivocó de mapa. La operación no se puede realizar con esta tarjeta."; diff --git a/TangemSdk/TangemSdk/Common/Localization/Resources/fr.lproj/Localizable.strings b/TangemSdk/TangemSdk/Common/Localization/Resources/fr.lproj/Localizable.strings index 005fe1b9a..c32764cdc 100644 --- a/TangemSdk/TangemSdk/Common/Localization/Resources/fr.lproj/Localizable.strings +++ b/TangemSdk/TangemSdk/Common/Localization/Resources/fr.lproj/Localizable.strings @@ -1,70 +1,77 @@ -"attestation_failed_card" = "This card may be production sample or counterfeit. You can continue at your own risk."; -"attestation_failed_dev_card" = "This is a development card. Its authenticity cannot be verified. Do not accept this card as a means of payment."; -"attestation_online_failed_body" = "At the moment, online attestation of the card cannot be performed. You can continue at your own risk or try again later."; -"attestation_online_failed_title" = "Online attestation failed"; -"attestation_warning_attest_wallets" = "Suspicious use of the wallet on the card has been detected."; -"backup_add_backup_card_message" = "Connect your phone and the card you want to use as a backup exactly as it shown above."; -"backup_finalize_backup_card_message_format" = "Tap the card with number %@ to your phone exactly as shown above."; -"backup_finalize_primary_card_message_format" = "Connect your phone and the primary card with number %@ exactly as it shown above."; -"backup_prepare_primary_card_message" = "Connect your phone and the primary card exactly as it shown above."; -"backup_prepare_primary_card_message_format" = "Connect your phone and the primary card with number %@ exactly as it shown above."; -"cid_format" = "Card #%@"; +"attestation_failed_card" = "Cette carte peut être un échantillon de production ou une contrefaçon. Vous pouvez continuer à vos propres risques."; +"attestation_failed_dev_card" = "Ceci est une carte de développement. Son authenticité ne peut être vérifiée. N'acceptez pas cette carte comme moyen de paiement."; +"attestation_online_failed_body" = "Pour le moment, l'attestation en ligne de la carte ne peut pas être effectuée. Vous pouvez continuer à vos propres risques ou réessayer plus tard."; +"attestation_online_failed_title" = "L'attestation en ligne a échoué"; +"attestation_warning_attest_wallets" = "Une utilisation suspecte du portefeuille sur la carte a été détectée."; +"backup_add_backup_card_message" = "Connectez votre téléphone et la carte que vous souhaitez utiliser comme sauvegarde exactement comme indiqué ci-dessus."; +"backup_finalize_backup_card_message_format" = "Appuyez la carte portant le numéro %@ sur votre téléphone exactement comme indiqué ci-dessus."; +"backup_finalize_backup_ring_message" = "Tap the ring to your phone exactly as shown above."; +"backup_finalize_primary_card_message_format" = "Connectez votre téléphone et la carte principale avec le numéro %@ exactement comme indiqué ci-dessus."; +"backup_finalize_primary_ring_message" = "Connect your phone and the primary ring as it shown above."; +"backup_prepare_primary_card_message" = "Connectez votre téléphone et la carte principale exactement comme indiqué ci-dessus."; +"backup_prepare_primary_card_message_format" = "Connectez votre téléphone et la carte principale avec le numéro %@ exactement comme indiqué ci-dessus."; +"cid_format" = "Carte n°%@"; "common_cancel" = "Annuler"; +"common_card" = "card"; +"common_card_or_ring" = "card or ring"; "common_continue" = "Continuer"; "common_error" = "Erreur"; "common_ok" = "OK"; -"common_retry" = "Retry"; +"common_retry" = "Réessayez"; +"common_ring" = "ring"; "common_success" = "Avec succès"; -"common_understand" = "I understand"; -"common_warning" = "Warning"; +"common_understand" = "Je comprends"; +"common_warning" = "Attention"; "error_already_created" = "Le portefeuille a déjà été créé"; -"error_backup_card_already_added" = "This card has already been added to the list"; -"error_backup_failed_already_created" = "This card cannot be used as a backup because it already contains a wallet. Ensure that no funds are stored on the card by scanning it in the app. Then, reset it to factory settings."; -"error_backup_not_empty_wallets" = "This card already has a wallet. If you want to proceed you have to reset it to factory settings first."; -"error_backup_wrong_card" = "This card can't be used as a backup card. Error code: %@."; +"error_backup_card_already_added" = "Cette carte a déjà été ajoutée à la liste"; +"error_backup_failed_already_created" = "Cette carte ne peut être utilisée comme sauvegarde car elle contient déjà un portefeuille. Assurez-vous qu'aucun fonds n'est stocké sur la carte en la scannant dans l'application. Ensuite, réinitialisez-le aux paramètres d'usine."; +"error_backup_not_empty_wallets" = "Cette carte possède déjà un portefeuille. Si vous souhaitez continuer, vous devez d'abord le réinitialiser aux paramètres d'usine."; +"error_backup_wrong_card" = "Cette carte ne peut être utilisée comme carte de secours. Code d'erreur: %@."; "error_card_verification_failed" = "Erreur de validation de la carte"; -"error_file_not_found" = "File not found"; -"error_no_active_backup" = "The selected card cannot be used to reset the card access code, because there is no backup on it. Please contact support team."; -"error_old_card" = "Tangem cards issued before September 2019 cannot sign data using an iPhone due to iOS restrictions"; -"error_pin_cannot_be_changed_format" = "%@ cannot be changed"; -"error_pin_cannot_be_default_format" = "%@ cannot be changed to this value. Please, enter another one."; -"error_pin_required_format" = "%@ is required"; -"error_pin_too_short_format" = "%1$@ must be at least %2$li characters long"; -"error_purge_prohibited" = "The wallet cannot be erased"; -"error_reset_wrong_card" = "This card can't be used for code recovery. Error code: %@."; +"error_file_not_found" = "Fichier introuvable"; +"error_no_active_backup" = "La carte sélectionnée ne peut être utilisée pour réinitialiser le code d'accès de la carte, car elle ne contient aucune sauvegarde. Veuillez contacter l'équipe d'assistance."; +"error_old_card" = "Les cartes Tangem émises avant septembre 2019 ne peuvent pas signer de données à l'aide d'un iPhone en raison des restrictions iOS"; +"error_pin_cannot_be_changed_format" = "%@ ne peut être modifié"; +"error_pin_cannot_be_default_format" = "%@ ne peut être modifié à cette valeur. Veuillez en saisir un autre."; +"error_pin_required_format" = "%@ est requis"; +"error_pin_too_short_format" = "%1$@ doit contenir au moins %2$li caractères"; +"error_purge_prohibited" = "Le portefeuille ne peut être effacé"; +"error_reset_wrong_card" = "Cette carte ne peut être utilisée pour la récupération de code. Code d'erreur : %@."; "error_user_cancelled" = "L'utilisateur a annulé l'opération"; -"error_user_code_recovery_disabled" = "Unable to reset the access code using this card"; -"error_wrong_card_number_with_card_id" = "You tapped a different card. Please tap card %@."; -"error_wrong_card_number_without_card_id" = "You tapped a different card"; -"error_wrong_card_type" = "This application is not designed to work with this card or needs to be updated"; -"error_wrong_pin_format" = "Wrong %@"; +"error_user_code_recovery_disabled" = "Impossible de réinitialiser le code d'accès à l'aide de cette carte"; +"error_wrong_card_number_with_card_id" = "Vous avez tapé une autre carte. Veuillez appuyer sur la carte %@."; +"error_wrong_card_number_without_card_id" = "Vous avez tapé une autre carte"; +"error_wrong_card_type" = "Cette application n'est pas conçue pour fonctionner avec cette carte ou doit être mise à jour"; +"error_wrong_pin_format" = "Incorrect %@"; "generic_error_code" = "Une erreur s'est produite lors de l'opération. Code : %@."; -"issuer_signature_loading_failed" = "Couldn't load the card's certificate. Please try again later."; +"issuer_signature_loading_failed" = "Impossible de charger le certificat de la carte. Veuillez réessayer plus tard."; "nfc_alert_default_done" = "Exécuté"; -"nfc_session_timeout" = "Incomplete process. To finalize the operation, kindly tap the card again"; -"nfc_stuck_error" = "It seems that NFC does not work properly on your iPhone. Try to reboot your phone."; +"nfc_session_timeout" = "Processus incomplet. Pour finaliser l'opération, veuillez appuyer à nouveau sur la carte"; +"nfc_stuck_error" = "Il semble que le NFC ne fonctionne pas correctement sur votre iPhone. Essayez de redémarrer votre téléphone."; "pin1" = "Code d'accès"; "pin2" = "Mot de passe"; "pin_change_new_code_format" = "Nouveau %@"; -"pin_confirm_error_format" = "Codes ne correspondent pas"; +"pin_confirm_error_format" = "Les codes ne correspondent pas"; "pin_enter" = "Saisir %@"; -"pin_reset_code_format" = "Reset %@"; +"pin_reset_code_format" = "Réinitialiser %@"; "pin_set_code_confirm_format" = "Confirmer %@"; -"pin_set_code_format" = "Modifier %@"; -"reset_codes_btn_forgot_your_code" = "Forgot your code?"; -"reset_codes_current_card" = "Current card"; -"reset_codes_linked_card" = "Linked card"; -"reset_codes_message_body_backup" = "Tap the linked card"; -"reset_codes_message_body_restore" = "First, prepare the card for restore process"; -"reset_codes_message_body_restore_final" = "Tap again the card on which you want to restore the access code"; -"reset_codes_message_title_backup" = "Tap a backup card"; -"reset_codes_message_title_restore" = "Tap the card you want to restore"; -"reset_codes_scan_confirmation_card" = "Scan another linked card"; -"reset_codes_scan_first_card" = "Scan the card on which you want to reset the %@"; -"reset_codes_scan_to_reset" = "Scan card to reset user codes"; -"reset_codes_success_message" = "Code was reset successfully"; -"sign_multiple_chunks_part" = "Signing part %1$li of %2$li"; -"touch_id_localized_reason" = "Use Touch ID to save access codes in the app"; -"view_delegate_scan_description" = "Tap the card as shown above and hold until the end of the operation"; -"view_delegate_security_delay_description" = "To ensure security please hold the card until the operation complete"; -"wallet_not_found" = "Looks like you got the wrong card. The operation cannot be performed with this card."; +"pin_set_code_format" = "Régler %@"; +"reset_codes_btn_forgot_your_code" = "Vous avez oublié votre code ?"; +"reset_codes_current_card" = "Carte actuelle"; +"reset_codes_linked_card" = "Carte liée"; +"reset_codes_message_body_backup" = "Appuyez sur la carte liée"; +"reset_codes_message_body_restore" = "Tout d’abord, préparez la carte pour le processus de restauration"; +"reset_codes_message_body_restore_final" = "Appuyez à nouveau sur la carte sur laquelle vous souhaitez restaurer le code d'accès"; +"reset_codes_message_title_backup" = "Appuyez sur une carte de sauvegarde"; +"reset_codes_message_title_restore" = "Appuyez sur la carte que vous souhaitez restaurer"; +"reset_codes_scan_confirmation_card" = "Scanner une autre carte liée"; +"reset_codes_scan_first_card" = "Scannez la carte sur laquelle vous souhaitez réinitialiser la %@"; +"reset_codes_scan_to_reset" = "Scannez la carte pour réinitialiser les codes utilisateur"; +"reset_codes_success_message" = "Le code a été réinitialisé avec succès"; +"sign_multiple_chunks_part" = "Signature de la partie %1$li de %2$li"; +"touch_id_localized_reason" = "Utilisez Touch ID pour enregistrer les codes d'accès dans l'application"; +"view_delegate_scan_description" = "Appuyez sur la carte comme indiqué ci-dessus et maintenez jusqu'à la fin de l'opération"; +"view_delegate_scan_description_format" = "Tap the %@ as shown above and hold until the end of the operation"; +"view_delegate_security_delay_description" = "Pour garantir la sécurité, veuillez conserver la carte jusqu'à ce que l'opération soit terminée."; +"view_delegate_security_delay_description_format" = "To ensure security please hold the %@ until the operation is complete"; +"wallet_not_found" = "On dirait que vous vous êtes trompé de carte. L'opération ne peut pas être effectuée avec cette carte."; diff --git a/TangemSdk/TangemSdk/Common/Localization/Resources/it.lproj/Localizable.strings b/TangemSdk/TangemSdk/Common/Localization/Resources/it.lproj/Localizable.strings index 29e633762..28dfc12aa 100644 --- a/TangemSdk/TangemSdk/Common/Localization/Resources/it.lproj/Localizable.strings +++ b/TangemSdk/TangemSdk/Common/Localization/Resources/it.lproj/Localizable.strings @@ -3,17 +3,22 @@ "attestation_online_failed_body" = "At the moment, online attestation of the card cannot be performed. You can continue at your own risk or try again later."; "attestation_online_failed_title" = "Online attestation failed"; "attestation_warning_attest_wallets" = "Suspicious use of the wallet on the card has been detected."; -"backup_add_backup_card_message" = "Connect your phone and the card you want to use as a backup exactly as it shown above."; +"backup_add_backup_card_message" = "Connect your phone to the card or ring you want to use as a backup, exactly as shown above."; "backup_finalize_backup_card_message_format" = "Tap the card with number %@ to your phone exactly as shown above."; +"backup_finalize_backup_ring_message" = "Tap the ring to your phone exactly as shown above."; "backup_finalize_primary_card_message_format" = "Connect your phone and the primary card with number %@ exactly as it shown above."; +"backup_finalize_primary_ring_message" = "Connect your phone and the primary ring as it shown above."; "backup_prepare_primary_card_message" = "Connect your phone and the primary card exactly as it shown above."; "backup_prepare_primary_card_message_format" = "Connect your phone and the primary card with number %@ exactly as it shown above."; "cid_format" = "Card #%@"; "common_cancel" = "Annulla"; +"common_card" = "card"; +"common_card_or_ring" = "card or ring"; "common_continue" = "Continua"; "common_error" = "Errore"; "common_ok" = "OK"; "common_retry" = "Retry"; +"common_ring" = "ring"; "common_success" = "Con successo"; "common_understand" = "I understand"; "common_warning" = "Warning"; @@ -55,16 +60,18 @@ "reset_codes_current_card" = "Current card"; "reset_codes_linked_card" = "Linked card"; "reset_codes_message_body_backup" = "Tap the linked card"; -"reset_codes_message_body_restore" = "First, prepare the card for restore process"; +"reset_codes_message_body_restore" = "First, prepare the card or ring for restore process"; "reset_codes_message_body_restore_final" = "Tap again the card on which you want to restore the access code"; -"reset_codes_message_title_backup" = "Tap a backup card"; -"reset_codes_message_title_restore" = "Tap the card you want to restore"; -"reset_codes_scan_confirmation_card" = "Scan another linked card"; +"reset_codes_message_title_backup" = "Tap a backup card or ring"; +"reset_codes_message_title_restore" = "Tap the card or ring you want to restore"; +"reset_codes_scan_confirmation_card" = "Scan another linked card or ring"; "reset_codes_scan_first_card" = "Scan the card on which you want to reset the %@"; -"reset_codes_scan_to_reset" = "Scan card to reset user codes"; +"reset_codes_scan_to_reset" = "Scan card or ring to reset user codes"; "reset_codes_success_message" = "Code was reset successfully"; "sign_multiple_chunks_part" = "Signing part %1$li of %2$li"; "touch_id_localized_reason" = "Use Touch ID to save access codes in the app"; -"view_delegate_scan_description" = "Tap the card as shown above and hold until the end of the operation"; -"view_delegate_security_delay_description" = "To ensure security please hold the card until the operation complete"; +"view_delegate_scan_description" = "Tap the card or ring as shown above and hold until the end of the operation"; +"view_delegate_scan_description_format" = "Tap the %@ as shown above and hold until the end of the operation"; +"view_delegate_security_delay_description" = "To ensure security please hold the card or ring until the operation complete"; +"view_delegate_security_delay_description_format" = "To ensure security please hold the %@ until the operation is complete"; "wallet_not_found" = "Looks like you got the wrong card. The operation cannot be performed with this card."; diff --git a/TangemSdk/TangemSdk/Common/Localization/Resources/ja.lproj/Localizable.strings b/TangemSdk/TangemSdk/Common/Localization/Resources/ja.lproj/Localizable.strings new file mode 100644 index 000000000..fd618abba --- /dev/null +++ b/TangemSdk/TangemSdk/Common/Localization/Resources/ja.lproj/Localizable.strings @@ -0,0 +1,77 @@ +"attestation_failed_card" = "このカードは、製造サンプルまたは偽造品である可能性があります。自己責任で続行してください。"; +"attestation_failed_dev_card" = "これは開発カードです。真正性は確認できません。このカードを支払い手段として使用しないでください。"; +"attestation_online_failed_body" = "現在、カードのオンライン認証は実行できません。自己責任で続行するか、後でもう一度お試しください。"; +"attestation_online_failed_title" = "オンライン認証に失敗しました"; +"attestation_warning_attest_wallets" = "カードのウォレットの不審な使用が検出されました。"; +"backup_add_backup_card_message" = "スマートフォンとバックアップとして使用したいカードを、上記のとおりに接続してください。"; +"backup_finalize_backup_card_message_format" = "上図のように、番号%@のカードをスマートフォンにタップしてください。"; +"backup_finalize_backup_ring_message" = "Tap the ring to your phone exactly as shown above."; +"backup_finalize_primary_card_message_format" = "お使いのスマートフォンと番号%@のプライマリカードを、上記のように接続してください。"; +"backup_finalize_primary_ring_message" = "Connect your phone and the primary ring as it shown above."; +"backup_prepare_primary_card_message" = "スマートフォンとプライマリカードを上記のとおりに接続してください。"; +"backup_prepare_primary_card_message_format" = "お使いのスマートフォンと番号%@のプライマリカードを、上記のように接続してください。"; +"cid_format" = "カード番号%@"; +"common_cancel" = "キャンセル"; +"common_card" = "card"; +"common_card_or_ring" = "card or ring"; +"common_continue" = "続ける"; +"common_error" = "エラー"; +"common_ok" = "わかりました"; +"common_retry" = "再試行"; +"common_ring" = "ring"; +"common_success" = "成功"; +"common_understand" = "わかりました"; +"common_warning" = "警告"; +"error_already_created" = "ウォレットはすでに作成されています"; +"error_backup_card_already_added" = "このカードはすでにリストに追加されています"; +"error_backup_failed_already_created" = "このカードにはすでにウォレットが含まれているため、バックアップとして使用することはできません。アプリでカードをスキャンして、カードに資金が保存されていないことを確認してください。その後、工場出荷時の設定にリセットしてください。"; +"error_backup_not_empty_wallets" = "このカードにはすでにウォレットがあります。続行するには、まず工場出荷時の設定にリセットする必要があります。"; +"error_backup_wrong_card" = "このカードはバックアップカードとして使用できません。エラー コード: %@ 。"; +"error_card_verification_failed" = "カード認証に失敗しました"; +"error_file_not_found" = "ファイルが見つかりません"; +"error_no_active_backup" = "選択したカードにはバックアップがないため、カードのアクセスコードをリセットすることはできません。サポートチームにお問い合わせください。"; +"error_old_card" = "2019年9月以前に発行されたTangemカードは、iOSの制限によりiPhoneを使用してデータに署名できません。"; +"error_pin_cannot_be_changed_format" = "%@ は変更できません"; +"error_pin_cannot_be_default_format" = "%@ はこの値に変更できません。別の値を入力してください。"; +"error_pin_required_format" = "%@ が必要です"; +"error_pin_too_short_format" = "%1$@ は %2$li 文字以上でなければなりません"; +"error_purge_prohibited" = "ウォレットは消去できません"; +"error_reset_wrong_card" = "このカードはコード回復には使用できません。エラー コード: %@ 。"; +"error_user_cancelled" = "ユーザーが操作をキャンセルしました"; +"error_user_code_recovery_disabled" = "このカードを使用してアクセスコードをリセットできません"; +"error_wrong_card_number_with_card_id" = "別のカードをタップしました。カード%@をタップしてください。"; +"error_wrong_card_number_without_card_id" = "別のカードをタップしました"; +"error_wrong_card_type" = "このアプリケーションはこのカードで動作するように設計されていないか、更新する必要があります"; +"error_wrong_pin_format" = "間違っています%@"; +"generic_error_code" = "操作中にエラーが発生しました。コード: %@ 。"; +"issuer_signature_loading_failed" = "カードの証明書を読み込めませんでした。しばらくしてからもう一度お試しください。"; +"nfc_alert_default_done" = "完了"; +"nfc_session_timeout" = "処理が完了していません。操作を完了するには、カードをもう一度タップしてください。"; +"nfc_stuck_error" = "iPhoneでNFCが正しく動作していないようです。デバイスを再起動してみてください。"; +"pin1" = "アクセスコード"; +"pin2" = "パスコード"; +"pin_change_new_code_format" = "新しい%@"; +"pin_confirm_error_format" = "コードが一致しません"; +"pin_enter" = "%@を入力"; +"pin_reset_code_format" = "%@をリセット"; +"pin_set_code_confirm_format" = "%@を確認"; +"pin_set_code_format" = "%@を設定"; +"reset_codes_btn_forgot_your_code" = "コードをお忘れですか?"; +"reset_codes_current_card" = "現在のカード"; +"reset_codes_linked_card" = "リンクされたカード"; +"reset_codes_message_body_backup" = "リンクされたカードをタップしてください"; +"reset_codes_message_body_restore" = "まず、復元処理のためにカードを準備してください"; +"reset_codes_message_body_restore_final" = "アクセスコードを復元したいカードを、もう一度タップしてください"; +"reset_codes_message_title_backup" = "バックアップカードをタップしてください"; +"reset_codes_message_title_restore" = "復元したいカードをタップしてください"; +"reset_codes_scan_confirmation_card" = "別のリンクされたカードをスキャンしてください"; +"reset_codes_scan_first_card" = "%@をリセットしたいカードをスキャンしてください"; +"reset_codes_scan_to_reset" = "カードをスキャンしてユーザーコードをリセットしてください"; +"reset_codes_success_message" = "コードは正常にリセットされました"; +"sign_multiple_chunks_part" = "%2$liのうち%1$li部分に署名しています"; +"touch_id_localized_reason" = "Touch IDを使用して、アプリにアクセスコードを保存します"; +"view_delegate_scan_description" = "上記のようにカードをタップし、操作が完了するまでホールドし続けます。"; +"view_delegate_scan_description_format" = "Tap the %@ as shown above and hold until the end of the operation"; +"view_delegate_security_delay_description" = "セキュリティを確保するため、操作が完了するまでカードをホールドしてください。"; +"view_delegate_security_delay_description_format" = "To ensure security please hold the %@ until the operation is complete"; +"wallet_not_found" = "カードが間違っているようです。このカードでは操作を実行できません。"; diff --git a/TangemSdk/TangemSdk/Common/Localization/Resources/ru.lproj/Localizable.strings b/TangemSdk/TangemSdk/Common/Localization/Resources/ru.lproj/Localizable.strings index c847c6a8f..758110cdb 100644 --- a/TangemSdk/TangemSdk/Common/Localization/Resources/ru.lproj/Localizable.strings +++ b/TangemSdk/TangemSdk/Common/Localization/Resources/ru.lproj/Localizable.strings @@ -3,23 +3,28 @@ "attestation_online_failed_body" = "В настоящее время онлайн аттестация карты не может быть выполнена. Вы можете продолжить на свой страх и риск или повторить попытку."; "attestation_online_failed_title" = "Онлайн-аттестация не удалась"; "attestation_warning_attest_wallets" = "Обнаружено подозрительное использование кошелька на карте."; -"backup_add_backup_card_message" = "Соедините телефон и карту, которую вы хотите использовать в качестве резервной, в точности, как показано выше."; +"backup_add_backup_card_message" = "Соедините телефон с картой или кольцом, которые вы хотите использовать в качестве резервных, точно так, как показано выше."; "backup_finalize_backup_card_message_format" = "Поднесите карту с номером %@ к телефону в точности, как показано выше."; +"backup_finalize_backup_ring_message" = "Поднесите кольцо к телефону в точности, как показано выше."; "backup_finalize_primary_card_message_format" = "Соедините телефон и основную карту с номером %@ в точности, как показано выше."; +"backup_finalize_primary_ring_message" = "Соедините телефон и основное кольцо в точности, как показано выше."; "backup_prepare_primary_card_message" = "Соедините телефон и основную карту в точности, как показано выше."; "backup_prepare_primary_card_message_format" = "Соедините телефон и основную карту с номером %@ в точности, как показано выше."; "cid_format" = "Карта #%@"; "common_cancel" = "Отменить"; +"common_card" = "карту"; +"common_card_or_ring" = "кольцо или карту"; "common_continue" = "Продолжить"; "common_error" = "Ошибка"; "common_ok" = "OK"; "common_retry" = "Повторить"; +"common_ring" = "кольцо"; "common_success" = "Успешно"; "common_understand" = "Я понимаю"; "common_warning" = "Предупреждение"; "error_already_created" = "Кошелек уже создан"; "error_backup_card_already_added" = "Эта карта уже добавлена в список"; -"error_backup_failed_already_created" = "Резервное копирование не возможно, на выбранной карте уже создан кошелек. Пожалуйста, убедитесь, что на этой карте нет средств, отсканировав её в приложении, и затем сбросьте её до заводских настроек."; +"error_backup_failed_already_created" = "Резервное копирование невозможно, на выбранной карте уже создан кошелек. Пожалуйста, убедитесь, что на этой карте нет средств, отсканировав её в приложении, и затем сбросьте её до заводских настроек."; "error_backup_not_empty_wallets" = "На этой карте уже создан кошелёк. Если вы хотите продолжить, сбросьте карту к заводским настройкам."; "error_backup_wrong_card" = "Эту карту нельзя использовать для резервного копирования. Код ошибки: %@."; "error_card_verification_failed" = "Ошибка проверки карты"; @@ -55,16 +60,18 @@ "reset_codes_current_card" = "Текущая карта"; "reset_codes_linked_card" = "Связанная карта"; "reset_codes_message_body_backup" = "Приложите связанную карту"; -"reset_codes_message_body_restore" = "Сначала подготовьте карту к процессу восстановления"; +"reset_codes_message_body_restore" = "Сначала подготовьте карту или кольцо к процессу восстановления"; "reset_codes_message_body_restore_final" = "Приложите еще раз карту, на которой хотите восстановить код доступа"; -"reset_codes_message_title_backup" = "Приложите резервную карту"; -"reset_codes_message_title_restore" = "Отсканируйте карту, которую хотите восстановить"; -"reset_codes_scan_confirmation_card" = "Отсканируйте другую привязанную карту"; +"reset_codes_message_title_backup" = "Приложите резервную карту или кольцо"; +"reset_codes_message_title_restore" = "Отсканируйте карту или кольцо, которую хотите восстановить"; +"reset_codes_scan_confirmation_card" = "Отсканируйте другую привязанную карту или кольцо"; "reset_codes_scan_first_card" = "Отсканируйте карту, на которой вы хотите сбросить %@"; -"reset_codes_scan_to_reset" = "Отсканируйте карту для сброса кода"; +"reset_codes_scan_to_reset" = "Отсканируйте карту или кольцо для сброса кода"; "reset_codes_success_message" = "Код успешно сброшен"; "sign_multiple_chunks_part" = "Подпись части %1$li из %2$li"; "touch_id_localized_reason" = "Используйте Touch ID для сохранения кодов доступа в приложении"; -"view_delegate_scan_description" = "Поднесите карту, как показано выше, и удерживайте до конца операции"; -"view_delegate_security_delay_description" = "Пожалуйста, удерживайте карту до завершения операции"; +"view_delegate_scan_description" = "Поднесите карту или кольцо, как показано выше, и удерживайте до конца операции"; +"view_delegate_scan_description_format" = "Поднесите %@, как показано выше, и удерживайте до конца операции"; +"view_delegate_security_delay_description" = "Пожалуйста, удерживайте карту или кольцо до завершения операции"; +"view_delegate_security_delay_description_format" = "Пожалуйста, удерживайте %@ до завершения операции"; "wallet_not_found" = "Кажется, вы ошиблись картой. Операция не может быть выполнена с этой картой."; diff --git a/TangemSdk/TangemSdk/Common/Localization/Resources/uk-UA.lproj/Localizable.strings b/TangemSdk/TangemSdk/Common/Localization/Resources/uk-UA.lproj/Localizable.strings new file mode 100644 index 000000000..7a07e6482 --- /dev/null +++ b/TangemSdk/TangemSdk/Common/Localization/Resources/uk-UA.lproj/Localizable.strings @@ -0,0 +1,77 @@ +"attestation_failed_card" = "Ця картка – тестовий зразок або підробка. Ви можете продовжувати на свій страх і ризик."; +"attestation_failed_dev_card" = "Ця картка призначена для тестових цілей. Її автентичність не може бути перевірена. Не приймайте цю карту як засіб оплати."; +"attestation_online_failed_body" = "Наразі онлайн-атестація картки неможлива. Ви можете продовжити на свій страх і ризик або спробувати ще раз."; +"attestation_online_failed_title" = "Онлайн-атестація не вдалася"; +"attestation_warning_attest_wallets" = "Виявлено підозріле використання гаманця на картці."; +"backup_add_backup_card_message" = "З'єднайте телефон і картку, яку ви хочете використати як резервну, точно так, як показано вище."; +"backup_finalize_backup_card_message_format" = "Піднесіть картку з номером %@ до телефону точно так, як показано вище."; +"backup_finalize_backup_ring_message" = "Tap the ring to your phone exactly as shown above."; +"backup_finalize_primary_card_message_format" = "З'єднайте телефон і основну картку з номером %@ точно так, як показано вище."; +"backup_finalize_primary_ring_message" = "Connect your phone and the primary ring as it shown above."; +"backup_prepare_primary_card_message" = "З'єднайте телефон і основну картку точно так, як показано вище."; +"backup_prepare_primary_card_message_format" = "З'єднайте телефон і основну картку з номером %@ точно так, як показано вище."; +"cid_format" = "Картка #%@"; +"common_cancel" = "Скасувати"; +"common_card" = "card"; +"common_card_or_ring" = "card or ring"; +"common_continue" = "Продовжити"; +"common_error" = "Помилка"; +"common_ok" = "OK"; +"common_retry" = "Повторити"; +"common_ring" = "ring"; +"common_success" = "Успішно"; +"common_understand" = "Я розумію"; +"common_warning" = "Попередження"; +"error_already_created" = "Гаманець вже створено"; +"error_backup_card_already_added" = "Цю картку вже додано до списку"; +"error_backup_failed_already_created" = "Резервне копіювання неможливе, на обраній картці вже створено гаманець. Будь ласка, переконайтеся, що на цій картці немає коштів, відсканувавши її в додатку, а потім скиньте до заводських налаштувань."; +"error_backup_not_empty_wallets" = "На цій картці вже створено гаманець. Якщо ви хочете продовжити, скиньте картку до заводських налаштувань."; +"error_backup_wrong_card" = "Цю картку не можна використовувати для резервного копіювання. Код помилки: %@."; +"error_card_verification_failed" = "Помилка перевірки картки"; +"error_file_not_found" = "Файл не знайдено"; +"error_no_active_backup" = "Обрана картка не може бути використана для скидання коду доступу картки, оскільки на ній не створено резервну копію. Будь ласка, зверніться до служби підтримки."; +"error_old_card" = "Картки Tangem, випущені до вересня 2019 року, не можуть підписувати дані за допомогою iPhone через обмеження iOS."; +"error_pin_cannot_be_changed_format" = "%@ не може бути змінений"; +"error_pin_cannot_be_default_format" = "%@ не можна змінити на це значення. Будь ласка, введіть інше"; +"error_pin_required_format" = "Введіть %@"; +"error_pin_too_short_format" = "%1$@ має складатися не менше ніж із %2$li символів."; +"error_purge_prohibited" = "Гаманець не може бути видалений"; +"error_reset_wrong_card" = "Цю картку не можна використовувати для відновлення коду. Код помилки: %@."; +"error_user_cancelled" = "Користувач скасував операцію"; +"error_user_code_recovery_disabled" = "Неможливо скинути код доступу, використовуючи цю картку"; +"error_wrong_card_number_with_card_id" = "Ви торкнулися іншою карткою. Будь ласка, прикладіть карту %@."; +"error_wrong_card_number_without_card_id" = "Ви торкнулися іншою карткою"; +"error_wrong_card_type" = "Цей застосунок не призначений для роботи з цією карткою або потребує оновлення"; +"error_wrong_pin_format" = "Невірний %@"; +"generic_error_code" = "Під час операції сталася помилка. Код: %@."; +"issuer_signature_loading_failed" = "Не вдалося завантажити сертифікат картки. Будь ласка, повторіть спробу пізніше."; +"nfc_alert_default_done" = "Готово"; +"nfc_session_timeout" = "Процес не завершено. Щоб завершити операцію, прикладіть картку ще раз"; +"nfc_stuck_error" = "Судячи з усього, NFC не працює належним чином на вашому iPhone. Спробуйте перезавантажити телефон."; +"pin1" = "Код доступу"; +"pin2" = "Пароль"; +"pin_change_new_code_format" = "Новий %@"; +"pin_confirm_error_format" = "Коди не збігаються"; +"pin_enter" = "Введіть %@"; +"pin_reset_code_format" = "Скинути %@"; +"pin_set_code_confirm_format" = "Підтвердити %@"; +"pin_set_code_format" = "Встановити %@"; +"reset_codes_btn_forgot_your_code" = "Забули код?"; +"reset_codes_current_card" = "Поточна картка"; +"reset_codes_linked_card" = "Пов'язана картка"; +"reset_codes_message_body_backup" = "Прикладіть пов'язану картку"; +"reset_codes_message_body_restore" = "Спочатку підготуйте картку до процесу відновлення"; +"reset_codes_message_body_restore_final" = "Знову прикладіть картку, на якій потрібно відновити код доступу"; +"reset_codes_message_title_backup" = "Прикладіть резервну картку"; +"reset_codes_message_title_restore" = "Відскануйте картку, яку потрібно відновити"; +"reset_codes_scan_confirmation_card" = "Відскануйте іншу пов'язану картку"; +"reset_codes_scan_first_card" = "Відскануйте картку, на якій потрібно скинути %@"; +"reset_codes_scan_to_reset" = "Відскануйте картку, щоб скинути код"; +"reset_codes_success_message" = "Код успішно скинуто"; +"sign_multiple_chunks_part" = "Підпис частини %1$li з %2$li"; +"touch_id_localized_reason" = "Використовуйте Touch ID для збереження кодів доступу в додатку"; +"view_delegate_scan_description" = "Піднесіть картку, як показано вище, і утримуйте до кінця операції"; +"view_delegate_scan_description_format" = "Tap the %@ as shown above and hold until the end of the operation"; +"view_delegate_security_delay_description" = "Будь ласка, утримуйте картку до завершення операції"; +"view_delegate_security_delay_description_format" = "To ensure security please hold the %@ until the operation is complete"; +"wallet_not_found" = "Здається, ви помилилися карткою. Операція не може бути виконана з цією карткою."; diff --git a/TangemSdk/TangemSdk/Common/Localization/Resources/zh-Hant.lproj/Localizable.strings b/TangemSdk/TangemSdk/Common/Localization/Resources/zh-Hant.lproj/Localizable.strings index a5d0b3514..57d92594d 100644 --- a/TangemSdk/TangemSdk/Common/Localization/Resources/zh-Hant.lproj/Localizable.strings +++ b/TangemSdk/TangemSdk/Common/Localization/Resources/zh-Hant.lproj/Localizable.strings @@ -5,15 +5,20 @@ "attestation_warning_attest_wallets" = "Suspicious use of the wallet on the card has been detected."; "backup_add_backup_card_message" = "完全按照上圖所示連接手機和要用作備份的卡"; "backup_finalize_backup_card_message_format" = "Tap the card with number %@ to your phone exactly as shown above."; +"backup_finalize_backup_ring_message" = "Tap the ring to your phone exactly as shown above."; "backup_finalize_primary_card_message_format" = "完全按照上面顯示的方式連接您的手機和編號為 %@ 的主卡"; +"backup_finalize_primary_ring_message" = "Connect your phone and the primary ring as it shown above."; "backup_prepare_primary_card_message" = "完全按照上圖所示連接手機和主卡"; "backup_prepare_primary_card_message_format" = "完全按照上面顯示的方式連接您的手機和編號為 %@ 的主卡"; "cid_format" = "卡片 #%@"; "common_cancel" = "取消"; +"common_card" = "card"; +"common_card_or_ring" = "card or ring"; "common_continue" = "繼續"; "common_error" = "錯誤"; "common_ok" = "OK"; "common_retry" = "重試"; +"common_ring" = "ring"; "common_success" = "成功"; "common_understand" = "我明白"; "common_warning" = "警告"; @@ -66,5 +71,7 @@ "sign_multiple_chunks_part" = "簽署第 %1$li 部分,共 %2$li"; "touch_id_localized_reason" = "使用 Touch ID 在應用程序中保存訪問密碼"; "view_delegate_scan_description" = "如上圖觸碰卡片並按住直到操作結束"; +"view_delegate_scan_description_format" = "Tap the %@ as shown above and hold until the end of the operation"; "view_delegate_security_delay_description" = "為確保安全,請持有卡直至操作完成"; +"view_delegate_security_delay_description_format" = "To ensure security please hold the %@ until the operation is complete"; "wallet_not_found" = "Looks like you got the wrong card. The operation cannot be performed with this card."; diff --git a/TangemSdk/TangemSdk/Common/Log/Log.swift b/TangemSdk/TangemSdk/Common/Log/Log.swift index a7a816262..dc258ec88 100644 --- a/TangemSdk/TangemSdk/Common/Log/Log.swift +++ b/TangemSdk/TangemSdk/Common/Log/Log.swift @@ -165,7 +165,6 @@ public extension Log { } } // MARK:- Log formatter helpers -@available(iOS 13.0, *) extension Log { static func sendCommand(_ commandObject: AnyObject) { let commandName = "\(commandObject)".remove("TangemSdk.").remove("Command") diff --git a/TangemSdk/TangemSdk/Common/Log/TlvLogging.swift b/TangemSdk/TangemSdk/Common/Log/TlvLogging.swift index 9451e5b4f..5042d94e9 100644 --- a/TangemSdk/TangemSdk/Common/Log/TlvLogging.swift +++ b/TangemSdk/TangemSdk/Common/Log/TlvLogging.swift @@ -8,12 +8,10 @@ import Foundation -@available(iOS 13.0, *) protocol TlvLogging { func logTlv(_ tlv: Tlv, _ value: T) } -@available(iOS 13.0, *) extension TlvLogging { func logTlv(_ tlv: Tlv, _ value: T) { var tlvString = "\(tlv)" diff --git a/TangemSdk/TangemSdk/Common/NFC/CardReader.swift b/TangemSdk/TangemSdk/Common/NFC/CardReader.swift index 2cf157e73..4ee0dbc21 100644 --- a/TangemSdk/TangemSdk/Common/NFC/CardReader.swift +++ b/TangemSdk/TangemSdk/Common/NFC/CardReader.swift @@ -28,7 +28,6 @@ public enum NFCTagType: Equatable, CustomStringConvertible { /// Allows interaction between the phone or any other terminal and Tangem card. /// Its default implementation, `NfcReader`, is in our module. -@available(iOS 13.0, *) public protocol CardReader: AnyObject { /// For setting alertMessage into NFC popup var isPaused: Bool { get } @@ -36,7 +35,7 @@ public protocol CardReader: AnyObject { var alertMessage: String { get set } var tag: CurrentValueSubject { get } var viewEventsPublisher: CurrentValueSubject { get } - func startSession(with message: String?) + func startSession(with message: String) func resumeSession() func stopSession(with errorMessage: String?) func pauseSession(with errorMessage: String?) @@ -45,12 +44,7 @@ public protocol CardReader: AnyObject { func restartPolling(silent: Bool) } -@available(iOS 13.0, *) public extension CardReader { - func startSession(with message: String? = nil) { - startSession(with: message) - } - func pauseSession(with errorMessage: String? = nil) { pauseSession(with: errorMessage) } diff --git a/TangemSdk/TangemSdk/Common/NFC/NFCReader.swift b/TangemSdk/TangemSdk/Common/NFC/NFCReader.swift index cedf26244..10ef1e6ce 100644 --- a/TangemSdk/TangemSdk/Common/NFC/NFCReader.swift +++ b/TangemSdk/TangemSdk/Common/NFC/NFCReader.swift @@ -12,7 +12,6 @@ import CoreNFC import UIKit /// Provides NFC communication between an application and Tangem card. -@available(iOS 13.0, *) final class NFCReader: NSObject { var viewEventsPublisher = CurrentValueSubject(.none) private(set) var tag = CurrentValueSubject(.none) @@ -105,7 +104,6 @@ final class NFCReader: NSObject { } //MARK: CardReader -@available(iOS 13.0, *) extension NFCReader: CardReader { var alertMessage: String { get { return _alertMessage ?? "" } @@ -121,7 +119,7 @@ extension NFCReader: CardReader { } /// Start session and try to connect with tag - func startSession(with message: String?) { + func startSession(with message: String) { Log.nfc("Start NFC session") bag = Set() isPaused = false @@ -135,8 +133,7 @@ extension NFCReader: CardReader { firstConnectionTS = nil sessionDidBecomeActiveTS = Date() - let alertMessage = message ?? "view_delegate_scan_description".localized - _alertMessage = alertMessage + _alertMessage = message let isExistingSessionActive = readerSession?.isReady ?? false if !isExistingSessionActive { @@ -250,7 +247,7 @@ extension NFCReader: CardReader { func resumeSession() { Log.nfc("Resume reader session invoked") isPaused = false - startSession(with: _alertMessage) + startSession(with: _alertMessage ?? "") } func pauseSession(with errorMessage: String? = nil) { @@ -501,7 +498,6 @@ extension NFCReader: CardReader { } //MARK: NFCTagReaderSessionDelegate -@available(iOS 13.0, *) extension NFCReader: NFCTagReaderSessionDelegate { func tagReaderSessionDidBecomeActive(_ session: NFCTagReaderSession) { sessionDidBecomeActiveTS = Date() @@ -554,7 +550,6 @@ extension NFCReader: NFCTagReaderSessionDelegate { } //MARK: Constants -@available(iOS 13.0, *) extension NFCReader { enum Constants { static let tagTimeout = 20.0 diff --git a/TangemSdk/TangemSdk/Common/NFC/NFCUtils.swift b/TangemSdk/TangemSdk/Common/NFC/NFCUtils.swift index ed386670b..6985e5627 100644 --- a/TangemSdk/TangemSdk/Common/NFC/NFCUtils.swift +++ b/TangemSdk/TangemSdk/Common/NFC/NFCUtils.swift @@ -15,11 +15,7 @@ public class NFCUtils { public static var isNFCAvailable: Bool { if NSClassFromString("NFCNDEFReaderSession") == nil { return false } - if #available(iOS 13.0, *) { - return NFCNDEFReaderSession.readingAvailable - } else { - return false - } + return NFCNDEFReaderSession.readingAvailable } public static var isPoorNfcQualityDevice: Bool { diff --git a/TangemSdk/TangemSdk/Common/Network/NetworkService.swift b/TangemSdk/TangemSdk/Common/Network/NetworkService.swift index 0aec5aad8..15152ee78 100644 --- a/TangemSdk/TangemSdk/Common/Network/NetworkService.swift +++ b/TangemSdk/TangemSdk/Common/Network/NetworkService.swift @@ -46,7 +46,6 @@ public enum NetworkServiceError: Error, LocalizedError { } } -@available(iOS 13.0, *) public class NetworkService { private let configuration: URLSessionConfiguration? diff --git a/TangemSdk/TangemSdk/Common/Network/TangemEndpoint.swift b/TangemSdk/TangemSdk/Common/Network/TangemEndpoint.swift index e31fc238c..751c8535a 100644 --- a/TangemSdk/TangemSdk/Common/Network/TangemEndpoint.swift +++ b/TangemSdk/TangemSdk/Common/Network/TangemEndpoint.swift @@ -8,7 +8,6 @@ import Foundation -@available(iOS 13.0, *) public enum TangemEndpoint: NetworkEndpoint { case verifyAndGetInfo(request: CardVerifyAndGetInfoRequest) case artwork(cid: String, cardPublicKey: Data, artworkId: String) diff --git a/TangemSdk/TangemSdk/Common/OptionSet/OptionSetCodable.swift b/TangemSdk/TangemSdk/Common/OptionSet/OptionSetCodable.swift index 3024baea4..80c7e8ae2 100644 --- a/TangemSdk/TangemSdk/Common/OptionSet/OptionSetCodable.swift +++ b/TangemSdk/TangemSdk/Common/OptionSet/OptionSetCodable.swift @@ -8,19 +8,16 @@ import Foundation -@available(iOS 13.0, *) protocol OptionKey: CaseIterable, RawRepresentable where RawValue == String { associatedtype SomeOptionSet: OptionSet var value: SomeOptionSet { get } } -@available(iOS 13.0, *) protocol OptionSetCodable: Codable where Self: OptionSet { associatedtype OptionKeys: OptionKey } -@available(iOS 13.0, *) extension OptionSetCodable where OptionKeys.SomeOptionSet == Element, Self.RawValue: Decodable { func encode(to encoder: Encoder) throws { diff --git a/TangemSdk/TangemSdk/Common/OptionSet/OptionSetCustomStringConvertible.swift b/TangemSdk/TangemSdk/Common/OptionSet/OptionSetCustomStringConvertible.swift index ac85e96dd..41cfe97f9 100644 --- a/TangemSdk/TangemSdk/Common/OptionSet/OptionSetCustomStringConvertible.swift +++ b/TangemSdk/TangemSdk/Common/OptionSet/OptionSetCustomStringConvertible.swift @@ -8,10 +8,8 @@ import Foundation -@available(iOS 13.0, *) protocol OptionSetCustomStringConvertible: CustomStringConvertible {} -@available(iOS 13.0, *) extension OptionSetCustomStringConvertible where Self: OptionSetCodable { var description: String { if let data = try? JSONEncoder().encode(self), diff --git a/TangemSdk/TangemSdk/Common/Services/Secure/AccessCodeRepository.swift b/TangemSdk/TangemSdk/Common/Services/Secure/AccessCodeRepository.swift index 9b8c4bf2d..3f375597c 100644 --- a/TangemSdk/TangemSdk/Common/Services/Secure/AccessCodeRepository.swift +++ b/TangemSdk/TangemSdk/Common/Services/Secure/AccessCodeRepository.swift @@ -8,7 +8,6 @@ import Foundation -@available(iOS 13.0, *) public class AccessCodeRepository { var isEmpty: Bool { getCards().isEmpty diff --git a/TangemSdk/TangemSdk/Common/Services/Secure/BiometricsStorage.swift b/TangemSdk/TangemSdk/Common/Services/Secure/BiometricsStorage.swift index bb03e7aeb..1652f5043 100644 --- a/TangemSdk/TangemSdk/Common/Services/Secure/BiometricsStorage.swift +++ b/TangemSdk/TangemSdk/Common/Services/Secure/BiometricsStorage.swift @@ -11,7 +11,6 @@ import Security import LocalAuthentication /// Helper class for Keychain -@available(iOS 13.0, *) public class BiometricsStorage { private let context = LAContext.default diff --git a/TangemSdk/TangemSdk/Common/Services/Secure/BiometricsUtil.swift b/TangemSdk/TangemSdk/Common/Services/Secure/BiometricsUtil.swift index f9f7c87bf..3ce0e43c9 100644 --- a/TangemSdk/TangemSdk/Common/Services/Secure/BiometricsUtil.swift +++ b/TangemSdk/TangemSdk/Common/Services/Secure/BiometricsUtil.swift @@ -29,7 +29,6 @@ public final class BiometricsUtil { /// - Parameters: /// - localizedReason:The app-provided reason for requesting authentication, which displays in the authentication dialog presented to the user. Must be non-empty. Only for touchID. /// - completion: Result - @available(iOS 13.0, *) public static func requestAccess(localizedReason: String, completion: @escaping CompletionResult) { let context = LAContext.default diff --git a/TangemSdk/TangemSdk/Common/Services/Secure/GenericPasswordConvertible.swift b/TangemSdk/TangemSdk/Common/Services/Secure/GenericPasswordConvertible.swift index ecb2c1e2a..c6f5025c0 100644 --- a/TangemSdk/TangemSdk/Common/Services/Secure/GenericPasswordConvertible.swift +++ b/TangemSdk/TangemSdk/Common/Services/Secure/GenericPasswordConvertible.swift @@ -28,7 +28,6 @@ extension GenericPasswordConvertible { } } -@available(iOS 13.0, *) extension SecureEnclave.P256.Signing.PrivateKey: GenericPasswordConvertible { init(rawRepresentation data: D) throws where D: ContiguousBytes { try self.init(dataRepresentation: data.dataRepresentation) diff --git a/TangemSdk/TangemSdk/Common/Services/Secure/KeyStoreError.swift b/TangemSdk/TangemSdk/Common/Services/Secure/KeyStoreError.swift index 0ed90e971..0ce275252 100644 --- a/TangemSdk/TangemSdk/Common/Services/Secure/KeyStoreError.swift +++ b/TangemSdk/TangemSdk/Common/Services/Secure/KeyStoreError.swift @@ -22,7 +22,6 @@ struct KeyStoreError: Error, CustomStringConvertible { } } -@available(iOS 13.0, *) extension OSStatus { /// A human readable message for the status. diff --git a/TangemSdk/TangemSdk/Common/Services/Secure/SecureEnclaveService.swift b/TangemSdk/TangemSdk/Common/Services/Secure/SecureEnclaveService.swift index 2ccf54f10..b6cb27be4 100644 --- a/TangemSdk/TangemSdk/Common/Services/Secure/SecureEnclaveService.swift +++ b/TangemSdk/TangemSdk/Common/Services/Secure/SecureEnclaveService.swift @@ -9,7 +9,6 @@ import Foundation import CryptoKit -@available(iOS 13.0, *) struct SecureEnclaveService { private let storage = SecureStorage() diff --git a/TangemSdk/TangemSdk/Common/Services/Secure/SecureStorage.swift b/TangemSdk/TangemSdk/Common/Services/Secure/SecureStorage.swift index bbc55b958..b206baf9b 100644 --- a/TangemSdk/TangemSdk/Common/Services/Secure/SecureStorage.swift +++ b/TangemSdk/TangemSdk/Common/Services/Secure/SecureStorage.swift @@ -10,7 +10,6 @@ import Foundation import Security /// Helper class for Keychain -@available(iOS 13.0, *) public struct SecureStorage { public init() {} @@ -105,7 +104,6 @@ public struct SecureStorage { } } -@available(iOS 13.0, *) extension SecureStorage { /// Stores a CryptoKit key in the keychain as a generic password. func storeKey(_ key: T, forKey storageKey: SecureStorageKey) throws { diff --git a/TangemSdk/TangemSdk/Common/Services/Secure/TerminalKeysService.swift b/TangemSdk/TangemSdk/Common/Services/Secure/TerminalKeysService.swift index 596852499..0344842c0 100644 --- a/TangemSdk/TangemSdk/Common/Services/Secure/TerminalKeysService.swift +++ b/TangemSdk/TangemSdk/Common/Services/Secure/TerminalKeysService.swift @@ -9,7 +9,6 @@ import Foundation /// Service for manage keypair, used for Linked Terminal feature. Can be disabled by legacyMode or manually -@available(iOS 13.0, *) public class TerminalKeysService { let secureStorage = SecureStorage() @@ -27,14 +26,6 @@ public class TerminalKeysService { return nil } - //migrate from old format - if privateKey.count != 32, publicKey.count != 65, - let decodedPrivateKey = try? NSKeyedUnarchiver.unarchiveTopLevelObjectWithData(privateKey) as? Data, - let decodedPublicKey = try? NSKeyedUnarchiver.unarchiveTopLevelObjectWithData(publicKey) as? Data, - decodedPrivateKey.count == 32, decodedPublicKey.count == 65 { - return KeyPair(privateKey: decodedPrivateKey, publicKey: decodedPublicKey) - } - return KeyPair(privateKey: privateKey, publicKey: publicKey) }() } diff --git a/TangemSdk/TangemSdk/Common/Services/TrustedCardsRepo.swift b/TangemSdk/TangemSdk/Common/Services/TrustedCardsRepo.swift index f1ffa3315..c3cdd5ef5 100644 --- a/TangemSdk/TangemSdk/Common/Services/TrustedCardsRepo.swift +++ b/TangemSdk/TangemSdk/Common/Services/TrustedCardsRepo.swift @@ -8,7 +8,6 @@ import Foundation -@available(iOS 13.0, *) public class TrustedCardsRepo { private let storage = Storage() private let secureStorage = SecureStorage() @@ -69,7 +68,6 @@ public class TrustedCardsRepo { } } -@available(iOS 13.0, *) private extension TrustedCardsRepo { enum Constants { static var maxCards = 1000 //todo: Think about it! diff --git a/TangemSdk/TangemSdk/Common/TLV/Tlv.swift b/TangemSdk/TangemSdk/Common/TLV/Tlv.swift index 2028eefc7..09e30ed2e 100644 --- a/TangemSdk/TangemSdk/Common/TLV/Tlv.swift +++ b/TangemSdk/TangemSdk/Common/TLV/Tlv.swift @@ -9,7 +9,6 @@ import Foundation /// The data converted to the Tag Length Value protocol. -@available(iOS 13.0, *) public struct Tlv: Equatable { public let tag: TlvTag public let tagRaw: Byte @@ -94,7 +93,6 @@ public struct Tlv: Equatable { } } -@available(iOS 13.0, *) extension Tlv: CustomStringConvertible { public var description: String { let tagName = "\(tag)".capitalizingFirst() diff --git a/TangemSdk/TangemSdk/Common/TLV/TlvBuilder.swift b/TangemSdk/TangemSdk/Common/TLV/TlvBuilder.swift index c23270eb2..8a1ec228b 100644 --- a/TangemSdk/TangemSdk/Common/TLV/TlvBuilder.swift +++ b/TangemSdk/TangemSdk/Common/TLV/TlvBuilder.swift @@ -8,7 +8,6 @@ import Foundation -@available(iOS 13.0, *) public class TlvBuilder { private var tlvs = [Tlv]() private let encoder = TlvEncoder() diff --git a/TangemSdk/TangemSdk/Common/TLV/TlvDecoder.swift b/TangemSdk/TangemSdk/Common/TLV/TlvDecoder.swift index 7ce2c7051..ede5d5f1b 100644 --- a/TangemSdk/TangemSdk/Common/TLV/TlvDecoder.swift +++ b/TangemSdk/TangemSdk/Common/TLV/TlvDecoder.swift @@ -10,7 +10,6 @@ import Foundation /// Decode value fields in `Tlv` from raw bytes to concrete types /// according to their `TlvTag` and corresponding `TlvValueType`. -@available(iOS 13.0, *) public final class TlvDecoder { let tlv: [Tlv] @@ -233,5 +232,4 @@ public final class TlvDecoder { } } -@available(iOS 13.0, *) extension TlvDecoder: TlvLogging { } diff --git a/TangemSdk/TangemSdk/Common/TLV/TlvEncoder.swift b/TangemSdk/TangemSdk/Common/TLV/TlvEncoder.swift index 5c385b512..d01e8b130 100644 --- a/TangemSdk/TangemSdk/Common/TLV/TlvEncoder.swift +++ b/TangemSdk/TangemSdk/Common/TLV/TlvEncoder.swift @@ -8,7 +8,6 @@ import Foundation -@available(iOS 13.0, *) public final class TlvEncoder { public init() {} @@ -134,5 +133,4 @@ public final class TlvEncoder { } } -@available(iOS 13.0, *) extension TlvEncoder: TlvLogging {} diff --git a/TangemSdk/TangemSdk/Common/UserCode.swift b/TangemSdk/TangemSdk/Common/UserCode.swift index 148708ebb..1b93934e8 100644 --- a/TangemSdk/TangemSdk/Common/UserCode.swift +++ b/TangemSdk/TangemSdk/Common/UserCode.swift @@ -9,7 +9,6 @@ import Foundation ///// Contains information about the user code -@available(iOS 13.0, *) struct UserCode { let type: UserCodeType let value: Data? @@ -52,7 +51,6 @@ extension UserCodeType { private static let defaultPasscode = "000" } -@available(iOS 13.0, *) extension UserCodeType { var name: String { switch self { diff --git a/TangemSdk/TangemSdk/Crypto/BIP39/BIP39.swift b/TangemSdk/TangemSdk/Crypto/BIP39/BIP39.swift index c51edbfe8..ebc95a9b1 100644 --- a/TangemSdk/TangemSdk/Crypto/BIP39/BIP39.swift +++ b/TangemSdk/TangemSdk/Crypto/BIP39/BIP39.swift @@ -9,7 +9,6 @@ import Foundation // https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki -@available(iOS 13.0, *) public struct BIP39 { public init() {} @@ -228,7 +227,6 @@ public struct BIP39 { // MARK: - Constants -@available(iOS 13.0, *) private extension BIP39 { enum Constants { static let seedSaltPrefix = "mnemonic" diff --git a/TangemSdk/TangemSdk/Crypto/BIP39/Mnemonic.swift b/TangemSdk/TangemSdk/Crypto/BIP39/Mnemonic.swift index 3817a074f..30f1698ec 100644 --- a/TangemSdk/TangemSdk/Crypto/BIP39/Mnemonic.swift +++ b/TangemSdk/TangemSdk/Crypto/BIP39/Mnemonic.swift @@ -8,7 +8,6 @@ import Foundation -@available(iOS 13.0, *) /// The `BIP-39` facade public struct Mnemonic { public let mnemonicComponents: [String] diff --git a/TangemSdk/TangemSdk/Crypto/BIP39/Wordlist.swift b/TangemSdk/TangemSdk/Crypto/BIP39/Wordlist.swift index ee81111a8..1b650b629 100644 --- a/TangemSdk/TangemSdk/Crypto/BIP39/Wordlist.swift +++ b/TangemSdk/TangemSdk/Crypto/BIP39/Wordlist.swift @@ -8,14 +8,12 @@ import Foundation -@available(iOS 13.0, *) extension BIP39 { public enum Wordlist: CaseIterable { case en } } -@available(iOS 13.0, *) extension BIP39.Wordlist { /// This var reads a big array from a file public var words: [String] { diff --git a/TangemSdk/TangemSdk/Crypto/BLS/BLSUtils.swift b/TangemSdk/TangemSdk/Crypto/BLS/BLSUtils.swift index 2c1720656..d08ca89dc 100644 --- a/TangemSdk/TangemSdk/Crypto/BLS/BLSUtils.swift +++ b/TangemSdk/TangemSdk/Crypto/BLS/BLSUtils.swift @@ -10,7 +10,6 @@ import Foundation import CryptoKit import Bls_Signature -@available(iOS 13.0, *) public struct BLSUtils { // MARK: - Init @@ -49,7 +48,6 @@ public struct BLSUtils { } } -@available(iOS 13.0, *) extension BLSUtils { enum Constants { /// Version of keygen algorithm prior to number 4 @@ -72,7 +70,6 @@ extension BLSUtils { // MARK: - Bls_Signature Implementation -@available(iOS 13.0, *) public extension BLSUtils { /// Obtain G2 point for bls curve /// - Parameters: diff --git a/TangemSdk/TangemSdk/Crypto/BLS/HKDFUtil.swift b/TangemSdk/TangemSdk/Crypto/BLS/HKDFUtil.swift index 9f84491eb..91ada491e 100644 --- a/TangemSdk/TangemSdk/Crypto/BLS/HKDFUtil.swift +++ b/TangemSdk/TangemSdk/Crypto/BLS/HKDFUtil.swift @@ -12,7 +12,6 @@ import CommonCrypto /// We can't use CryptoKit's HKDF because of iOS14 /// https://www.rfc-editor.org/rfc/rfc5869 -@available(iOS 13.0, *) enum HKDFUtil { /// HKDF-Extract(salt, IKM) -> PRK diff --git a/TangemSdk/TangemSdk/Crypto/Base58.swift b/TangemSdk/TangemSdk/Crypto/Base58.swift index 06c45b25e..24f773c8c 100644 --- a/TangemSdk/TangemSdk/Crypto/Base58.swift +++ b/TangemSdk/TangemSdk/Crypto/Base58.swift @@ -122,7 +122,6 @@ public extension Data { return bytes.base58EncodedString } - @available(iOS 13.0, *) var base58CheckEncodedString: String { let bytes = Array(self) return bytes.base58CheckEncodedString @@ -138,7 +137,6 @@ public extension Array where Element == UInt8 { return Base58.base58FromBytes(self) } - @available(iOS 13.0, *) var base58CheckEncodedString: String { guard !self.isEmpty else { return "" } @@ -159,14 +157,12 @@ public extension String { return Base58.bytesFromBase58(self) } - @available(iOS 13.0, *) var base58CheckDecodedData: Data? { guard let bytes = base58CheckDecodedBytes else { return nil } return Data(bytes) } - @available(iOS 13.0, *) var base58CheckDecodedBytes: [UInt8]? { let bytes = Base58.bytesFromBase58(self) diff --git a/TangemSdk/TangemSdk/Crypto/CryptoUtils.swift b/TangemSdk/TangemSdk/Crypto/CryptoUtils.swift index 2cec939b3..349cc4eb6 100644 --- a/TangemSdk/TangemSdk/Crypto/CryptoUtils.swift +++ b/TangemSdk/TangemSdk/Crypto/CryptoUtils.swift @@ -10,7 +10,6 @@ import Foundation import CommonCrypto import CryptoKit -@available(iOS 13.0, *) public enum CryptoUtils { /** @@ -179,7 +178,6 @@ public enum CryptoUtils { } } -@available(iOS 13.0, *) fileprivate struct CustomSha256Digest: Digest { static var byteCount: Int { 32 } @@ -191,7 +189,6 @@ fileprivate struct CustomSha256Digest: Digest { } // MARK: - Constants -@available(iOS 13.0, *) private extension CryptoUtils { enum Constants { static let p256CompressedKeySize = 33 diff --git a/TangemSdk/TangemSdk/Crypto/HDWallet/BIP32/BIP32.swift b/TangemSdk/TangemSdk/Crypto/HDWallet/BIP32/BIP32.swift index bf700c222..e87aca070 100644 --- a/TangemSdk/TangemSdk/Crypto/HDWallet/BIP32/BIP32.swift +++ b/TangemSdk/TangemSdk/Crypto/HDWallet/BIP32/BIP32.swift @@ -12,8 +12,7 @@ import CryptoKit // https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki public struct BIP32 { public init() {} - - @available(iOS 13.0, *) + /// Generate an extended private key from the seed. /// - Parameters: /// - seed: The seed to use @@ -65,7 +64,6 @@ extension BIP32 { } } -@available(iOS 13.0, *) fileprivate extension EllipticCurve { var hmacKey: BIP32.HMACKey? { switch self { diff --git a/TangemSdk/TangemSdk/Crypto/HDWallet/BIP32/DerivationPath.swift b/TangemSdk/TangemSdk/Crypto/HDWallet/BIP32/DerivationPath.swift index 08d2e391b..14393616f 100644 --- a/TangemSdk/TangemSdk/Crypto/HDWallet/BIP32/DerivationPath.swift +++ b/TangemSdk/TangemSdk/Crypto/HDWallet/BIP32/DerivationPath.swift @@ -85,7 +85,6 @@ public struct DerivationPath: Equatable, Hashable { } } -@available(iOS 13.0, *) extension DerivationPath { init(from tlvData: Data) throws { guard tlvData.count % 4 == 0 else { diff --git a/TangemSdk/TangemSdk/Crypto/HDWallet/BIP32/ExtendedKeySerialization/ExtendedKeySerializable.swift b/TangemSdk/TangemSdk/Crypto/HDWallet/BIP32/ExtendedKeySerialization/ExtendedKeySerializable.swift index e57bfe69b..5a4c228ae 100644 --- a/TangemSdk/TangemSdk/Crypto/HDWallet/BIP32/ExtendedKeySerialization/ExtendedKeySerializable.swift +++ b/TangemSdk/TangemSdk/Crypto/HDWallet/BIP32/ExtendedKeySerialization/ExtendedKeySerializable.swift @@ -9,7 +9,6 @@ import Foundation /// https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki#serialization-format -@available(iOS 13.0, *) public protocol ExtendedKeySerializable { init(from extendedKeyString: String, networkType: NetworkType) throws func serialize(for networkType: NetworkType) throws -> String diff --git a/TangemSdk/TangemSdk/Crypto/HDWallet/BIP32/ExtendedKeySerialization/ExtendedKeySerializer.swift b/TangemSdk/TangemSdk/Crypto/HDWallet/BIP32/ExtendedKeySerialization/ExtendedKeySerializer.swift index 8b91457da..299a95183 100644 --- a/TangemSdk/TangemSdk/Crypto/HDWallet/BIP32/ExtendedKeySerialization/ExtendedKeySerializer.swift +++ b/TangemSdk/TangemSdk/Crypto/HDWallet/BIP32/ExtendedKeySerialization/ExtendedKeySerializer.swift @@ -8,7 +8,6 @@ import Foundation -@available(iOS 13.0, *) enum ExtendedKeySerializer { enum Version { case `public` diff --git a/TangemSdk/TangemSdk/Crypto/HDWallet/BIP32/ExtendedPrivateKey.swift b/TangemSdk/TangemSdk/Crypto/HDWallet/BIP32/ExtendedPrivateKey.swift index 909984970..ee8adeed1 100644 --- a/TangemSdk/TangemSdk/Crypto/HDWallet/BIP32/ExtendedPrivateKey.swift +++ b/TangemSdk/TangemSdk/Crypto/HDWallet/BIP32/ExtendedPrivateKey.swift @@ -8,7 +8,6 @@ import Foundation -@available(iOS 13.0, *) /// BIP32 extended private key public struct ExtendedPrivateKey: Equatable, Hashable, JSONStringConvertible, Codable { public let privateKey: Data @@ -61,7 +60,6 @@ public struct ExtendedPrivateKey: Equatable, Hashable, JSONStringConvertible, Co // MARK: - ExtendedKeySerializable -@available(iOS 13.0, *) extension ExtendedPrivateKey: ExtendedKeySerializable { public init(from extendedKeyString: String, networkType: NetworkType) throws { guard let data = extendedKeyString.base58CheckDecodedData else { diff --git a/TangemSdk/TangemSdk/Crypto/HDWallet/BIP32/ExtendedPublicKey.swift b/TangemSdk/TangemSdk/Crypto/HDWallet/BIP32/ExtendedPublicKey.swift index d7313c517..7158135a7 100644 --- a/TangemSdk/TangemSdk/Crypto/HDWallet/BIP32/ExtendedPublicKey.swift +++ b/TangemSdk/TangemSdk/Crypto/HDWallet/BIP32/ExtendedPublicKey.swift @@ -9,7 +9,6 @@ import Foundation import CryptoKit -@available(iOS 13.0, *) public struct ExtendedPublicKey: Equatable, Hashable, JSONStringConvertible { public let publicKey: Data public let chainCode: Data @@ -90,7 +89,6 @@ public struct ExtendedPublicKey: Equatable, Hashable, JSONStringConvertible { // MARK: - ExtendedKeySerializable -@available(iOS 13.0, *) extension ExtendedPublicKey: ExtendedKeySerializable { public init(from extendedKeyString: String, networkType: NetworkType) throws { guard let data = extendedKeyString.base58CheckDecodedData else { @@ -156,7 +154,7 @@ extension ExtendedPublicKey: ExtendedKeySerializable { } // MARK: - Decodable -@available(iOS 13.0, *) + extension ExtendedPublicKey: Decodable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) diff --git a/TangemSdk/TangemSdk/Crypto/HDWallet/MasterKey/AnyMasterKeyFactory.swift b/TangemSdk/TangemSdk/Crypto/HDWallet/MasterKey/AnyMasterKeyFactory.swift index b8436099d..d2475b6f7 100644 --- a/TangemSdk/TangemSdk/Crypto/HDWallet/MasterKey/AnyMasterKeyFactory.swift +++ b/TangemSdk/TangemSdk/Crypto/HDWallet/MasterKey/AnyMasterKeyFactory.swift @@ -8,7 +8,6 @@ import Foundation -@available(iOS 13.0, *) public struct AnyMasterKeyFactory { private let mnemonic: Mnemonic private let passphrase: String diff --git a/TangemSdk/TangemSdk/Crypto/HDWallet/MasterKey/BIP32MasterKeyFactory.swift b/TangemSdk/TangemSdk/Crypto/HDWallet/MasterKey/BIP32MasterKeyFactory.swift index 283a335b3..2e92904cd 100644 --- a/TangemSdk/TangemSdk/Crypto/HDWallet/MasterKey/BIP32MasterKeyFactory.swift +++ b/TangemSdk/TangemSdk/Crypto/HDWallet/MasterKey/BIP32MasterKeyFactory.swift @@ -8,7 +8,6 @@ import Foundation -@available(iOS 13.0, *) struct BIP32MasterKeyFactory: MasterKeyFactory { private let seed: Data private let curve: EllipticCurve diff --git a/TangemSdk/TangemSdk/Crypto/HDWallet/MasterKey/EIP2333MasterKeyFactory.swift b/TangemSdk/TangemSdk/Crypto/HDWallet/MasterKey/EIP2333MasterKeyFactory.swift index e29f8fbef..85e52bcec 100644 --- a/TangemSdk/TangemSdk/Crypto/HDWallet/MasterKey/EIP2333MasterKeyFactory.swift +++ b/TangemSdk/TangemSdk/Crypto/HDWallet/MasterKey/EIP2333MasterKeyFactory.swift @@ -8,7 +8,6 @@ import Foundation -@available(iOS 13.0, *) struct EIP2333MasterKeyFactory: MasterKeyFactory { private let seed: Data diff --git a/TangemSdk/TangemSdk/Crypto/HDWallet/MasterKey/IkarusMasterKeyFactory.swift b/TangemSdk/TangemSdk/Crypto/HDWallet/MasterKey/IkarusMasterKeyFactory.swift index 5698648d1..f80b1c930 100644 --- a/TangemSdk/TangemSdk/Crypto/HDWallet/MasterKey/IkarusMasterKeyFactory.swift +++ b/TangemSdk/TangemSdk/Crypto/HDWallet/MasterKey/IkarusMasterKeyFactory.swift @@ -8,7 +8,6 @@ import Foundation -@available(iOS 13.0, *) struct IkarusMasterKeyFactory: MasterKeyFactory { private let entropy: Data private let passphrase: String diff --git a/TangemSdk/TangemSdk/Crypto/HDWallet/MasterKey/MasterKeyFactory.swift b/TangemSdk/TangemSdk/Crypto/HDWallet/MasterKey/MasterKeyFactory.swift index efd453e2a..a63a60347 100644 --- a/TangemSdk/TangemSdk/Crypto/HDWallet/MasterKey/MasterKeyFactory.swift +++ b/TangemSdk/TangemSdk/Crypto/HDWallet/MasterKey/MasterKeyFactory.swift @@ -8,7 +8,6 @@ import Foundation -@available(iOS 13.0, *) protocol MasterKeyFactory { func makePrivateKey() throws -> ExtendedPrivateKey } diff --git a/TangemSdk/TangemSdk/Crypto/HDWallet/SLIP23.swift b/TangemSdk/TangemSdk/Crypto/HDWallet/SLIP23.swift index 3d216b16e..ceedaa264 100644 --- a/TangemSdk/TangemSdk/Crypto/HDWallet/SLIP23.swift +++ b/TangemSdk/TangemSdk/Crypto/HDWallet/SLIP23.swift @@ -10,7 +10,6 @@ import Foundation /// https://github.com/satoshilabs/slips/blob/master/slip-0023.md /// https://github.com/cardano-foundation/CIPs/blob/09d7d8ee1bd64f7e6b20b5a6cae088039dce00cb/CIP-0003/Icarus.md -@available(iOS 13.0, *) public struct SLIP23 { public init() {} @@ -34,7 +33,6 @@ public struct SLIP23 { } } -@available(iOS 13.0, *) extension SLIP23 { enum SLIP23Error: Error { case passphraseToUTF8Failed diff --git a/TangemSdk/TangemSdk/Crypto/IssuerDataVerifier.swift b/TangemSdk/TangemSdk/Crypto/IssuerDataVerifier.swift index e538a9b0d..f172bec06 100644 --- a/TangemSdk/TangemSdk/Crypto/IssuerDataVerifier.swift +++ b/TangemSdk/TangemSdk/Crypto/IssuerDataVerifier.swift @@ -8,7 +8,6 @@ import Foundation -@available(iOS 13.0, *) class IssuerDataVerifier { static func verify(cardId: String, issuerData: Data, diff --git a/TangemSdk/TangemSdk/Crypto/NetworkType.swift b/TangemSdk/TangemSdk/Crypto/NetworkType.swift index e2508b2d5..25976eb7d 100644 --- a/TangemSdk/TangemSdk/Crypto/NetworkType.swift +++ b/TangemSdk/TangemSdk/Crypto/NetworkType.swift @@ -8,7 +8,6 @@ import Foundation -@available(iOS 13.0, *) public enum NetworkType { case mainnet case testnet diff --git a/TangemSdk/TangemSdk/Crypto/SchnorrSignature.swift b/TangemSdk/TangemSdk/Crypto/SchnorrSignature.swift index 0c5013eff..40c6ec394 100644 --- a/TangemSdk/TangemSdk/Crypto/SchnorrSignature.swift +++ b/TangemSdk/TangemSdk/Crypto/SchnorrSignature.swift @@ -9,7 +9,6 @@ import Foundation import TangemSdk_secp256k1 -@available(iOS 13.0, *) public struct SchnorrSignature { private let secp256k1 = Secp256k1Utils() private let signature: Data diff --git a/TangemSdk/TangemSdk/Crypto/Secp256k1Key.swift b/TangemSdk/TangemSdk/Crypto/Secp256k1Key.swift index fb94171bf..b78cc8787 100644 --- a/TangemSdk/TangemSdk/Crypto/Secp256k1Key.swift +++ b/TangemSdk/TangemSdk/Crypto/Secp256k1Key.swift @@ -9,7 +9,6 @@ import Foundation import TangemSdk_secp256k1 -@available(iOS 13.0, *) public struct Secp256k1Key { private let secp256k1 = Secp256k1Utils() private let secp256k1PubKey: secp256k1_pubkey @@ -17,7 +16,15 @@ public struct Secp256k1Key { public init(with data: Data) throws { secp256k1PubKey = try secp256k1.parsePublicKey(data) } - + + public init(with signature: Secp256k1Signature.Extended, hash: Data) throws { + secp256k1PubKey = try secp256k1.recoverPublicKey(signatureCoponents: signature.components, hash: hash) + } + + public init(with signature: Secp256k1Signature.Extended, message: Data) throws { + try self.init(with: signature, hash: message.getSha256()) + } + public func compress() throws -> Data { var pubkey = secp256k1PubKey return try secp256k1.serializePublicKey(&pubkey, compressed: true) diff --git a/TangemSdk/TangemSdk/Crypto/Secp256k1Signature.swift b/TangemSdk/TangemSdk/Crypto/Secp256k1Signature.swift index ec517886d..5575d00e1 100644 --- a/TangemSdk/TangemSdk/Crypto/Secp256k1Signature.swift +++ b/TangemSdk/TangemSdk/Crypto/Secp256k1Signature.swift @@ -9,7 +9,6 @@ import Foundation import TangemSdk_secp256k1 -@available(iOS 13.0, *) public struct Secp256k1Signature { private let secp256k1 = Secp256k1Utils() private let rawSig: secp256k1_ecdsa_signature @@ -40,12 +39,11 @@ public struct Secp256k1Signature { public func unmarshal(with publicKey: Data, hash: Data) throws -> Extended { var sig = rawSig - let (r, s, v) = try secp256k1.unmarshalSignature(&sig, publicKey: publicKey, hash: hash) - return Extended(r: r, s: s, v: v) + let components = try secp256k1.unmarshalSignature(&sig, publicKey: publicKey, hash: hash) + return Extended(r: components.r, s: components.s, v: components.v) } } -@available(iOS 13.0, *) extension Secp256k1Signature { public struct Extended { public let r: Data @@ -57,6 +55,10 @@ extension Secp256k1Signature { return r + s + v } + var components: Secp256k1SignatureComponents { + (r,s,v) + } + public init(r: Data, s: Data, v: Data) { self.r = r self.s = s diff --git a/TangemSdk/TangemSdk/Crypto/Secp256k1Utils.swift b/TangemSdk/TangemSdk/Crypto/Secp256k1Utils.swift index 02f322aeb..f76619580 100644 --- a/TangemSdk/TangemSdk/Crypto/Secp256k1Utils.swift +++ b/TangemSdk/TangemSdk/Crypto/Secp256k1Utils.swift @@ -9,7 +9,8 @@ import Foundation import TangemSdk_secp256k1 -@available(iOS 13.0, *) +typealias Secp256k1SignatureComponents = (r: Data, s: Data, v: Data) + public final class Secp256k1Utils { private let context: OpaquePointer @@ -174,7 +175,7 @@ public final class Secp256k1Utils { return Data(der[0.. (r: Data, s: Data, v: Data) { + func unmarshalSignature(_ signature: inout secp256k1_ecdsa_signature, publicKey: Data, hash: Data) throws -> Secp256k1SignatureComponents { guard hash.count == 32 else { throw TangemSdkError.cryptoUtilsError("Hash size must be 32 bytes length") } guard try verifySignature(&signature, publicKey: publicKey, hash: hash) else { @@ -247,6 +248,15 @@ public final class Secp256k1Utils { return pubkey } + func recoverPublicKey(signatureCoponents: Secp256k1SignatureComponents, hash: Data) throws -> secp256k1_pubkey { + guard let intV = Int32(hexData: signatureCoponents.v) else { + throw TangemSdkError.cryptoUtilsError("Failed to parse v") + } + + var recoverableSignature = try parseRecoverableSignature(signatureCoponents.r + signatureCoponents.s, v: intV) + return try recoverPublicKey(hash: hash, recoverableSignature: &recoverableSignature) + } + func parseXOnlyPublicKey(_ publicKey: Data) throws -> secp256k1_xonly_pubkey { var pubkey = secp256k1_xonly_pubkey() diff --git a/TangemSdk/TangemSdk/Crypto/WIF.swift b/TangemSdk/TangemSdk/Crypto/WIF.swift index 717503645..5a7bfd816 100644 --- a/TangemSdk/TangemSdk/Crypto/WIF.swift +++ b/TangemSdk/TangemSdk/Crypto/WIF.swift @@ -8,7 +8,6 @@ import Foundation -@available(iOS 13.0, *) public enum WIF { public static func encodeToWIFCompressed(_ privateKey: Data, networkType: NetworkType) -> String { let extended = networkType.prefix + privateKey + Constants.compressedSuffix @@ -30,7 +29,6 @@ public enum WIF { } } -@available(iOS 13.0, *) fileprivate extension WIF { enum Constants { static let prefixMainnet = Data(hexString: "0x80") @@ -41,7 +39,6 @@ fileprivate extension WIF { } } -@available(iOS 13.0, *) fileprivate extension NetworkType { var prefix: Data { switch self { diff --git a/TangemSdk/TangemSdk/Operations/Attestation/AttestCardKeyCommand.swift b/TangemSdk/TangemSdk/Operations/Attestation/AttestCardKeyCommand.swift index 4c456a78e..30880dcc6 100644 --- a/TangemSdk/TangemSdk/Operations/Attestation/AttestCardKeyCommand.swift +++ b/TangemSdk/TangemSdk/Operations/Attestation/AttestCardKeyCommand.swift @@ -9,7 +9,6 @@ import Foundation /// Deserialized response from the Tangem card after `AttestCardKeyCommand`. -@available(iOS 13.0, *) public struct AttestCardKeyResponse: JSONStringConvertible { /// Unique Tangem card ID number public let cardId: String @@ -36,7 +35,6 @@ public struct AttestCardKeyResponse: JSONStringConvertible { } } -@available(iOS 13.0, *) public class AttestCardKeyCommand: Command { public var preflightReadMode: PreflightReadMode { .readCardOnly } @@ -144,7 +142,6 @@ public class AttestCardKeyCommand: Command { } } -@available(iOS 13.0, *) public extension AttestCardKeyCommand { enum Mode: String, StringCodable { /// Attest only current card @@ -163,14 +160,12 @@ public extension AttestCardKeyCommand { } } -@available(iOS 13.0, *) public extension AttestCardKeyResponse { enum Constants { static let linkedCardsPrefix = "BACKUP_CARDS" } } -@available(iOS 13.0, *) private extension AttestCardKeyCommand.Mode { enum RawMode: Byte, InteractionMode { case full = 0x01 diff --git a/TangemSdk/TangemSdk/Operations/Attestation/AttestWalletKeyCommand.swift b/TangemSdk/TangemSdk/Operations/Attestation/AttestWalletKeyCommand.swift index 8611f7f67..fee13336e 100644 --- a/TangemSdk/TangemSdk/Operations/Attestation/AttestWalletKeyCommand.swift +++ b/TangemSdk/TangemSdk/Operations/Attestation/AttestWalletKeyCommand.swift @@ -9,7 +9,6 @@ import Foundation /// Deserialized response from the Tangem card after `AttestWalletKeyCommand`. -@available(iOS 13.0, *) public struct AttestWalletKeyResponse: JSONStringConvertible { /// Unique Tangem card ID number public let cardId: String @@ -33,7 +32,6 @@ public struct AttestWalletKeyResponse: JSONStringConvertible { } /// This command proves that the wallet private key from the card corresponds to the wallet public key. Standard challenge/response scheme is used -@available(iOS 13.0, *) public final class AttestWalletKeyCommand: Command { private var challenge: Data! private let walletPublicKey: Data @@ -167,7 +165,6 @@ public final class AttestWalletKeyCommand: Command { } } -@available(iOS 13.0, *) public extension AttestWalletKeyCommand { enum ConfirmationMode { case none diff --git a/TangemSdk/TangemSdk/Operations/Attestation/Attestation.swift b/TangemSdk/TangemSdk/Operations/Attestation/Attestation.swift index 01530ed2a..3bf4e6923 100644 --- a/TangemSdk/TangemSdk/Operations/Attestation/Attestation.swift +++ b/TangemSdk/TangemSdk/Operations/Attestation/Attestation.swift @@ -8,7 +8,6 @@ import Foundation -@available(iOS 13.0, *) public struct Attestation: JSONStringConvertible, Equatable { /// Attestation status of card's public key public internal(set) var cardKeyAttestation: Status @@ -55,14 +54,12 @@ public struct Attestation: JSONStringConvertible, Equatable { } } -@available(iOS 13.0, *) public extension Attestation { enum Status: String, StringCodable { case failed, warning, skipped, verifiedOffline, verified } } -@available(iOS 13.0, *) public extension Attestation { static var empty: Attestation { .init(cardKeyAttestation: .skipped, @@ -72,7 +69,6 @@ public extension Attestation { } } -@available(iOS 13.0, *) extension Attestation { var rawRepresentation: String { return "\(index),\(cardKeyAttestation.intRepresentation),\(walletKeysAttestation.intRepresentation),\(firmwareAttestation.intRepresentation),\(cardUniquenessAttestation.intRepresentation)" @@ -97,7 +93,6 @@ extension Attestation { } } -@available(iOS 13.0, *) extension Attestation.Status { var intRepresentation: Int { switch self { @@ -127,7 +122,6 @@ extension Attestation.Status { } } -@available(iOS 13.0, *) extension Attestation: Decodable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) diff --git a/TangemSdk/TangemSdk/Operations/Attestation/AttestationTask.swift b/TangemSdk/TangemSdk/Operations/Attestation/AttestationTask.swift index f1e9a19d2..012c1f6f5 100644 --- a/TangemSdk/TangemSdk/Operations/Attestation/AttestationTask.swift +++ b/TangemSdk/TangemSdk/Operations/Attestation/AttestationTask.swift @@ -9,7 +9,6 @@ import Foundation import Combine -@available(iOS 13.0, *) public final class AttestationTask: CardSessionRunnable { private let mode: Mode private let trustedCardsRepo: TrustedCardsRepo = .init() @@ -248,7 +247,6 @@ public final class AttestationTask: CardSessionRunnable { } } -@available(iOS 13.0, *) public extension AttestationTask { enum Mode: String, StringCodable, CaseIterable, Comparable { case offline, normal, full @@ -268,7 +266,6 @@ public extension AttestationTask { } } -@available(iOS 13.0, *) private extension AttestationTask { enum Constants { //Attest wallet count or sign command count greater this value is looks suspicious. diff --git a/TangemSdk/TangemSdk/Operations/Attestation/OnlineCardVerifier.swift b/TangemSdk/TangemSdk/Operations/Attestation/OnlineCardVerifier.swift index 8866eee7e..215b96fba 100644 --- a/TangemSdk/TangemSdk/Operations/Attestation/OnlineCardVerifier.swift +++ b/TangemSdk/TangemSdk/Operations/Attestation/OnlineCardVerifier.swift @@ -10,7 +10,6 @@ import Foundation import Combine /// Online verification for Tangem cards. Do not use for developer cards -@available(iOS 13.0, *) public class OnlineCardVerifier { private let networkService: NetworkService diff --git a/TangemSdk/TangemSdk/Operations/Backup/BackupCertificateProvider.swift b/TangemSdk/TangemSdk/Operations/Backup/BackupCertificateProvider.swift index d570de119..72bd21e60 100644 --- a/TangemSdk/TangemSdk/Operations/Backup/BackupCertificateProvider.swift +++ b/TangemSdk/TangemSdk/Operations/Backup/BackupCertificateProvider.swift @@ -9,7 +9,6 @@ import Foundation import Combine -@available(iOS 13.0, *) class BackupCertificateProvider { private let onlineCardVerifier = OnlineCardVerifier() private var cancellable: AnyCancellable? = nil diff --git a/TangemSdk/TangemSdk/Operations/Backup/BackupService.swift b/TangemSdk/TangemSdk/Operations/Backup/BackupService.swift index 81eeebdaf..c83c4e85d 100644 --- a/TangemSdk/TangemSdk/Operations/Backup/BackupService.swift +++ b/TangemSdk/TangemSdk/Operations/Backup/BackupService.swift @@ -9,17 +9,16 @@ import Foundation import Combine -@available(iOS 13.0, *) -public class BackupService: ObservableObject { +public class BackupService { public static let maxBackupCardsCount = 2 - @Published public private(set) var currentState: State = .preparing + public private(set) var currentState: State = .preparing public var canAddBackupCards: Bool { addedBackupCardsCount < BackupService.maxBackupCardsCount && repo.data.primaryCard?.linkingKey != nil } - + public var hasIncompletedBackup: Bool { switch currentState { case .finalizingPrimaryCard, .finalizingBackupCard: @@ -28,66 +27,65 @@ public class BackupService: ObservableObject { return false } } - + public var config: Config { get { sdk.config } set { sdk.config = newValue } } - + public var addedBackupCardsCount: Int { repo.data.backupCards.count } public var canProceed: Bool { currentState != .preparing && currentState != .finished } public var accessCodeIsSet: Bool { repo.data.accessCode != nil } public var passcodeIsSet: Bool { repo.data.passcode != nil } public var primaryCardIsSet: Bool { repo.data.primaryCard != nil } public var primaryCard: PrimaryCard? { repo.data.primaryCard } - public var backupCardIds: [String] { repo.data.backupCards.map {$0.cardId} } - + public var backupCards: [BackupCard] { repo.data.backupCards } /// Perform additional compatibility checks while adding backup cards. Change this setting only if you understand what you do. public var skipCompatibilityChecks: Bool = false - + private let sdk: TangemSdk private var repo: BackupRepo = .init() private var currentCommand: AnyObject? = nil private var handleErrors: Bool { sdk.config.handleErrors } - + public init(sdk: TangemSdk) { self.sdk = sdk self.updateState() } - + deinit { Log.debug("BackupService deinit") } - + public func discardIncompletedBackup() { repo.reset() updateState() } - - public func addBackupCard(completion: @escaping CompletionResult) { + + public func addBackupCard(completion: @escaping CompletionResult) { guard let primaryCard = repo.data.primaryCard else { completion(.failure(.missingPrimaryCard)) return } - + if handleErrors { guard addedBackupCardsCount < BackupService.maxBackupCardsCount else { completion(.failure(.tooMuchBackupCards)) return } } - + if primaryCard.certificate != nil { readBackupCard(primaryCard, completion: completion) return } - + fetchCertificate( for: primaryCard.cardId, cardPublicKey: primaryCard.cardPublicKey, firmwareVersion: primaryCard.firmwareVersion) { [weak self] result in guard let self else { return } - + switch result { case .success(let certificate): var primaryCard = primaryCard @@ -99,59 +97,59 @@ public class BackupService: ObservableObject { } } } - + public func setAccessCode(_ code: String) throws { repo.data.accessCode = nil let code = code.trim() - + if handleErrors { guard !code.isEmpty else { throw TangemSdkError.accessCodeRequired } - + if code == UserCodeType.accessCode.defaultValue { throw TangemSdkError.accessCodeCannotBeDefault } - + if code.count < UserCodeType.minLength { throw TangemSdkError.accessCodeTooShort } } - + guard currentState == .preparing || currentState == .finalizingPrimaryCard else { throw TangemSdkError.accessCodeCannotBeChanged } - + repo.data.accessCode = code.sha256() updateState() } - + public func setPasscode(_ code: String) throws { repo.data.passcode = nil let code = code.trim() - + if handleErrors { guard !code.isEmpty else { throw TangemSdkError.passcodeRequired } - + if code == UserCodeType.passcode.defaultValue { throw TangemSdkError.passcodeCannotBeDefault } - + if code.count < UserCodeType.minLength { throw TangemSdkError.passcodeTooShort } } - + guard currentState == .preparing || currentState == .finalizingPrimaryCard else { throw TangemSdkError.passcodeCannotBeChanged } - + repo.data.passcode = code.sha256() updateState() } - + public func proceedBackup(completion: @escaping CompletionResult) { switch currentState { case .finalizingPrimaryCard: @@ -166,20 +164,20 @@ public class BackupService: ObservableObject { completion(.failure(TangemSdkError.backupServiceInvalidState)) } } - + public func setPrimaryCard(_ primaryCard: PrimaryCard) { repo.data.primaryCard = primaryCard updateState() } - + public func readPrimaryCard(cardId: String? = nil, completion: @escaping CompletionResult) { let formattedCardId = cardId.flatMap { CardIdFormatter(style: sdk.config.cardIdDisplayFormat).string(from: $0) } - + let initialMessage = formattedCardId.map { Message(header: nil, body: "backup_prepare_primary_card_message_format".localized($0)) } ?? Message(header: "backup_prepare_primary_card_message".localized) - + let command = StartPrimaryCardLinkingCommand() currentCommand = command sdk.startSession(with: command, @@ -197,7 +195,7 @@ public class BackupService: ObservableObject { self.currentCommand = nil } } - + private func handleCompletion(_ result: Result, completion: @escaping CompletionResult) -> Void { switch result { case .success(let card): @@ -207,14 +205,16 @@ public class BackupService: ObservableObject { completion(.failure(error.toTangemSdkError())) } } - + @discardableResult private func updateState() -> State { if repo.data.accessCode == nil || repo.data.primaryCard == nil || repo.data.backupCards.isEmpty { currentState = .preparing - } else if repo.data.attestSignature == nil || repo.data.backupData.isEmpty { + } else if repo.data.attestSignature == nil + || repo.data.backupData.count < repo.data.backupCards.count + || repo.data.primaryCardFinalized == false { currentState = .finalizingPrimaryCard } else if repo.data.finalizedBackupCardsCount < repo.data.backupCards.count { currentState = .finalizingBackupCard(index: repo.data.finalizedBackupCardsCount + 1) @@ -222,45 +222,47 @@ public class BackupService: ObservableObject { currentState = .finished onBackupCompleted() } - + return currentState } - - private func addBackupCard(_ backupCard: BackupCard, completion: @escaping CompletionResult) { + + private func addBackupCard(_ backupCardResponse: StartBackupCardLinkingTaskResponse, completion: @escaping CompletionResult) { + let backupCard = backupCardResponse.backupCard + if let existingIndex = repo.data.backupCards.firstIndex(where: { $0.cardId == backupCard.cardId }) { repo.data.backupCards.remove(at: existingIndex) } - + fetchCertificate(for: backupCard.cardId, cardPublicKey: backupCard.cardPublicKey, firmwareVersion: backupCard.firmwareVersion) { [weak self] result in guard let self else { return } - + switch result { case .success(let certificate): var backupCard = backupCard backupCard.certificate = certificate self.repo.data.backupCards.append(backupCard) self.updateState() - completion(.success(())) + completion(.success(backupCardResponse.card)) case .failure(let error): completion(.failure(error)) } } } - - private func readBackupCard(_ primaryCard: PrimaryCard, completion: @escaping CompletionResult) { + + private func readBackupCard(_ primaryCard: PrimaryCard, completion: @escaping CompletionResult) { let command = StartBackupCardLinkingTask(primaryCard: primaryCard, addedBackupCards: repo.data.backupCards.map { $0.cardId }, skipCompatibilityChecks: skipCompatibilityChecks) currentCommand = command - + sdk.startSession(with: command, filter: nil, initialMessage: Message(header: nil, body: "backup_add_backup_card_message".localized)) {[weak self] result in guard let self = self else { return } - + switch result { case .success(let response): self.addBackupCard(response, completion: completion) @@ -270,7 +272,7 @@ public class BackupService: ObservableObject { self.currentCommand = nil } } - + private func handleFinalizePrimaryCard(completion: @escaping CompletionResult) { do { if handleErrors { @@ -278,53 +280,71 @@ public class BackupService: ObservableObject { throw TangemSdkError.accessCodeOrPasscodeRequired } } - + let accessCode = repo.data.accessCode ?? UserCodeType.accessCode.defaultValue.sha256() let passcode = repo.data.passcode ?? UserCodeType.passcode.defaultValue.sha256() - + guard let primaryCard = repo.data.primaryCard else { throw TangemSdkError.missingPrimaryCard } - + if handleErrors { guard !repo.data.backupCards.isEmpty else { throw TangemSdkError.emptyBackupCards } - + guard repo.data.backupCards.count < 3 else { throw TangemSdkError.tooMuchBackupCards } } - - let task = FinalizePrimaryCardTask(backupCards: repo.data.backupCards, - accessCode: accessCode, - passcode: passcode, - readBackupStartIndex: repo.data.backupData.count, - attestSignature: repo.data.attestSignature, - onLink: { self.repo.data.attestSignature = $0 }, - onRead: { self.repo.data.backupData[$0.0] = $0.1 }) - - let formattedCardId = CardIdFormatter(style: sdk.config.cardIdDisplayFormat).string(from: primaryCard.cardId) - - let initialMessage = formattedCardId.map { - Message(header: nil, - body: "backup_finalize_primary_card_message_format".localized($0)) + + let task = FinalizePrimaryCardTask( + backupCards: repo.data.backupCards, + accessCode: accessCode, + passcode: passcode, + readBackupStartIndex: repo.data.backupData.count, + attestSignature: repo.data.attestSignature, + onLink: { + self.repo.data.attestSignature = $0 + self.repo.data.primaryCardFinalized = false + }, + onRead: { + self.repo.data.backupData[$0.0] = $0.1 + self.repo.data.primaryCardFinalized = false + }, + onFinalize: { + self.repo.data.primaryCardFinalized = true + } + ) + + var initialMessage: Message? = nil + + if config.productType == .ring { + initialMessage = Message( + header: nil, + body:"backup_finalize_primary_ring_message".localized + ) + } else if let formattedCardId = CardIdFormatter(style: sdk.config.cardIdDisplayFormat).string(from: primaryCard.cardId) { + initialMessage = Message( + header: nil, + body: "backup_finalize_primary_card_message_format".localized(formattedCardId)) } + currentCommand = task - + sdk.startSession(with: task, cardId: primaryCard.cardId, initialMessage: initialMessage) {[weak self] result in completion(result) self?.currentCommand = nil } - + } catch { completion(.failure(error.toTangemSdkError())) } } - + private func handleWriteBackupCard(index: Int, completion: @escaping CompletionResult) { do { if handleErrors { @@ -332,36 +352,36 @@ public class BackupService: ObservableObject { throw TangemSdkError.accessCodeOrPasscodeRequired } } - + let accessCode = repo.data.accessCode ?? UserCodeType.accessCode.defaultValue.sha256() let passcode = repo.data.passcode ?? UserCodeType.passcode.defaultValue.sha256() - + guard let attestSignature = repo.data.attestSignature else { throw TangemSdkError.missingPrimaryAttestSignature } - + guard let primaryCard = repo.data.primaryCard else { throw TangemSdkError.missingPrimaryCard } - + let cardIndex = index - 1 - + guard cardIndex < repo.data.backupCards.count else { throw TangemSdkError.noBackupCardForIndex } - + if handleErrors { guard repo.data.backupCards.count < 3 else { throw TangemSdkError.tooMuchBackupCards } } - + let backupCard = repo.data.backupCards[cardIndex] - + guard let backupData = repo.data.backupData[backupCard.cardId] else { throw TangemSdkError.noBackupDataForCard } - + let command = FinalizeBackupCardTask(primaryCard: primaryCard, backupCards: repo.data.backupCards, backupData: backupData, @@ -369,20 +389,26 @@ public class BackupService: ObservableObject { accessCode: accessCode, passcode: passcode) - let formattedCardId = CardIdFormatter(style: sdk.config.cardIdDisplayFormat).string(from: backupCard.cardId) - - let initialMessage = formattedCardId.map { - Message(header: nil, - body: "backup_finalize_backup_card_message_format".localized($0)) + var initialMessage: Message? = nil + + if config.productType == .ring { + initialMessage = Message( + header: nil, + body:"backup_finalize_backup_ring_message".localized + ) + } else if let formattedCardId = CardIdFormatter(style: sdk.config.cardIdDisplayFormat).string(from: backupCard.cardId) { + initialMessage = Message( + header: nil, + body: "backup_finalize_backup_card_message_format".localized(formattedCardId)) } - + currentCommand = command - + sdk.startSession(with: command, cardId: backupCard.cardId, initialMessage: initialMessage) {[weak self] result in guard let self = self else { return } - + switch result { case .success(let card): self.repo.data.finalizedBackupCardsCount += 1 @@ -390,19 +416,19 @@ public class BackupService: ObservableObject { case .failure(let error): completion(.failure(error)) } - + self.currentCommand = nil } - + } catch { completion(.failure(error.toTangemSdkError())) } } - + private func onBackupCompleted() { repo.reset() } - + private func fetchCertificate( for cardId: String, cardPublicKey: Data, @@ -422,7 +448,6 @@ public class BackupService: ObservableObject { // MARK: - State -@available(iOS 13.0, *) extension BackupService { public enum State: Equatable { case preparing @@ -434,12 +459,11 @@ extension BackupService { // MARK: - Storage entities -@available(iOS 13.0, *) public struct PrimaryCard: Codable { public let cardId: String public let cardPublicKey: Data public let linkingKey: Data - + //For compatibility check with backup card public let existingWalletsCount: Int public let isHDWalletAllowed: Bool @@ -448,18 +472,19 @@ public struct PrimaryCard: Codable { public let batchId: String? // Optional for compatibility with interrupted backups public let firmwareVersion: FirmwareVersion? // Optional for compatibility with interrupted backups public let isKeysImportAllowed: Bool? // Optional for compatibility with interrupted backups - + var certificate: Data? } -@available(iOS 13.0, *) -struct BackupCard: Codable { - let cardId: String - let cardPublicKey: Data +public struct BackupCard: Codable { + public let cardId: String + public let cardPublicKey: Data + public let firmwareVersion: FirmwareVersion? // Optional for compatibility with interrupted backups + public let batchId: String? // Optional for compatibility with interrupted backups + let linkingKey: Data let attestSignature: Data - let firmwareVersion: FirmwareVersion? // Optional for compatibility with interrupted backups - + var certificate: Data? } @@ -468,7 +493,6 @@ struct EncryptedBackupData: Codable { let salt: Data } -@available(iOS 13.0, *) struct BackupServiceData: Codable { var accessCode: Data? = nil var passcode: Data? = nil @@ -477,7 +501,8 @@ struct BackupServiceData: Codable { var backupCards: [BackupCard] = [] var backupData: [String:[EncryptedBackupData]] = [:] var finalizedBackupCardsCount: Int = 0 - + var primaryCardFinalized: Bool? = nil + var shouldSave: Bool { attestSignature != nil || !backupData.isEmpty } @@ -485,11 +510,10 @@ struct BackupServiceData: Codable { // MARK: - BackupRepo -@available(iOS 13.0, *) class BackupRepo { private let storage = SecureStorage() private var isFetching: Bool = false - + var data: BackupServiceData = .init() { didSet { do { @@ -501,7 +525,7 @@ class BackupRepo { Log.debug("BackupRepo updated") } } - + init () { do { try fetch() @@ -509,7 +533,7 @@ class BackupRepo { Log.debug(error) } } - + func reset() { do { try storage.delete(.backupData) @@ -518,18 +542,18 @@ class BackupRepo { } data = .init() } - + private func save() throws { guard !isFetching && data.shouldSave else { return } - + let encoded = try JSONEncoder().encode(data) try storage.store(encoded, forKey: .backupData) } - + private func fetch() throws { self.isFetching = true defer { self.isFetching = false } - + if let savedData = try storage.get(.backupData) { self.data = try JSONDecoder().decode(BackupServiceData.self, from: savedData) } diff --git a/TangemSdk/TangemSdk/Operations/Backup/FinalizeBackupCardTask.swift b/TangemSdk/TangemSdk/Operations/Backup/FinalizeBackupCardTask.swift index 944b4ffc9..b9492d2b1 100644 --- a/TangemSdk/TangemSdk/Operations/Backup/FinalizeBackupCardTask.swift +++ b/TangemSdk/TangemSdk/Operations/Backup/FinalizeBackupCardTask.swift @@ -8,7 +8,6 @@ import Foundation -@available(iOS 13.0, *) class FinalizeBackupCardTask: CardSessionRunnable { var shouldAskForAccessCode: Bool { false } @@ -43,14 +42,15 @@ class FinalizeBackupCardTask: CardSessionRunnable { completion(.failure(.missingPreflightRead)) return } - - if case .noBackup = card.backupStatus { + + switch card.backupStatus { + case .noBackup: // The direct case let command = LinkPrimaryCardCommand(primaryCard: primaryCard, backupCards: backupCards, attestSignature: attestSignature, accessCode: accessCode, passcode: passcode) - + command.run(in: session) { linkResult in switch linkResult { case .success: @@ -59,7 +59,9 @@ class FinalizeBackupCardTask: CardSessionRunnable { completion(.failure(error)) } } - } else { + case .active: // Inconsistence case. The card status is ok, but sdk status is incompleted. We should check all wallets later on the app side. + readWallets(in: session, completion: completion) + default: // only an interrupted case is possible writeBackupData(in: session, completion: completion) } } diff --git a/TangemSdk/TangemSdk/Operations/Backup/FinalizePrimaryCardTask.swift b/TangemSdk/TangemSdk/Operations/Backup/FinalizePrimaryCardTask.swift index 8bb0cd0e1..4cdbd04f5 100644 --- a/TangemSdk/TangemSdk/Operations/Backup/FinalizePrimaryCardTask.swift +++ b/TangemSdk/TangemSdk/Operations/Backup/FinalizePrimaryCardTask.swift @@ -8,7 +8,6 @@ import Foundation -@available(iOS 13.0, *) class FinalizePrimaryCardTask: CardSessionRunnable { var shouldAskForAccessCode: Bool { false } @@ -18,6 +17,7 @@ class FinalizePrimaryCardTask: CardSessionRunnable { private var attestSignature: Data? //We already have attestSignature private let onLink: (Data) -> Void private let onRead: ((String, [EncryptedBackupData])) -> Void + private let onFinalize: () -> Void private let readBackupStartIndex: Int init(backupCards: [BackupCard], @@ -26,16 +26,18 @@ class FinalizePrimaryCardTask: CardSessionRunnable { readBackupStartIndex: Int, //for restore attestSignature: Data?, onLink: @escaping (Data) -> Void, - onRead: @escaping ((String,[EncryptedBackupData])) -> Void) { + onRead: @escaping ((String,[EncryptedBackupData])) -> Void, + onFinalize: @escaping () -> Void) { self.backupCards = backupCards self.accessCode = accessCode self.passcode = passcode self.attestSignature = attestSignature self.onLink = onLink self.onRead = onRead + self.onFinalize = onFinalize self.readBackupStartIndex = readBackupStartIndex } - + deinit { Log.debug("FinalizePrimaryCardTask deinit") } @@ -108,6 +110,7 @@ class FinalizePrimaryCardTask: CardSessionRunnable { } guard card.firmwareVersion >= .keysImportAvailable else { + onFinalize() completion(.success(card)) return } @@ -117,8 +120,17 @@ class FinalizePrimaryCardTask: CardSessionRunnable { command?.run(in: session) { result in switch result { case .success: + self.onFinalize() completion(.success(card)) case .failure(let error): + // Backup data already finalized, but we didn't catch the original response due to NFC errors or tag lost. Just cover invalid state error + if case .invalidState = error { + Log.debug("Got \(error). Ignoring..") + self.onFinalize() + completion(.success(card)) + return + } + completion(.failure(error)) } @@ -143,7 +155,6 @@ class FinalizePrimaryCardTask: CardSessionRunnable { } } -@available(iOS 13.0, *) private extension FinalizePrimaryCardTask { enum LinkAction { case link diff --git a/TangemSdk/TangemSdk/Operations/Backup/FinalizeReadBackupDataCommand.swift b/TangemSdk/TangemSdk/Operations/Backup/FinalizeReadBackupDataCommand.swift index 2a1dd9f08..9d5946394 100644 --- a/TangemSdk/TangemSdk/Operations/Backup/FinalizeReadBackupDataCommand.swift +++ b/TangemSdk/TangemSdk/Operations/Backup/FinalizeReadBackupDataCommand.swift @@ -8,7 +8,6 @@ import Foundation -@available(iOS 13.0, *) final class FinalizeReadBackupDataCommand: Command { var requiresPasscode: Bool { return false } diff --git a/TangemSdk/TangemSdk/Operations/Backup/LinkBackupCardsCommand.swift b/TangemSdk/TangemSdk/Operations/Backup/LinkBackupCardsCommand.swift index ac842554a..1ffc2858c 100644 --- a/TangemSdk/TangemSdk/Operations/Backup/LinkBackupCardsCommand.swift +++ b/TangemSdk/TangemSdk/Operations/Backup/LinkBackupCardsCommand.swift @@ -9,14 +9,12 @@ import Foundation // Response from the Tangem card after `LinkBackupCardsCommand`. -@available(iOS 13.0, *) struct LinkBackupCardsResponse { /// Unique Tangem card ID number let cardId: String let attestSignature: Data } -@available(iOS 13.0, *) final class LinkBackupCardsCommand: Command { var requiresPasscode: Bool { return true } diff --git a/TangemSdk/TangemSdk/Operations/Backup/LinkPrimaryCardCommand.swift b/TangemSdk/TangemSdk/Operations/Backup/LinkPrimaryCardCommand.swift index fe2ce7647..0371fa56f 100644 --- a/TangemSdk/TangemSdk/Operations/Backup/LinkPrimaryCardCommand.swift +++ b/TangemSdk/TangemSdk/Operations/Backup/LinkPrimaryCardCommand.swift @@ -9,14 +9,12 @@ import Foundation // Response from the Tangem card after `LinkPrimaryCardCommand`. -@available(iOS 13.0, *) struct LinkPrimaryCardResponse { /// Unique Tangem card ID number let cardId: String let backupStatus: Card.BackupRawStatus } -@available(iOS 13.0, *) final class LinkPrimaryCardCommand: Command { var requiresPasscode: Bool { return true } diff --git a/TangemSdk/TangemSdk/Operations/Backup/ReadBackupDataCommand.swift b/TangemSdk/TangemSdk/Operations/Backup/ReadBackupDataCommand.swift index 7978ff4d8..3b2925296 100644 --- a/TangemSdk/TangemSdk/Operations/Backup/ReadBackupDataCommand.swift +++ b/TangemSdk/TangemSdk/Operations/Backup/ReadBackupDataCommand.swift @@ -9,7 +9,6 @@ import Foundation // Response from the Tangem card after `ReadBackupDataCommand`. -@available(iOS 13.0, *) struct ReadBackupDataResponse { /// Unique Tangem card ID number fileprivate(set) var cardId: String = "" @@ -22,7 +21,6 @@ struct ReadBackupDataResponse { } // Response from the Tangem card after `ReadBackupDataCommand`. -@available(iOS 13.0, *) struct PartialReadBackupDataResponse { /// Unique Tangem card ID number let cardId: String @@ -30,7 +28,6 @@ struct PartialReadBackupDataResponse { let data: EncryptedBackupData } -@available(iOS 13.0, *) final class ReadBackupDataCommand: Command { var requiresPasscode: Bool { return false } diff --git a/TangemSdk/TangemSdk/Operations/Backup/ResetBackupCommand.swift b/TangemSdk/TangemSdk/Operations/Backup/ResetBackupCommand.swift index 639cfbd40..8c15afba8 100644 --- a/TangemSdk/TangemSdk/Operations/Backup/ResetBackupCommand.swift +++ b/TangemSdk/TangemSdk/Operations/Backup/ResetBackupCommand.swift @@ -8,7 +8,6 @@ import Foundation -@available(iOS 13.0, *) struct ResetBackupResponse { let cardId: String let backupStatus: Card.BackupRawStatus @@ -17,7 +16,6 @@ struct ResetBackupResponse { let isDefaultPasscode: Bool } -@available(iOS 13.0, *) public final class ResetBackupCommand: Command { public var requiresPasscode: Bool { return true } public var preflightReadMode: PreflightReadMode { .fullCardRead } @@ -93,7 +91,6 @@ public final class ResetBackupCommand: Command { } } -@available(iOS 13.0, *) fileprivate extension Card.BackupStatus { var canResetBackup: Bool { switch self { diff --git a/TangemSdk/TangemSdk/Operations/Backup/StartBackupCardLinkingCommand.swift b/TangemSdk/TangemSdk/Operations/Backup/StartBackupCardLinkingCommand.swift index bb2aedf87..9fb846067 100644 --- a/TangemSdk/TangemSdk/Operations/Backup/StartBackupCardLinkingCommand.swift +++ b/TangemSdk/TangemSdk/Operations/Backup/StartBackupCardLinkingCommand.swift @@ -8,8 +8,6 @@ import Foundation - -@available(iOS 13.0, *) final class StartBackupCardLinkingCommand: Command { var requiresPasscode: Bool { return false } @@ -63,10 +61,13 @@ final class StartBackupCardLinkingCommand: Command { let decoder = TlvDecoder(tlv: tlv) - return BackupCard(cardId: try decoder.decode(.cardId), - cardPublicKey: card.cardPublicKey, - linkingKey: try decoder.decode(.backupCardLinkingKey), - attestSignature: try decoder.decode(.cardSignature), - firmwareVersion: card.firmwareVersion) + return BackupCard( + cardId: try decoder.decode(.cardId), + cardPublicKey: card.cardPublicKey, + firmwareVersion: card.firmwareVersion, + batchId: card.batchId, + linkingKey: try decoder.decode(.backupCardLinkingKey), + attestSignature: try decoder.decode(.cardSignature) + ) } } diff --git a/TangemSdk/TangemSdk/Operations/Backup/StartBackupCardLinkingTask.swift b/TangemSdk/TangemSdk/Operations/Backup/StartBackupCardLinkingTask.swift index c9e842246..6315184df 100644 --- a/TangemSdk/TangemSdk/Operations/Backup/StartBackupCardLinkingTask.swift +++ b/TangemSdk/TangemSdk/Operations/Backup/StartBackupCardLinkingTask.swift @@ -8,7 +8,15 @@ import Foundation -@available(iOS 13.0, *) +/// Response from the Tangem card after `StartBackupCardLinkingTask +struct StartBackupCardLinkingTaskResponse: JSONStringConvertible { + /// Backup data frrom the card + let backupCard: BackupCard + + /// Card being added + let card: Card +} + final class StartBackupCardLinkingTask: CardSessionRunnable { var shouldAskForAccessCode: Bool { false } @@ -27,7 +35,7 @@ final class StartBackupCardLinkingTask: CardSessionRunnable { Log.debug("StartBackupCardLinkingTask deinit") } - func run(in session: CardSession, completion: @escaping CompletionResult) { + func run(in session: CardSession, completion: @escaping CompletionResult) { if session.environment.config.handleErrors { guard let card = session.environment.card else { completion(.failure(.missingPreflightRead)) @@ -86,7 +94,19 @@ final class StartBackupCardLinkingTask: CardSessionRunnable { } linkingCommand = StartBackupCardLinkingCommand(primaryCardLinkingKey: primaryCard.linkingKey) - linkingCommand!.run(in: session, completion: completion) + linkingCommand!.run(in: session) { result in + switch result { + case .success(let backupCard): + guard let card = session.environment.card else { + completion(.failure(.missingPreflightRead)) + return + } + + completion(.success(.init(backupCard: backupCard, card: card))) + case .failure(let error): + completion(.failure(error)) + } + } } private func isBatchIdCompatible(_ batchId: String) -> Bool { diff --git a/TangemSdk/TangemSdk/Operations/Backup/StartPrimaryCardLinkingCommand.swift b/TangemSdk/TangemSdk/Operations/Backup/StartPrimaryCardLinkingCommand.swift index 98a728031..6e4d82c6d 100644 --- a/TangemSdk/TangemSdk/Operations/Backup/StartPrimaryCardLinkingCommand.swift +++ b/TangemSdk/TangemSdk/Operations/Backup/StartPrimaryCardLinkingCommand.swift @@ -8,7 +8,6 @@ import Foundation -@available(iOS 13.0, *) public final class StartPrimaryCardLinkingCommand: Command { var requiresPasscode: Bool { return false } diff --git a/TangemSdk/TangemSdk/Operations/Backup/WriteBackupDataCommand.swift b/TangemSdk/TangemSdk/Operations/Backup/WriteBackupDataCommand.swift index 69bb40ea9..5e16c0d63 100644 --- a/TangemSdk/TangemSdk/Operations/Backup/WriteBackupDataCommand.swift +++ b/TangemSdk/TangemSdk/Operations/Backup/WriteBackupDataCommand.swift @@ -9,14 +9,12 @@ import Foundation // Response from the Tangem card after `WriteBackupDataCommand`. -@available(iOS 13.0, *) struct WriteBackupDataResponse { /// Unique Tangem card ID number let cardId: String let backupStatus: Card.BackupRawStatus } -@available(iOS 13.0, *) final class WriteBackupDataCommand: Command { var requiresPasscode: Bool { return false } @@ -46,10 +44,6 @@ final class WriteBackupDataCommand: Command { if card.backupStatus == .noBackup { return .backupFailedCardNotLinked } - - if !card.wallets.isEmpty { - return .backupFailedNotEmptyWallets(cardId: card.cardId) - } return nil } diff --git a/TangemSdk/TangemSdk/Operations/Command.swift b/TangemSdk/TangemSdk/Operations/Command.swift index c026b73d5..41b50f064 100644 --- a/TangemSdk/TangemSdk/Operations/Command.swift +++ b/TangemSdk/TangemSdk/Operations/Command.swift @@ -10,7 +10,6 @@ import Foundation import CoreNFC -@available(iOS 13.0, *) protocol ApduSerializable { /// Simple interface for responses received after sending commands to Tangem cards. associatedtype CommandResponse @@ -28,7 +27,6 @@ protocol ApduSerializable { func deserialize(with environment: SessionEnvironment, from apdu: ResponseApdu) throws -> CommandResponse } -@available(iOS 13.0, *) extension ApduSerializable { /// Fix nfc issues with long-running commands and security delay for iPhone 7/7+. Card firmware 2.39 /// 4 - Timeout setting for ping nfc-module @@ -42,7 +40,6 @@ extension ApduSerializable { } /// The basic protocol for card commands -@available(iOS 13.0, *) protocol Command: AnyObject, ApduSerializable, CardSessionRunnable { /// If set to `true` and ` SessionEnvironment.passcode` is nil, pin2 will be requested automatically before transieve the apdu. Default is `false` var requiresPasscode: Bool { get } @@ -51,7 +48,6 @@ protocol Command: AnyObject, ApduSerializable, CardSessionRunnable { func mapError(_ card: Card?, _ error: TangemSdkError) -> TangemSdkError } -@available(iOS 13.0, *) extension Command { var requiresPasscode: Bool { return false } @@ -165,7 +161,7 @@ extension Command { let totalSd = session.environment.currentSecurityDelay! if totalSd > 0 { session.viewDelegate.setState(.delay(remaining: securityDelayResponse.remainingSeconds, total: totalSd)) - session.viewDelegate.showAlertMessage("view_delegate_security_delay_description".localized) + session.viewDelegate.showAlertMessage("view_delegate_security_delay_description_format".localized(session.environment.config.productType.localizedDescription)) } if securityDelayResponse.saveToFlash && session.environment.encryptionMode == .none { diff --git a/TangemSdk/TangemSdk/Operations/Derivation/DeriveMultipleWalletPublicKeysTask.swift b/TangemSdk/TangemSdk/Operations/Derivation/DeriveMultipleWalletPublicKeysTask.swift index 52387064f..01e65e58c 100644 --- a/TangemSdk/TangemSdk/Operations/Derivation/DeriveMultipleWalletPublicKeysTask.swift +++ b/TangemSdk/TangemSdk/Operations/Derivation/DeriveMultipleWalletPublicKeysTask.swift @@ -8,7 +8,6 @@ import Foundation -@available(iOS 13.0, *) public class DeriveMultipleWalletPublicKeysTask: CardSessionRunnable { public typealias Response = [Data: DerivedKeys] @@ -43,7 +42,12 @@ public class DeriveMultipleWalletPublicKeysTask: CardSessionRunnable { self.response[derivation.0] = derivedKeys self.derive(index: index + 1, in: session, completion: completion) case .failure(let error): - completion(.failure(error)) + if self.response.isEmpty { + completion(.failure(error)) + } else { + // return partial response + completion(.success(self.response)) + } } } } diff --git a/TangemSdk/TangemSdk/Operations/Derivation/DeriveWalletPublicKeyTask.swift b/TangemSdk/TangemSdk/Operations/Derivation/DeriveWalletPublicKeyTask.swift index b06408d94..de72045d5 100644 --- a/TangemSdk/TangemSdk/Operations/Derivation/DeriveWalletPublicKeyTask.swift +++ b/TangemSdk/TangemSdk/Operations/Derivation/DeriveWalletPublicKeyTask.swift @@ -8,7 +8,6 @@ import Foundation -@available(iOS 13.0, *) public class DeriveWalletPublicKeyTask: CardSessionRunnable { private let walletPublicKey: Data private let derivationPath: DerivationPath diff --git a/TangemSdk/TangemSdk/Operations/Derivation/DeriveWalletPublicKeysTask.swift b/TangemSdk/TangemSdk/Operations/Derivation/DeriveWalletPublicKeysTask.swift index 76f2b963e..e9cef3fe5 100644 --- a/TangemSdk/TangemSdk/Operations/Derivation/DeriveWalletPublicKeysTask.swift +++ b/TangemSdk/TangemSdk/Operations/Derivation/DeriveWalletPublicKeysTask.swift @@ -8,7 +8,6 @@ import Foundation -@available(iOS 13.0, *) public class DeriveWalletPublicKeysTask: CardSessionRunnable { private let walletPublicKey: Data private let derivationPaths: [DerivationPath] @@ -47,9 +46,16 @@ public class DeriveWalletPublicKeysTask: CardSessionRunnable { case .failure(let error): switch error { case .nonHardenedDerivationNotSupported, .walletNotFound, .unsupportedCurve: + // continue derivation Log.error(error) default: - completion(.failure(error)) + if keys.keys.isEmpty { + completion(.failure(error)) + } else { + Log.error(error) + // return partial response + completion(.success(keys)) + } return } } diff --git a/TangemSdk/TangemSdk/Operations/Files/ChangeFileSettingsCommand.swift b/TangemSdk/TangemSdk/Operations/Files/ChangeFileSettingsCommand.swift index 901a4ff3f..68514cc55 100644 --- a/TangemSdk/TangemSdk/Operations/Files/ChangeFileSettingsCommand.swift +++ b/TangemSdk/TangemSdk/Operations/Files/ChangeFileSettingsCommand.swift @@ -9,7 +9,6 @@ import Foundation /// Command for updating file settings -@available (iOS 13.0, *) public final class ChangeFileSettingsCommand: Command { public var requiresPasscode: Bool { true } diff --git a/TangemSdk/TangemSdk/Operations/Files/ChangeFileSettingsTask.swift b/TangemSdk/TangemSdk/Operations/Files/ChangeFileSettingsTask.swift index 61a2f5a3b..f51c1759f 100644 --- a/TangemSdk/TangemSdk/Operations/Files/ChangeFileSettingsTask.swift +++ b/TangemSdk/TangemSdk/Operations/Files/ChangeFileSettingsTask.swift @@ -9,7 +9,6 @@ import Foundation /// Task for updating settings for files saved on card -@available (iOS 13.0, *) public final class ChangeFileSettingsTask: CardSessionRunnable { private var changes: [(Int, FileVisibility)] diff --git a/TangemSdk/TangemSdk/Operations/Files/DeleteAllFilesTask.swift b/TangemSdk/TangemSdk/Operations/Files/DeleteAllFilesTask.swift index 6aff374ef..d020e13aa 100644 --- a/TangemSdk/TangemSdk/Operations/Files/DeleteAllFilesTask.swift +++ b/TangemSdk/TangemSdk/Operations/Files/DeleteAllFilesTask.swift @@ -9,7 +9,6 @@ import Foundation /// Task for deleting all files from card. -@available (iOS 13.0, *) final class DeleteAllFilesTask: CardSessionRunnable { func run(in session: CardSession, completion: @escaping CompletionResult) { deleteFile(session: session, completion: completion) diff --git a/TangemSdk/TangemSdk/Operations/Files/DeleteFileCommand.swift b/TangemSdk/TangemSdk/Operations/Files/DeleteFileCommand.swift index d71ddc8ea..1b0bae53f 100644 --- a/TangemSdk/TangemSdk/Operations/Files/DeleteFileCommand.swift +++ b/TangemSdk/TangemSdk/Operations/Files/DeleteFileCommand.swift @@ -9,7 +9,6 @@ import Foundation /// Command that deletes file at specified index -@available (iOS 13.0, *) public final class DeleteFileCommand: Command { var requiresPasscode: Bool { return true } diff --git a/TangemSdk/TangemSdk/Operations/Files/DeleteFilesTask.swift b/TangemSdk/TangemSdk/Operations/Files/DeleteFilesTask.swift index 141e00446..604755dd8 100644 --- a/TangemSdk/TangemSdk/Operations/Files/DeleteFilesTask.swift +++ b/TangemSdk/TangemSdk/Operations/Files/DeleteFilesTask.swift @@ -9,7 +9,6 @@ import Foundation /// Task for deleting files from card. -@available (iOS 13.0, *) public final class DeleteFilesTask: CardSessionRunnable { private let indices: [Int]? private var deleteRunnable: DeleteAllFilesTask? diff --git a/TangemSdk/TangemSdk/Operations/Files/File.swift b/TangemSdk/TangemSdk/Operations/Files/File.swift index 4ce0348a3..eecf2182a 100644 --- a/TangemSdk/TangemSdk/Operations/Files/File.swift +++ b/TangemSdk/TangemSdk/Operations/Files/File.swift @@ -8,7 +8,6 @@ import Foundation -@available (iOS 13, *) public struct File: JSONStringConvertible { public let name: String? public let data: Data @@ -27,7 +26,6 @@ public struct File: JSONStringConvertible { } } -@available (iOS 13, *) extension File { init?(response: ReadFileResponse) { guard response.size != nil, let settings = response.settings else { @@ -51,7 +49,6 @@ extension File { } } -@available(iOS 13.0, *) public struct NamedFile { public let name: String public let payload: Data @@ -96,7 +93,6 @@ public struct NamedFile { } /// File data to write by the user or file owner. -@available (iOS 13.0, *) public enum FileToWrite: Decodable { /// Write file protected by the user with security delay or user code if set /// - data: Data to write diff --git a/TangemSdk/TangemSdk/Operations/Files/FileHashHelper.swift b/TangemSdk/TangemSdk/Operations/Files/FileHashHelper.swift index 74eb29e03..cd70ca159 100644 --- a/TangemSdk/TangemSdk/Operations/Files/FileHashHelper.swift +++ b/TangemSdk/TangemSdk/Operations/Files/FileHashHelper.swift @@ -9,7 +9,6 @@ import Foundation /// Use this helper when creating signatures for files that signed by issuer -@available(iOS 13.0, *) public struct FileHashHelper { /// Creating hashes for `FileDataProtectedBySignature` diff --git a/TangemSdk/TangemSdk/Operations/Files/FileSettings.swift b/TangemSdk/TangemSdk/Operations/Files/FileSettings.swift index d58e3ea32..1d949fcf7 100644 --- a/TangemSdk/TangemSdk/Operations/Files/FileSettings.swift +++ b/TangemSdk/TangemSdk/Operations/Files/FileSettings.swift @@ -8,13 +8,11 @@ import Foundation -@available(iOS 13.0, *) public struct FileSettings: Codable { public let isPermanent: Bool public let visibility: FileVisibility } -@available(iOS 13.0, *) extension FileSettings { init?(_ data: Data?) throws { guard let data = data else { return nil } @@ -35,7 +33,6 @@ extension FileSettings { } ///File visibility. Private files can be read only with security delay or user code if set -@available(iOS 13.0, *) public enum FileVisibility: String, Codable { /// User can read public files without any codes case `public` diff --git a/TangemSdk/TangemSdk/Operations/Files/ReadFileChecksumCommand.swift b/TangemSdk/TangemSdk/Operations/Files/ReadFileChecksumCommand.swift index 3060277f8..71a79eca7 100644 --- a/TangemSdk/TangemSdk/Operations/Files/ReadFileChecksumCommand.swift +++ b/TangemSdk/TangemSdk/Operations/Files/ReadFileChecksumCommand.swift @@ -9,7 +9,6 @@ import Foundation /// Deserialized response for `ReadFileChecksumCommand` -@available (iOS 13.0, *) public struct ReadFileChecksumResponse: JSONStringConvertible { public let cardId: String public let checksum: Data @@ -17,7 +16,6 @@ public struct ReadFileChecksumResponse: JSONStringConvertible { } /// The command that prompts the card to create a file checksum. This checksum is used to check the integrity of the file on the card -@available (iOS 13.0, *) public final class ReadFileChecksumCommand: Command { public var shouldReadPrivateFiles = false diff --git a/TangemSdk/TangemSdk/Operations/Files/ReadFileCommand.swift b/TangemSdk/TangemSdk/Operations/Files/ReadFileCommand.swift index 995377857..456fcb1df 100644 --- a/TangemSdk/TangemSdk/Operations/Files/ReadFileCommand.swift +++ b/TangemSdk/TangemSdk/Operations/Files/ReadFileCommand.swift @@ -9,7 +9,6 @@ import Foundation /// Deserialized response for `ReadFileCommand` -@available (iOS 13.0, *) struct ReadFileResponse: JSONStringConvertible { var cardId: String var size: Int? @@ -55,7 +54,6 @@ struct ReadFileResponse: JSONStringConvertible { } /// Command that read single file at specified index. Reading private file will prompt user to input a passcode. -@available (iOS 13.0, *) final class ReadFileCommand: Command { ///If true, user code or security delay will be requested var shouldReadPrivateFiles = false diff --git a/TangemSdk/TangemSdk/Operations/Files/ReadFilesTask.swift b/TangemSdk/TangemSdk/Operations/Files/ReadFilesTask.swift index 139d172f0..ed5f5f967 100644 --- a/TangemSdk/TangemSdk/Operations/Files/ReadFilesTask.swift +++ b/TangemSdk/TangemSdk/Operations/Files/ReadFilesTask.swift @@ -9,7 +9,6 @@ import Foundation /// This task requesting information about files saved on card. Task can read private files -@available (iOS 13.0, *) public class ReadFilesTask: CardSessionRunnable { /// If true, user code or security delay will be requested public var shouldReadPrivateFiles = false diff --git a/TangemSdk/TangemSdk/Operations/Files/WriteFileCommand.swift b/TangemSdk/TangemSdk/Operations/Files/WriteFileCommand.swift index fc2ba9169..fb61bfb32 100644 --- a/TangemSdk/TangemSdk/Operations/Files/WriteFileCommand.swift +++ b/TangemSdk/TangemSdk/Operations/Files/WriteFileCommand.swift @@ -9,14 +9,12 @@ import Foundation /// Deserialized response for `WriteFileCommand` -@available (iOS 13.0, *) public struct WriteFileResponse: JSONStringConvertible { let cardId: String let fileIndex: Int? } /// Command for writing file on card -@available (iOS 13.0, *) public final class WriteFileCommand: Command { var requiresPasscode: Bool { isWritingByUserCodes } diff --git a/TangemSdk/TangemSdk/Operations/Files/WriteFilesTask.swift b/TangemSdk/TangemSdk/Operations/Files/WriteFilesTask.swift index a5bcb3427..9c4e807d3 100644 --- a/TangemSdk/TangemSdk/Operations/Files/WriteFilesTask.swift +++ b/TangemSdk/TangemSdk/Operations/Files/WriteFilesTask.swift @@ -12,7 +12,6 @@ import Foundation /// - Parameters: /// - cardId: CID, Unique Tangem card ID number /// - fileIndices: Indicies of created files -@available (iOS 13.0, *) public struct WriteFilesResponse: JSONStringConvertible { public let cardId: String public let filesIndices: [Int] @@ -22,7 +21,6 @@ public struct WriteFilesResponse: JSONStringConvertible { /// There are two secure ways to write files. /// 1. Data can be signed by owner (the one specified on card during personalization) /// 2. Data can be protected by user code. In this case, user code is required for the command. -@available (iOS 13.0, *) public final class WriteFilesTask: CardSessionRunnable { private let files: [FileToWrite] private var savedFilesIndices: [Int] = [] diff --git a/TangemSdk/TangemSdk/Operations/GenerateOTPCommand.swift b/TangemSdk/TangemSdk/Operations/GenerateOTPCommand.swift index 9b9ce9e4b..5e3fd2b6e 100644 --- a/TangemSdk/TangemSdk/Operations/GenerateOTPCommand.swift +++ b/TangemSdk/TangemSdk/Operations/GenerateOTPCommand.swift @@ -9,7 +9,6 @@ import Foundation /// Deserialized response from the Tangem card after `GenerateOTPCommand`. -@available(iOS 13.0, *) public struct GenerateOTPResponse: JSONStringConvertible { /// Unique Tangem card ID number. public let cardId: String @@ -22,7 +21,6 @@ public struct GenerateOTPResponse: JSONStringConvertible { } /// Generate OTP on the card. -@available(iOS 13.0, *) public class GenerateOTPCommand: Command { public init() {} diff --git a/TangemSdk/TangemSdk/Operations/GetEntropyCommand.swift b/TangemSdk/TangemSdk/Operations/GetEntropyCommand.swift index 120533fe4..7a0796b47 100644 --- a/TangemSdk/TangemSdk/Operations/GetEntropyCommand.swift +++ b/TangemSdk/TangemSdk/Operations/GetEntropyCommand.swift @@ -9,7 +9,6 @@ import Foundation /// Deserialized response from the Tangem card after `GetEntropyCommand`. -@available(iOS 13.0, *) public struct GetEntropyResponse: JSONStringConvertible { /// Unique Tangem card ID number. public let cardId: String @@ -18,7 +17,6 @@ public struct GetEntropyResponse: JSONStringConvertible { } /// Get entropy from the card -@available(iOS 13.0, *) public class GetEntropyCommand: Command { public var preflightReadMode: PreflightReadMode { .readCardOnly } diff --git a/TangemSdk/TangemSdk/Operations/IssuerAndUserData/ReadIssuerDataCommand.swift b/TangemSdk/TangemSdk/Operations/IssuerAndUserData/ReadIssuerDataCommand.swift index a7033dbff..d4be62f37 100644 --- a/TangemSdk/TangemSdk/Operations/IssuerAndUserData/ReadIssuerDataCommand.swift +++ b/TangemSdk/TangemSdk/Operations/IssuerAndUserData/ReadIssuerDataCommand.swift @@ -9,7 +9,6 @@ import Foundation /// Deserialized response from the Tangem card after `ReadIssuerDataCommand`. -@available(iOS 13.0, *) public struct ReadIssuerDataResponse: JSONStringConvertible { /// Unique Tangem card ID number public let cardId: String @@ -44,7 +43,6 @@ public struct ReadIssuerDataResponse: JSONStringConvertible { * wallet balance signed by the issuer or additional issuer’s attestation data. */ @available(*, deprecated, message: "Use files instead") -@available(iOS 13.0, *) public final class ReadIssuerDataCommand: Command { private var issuerPublicKey: Data? diff --git a/TangemSdk/TangemSdk/Operations/IssuerAndUserData/ReadIssuerExtraDataCommand.swift b/TangemSdk/TangemSdk/Operations/IssuerAndUserData/ReadIssuerExtraDataCommand.swift index f5a2b2e2d..57a75ce62 100644 --- a/TangemSdk/TangemSdk/Operations/IssuerAndUserData/ReadIssuerExtraDataCommand.swift +++ b/TangemSdk/TangemSdk/Operations/IssuerAndUserData/ReadIssuerExtraDataCommand.swift @@ -26,7 +26,6 @@ public enum IssuerExtraDataMode: Byte, InteractionMode { } /// Deserialized response from the Tangem card after `ReadIssuerExtraDataCommand`. -@available(iOS 13.0, *) public struct ReadIssuerExtraDataResponse: JSONStringConvertible { /// Unique Tangem card ID number public let cardId: String @@ -80,7 +79,6 @@ public struct ReadIssuerExtraDataResponse: JSONStringConvertible { * biometric information for ID card product. */ @available(*, deprecated, message: "Use files instead") -@available(iOS 13.0, *) public final class ReadIssuerExtraDataCommand: Command { private var issuerPublicKey: Data? private var completion: CompletionResult? diff --git a/TangemSdk/TangemSdk/Operations/IssuerAndUserData/ReadUserDataCommand.swift b/TangemSdk/TangemSdk/Operations/IssuerAndUserData/ReadUserDataCommand.swift index c7ecad151..e07f66439 100644 --- a/TangemSdk/TangemSdk/Operations/IssuerAndUserData/ReadUserDataCommand.swift +++ b/TangemSdk/TangemSdk/Operations/IssuerAndUserData/ReadUserDataCommand.swift @@ -33,7 +33,6 @@ public struct ReadUserDataResponse: JSONStringConvertible { * For example, this fields may contain blockchain nonce value. */ @available(*, deprecated, message: "Use files instead") -@available(iOS 13.0, *) public final class ReadUserDataCommand: Command { public init() {} diff --git a/TangemSdk/TangemSdk/Operations/IssuerAndUserData/WriteIssuerDataCommand.swift b/TangemSdk/TangemSdk/Operations/IssuerAndUserData/WriteIssuerDataCommand.swift index 3936fba69..17fdf61be 100644 --- a/TangemSdk/TangemSdk/Operations/IssuerAndUserData/WriteIssuerDataCommand.swift +++ b/TangemSdk/TangemSdk/Operations/IssuerAndUserData/WriteIssuerDataCommand.swift @@ -14,7 +14,6 @@ import Foundation * wallet balance signed by the issuer or additional issuer’s attestation data. */ @available(*, deprecated, message: "Use files instead") -@available(iOS 13.0, *) public final class WriteIssuerDataCommand: Command { /// Data provided by issuer public let issuerData: Data diff --git a/TangemSdk/TangemSdk/Operations/IssuerAndUserData/WriteIssuerExtraDataCommand.swift b/TangemSdk/TangemSdk/Operations/IssuerAndUserData/WriteIssuerExtraDataCommand.swift index 12e3980d5..df2e36336 100644 --- a/TangemSdk/TangemSdk/Operations/IssuerAndUserData/WriteIssuerExtraDataCommand.swift +++ b/TangemSdk/TangemSdk/Operations/IssuerAndUserData/WriteIssuerExtraDataCommand.swift @@ -14,7 +14,6 @@ import Foundation * For example, this field may contain a photo or biometric information for ID card products. */ @available(*, deprecated, message: "Use files instead") //todo: text -@available(iOS 13.0, *) public final class WriteIssuerExtraDataCommand: Command { private static let singleWriteSize = 900 private static let maxSize = 32 * 1024 diff --git a/TangemSdk/TangemSdk/Operations/IssuerAndUserData/WriteUserDataCommand.swift b/TangemSdk/TangemSdk/Operations/IssuerAndUserData/WriteUserDataCommand.swift index ea681f2c8..addb99ba4 100644 --- a/TangemSdk/TangemSdk/Operations/IssuerAndUserData/WriteUserDataCommand.swift +++ b/TangemSdk/TangemSdk/Operations/IssuerAndUserData/WriteUserDataCommand.swift @@ -20,7 +20,6 @@ import Foundation * User_ProtectedCounter and User_ProtectedData additionaly need PIN2 to confirmation. */ @available(*, deprecated, message: "Use files instead") -@available(iOS 13.0, *) public final class WriteUserDataCommand: Command { var requiresPasscode: Bool { return true } diff --git a/TangemSdk/TangemSdk/Operations/OpenSessionCommand.swift b/TangemSdk/TangemSdk/Operations/OpenSessionCommand.swift index d2d4325f4..9fa27850c 100644 --- a/TangemSdk/TangemSdk/Operations/OpenSessionCommand.swift +++ b/TangemSdk/TangemSdk/Operations/OpenSessionCommand.swift @@ -17,7 +17,6 @@ struct OpenSessionResponse { /// In case of encrypted communication, App should setup a session before calling any further command. /// [OpenSessionCommand] generates secret session_key that is used by both host and card /// to encrypt and decrypt commands’ payload. -@available(iOS 13.0, *) class OpenSessionCommand: ApduSerializable { private let sessionKeyA: Data @@ -50,7 +49,6 @@ protocol EncryptionHelper { func generateSecret(keyB: Data) throws -> Data } -@available(iOS 13.0, *) class EncryptionHelperFactory { static func make(for mode: EncryptionMode) throws -> EncryptionHelper { switch mode { @@ -64,7 +62,6 @@ class EncryptionHelperFactory { } } -@available(iOS 13.0, *) final class FastEncryptionHelper: EncryptionHelper { let keyA: Data @@ -77,7 +74,6 @@ final class FastEncryptionHelper: EncryptionHelper { } } -@available(iOS 13.0, *) final class StrongEncryptionHelper: EncryptionHelper { let keyA: Data diff --git a/TangemSdk/TangemSdk/Operations/Personalization/DepersonalizeCommand.swift b/TangemSdk/TangemSdk/Operations/Personalization/DepersonalizeCommand.swift index 65aa34a5a..284ebeaeb 100644 --- a/TangemSdk/TangemSdk/Operations/Personalization/DepersonalizeCommand.swift +++ b/TangemSdk/TangemSdk/Operations/Personalization/DepersonalizeCommand.swift @@ -17,7 +17,6 @@ public struct DepersonalizeResponse: JSONStringConvertible { * This command resets card to initial state, * erasing all data written during personalization and usage. */ -@available(iOS 13.0, *) public class DepersonalizeCommand: Command { public var preflightReadMode: PreflightReadMode { .none } diff --git a/TangemSdk/TangemSdk/Operations/Personalization/Entities/CardConfig.swift b/TangemSdk/TangemSdk/Operations/Personalization/Entities/CardConfig.swift index 9638e944c..42e80d29c 100644 --- a/TangemSdk/TangemSdk/Operations/Personalization/Entities/CardConfig.swift +++ b/TangemSdk/TangemSdk/Operations/Personalization/Entities/CardConfig.swift @@ -11,7 +11,6 @@ import Foundation * It is a configuration file with all the card settings that are written on the card * during [PersonalizeCommand]. */ -@available(iOS 13.0, *) public struct CardConfig: Decodable { let releaseVersion: Bool let issuerName: String @@ -237,7 +236,6 @@ public struct CardConfig: Decodable { } } -@available(iOS 13.0, *) extension CardConfig { struct CardConfigData: Decodable { let date: Date? diff --git a/TangemSdk/TangemSdk/Operations/Personalization/Entities/CardData.swift b/TangemSdk/TangemSdk/Operations/Personalization/Entities/CardData.swift index 6393141d8..66bfd6396 100644 --- a/TangemSdk/TangemSdk/Operations/Personalization/Entities/CardData.swift +++ b/TangemSdk/TangemSdk/Operations/Personalization/Entities/CardData.swift @@ -9,7 +9,6 @@ import Foundation /// Detailed information about card contents. -@available(iOS 13.0, *) struct CardData { /// Tangem internal manufacturing batch ID. let batchId: String diff --git a/TangemSdk/TangemSdk/Operations/Personalization/Entities/NdefRecord.swift b/TangemSdk/TangemSdk/Operations/Personalization/Entities/NdefRecord.swift index 483726463..01ec2f8d5 100644 --- a/TangemSdk/TangemSdk/Operations/Personalization/Entities/NdefRecord.swift +++ b/TangemSdk/TangemSdk/Operations/Personalization/Entities/NdefRecord.swift @@ -8,7 +8,6 @@ import Foundation -@available(iOS 13.0, *) struct NdefRecord: Codable { enum NdefRecordType: String, Codable { case uri @@ -24,7 +23,6 @@ struct NdefRecord: Codable { } } -@available(iOS 13.0, *) extension NdefRecord { public init(from decoder: Decoder) throws { let values = try decoder.container(keyedBy: CodingKeys.self) diff --git a/TangemSdk/TangemSdk/Operations/Personalization/Entities/ProductMask.swift b/TangemSdk/TangemSdk/Operations/Personalization/Entities/ProductMask.swift index 59e87f12d..5396e8c0d 100644 --- a/TangemSdk/TangemSdk/Operations/Personalization/Entities/ProductMask.swift +++ b/TangemSdk/TangemSdk/Operations/Personalization/Entities/ProductMask.swift @@ -8,7 +8,6 @@ import Foundation -@available(iOS 13.0, *) struct ProductMask: OptionSet, OptionSetCustomStringConvertible { let rawValue: Byte @@ -18,7 +17,6 @@ struct ProductMask: OptionSet, OptionSetCustomStringConvertible { } //MARK:- Constants -@available(iOS 13.0, *) extension ProductMask { static let note = ProductMask(rawValue: 0x01) static let tag = ProductMask(rawValue: 0x02) @@ -29,7 +27,6 @@ extension ProductMask { } //MARK: - OptionSetCodable conformance -@available(iOS 13.0, *) extension ProductMask: OptionSetCodable { enum OptionKeys: String, OptionKey { case note diff --git a/TangemSdk/TangemSdk/Operations/Personalization/NdefEncoder.swift b/TangemSdk/TangemSdk/Operations/Personalization/NdefEncoder.swift index 7a27f4e17..21baac902 100644 --- a/TangemSdk/TangemSdk/Operations/Personalization/NdefEncoder.swift +++ b/TangemSdk/TangemSdk/Operations/Personalization/NdefEncoder.swift @@ -12,7 +12,6 @@ import Foundation /** * Encodes information that is to be written on the card as an Ndef Tag. */ -@available(iOS 13.0, *) class NdefEncoder { private let ndefRecords: [NdefRecord] private let useDynamicNdef: Bool diff --git a/TangemSdk/TangemSdk/Operations/Personalization/PersonalizeCommand.swift b/TangemSdk/TangemSdk/Operations/Personalization/PersonalizeCommand.swift index 7c79e6da8..15bd765e2 100644 --- a/TangemSdk/TangemSdk/Operations/Personalization/PersonalizeCommand.swift +++ b/TangemSdk/TangemSdk/Operations/Personalization/PersonalizeCommand.swift @@ -13,8 +13,6 @@ import Foundation /// During this procedure a card setting is set up. /// During this procedure all data exchange is encrypted. /// - Warning: Command available only for cards with COS 3.34 and higher. Legacy devices not supported. - -@available(iOS 13.0, *) public class PersonalizeCommand: Command { public var preflightReadMode: PreflightReadMode { .none } diff --git a/TangemSdk/TangemSdk/Operations/Pins/CheckUserCodesCommand.swift b/TangemSdk/TangemSdk/Operations/Pins/CheckUserCodesCommand.swift index 5cce235c7..fa012afc9 100644 --- a/TangemSdk/TangemSdk/Operations/Pins/CheckUserCodesCommand.swift +++ b/TangemSdk/TangemSdk/Operations/Pins/CheckUserCodesCommand.swift @@ -13,7 +13,6 @@ public struct CheckUserCodesResponse: JSONStringConvertible { public let isPasscodeSet: Bool } -@available(iOS 13.0, *) public final class CheckUserCodesCommand: CardSessionRunnable { public init() {} diff --git a/TangemSdk/TangemSdk/Operations/Pins/SetUserCodeCommand.swift b/TangemSdk/TangemSdk/Operations/Pins/SetUserCodeCommand.swift index 9e3b2b21f..76d558674 100644 --- a/TangemSdk/TangemSdk/Operations/Pins/SetUserCodeCommand.swift +++ b/TangemSdk/TangemSdk/Operations/Pins/SetUserCodeCommand.swift @@ -8,7 +8,6 @@ import Foundation -@available(iOS 13.0, *) public class SetUserCodeCommand: Command { var requiresPasscode: Bool = true var shouldRestrictDefaultCodes = true @@ -223,7 +222,6 @@ public class SetUserCodeCommand: Command { } } // MARK:- Reset codes -@available(iOS 13.0, *) public extension SetUserCodeCommand { static var resetAccessCodeCommand: SetUserCodeCommand { let command = SetUserCodeCommand(accessCode: UserCodeType.accessCode.defaultValue) @@ -245,7 +243,6 @@ public extension SetUserCodeCommand { } } -@available(iOS 13.0, *) extension SetUserCodeCommand { enum UserCodeAction: Equatable { case request diff --git a/TangemSdk/TangemSdk/Operations/PreflightReadFilter/CardIdPreflightReadFilter.swift b/TangemSdk/TangemSdk/Operations/PreflightReadFilter/CardIdPreflightReadFilter.swift index a0d1f6417..223fe7918 100644 --- a/TangemSdk/TangemSdk/Operations/PreflightReadFilter/CardIdPreflightReadFilter.swift +++ b/TangemSdk/TangemSdk/Operations/PreflightReadFilter/CardIdPreflightReadFilter.swift @@ -8,7 +8,6 @@ import Foundation -@available(iOS 13.0, *) struct CardIdPreflightReadFilter: PreflightReadFilter { private let expectedCardId: String diff --git a/TangemSdk/TangemSdk/Operations/PreflightReadFilter/PreflightReadFilter.swift b/TangemSdk/TangemSdk/Operations/PreflightReadFilter/PreflightReadFilter.swift index 96ed4cc3c..25c579c62 100644 --- a/TangemSdk/TangemSdk/Operations/PreflightReadFilter/PreflightReadFilter.swift +++ b/TangemSdk/TangemSdk/Operations/PreflightReadFilter/PreflightReadFilter.swift @@ -8,7 +8,6 @@ import Foundation -@available(iOS 13.0, *) /// Use this filter to filter out cards on preflight read stage. If preflight mode is set to `readCardOnly` or `fullCardRead`. `HandleErrors` flag must be switched on. public protocol PreflightReadFilter { /// This method calls right after public information is read. User code is not required. If preflight mode is set to `readCardOnly` or `fullCardRead` diff --git a/TangemSdk/TangemSdk/Operations/PreflightReadTask.swift b/TangemSdk/TangemSdk/Operations/PreflightReadTask.swift index fbd6c8394..a0bb06687 100644 --- a/TangemSdk/TangemSdk/Operations/PreflightReadTask.swift +++ b/TangemSdk/TangemSdk/Operations/PreflightReadTask.swift @@ -10,7 +10,6 @@ import Foundation /// Mode for preflight read task /// - Note: Valid for cards with COS v.4 and higher. Older card will always read the card and the wallet info. `fullCardRead` will be used by default -@available(iOS 13.0, *) public enum PreflightReadMode: Decodable, Equatable { /// No card will be read at session start. `SessionEnvironment.card` will be empty case none @@ -36,7 +35,6 @@ public enum PreflightReadMode: Decodable, Equatable { } } -@available(iOS 13.0, *) final class PreflightReadTask: CardSessionRunnable { private let readMode: PreflightReadMode private let preflightFilter: PreflightReadFilter? diff --git a/TangemSdk/TangemSdk/Operations/Read/ReadCommand.swift b/TangemSdk/TangemSdk/Operations/Read/ReadCommand.swift index 6ece6acc5..88795772a 100644 --- a/TangemSdk/TangemSdk/Operations/Read/ReadCommand.swift +++ b/TangemSdk/TangemSdk/Operations/Read/ReadCommand.swift @@ -10,7 +10,7 @@ import Foundation /// This command receives from the Tangem Card all the data about the card and the wallet, /// including unique card number (CID or cardId) that has to be submitted while calling all other commands. -@available(iOS 13.0, *) + public final class ReadCommand: Command { public var preflightReadMode: PreflightReadMode { .none } diff --git a/TangemSdk/TangemSdk/Operations/Read/ReadWalletCommand.swift b/TangemSdk/TangemSdk/Operations/Read/ReadWalletCommand.swift index 5f0e9a78b..dfc74856f 100644 --- a/TangemSdk/TangemSdk/Operations/Read/ReadWalletCommand.swift +++ b/TangemSdk/TangemSdk/Operations/Read/ReadWalletCommand.swift @@ -8,14 +8,12 @@ import Foundation -@available(iOS 13.0, *) struct ReadWalletResponse: JSONStringConvertible { let cardId: String let wallet: Card.Wallet } /// Read single wallet on card. This command executes before interacting with specific wallet to retrieve information about it and perform prechecks -@available(iOS 13.0, *) class ReadWalletCommand: Command { var preflightReadMode: PreflightReadMode { .readCardOnly } diff --git a/TangemSdk/TangemSdk/Operations/Read/ReadWalletsListCommand.swift b/TangemSdk/TangemSdk/Operations/Read/ReadWalletsListCommand.swift index 1fa14f661..adbd630ee 100644 --- a/TangemSdk/TangemSdk/Operations/Read/ReadWalletsListCommand.swift +++ b/TangemSdk/TangemSdk/Operations/Read/ReadWalletsListCommand.swift @@ -8,14 +8,12 @@ import Foundation -@available(iOS 13.0, *) public struct ReadWalletsListResponse: JSONStringConvertible { public let cardId: String public let wallets: [Card.Wallet] } /// Read all wallets on card. -@available(iOS 13.0, *) public class ReadWalletsListCommand: Command { public var preflightReadMode: PreflightReadMode { .readCardOnly } diff --git a/TangemSdk/TangemSdk/Operations/ResetCode/AuthorizeResetPinToken.swift b/TangemSdk/TangemSdk/Operations/ResetCode/AuthorizeResetPinToken.swift index 8932d09f7..9e1779ede 100644 --- a/TangemSdk/TangemSdk/Operations/ResetCode/AuthorizeResetPinToken.swift +++ b/TangemSdk/TangemSdk/Operations/ResetCode/AuthorizeResetPinToken.swift @@ -8,7 +8,6 @@ import Foundation -@available(iOS 13.0, *) final class AuthorizeResetPinTokenCommand: Command { var requiresPasscode: Bool { return false } var preflightReadMode: PreflightReadMode { .readCardOnly } diff --git a/TangemSdk/TangemSdk/Operations/ResetCode/GetResetPinToken.swift b/TangemSdk/TangemSdk/Operations/ResetCode/GetResetPinToken.swift index 453a6c4c4..6090d8066 100644 --- a/TangemSdk/TangemSdk/Operations/ResetCode/GetResetPinToken.swift +++ b/TangemSdk/TangemSdk/Operations/ResetCode/GetResetPinToken.swift @@ -8,7 +8,6 @@ import Foundation -@available(iOS 13.0, *) final class GetResetPinTokenCommand: Command { var requiresPasscode: Bool { return false } var preflightReadMode: PreflightReadMode { .readCardOnly } diff --git a/TangemSdk/TangemSdk/Operations/ResetCode/ResetCodesController.swift b/TangemSdk/TangemSdk/Operations/ResetCode/ResetCodesController.swift index 19d38ae19..4555053dd 100644 --- a/TangemSdk/TangemSdk/Operations/ResetCode/ResetCodesController.swift +++ b/TangemSdk/TangemSdk/Operations/ResetCode/ResetCodesController.swift @@ -9,7 +9,6 @@ import Foundation import Combine -@available(iOS 13.0, *) public class ResetCodesController { public var cardIdDisplayFormat: CardIdDisplayFormat = .full @@ -45,7 +44,7 @@ public class ResetCodesController { private func bind() { self.resetService - .$currentState + .currentStatePublisher .dropFirst() .sink {[weak self] newState in guard let self else { return } diff --git a/TangemSdk/TangemSdk/Operations/ResetCode/ResetPinCommand.swift b/TangemSdk/TangemSdk/Operations/ResetCode/ResetPinCommand.swift index e2f0e27ab..fdea9d9b0 100644 --- a/TangemSdk/TangemSdk/Operations/ResetCode/ResetPinCommand.swift +++ b/TangemSdk/TangemSdk/Operations/ResetCode/ResetPinCommand.swift @@ -8,7 +8,6 @@ import Foundation -@available(iOS 13.0, *) final class ResetPinCommand: Command { var requiresPasscode: Bool { return false } var preflightReadMode: PreflightReadMode { .readCardOnly } diff --git a/TangemSdk/TangemSdk/Operations/ResetCode/ResetPinService.swift b/TangemSdk/TangemSdk/Operations/ResetCode/ResetPinService.swift index 3de358e7e..307333fdc 100644 --- a/TangemSdk/TangemSdk/Operations/ResetCode/ResetPinService.swift +++ b/TangemSdk/TangemSdk/Operations/ResetCode/ResetPinService.swift @@ -7,16 +7,19 @@ // import Foundation +import Combine -@available(iOS 13.0, *) -public class ResetPinService: ObservableObject { - @Published public private(set) var currentState: State = .needCode - @Published public private(set) var error: TangemSdkError? = nil +public class ResetPinService { + public var currentState: State { _currentState.value } + public var currentStatePublisher: AnyPublisher { _currentState.eraseToAnyPublisher() } + + public private(set) var error: TangemSdkError? = nil private var session: CardSession? private let config: Config private var repo: ResetPinRepo = .init() private var currentCommand: AnyObject? = nil + private var _currentState: CurrentValueSubject = .init(.needCode) public init(config: Config) { self.config = config @@ -47,7 +50,7 @@ public class ResetPinService: ObservableObject { repo.accessCode = code.sha256() if currentState == .needCode { - currentState = currentState.next() + _currentState.value = currentState.next() } } @@ -72,7 +75,7 @@ public class ResetPinService: ObservableObject { repo.passcode = code.sha256() if currentState == .needCode { - currentState = currentState.next() + _currentState.value = currentState.next() } } @@ -92,7 +95,7 @@ public class ResetPinService: ObservableObject { private func handleCompletion(_ result: Result) -> Void { switch result { case .success: - currentState = currentState.next() + _currentState.value = currentState.next() case .failure(let error): self.error = error } @@ -214,7 +217,6 @@ public class ResetPinService: ObservableObject { } } -@available(iOS 13.0, *) extension ResetPinService { class ResetPinRepo { var confirmationCard: ConfirmationCard? = nil diff --git a/TangemSdk/TangemSdk/Operations/ResetCode/ResetPinTask.swift b/TangemSdk/TangemSdk/Operations/ResetCode/ResetPinTask.swift index 82260d2a2..cfdfc008f 100644 --- a/TangemSdk/TangemSdk/Operations/ResetCode/ResetPinTask.swift +++ b/TangemSdk/TangemSdk/Operations/ResetCode/ResetPinTask.swift @@ -8,7 +8,6 @@ import Foundation -@available(iOS 13.0, *) class ResetPinTask: CardSessionRunnable { var preflightReadMode: PreflightReadMode { .readCardOnly } diff --git a/TangemSdk/TangemSdk/Operations/ResetCode/SignResetPinToken.swift b/TangemSdk/TangemSdk/Operations/ResetCode/SignResetPinToken.swift index 279ad7b08..23a900147 100644 --- a/TangemSdk/TangemSdk/Operations/ResetCode/SignResetPinToken.swift +++ b/TangemSdk/TangemSdk/Operations/ResetCode/SignResetPinToken.swift @@ -8,7 +8,6 @@ import Foundation -@available(iOS 13.0, *) final class SignResetPinTokenCommand: Command { var requiresPasscode: Bool { return false } var preflightReadMode: PreflightReadMode { .readCardOnly } diff --git a/TangemSdk/TangemSdk/Operations/ScanTask.swift b/TangemSdk/TangemSdk/Operations/ScanTask.swift index b5ecbe73d..be7f8cd5c 100644 --- a/TangemSdk/TangemSdk/Operations/ScanTask.swift +++ b/TangemSdk/TangemSdk/Operations/ScanTask.swift @@ -10,7 +10,6 @@ import Foundation /// Task that allows to read Tangem card and verify its private key. /// Returns data from a Tangem card after successful completion of `ReadCommand` and `AttestWalletKeyCommand`, subsequently. -@available(iOS 13.0, *) public final class ScanTask: CardSessionRunnable { public var shouldAskForAccessCode: Bool { false } diff --git a/TangemSdk/TangemSdk/Operations/Sign/SignCommand.swift b/TangemSdk/TangemSdk/Operations/Sign/SignCommand.swift index 5c7e335dc..2f215c99c 100644 --- a/TangemSdk/TangemSdk/Operations/Sign/SignCommand.swift +++ b/TangemSdk/TangemSdk/Operations/Sign/SignCommand.swift @@ -19,7 +19,6 @@ public struct SignResponse: JSONStringConvertible { } /// Signs transaction hashes using a wallet private key, stored on the card. -@available(iOS 13.0, *) class SignCommand: Command { var requiresPasscode: Bool { return true } @@ -271,8 +270,6 @@ class SignCommand: Command { } } - -@available(iOS 13.0, *) private extension SignCommand { enum Constants { /// The max answer is 1152 bytes (unencrypted) and 1120 (encrypted). The worst case is 8 hashes * 64 bytes for ed + 512 bytes of signatures + cardId, SignedHashes + TLV + SW is ok. diff --git a/TangemSdk/TangemSdk/Operations/Sign/SignHashCommand.swift b/TangemSdk/TangemSdk/Operations/Sign/SignHashCommand.swift index 368efc0e6..db9547989 100644 --- a/TangemSdk/TangemSdk/Operations/Sign/SignHashCommand.swift +++ b/TangemSdk/TangemSdk/Operations/Sign/SignHashCommand.swift @@ -18,7 +18,6 @@ public struct SignHashResponse: JSONStringConvertible { public let totalSignedHashes: Int? } -@available(iOS 13.0, *) public final class SignHashCommand: CardSessionRunnable { private let walletPublicKey: Data private let hash: Data diff --git a/TangemSdk/TangemSdk/Operations/Sign/SignHashesCommand.swift b/TangemSdk/TangemSdk/Operations/Sign/SignHashesCommand.swift index 0f4f830b3..907fdb3d4 100644 --- a/TangemSdk/TangemSdk/Operations/Sign/SignHashesCommand.swift +++ b/TangemSdk/TangemSdk/Operations/Sign/SignHashesCommand.swift @@ -9,7 +9,6 @@ import Foundation public typealias SignHashesResponse = SignResponse -@available(iOS 13.0, *) public final class SignHashesCommand: CardSessionRunnable { private let walletPublicKey: Data private let hashes: [Data] diff --git a/TangemSdk/TangemSdk/Operations/UserSettings/SetUserCodeRecoveryAllowedTask.swift b/TangemSdk/TangemSdk/Operations/UserSettings/SetUserCodeRecoveryAllowedTask.swift index 5edf36007..5122c5487 100644 --- a/TangemSdk/TangemSdk/Operations/UserSettings/SetUserCodeRecoveryAllowedTask.swift +++ b/TangemSdk/TangemSdk/Operations/UserSettings/SetUserCodeRecoveryAllowedTask.swift @@ -8,7 +8,6 @@ import Foundation -@available(iOS 13.0, *) public final class SetUserCodeRecoveryAllowedTask: CardSessionRunnable { public var preflightReadMode: PreflightReadMode { .readCardOnly } diff --git a/TangemSdk/TangemSdk/Operations/UserSettings/SetUserSettingsCommand.swift b/TangemSdk/TangemSdk/Operations/UserSettings/SetUserSettingsCommand.swift index 8bef143c5..701c46113 100644 --- a/TangemSdk/TangemSdk/Operations/UserSettings/SetUserSettingsCommand.swift +++ b/TangemSdk/TangemSdk/Operations/UserSettings/SetUserSettingsCommand.swift @@ -9,7 +9,6 @@ import Foundation /// Deserialized response from the Tangem card after `SetUserSettingsCommand`. COS v.6.16+ -@available(iOS 13.0, *) struct SetUserSettingsCommandResponse: JSONStringConvertible { /// Unique Tangem card ID number. let cardId: String @@ -18,7 +17,6 @@ struct SetUserSettingsCommandResponse: JSONStringConvertible { } /// Set user serrings on a card. COS v.6.16+ -@available(iOS 13.0, *) class SetUserSettingsCommand: Command { var preflightReadMode: PreflightReadMode { .readCardOnly } diff --git a/TangemSdk/TangemSdk/Operations/Wallet/CreateWalletCommand.swift b/TangemSdk/TangemSdk/Operations/Wallet/CreateWalletCommand.swift index af391e5fc..cda5a1864 100644 --- a/TangemSdk/TangemSdk/Operations/Wallet/CreateWalletCommand.swift +++ b/TangemSdk/TangemSdk/Operations/Wallet/CreateWalletCommand.swift @@ -9,7 +9,6 @@ import Foundation /// Response from the Tangem card after `CreateWalletCommand` or `CreateWalletTask`. -@available(iOS 13.0, *) public struct CreateWalletResponse: JSONStringConvertible { /// Unique Tangem card ID number public let cardId: String @@ -26,7 +25,6 @@ public struct CreateWalletResponse: JSONStringConvertible { * WalletPrivateKey is never revealed by the card and will be used by `SignHash` or `SignHashes` and `AttestWalletKeyCommand`. * RemainingSignature is set to MaxSignatures. */ -@available(iOS 13.0, *) final class CreateWalletCommand: Command { var requiresPasscode: Bool { return true } var walletIndex: Int = 0 diff --git a/TangemSdk/TangemSdk/Operations/Wallet/CreateWalletTask.swift b/TangemSdk/TangemSdk/Operations/Wallet/CreateWalletTask.swift index 0ad4181e8..728e09a1e 100644 --- a/TangemSdk/TangemSdk/Operations/Wallet/CreateWalletTask.swift +++ b/TangemSdk/TangemSdk/Operations/Wallet/CreateWalletTask.swift @@ -17,7 +17,6 @@ import Foundation * WalletPrivateKey is never revealed by the card and will be used by `SignHash` or `SignHashes` and `AttestWalletKeyCommand`. * RemainingSignature is set to MaxSignatures. */ -@available(iOS 13.0, *) public class CreateWalletTask: CardSessionRunnable { private let curve: EllipticCurve private let privateKey: ExtendedPrivateKey? diff --git a/TangemSdk/TangemSdk/Operations/Wallet/PurgeWalletCommand.swift b/TangemSdk/TangemSdk/Operations/Wallet/PurgeWalletCommand.swift index 15d3fa75f..31d31ed9c 100644 --- a/TangemSdk/TangemSdk/Operations/Wallet/PurgeWalletCommand.swift +++ b/TangemSdk/TangemSdk/Operations/Wallet/PurgeWalletCommand.swift @@ -9,7 +9,6 @@ import Foundation /// This command deletes all wallet data and its private and public keys -@available(iOS 13.0, *) public final class PurgeWalletCommand: Command { var requiresPasscode: Bool { return true } diff --git a/TangemSdk/TangemSdk/TangemSdk.swift b/TangemSdk/TangemSdk/TangemSdk.swift index 61d316da1..d2096e61d 100644 --- a/TangemSdk/TangemSdk/TangemSdk.swift +++ b/TangemSdk/TangemSdk/TangemSdk.swift @@ -11,7 +11,6 @@ import CoreNFC import Combine /// The main interface of Tangem SDK that allows your app to communicate with Tangem cards. -@available(iOS 13.0, *) public final class TangemSdk { /// Configuration of the SDK. Do not change the default values unless you know what you are doing public var config = Config() @@ -54,7 +53,6 @@ public final class TangemSdk { } //MARK: - Card operations -@available(iOS 13.0, *) public extension TangemSdk { //MARK: - Common @@ -600,7 +598,6 @@ public extension TangemSdk { } //MARK: - Session start -@available(iOS 13.0, *) extension TangemSdk { /// Allows running a custom bunch of commands in one NFC Session by creating a custom task. Tangem SDK will start a card session, perform preflight `Read` command, /// invoke the `run ` method of `CardSessionRunnable` and close the session. @@ -756,7 +753,6 @@ extension TangemSdk { } //MARK: - Private -@available(iOS 13.0, *) extension TangemSdk { private func checkSession() throws { if let existingSession = cardSession, existingSession.state == .active { diff --git a/TangemSdk/TangemSdk/UI/BaseViewDelegate.swift b/TangemSdk/TangemSdk/UI/BaseViewDelegate.swift index 066dba0c3..d07593c04 100644 --- a/TangemSdk/TangemSdk/UI/BaseViewDelegate.swift +++ b/TangemSdk/TangemSdk/UI/BaseViewDelegate.swift @@ -9,7 +9,6 @@ import Foundation import UIKit -@available(iOS 13.0, *) class BaseViewDelegate { var screen: UIViewController? = nil diff --git a/TangemSdk/TangemSdk/UI/Main/DefaultSessionViewDelegate.swift b/TangemSdk/TangemSdk/UI/Main/DefaultSessionViewDelegate.swift index be3c7c6c5..eee2355d6 100644 --- a/TangemSdk/TangemSdk/UI/Main/DefaultSessionViewDelegate.swift +++ b/TangemSdk/TangemSdk/UI/Main/DefaultSessionViewDelegate.swift @@ -10,7 +10,6 @@ import Foundation import UIKit import SwiftUI -@available(iOS 13.0, *) final class DefaultSessionViewDelegate: BaseViewDelegate { private let reader: CardReader private let engine: HapticsEngine @@ -37,7 +36,6 @@ final class DefaultSessionViewDelegate: BaseViewDelegate { } } -@available(iOS 13.0, *) extension DefaultSessionViewDelegate: SessionViewDelegate { func setState(_ state: SessionViewState) { Log.view("Set state: \(state)") @@ -64,12 +62,12 @@ extension DefaultSessionViewDelegate: SessionViewDelegate { engine.playSuccess() } - func tagLost() { + func tagLost(message: String) { Log.view("Tag lost") if pinnedMessage == nil { pinnedMessage = reader.alertMessage } - showAlertMessage("view_delegate_scan_description".localized) + showAlertMessage(message) } func wrongCard(message: String) { diff --git a/TangemSdk/TangemSdk/UI/Main/HapticsEngine.swift b/TangemSdk/TangemSdk/UI/Main/HapticsEngine.swift index ea7b6b2d8..f91722c9c 100644 --- a/TangemSdk/TangemSdk/UI/Main/HapticsEngine.swift +++ b/TangemSdk/TangemSdk/UI/Main/HapticsEngine.swift @@ -11,7 +11,6 @@ import CoreHaptics import UIKit import AVFoundation -@available(iOS 13.0, *) class HapticsEngine { private var engine: CHHapticEngine? private var engineNeedsStart = true diff --git a/TangemSdk/TangemSdk/UI/Main/MainScreen.swift b/TangemSdk/TangemSdk/UI/Main/MainScreen.swift index 82f41a2e3..e4a3dbf42 100644 --- a/TangemSdk/TangemSdk/UI/Main/MainScreen.swift +++ b/TangemSdk/TangemSdk/UI/Main/MainScreen.swift @@ -8,7 +8,6 @@ import SwiftUI -@available(iOS 13.0, *) struct MainScreen: View { @EnvironmentObject var viewModel: MainViewModel @EnvironmentObject var style: TangemSdkStyle @@ -71,7 +70,6 @@ struct MainScreen: View { } } -@available(iOS 13.0, *) private extension MainScreen { enum Constants { static let indicatorMaxSize: CGFloat = 280 @@ -80,7 +78,6 @@ private extension MainScreen { } } -@available(iOS 13.0, *) struct MainScreen_Preview: PreviewProvider { static var previews: some View { MainScreen() @@ -89,9 +86,7 @@ struct MainScreen_Preview: PreviewProvider { } } -@available(iOS 13.0, *) fileprivate extension SessionViewState { - @available(iOS 13.0, *) var indicatorState: IndicatorView.ViewState? { switch self { case .default: diff --git a/TangemSdk/TangemSdk/UI/Main/MainViewModel.swift b/TangemSdk/TangemSdk/UI/Main/MainViewModel.swift index af36d22c3..eb48d169c 100644 --- a/TangemSdk/TangemSdk/UI/Main/MainViewModel.swift +++ b/TangemSdk/TangemSdk/UI/Main/MainViewModel.swift @@ -8,5 +8,4 @@ import Foundation -@available(iOS 13.0, *) typealias MainViewModel = ViewModel diff --git a/TangemSdk/TangemSdk/UI/Main/Message.swift b/TangemSdk/TangemSdk/UI/Main/Message.swift index 1be005187..44fa81332 100644 --- a/TangemSdk/TangemSdk/UI/Main/Message.swift +++ b/TangemSdk/TangemSdk/UI/Main/Message.swift @@ -9,7 +9,6 @@ import Foundation /// Wrapper for a message that can be shown to user after a start of NFC session. -@available(iOS 13.0, *) public struct Message: Codable { let header: String? let body: String? diff --git a/TangemSdk/TangemSdk/UI/Main/SessionViewDelegate.swift b/TangemSdk/TangemSdk/UI/Main/SessionViewDelegate.swift index 6dee4c48b..24ab9e344 100644 --- a/TangemSdk/TangemSdk/UI/Main/SessionViewDelegate.swift +++ b/TangemSdk/TangemSdk/UI/Main/SessionViewDelegate.swift @@ -11,7 +11,6 @@ import UIKit /// Allows interaction with users and shows visual elements. /// Its default implementation, `DefaultSessionViewDelegate`, is in our SDK. -@available(iOS 13.0, *) public protocol SessionViewDelegate: AnyObject { func showAlertMessage(_ text: String) @@ -19,7 +18,7 @@ public protocol SessionViewDelegate: AnyObject { func tagConnected() /// It is called when tag was lost - func tagLost() + func tagLost(message: String) func wrongCard(message: String) @@ -37,7 +36,6 @@ public protocol SessionViewDelegate: AnyObject { } /// Current state of the sdk's UI -@available(iOS 13.0, *) public enum SessionViewState { case delay(remaining: Float, total: Float) //seconds case progress(percent: Int) @@ -57,7 +55,6 @@ public enum SessionViewState { } } -@available(iOS 13.0, *) extension UIAlertController { static func showShouldContinue(from controller: UIViewController, title: String, message: String, tint: UIColor, onContinue: @escaping () -> Void, onCancel: @escaping () -> Void) { let alert = UIAlertController(title: title, message: message, preferredStyle: .alert) diff --git a/TangemSdk/TangemSdk/UI/ResetUserCodes/ResetCodesScreen.swift b/TangemSdk/TangemSdk/UI/ResetUserCodes/ResetCodesScreen.swift index b7afb527d..2b5da7a8a 100644 --- a/TangemSdk/TangemSdk/UI/ResetUserCodes/ResetCodesScreen.swift +++ b/TangemSdk/TangemSdk/UI/ResetUserCodes/ResetCodesScreen.swift @@ -8,7 +8,6 @@ import SwiftUI -@available(iOS 13.0, *) struct ResetCodesScreen: View { @EnvironmentObject var viewModel: ResetCodesViewModel @EnvironmentObject var style: TangemSdkStyle @@ -46,7 +45,6 @@ struct ResetCodesScreen: View { } -@available(iOS 13.0, *) struct ResetUserCodesScreen_Preview: PreviewProvider { static var previews: some View { ResetCodesScreen() diff --git a/TangemSdk/TangemSdk/UI/ResetUserCodes/ResetCodesViewDelegate.swift b/TangemSdk/TangemSdk/UI/ResetUserCodes/ResetCodesViewDelegate.swift index be371f0b0..ee512f3cc 100644 --- a/TangemSdk/TangemSdk/UI/ResetUserCodes/ResetCodesViewDelegate.swift +++ b/TangemSdk/TangemSdk/UI/ResetUserCodes/ResetCodesViewDelegate.swift @@ -10,7 +10,6 @@ import Foundation import UIKit import SwiftUI -@available(iOS 13.0, *) final class ResetCodesViewDelegate: BaseViewDelegate { private let viewModel: ResetCodesViewModel = .init(viewState: .empty) private let style: TangemSdkStyle diff --git a/TangemSdk/TangemSdk/UI/ResetUserCodes/ResetCodesViewModel.swift b/TangemSdk/TangemSdk/UI/ResetUserCodes/ResetCodesViewModel.swift index 3e0972912..7946200cd 100644 --- a/TangemSdk/TangemSdk/UI/ResetUserCodes/ResetCodesViewModel.swift +++ b/TangemSdk/TangemSdk/UI/ResetUserCodes/ResetCodesViewModel.swift @@ -8,5 +8,4 @@ import Foundation -@available(iOS 13.0, *) typealias ResetCodesViewModel = ViewModel diff --git a/TangemSdk/TangemSdk/UI/ResetUserCodes/ResetCodesViewState.swift b/TangemSdk/TangemSdk/UI/ResetUserCodes/ResetCodesViewState.swift index 98fbbf188..abb59dee2 100644 --- a/TangemSdk/TangemSdk/UI/ResetUserCodes/ResetCodesViewState.swift +++ b/TangemSdk/TangemSdk/UI/ResetUserCodes/ResetCodesViewState.swift @@ -8,7 +8,6 @@ import Foundation -@available(iOS 13.0, *) enum ResetCodesViewState { case empty case requestCode(_ type: UserCodeType, cardId: String?, completion: CompletionResult) diff --git a/TangemSdk/TangemSdk/UI/TangemSdkStyle.swift b/TangemSdk/TangemSdk/UI/TangemSdkStyle.swift index 3677a39ae..c88fade54 100644 --- a/TangemSdk/TangemSdk/UI/TangemSdkStyle.swift +++ b/TangemSdk/TangemSdk/UI/TangemSdkStyle.swift @@ -9,7 +9,6 @@ import Foundation import SwiftUI -@available(iOS 13.0, *) public class TangemSdkStyle: ObservableObject { public var colors: Colors = .default public var textSizes: TextSizes = .default @@ -19,7 +18,6 @@ public class TangemSdkStyle: ObservableObject { public static var `default`: TangemSdkStyle = .init() } -@available(iOS 13.0, *) public extension TangemSdkStyle { struct Colors { /// Tint color of the interface. Note that due to the inability to convert SwiftUI.Color to UIKit.UIColor you have to set the two separately @@ -61,7 +59,6 @@ public extension TangemSdkStyle { } } -@available(iOS 13.0, *) public extension TangemSdkStyle { struct TextSizes { public var indicatorLabel: CGFloat = 50 @@ -70,13 +67,15 @@ public extension TangemSdkStyle { } } -@available(iOS 13.0, *) public extension TangemSdkStyle { /// Options for displaying different tags on the scanning screen enum ScanTagImage { /// Generic card provided by the SDK case genericCard - + + /// Generic ring provided by the SDK + case genericRing + /// A custom tag made out of a UIImage instance. /// The image can be shifted vertically from the standard position by specifying `verticalOffset`. /// Note that the width of the image will be limited to a certain size, while the height will be determined by the aspect ratio of the image. diff --git a/TangemSdk/TangemSdk/UI/ViewModel.swift b/TangemSdk/TangemSdk/UI/ViewModel.swift index 2ce29566a..fbb0ecb22 100644 --- a/TangemSdk/TangemSdk/UI/ViewModel.swift +++ b/TangemSdk/TangemSdk/UI/ViewModel.swift @@ -9,7 +9,6 @@ import Foundation import SwiftUI -@available(iOS 13.0, *) class ViewModel: ObservableObject { @Published var viewState: ViewState diff --git a/TangemSdk/TangemSdk/UI/Views/Common/ActivityIndicatorView.swift b/TangemSdk/TangemSdk/UI/Views/Common/ActivityIndicatorView.swift index 5b6777d3d..ec68c283a 100644 --- a/TangemSdk/TangemSdk/UI/Views/Common/ActivityIndicatorView.swift +++ b/TangemSdk/TangemSdk/UI/Views/Common/ActivityIndicatorView.swift @@ -9,19 +9,11 @@ import Foundation import SwiftUI -@available(iOS 13.0, *) struct ActivityIndicatorView: UIViewRepresentable { private var isAnimating: Bool private var style: UIActivityIndicatorView.Style private var color: UIColor - - init(isAnimating: Bool = true, style: UIActivityIndicatorView.Style = .medium, color: UIColor) { - self.isAnimating = isAnimating - self.style = style - self.color = color - } - - @available(iOS 14.0, *) + init(isAnimating: Bool = true, style: UIActivityIndicatorView.Style = .medium, color: Color) { self.isAnimating = isAnimating self.style = style diff --git a/TangemSdk/TangemSdk/UI/Views/Common/FloatingTextField.swift b/TangemSdk/TangemSdk/UI/Views/Common/FloatingTextField.swift index f8e349f53..43d99d081 100644 --- a/TangemSdk/TangemSdk/UI/Views/Common/FloatingTextField.swift +++ b/TangemSdk/TangemSdk/UI/Views/Common/FloatingTextField.swift @@ -9,12 +9,10 @@ import SwiftUI import Combine -@available(iOS 13.0, *) struct FloatingTextField: View { let title: String let text: Binding var onCommit: () -> Void = {} - /// iOS15+ var shouldBecomeFirstResponder: Bool = false @EnvironmentObject private var style: TangemSdkStyle @@ -22,23 +20,12 @@ struct FloatingTextField: View { @ViewBuilder private var textField: some View { - if #available(iOS 15.0, *) { - FocusableTextField(isSecured: isSecured, - shouldBecomeFirstResponder: shouldBecomeFirstResponder, - text: text, - onCommit: onCommit) - } else { - legacyTextField - } - } - - @ViewBuilder - private var legacyTextField: some View { - if isSecured { - SecureField("", text: text, onCommit: onCommit) - } else { - TextField("", text: text, onCommit: onCommit) - } + FocusableTextField( + isSecured: isSecured, + shouldBecomeFirstResponder: shouldBecomeFirstResponder, + text: text, + onCommit: onCommit + ) } var body: some View { @@ -68,7 +55,7 @@ struct FloatingTextField: View { .frame(height: 1) } .padding(.top, 20) - .animation(Animation.easeInOut(duration: 0.1)) + .animation(Animation.easeInOut(duration: 0.1), value: text.wrappedValue) } private func toggleSecured() { @@ -77,7 +64,6 @@ struct FloatingTextField: View { } -@available(iOS 13.0, *) struct FloatingTextField_Previews: PreviewProvider { @State static var text: String = "002139123" diff --git a/TangemSdk/TangemSdk/UI/Views/Common/FocusableTextField.swift b/TangemSdk/TangemSdk/UI/Views/Common/FocusableTextField.swift index 0442b4e51..501673ea3 100644 --- a/TangemSdk/TangemSdk/UI/Views/Common/FocusableTextField.swift +++ b/TangemSdk/TangemSdk/UI/Views/Common/FocusableTextField.swift @@ -10,7 +10,6 @@ import Foundation import SwiftUI import Combine -@available(iOS 15.0, *) struct FocusableTextField: View { let isSecured: Bool let shouldBecomeFirstResponder: Bool @@ -58,7 +57,6 @@ struct FocusableTextField: View { } -@available(iOS 15.0, *) private extension FocusableTextField { enum Field: Hashable { case secure @@ -66,7 +64,6 @@ private extension FocusableTextField { } } -@available(iOS 15.0, *) fileprivate class FocusableTextFieldModel: ObservableObject { var focusPublisher: PassthroughSubject = .init() diff --git a/TangemSdk/TangemSdk/UI/Views/Common/RoundedButtonStyle.swift b/TangemSdk/TangemSdk/UI/Views/Common/RoundedButtonStyle.swift index 438a253f4..e7558ab0d 100644 --- a/TangemSdk/TangemSdk/UI/Views/Common/RoundedButtonStyle.swift +++ b/TangemSdk/TangemSdk/UI/Views/Common/RoundedButtonStyle.swift @@ -9,7 +9,6 @@ import Foundation import SwiftUI -@available(iOS 13.0, *) struct RoundedButton: ButtonStyle { var colors: TangemSdkStyle.ButtonColors var isDisabled: Bool = false @@ -29,11 +28,7 @@ struct RoundedButton: ButtonStyle { if isLoading { ZStack { colors.backgroundColor - if #available(iOS 14.0, *) { - ActivityIndicatorView(color: colors.foregroundColor) - } else { - ActivityIndicatorView(color: UIColor.white) - } + ActivityIndicatorView(color: colors.foregroundColor) } } else { Color.clear @@ -54,11 +49,10 @@ struct RoundedButton: ButtonStyle { .overlay(loadingOverlay) .cornerRadius(8) .allowsHitTesting(!isDisabled && !isLoading) - .animation(.easeInOut(duration: 0.2)) + .animation(.easeInOut(duration: 0.2), value: isDisabled) } } -@available(iOS 13.0, *) struct RoundedButton_Previews: PreviewProvider { @ViewBuilder diff --git a/TangemSdk/TangemSdk/UI/Views/IndicatorView.swift b/TangemSdk/TangemSdk/UI/Views/IndicatorView.swift index 544d4830a..c2e87adcc 100644 --- a/TangemSdk/TangemSdk/UI/Views/IndicatorView.swift +++ b/TangemSdk/TangemSdk/UI/Views/IndicatorView.swift @@ -8,7 +8,6 @@ import SwiftUI -@available(iOS 13.0, *) struct IndicatorView: View { var state: ViewState = .spinner @@ -107,9 +106,7 @@ struct IndicatorView: View { } } -@available(iOS 13.0, *) extension IndicatorView { - @available(iOS 13.0, *) enum ViewState { case spinner case delay(currentValue: CGFloat, totalValue: CGFloat) @@ -117,8 +114,6 @@ extension IndicatorView { } } - -@available(iOS 13.0, *) struct SpinnerView_Previews: PreviewProvider { static var previews: some View { Group { diff --git a/TangemSdk/TangemSdk/UI/Views/KeyboardAvoidance/KeyboardAdaptive.swift b/TangemSdk/TangemSdk/UI/Views/KeyboardAvoidance/KeyboardAdaptive.swift deleted file mode 100644 index 6e026a50d..000000000 --- a/TangemSdk/TangemSdk/UI/Views/KeyboardAvoidance/KeyboardAdaptive.swift +++ /dev/null @@ -1,40 +0,0 @@ -// -// KeyboardAdaptive.swift -// KeyboardAvoidanceSwiftUI -// -// Created by Vadim Bulavin on 3/27/20. -// Copyright © 2020 Vadim Bulavin. All rights reserved. -// - -import SwiftUI -import Combine - -@available(iOS 13.0, *) -struct KeyboardAdaptive: ViewModifier { - @State private var bottomPadding: CGFloat = 0 - @State private var animationDuration: Double = 0 - var animated: Binding - - func body(content: Content) -> some View { - content - .padding(.bottom, self.bottomPadding) - .onReceive(Publishers.keyboardInfo) { keyboardHeight, animationDuration in - let bottomSafeAreaInset = keyboardHeight > 0 ? UIApplication.shared.windows.first?.safeAreaInsets.bottom ?? 0 : 0 - self.animationDuration = animationDuration - self.bottomPadding = keyboardHeight - bottomSafeAreaInset - } - .animation(animated.wrappedValue ? Animation.easeOut(duration: animationDuration) : nil) - } -} - -@available(iOS 13.0, *) -extension View { - @ViewBuilder - func keyboardAdaptive(animated: Binding) -> some View { - if #available(iOS 14.0, *) { - self - } else { - ModifiedContent(content: self, modifier: KeyboardAdaptive(animated: animated)) - } - } -} diff --git a/TangemSdk/TangemSdk/UI/Views/KeyboardAvoidance/KeyboardHeightPublisher.swift b/TangemSdk/TangemSdk/UI/Views/KeyboardAvoidance/KeyboardHeightPublisher.swift deleted file mode 100644 index 901a1e31e..000000000 --- a/TangemSdk/TangemSdk/UI/Views/KeyboardAvoidance/KeyboardHeightPublisher.swift +++ /dev/null @@ -1,36 +0,0 @@ -// -// KeyboardHeightPublisher.swift -// KeyboardAvoidanceSwiftUI -// -// Created by Vadim Bulavin on 3/27/20. -// Copyright © 2020 Vadim Bulavin. All rights reserved. -// - -import Combine -import UIKit - -@available(iOS 13.0, *) -extension Publishers { - static var keyboardInfo: AnyPublisher<(CGFloat, Double), Never> { - let willShow = NotificationCenter.default.publisher(for: UIApplication.keyboardWillShowNotification) - .map { ($0.keyboardHeight, $0.anumationDuration) } - - let willHide = NotificationCenter.default.publisher(for: UIApplication.keyboardWillHideNotification) - .map { (CGFloat(0), $0.anumationDuration) } - - return MergeMany(willShow, willHide) - .eraseToAnyPublisher() - } -} - -@available(iOS 13.0, *) -extension Notification { - var keyboardHeight: CGFloat { - return (userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? CGRect)?.height ?? 0 - } - - var anumationDuration: Double { - return (userInfo?[UIResponder.keyboardAnimationDurationUserInfoKey] as? NSNumber)?.doubleValue ?? 0 - } - -} diff --git a/TangemSdk/TangemSdk/UI/Views/Scan/CardView.swift b/TangemSdk/TangemSdk/UI/Views/Scan/CardView.swift index 39144cad7..f4f527898 100644 --- a/TangemSdk/TangemSdk/UI/Views/Scan/CardView.swift +++ b/TangemSdk/TangemSdk/UI/Views/Scan/CardView.swift @@ -8,7 +8,6 @@ import SwiftUI -@available(iOS 13.0, *) struct CardView: View { let cardColor: Color let starsColor: Color @@ -39,7 +38,6 @@ struct CardView: View { } } -@available(iOS 13.0, *) struct CardView_Previews: PreviewProvider { static var cardColor = TangemSdkStyle().colors.cardColor diff --git a/TangemSdk/TangemSdk/UI/Views/Scan/NFCFieldView.swift b/TangemSdk/TangemSdk/UI/Views/Scan/NFCFieldView.swift index b27d0221d..1d72e8752 100644 --- a/TangemSdk/TangemSdk/UI/Views/Scan/NFCFieldView.swift +++ b/TangemSdk/TangemSdk/UI/Views/Scan/NFCFieldView.swift @@ -8,7 +8,6 @@ import SwiftUI -@available(iOS 13.0, *) struct NFCFieldView: View { var isAnimationOn: Bool { didSet { @@ -41,14 +40,14 @@ struct NFCFieldView: View { Circle() .fill(style.colors.tint.opacity(0.2)) .scaleEffect(circleScale) - .animation(isAnimationOn ? bigCircleAnimation : nil) - + .animation(isAnimationOn ? bigCircleAnimation : nil, value: circleScale) + Circle() .fill(style.colors.tint.opacity(0.2)) .frame(width: 0.6 * geo.size.width, height: 0.6 * geo.size.width) .scaleEffect(circleScale) - .animation(isAnimationOn ? smallCircleAnimation : nil) + .animation(isAnimationOn ? smallCircleAnimation : nil, value: circleScale) } } .onAppear() { @@ -57,7 +56,6 @@ struct NFCFieldView: View { } } -@available(iOS 13.0, *) struct NFCView_Previews: PreviewProvider { @State static var animation: Bool = true static var previews: some View { diff --git a/TangemSdk/TangemSdk/UI/Views/Scan/PhoneView.swift b/TangemSdk/TangemSdk/UI/Views/Scan/PhoneView.swift index 990f416ac..6bff57a94 100644 --- a/TangemSdk/TangemSdk/UI/Views/Scan/PhoneView.swift +++ b/TangemSdk/TangemSdk/UI/Views/Scan/PhoneView.swift @@ -8,7 +8,6 @@ import SwiftUI -@available(iOS 13.0, *) struct PhoneView: View { @EnvironmentObject var style: TangemSdkStyle @@ -35,7 +34,6 @@ struct PhoneView: View { } } -@available(iOS 13.0, *) struct PhoneView_Previews: PreviewProvider { static var previews: some View { Group { diff --git a/TangemSdk/TangemSdk/UI/Views/Scan/ReadView.swift b/TangemSdk/TangemSdk/UI/Views/Scan/ReadView.swift index 4a8bc8569..04510abcb 100644 --- a/TangemSdk/TangemSdk/UI/Views/Scan/ReadView.swift +++ b/TangemSdk/TangemSdk/UI/Views/Scan/ReadView.swift @@ -8,7 +8,6 @@ import SwiftUI -@available(iOS 13.0, *) struct ReadView: View { @EnvironmentObject var style: TangemSdkStyle @@ -24,11 +23,14 @@ struct ReadView: View { tagView .frame(minWidth: 210, maxWidth: 210) .offset(cardOffset) - .animation(Animation - .easeInOut(duration: 1) - .delay(1) - .repeatForever()) - + .animation( + Animation + .easeInOut(duration: 1) + .delay(1) + .repeatForever(), + value: cardOffset + ) + PhoneView() .frame(width: 180, height: 360) } @@ -45,6 +47,8 @@ struct ReadView: View { switch style.scanTagImage { case .genericCard: CardView(cardColor: style.colors.cardColor, starsColor: style.colors.starsColor) + case .genericRing: + Image("ring_shape_scan") case .image(let uiImage, let verticalOffset): Image(uiImage: uiImage) .resizable() @@ -54,7 +58,6 @@ struct ReadView: View { } } -@available(iOS 13.0, *) struct ReadView_Previews: PreviewProvider { static var previews: some View { Group { diff --git a/TangemSdk/TangemSdk/UI/Views/UserCodes/BadgedCardView.swift b/TangemSdk/TangemSdk/UI/Views/UserCodes/BadgedCardView.swift index 0a51ffc68..a72856b8f 100644 --- a/TangemSdk/TangemSdk/UI/Views/UserCodes/BadgedCardView.swift +++ b/TangemSdk/TangemSdk/UI/Views/UserCodes/BadgedCardView.swift @@ -8,7 +8,6 @@ import SwiftUI -@available(iOS 13.0, *) struct BadgedCardView: View { let cardColor: Color let starsColor: Color @@ -39,7 +38,6 @@ struct BadgedCardView: View { } } -@available(iOS 13.0, *) struct BadgedCardView_Previews: PreviewProvider { static var previews: some View { BadgedCardView(cardColor: .blue, starsColor: .gray, diff --git a/TangemSdk/TangemSdk/UI/Views/UserCodes/ChangeUserCodeView.swift b/TangemSdk/TangemSdk/UI/Views/UserCodes/ChangeUserCodeView.swift index 4a740eb43..f75187510 100644 --- a/TangemSdk/TangemSdk/UI/Views/UserCodes/ChangeUserCodeView.swift +++ b/TangemSdk/TangemSdk/UI/Views/UserCodes/ChangeUserCodeView.swift @@ -8,7 +8,6 @@ import SwiftUI -@available(iOS 13.0, *) struct ChangeUserCodeView: View { let type: UserCodeType let title: String @@ -57,7 +56,6 @@ struct ChangeUserCodeView: View { isDisabled: isContinueDisabled, isLoading: false)) } - .keyboardAdaptive(animated: .constant(true)) } .padding([.horizontal, .bottom]) } @@ -106,7 +104,6 @@ struct ChangeUserCodeView: View { } } -@available(iOS 13.0, *) struct ChangeUserCodeView_Previews: PreviewProvider { static var previews: some View { Group { diff --git a/TangemSdk/TangemSdk/UI/Views/UserCodes/EnterUserCodeView.swift b/TangemSdk/TangemSdk/UI/Views/UserCodes/EnterUserCodeView.swift index 5dec78acd..e241857f0 100644 --- a/TangemSdk/TangemSdk/UI/Views/UserCodes/EnterUserCodeView.swift +++ b/TangemSdk/TangemSdk/UI/Views/UserCodes/EnterUserCodeView.swift @@ -8,7 +8,6 @@ import SwiftUI -@available(iOS 13.0, *) struct EnterUserCodeView: View { let title: String let cardId: String @@ -52,7 +51,6 @@ struct EnterUserCodeView: View { isDisabled: isContinueDisabled, isLoading: isLoading)) } - .keyboardAdaptive(animated: .constant(true)) } .padding([.horizontal, .bottom]) .onAppear(perform: onAppear) @@ -85,7 +83,6 @@ struct EnterUserCodeView: View { } } -@available(iOS 13.0, *) struct EnterUserCodeView_Previews: PreviewProvider { static var previews: some View { Group { diff --git a/TangemSdk/TangemSdk/UI/Views/UserCodes/ResetUserCodesView.swift b/TangemSdk/TangemSdk/UI/Views/UserCodes/ResetUserCodesView.swift index 2eb997690..e94e839b8 100644 --- a/TangemSdk/TangemSdk/UI/Views/UserCodes/ResetUserCodesView.swift +++ b/TangemSdk/TangemSdk/UI/Views/UserCodes/ResetUserCodesView.swift @@ -9,7 +9,6 @@ import Foundation import SwiftUI -@available(iOS 13.0, *) struct ResetUserCodesView: View { let title: String let cardId: String @@ -98,7 +97,6 @@ struct ResetUserCodesView: View { } } -@available(iOS 13.0, *) struct ResetUserCodesView_Previews: PreviewProvider { static var previews: some View { Group { diff --git a/TangemSdk/TangemSdk/UI/Views/UserCodes/UserCodeHeaderView.swift b/TangemSdk/TangemSdk/UI/Views/UserCodes/UserCodeHeaderView.swift index 4d8b99263..67b71f261 100644 --- a/TangemSdk/TangemSdk/UI/Views/UserCodes/UserCodeHeaderView.swift +++ b/TangemSdk/TangemSdk/UI/Views/UserCodes/UserCodeHeaderView.swift @@ -8,7 +8,6 @@ import SwiftUI -@available(iOS 13.0, *) struct UserCodeHeaderView: View { let title: String let cardId: String @@ -34,7 +33,6 @@ struct UserCodeHeaderView: View { } } -@available(iOS 13.0, *) struct UserCodeHeaderView_Previews: PreviewProvider { static var previews: some View { Group { diff --git a/TangemSdk/TangemSdkTests/ApduTests.swift b/TangemSdk/TangemSdkTests/ApduTests.swift index 07ee86d9d..f21457e39 100644 --- a/TangemSdk/TangemSdkTests/ApduTests.swift +++ b/TangemSdk/TangemSdkTests/ApduTests.swift @@ -11,7 +11,6 @@ import XCTest import CoreNFC @testable import TangemSdk -@available(iOS 13.0, *) class ApduTests: XCTestCase { func testInitialization() { let commandApdu1 = CommandApdu(Instruction.read, tlv: Data()) @@ -92,8 +91,6 @@ class ApduTests: XCTestCase { } } - -@available(iOS 13.0, *) fileprivate extension CommandApdu { var NFCISO7816APDUDATA: Data { let nfcApdu = NFCISO7816APDU(data: self.serialize())! diff --git a/TangemSdk/TangemSdkTests/BIP32Tests.swift b/TangemSdk/TangemSdkTests/BIP32Tests.swift index dede5071b..be3029360 100644 --- a/TangemSdk/TangemSdkTests/BIP32Tests.swift +++ b/TangemSdk/TangemSdkTests/BIP32Tests.swift @@ -13,7 +13,6 @@ import CryptoKit /// Tests for firmware 6.33 /// https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki#user-content-Test_Vectors -@available(iOS 13.0, *) class BIP32Tests: XCTestCase { // MARK: - Test vector 5 @@ -72,7 +71,6 @@ class BIP32Tests: XCTestCase { // MARK: - SLIP10FWTests -@available(iOS 13.0, *) class BIP32FWTests: FWTestCase { func testVector1() { let sdk = TangemSdk() diff --git a/TangemSdk/TangemSdkTests/BIP39Tests.swift b/TangemSdk/TangemSdkTests/BIP39Tests.swift index d8fdb033a..b8582879b 100644 --- a/TangemSdk/TangemSdkTests/BIP39Tests.swift +++ b/TangemSdk/TangemSdkTests/BIP39Tests.swift @@ -10,7 +10,6 @@ import Foundation import XCTest @testable import TangemSdk -@available(iOS 13.0, *) class BIP39Tests: XCTestCase { func testReadWords() { let langs = BIP39.Wordlist.allCases @@ -121,7 +120,6 @@ class BIP39Tests: XCTestCase { } } -@available(iOS 13.0, *) private extension BIP39Tests { enum Constants { static let englishTestVectors = "english" diff --git a/TangemSdk/TangemSdkTests/BLSTests.swift b/TangemSdk/TangemSdkTests/BLSTests.swift index ecbeb1589..4d3c36492 100644 --- a/TangemSdk/TangemSdkTests/BLSTests.swift +++ b/TangemSdk/TangemSdkTests/BLSTests.swift @@ -11,7 +11,6 @@ import XCTest @testable import TangemSdk /// testcases from https://eips.ethereum.org/EIPS/eip-2333#hkdf_mod_r-1 -@available(iOS 13.0, *) class BLSTests: XCTestCase { func testCase0() throws { let key = try BLSUtils().generateKey(inputKeyMaterial: Data(hexString: "c55257c360c07c72029aebc1b53c05ed0362ada38ead3e3e9efa3708e53495531f09a6987599d18264c1e1c92f2cf141630c7a3c4ab7c81b2f001698e7463b04")) diff --git a/TangemSdk/TangemSdkTests/Base58Tests.swift b/TangemSdk/TangemSdkTests/Base58Tests.swift index 946c5b1de..7ff833c23 100644 --- a/TangemSdk/TangemSdkTests/Base58Tests.swift +++ b/TangemSdk/TangemSdkTests/Base58Tests.swift @@ -10,7 +10,6 @@ import Foundation import XCTest @testable import TangemSdk -@available(iOS 13.0, *) class Base58Tests: XCTestCase { func testRoundTrip() { let data = Data(repeating: UInt8(1), count: 32) diff --git a/TangemSdk/TangemSdkTests/ByteUtilsTest.swift b/TangemSdk/TangemSdkTests/ByteUtilsTest.swift index 91eced4c5..d5193a9ad 100644 --- a/TangemSdk/TangemSdkTests/ByteUtilsTest.swift +++ b/TangemSdk/TangemSdkTests/ByteUtilsTest.swift @@ -10,7 +10,6 @@ import Foundation import XCTest @testable import TangemSdk -@available(iOS 13.0, *) class ByteUtilsTests: XCTestCase { func testHexConversion() { let testData = UInt8(0x1B) diff --git a/TangemSdk/TangemSdkTests/CommonFirmwareTests.swift b/TangemSdk/TangemSdkTests/CommonFirmwareTests.swift index 7e955b229..f43a0391d 100644 --- a/TangemSdk/TangemSdkTests/CommonFirmwareTests.swift +++ b/TangemSdk/TangemSdkTests/CommonFirmwareTests.swift @@ -104,11 +104,11 @@ class CommonFirmwareTests: FWTestCase { "ac188745db0b9442313bc027118214f007ffc06c43a2eb4020a1d47cd1422480190639e7775b133fc999e8dccd8ba26c", "8793a32f2bf261acabcbfc67f33c0c5278463826e677438b7801136ffd0c8aeb22626a3abb57da9d414a58bae16a2096", ] - let pass = "TREZOR" + let passphrase = "TREZOR" let cmds = mnemonics.map { let mnemonic = try! Mnemonic(with: $0) - let factory = AnyMasterKeyFactory(mnemonic: mnemonic, passphrase: "TREZOR") + let factory = AnyMasterKeyFactory(mnemonic: mnemonic, passphrase: passphrase) let prvKey = try! factory.makeMasterKey(for: .bls12381_G2_AUG) let cmd = CreateWalletTask(curve: .bls12381_G2_AUG, privateKey: prvKey) return (cmd, prvKey) @@ -197,7 +197,6 @@ class CommonFirmwareTests: FWTestCase { "010e304751311432c4ffb107cee6a4fc56fa3fbd43e7f354da5166c3915400feff", "01539f7909fe0243b862dd4395d2c8575bf070d22931952e94fb46d9aa557fa46a", ] - let pass = "TREZOR" let cmds = mnemonics.map { let mnemonic = try! Mnemonic(with: $0) diff --git a/TangemSdk/TangemSdkTests/CommonTests.swift b/TangemSdk/TangemSdkTests/CommonTests.swift index e44b1ef39..0787a9ecb 100644 --- a/TangemSdk/TangemSdkTests/CommonTests.swift +++ b/TangemSdk/TangemSdkTests/CommonTests.swift @@ -10,7 +10,6 @@ import Foundation import XCTest @testable import TangemSdk -@available(iOS 13.0, *) class CommonTests: XCTestCase { func testAtetstModeCompare() { XCTAssertTrue(AttestationTask.Mode.normal < AttestationTask.Mode.full) diff --git a/TangemSdk/TangemSdkTests/CryptoUtilsTests.swift b/TangemSdk/TangemSdkTests/CryptoUtilsTests.swift index 932dc7b60..38a56bcd6 100644 --- a/TangemSdk/TangemSdkTests/CryptoUtilsTests.swift +++ b/TangemSdk/TangemSdkTests/CryptoUtilsTests.swift @@ -10,7 +10,6 @@ import XCTest @testable import TangemSdk import CryptoKit -@available(iOS 13.0, *) class CryptoUtilsTests: XCTestCase { override func setUp() { @@ -140,7 +139,7 @@ class CryptoUtilsTests: XCTestCase { XCTAssertEqual(normalized.hexString, "5365F955FC45763383936BBC021A15D583E8D2300D1A65D21853B6A0FCAECE4E29AF6C44A13AD6E138336A4BD872F15FC517C30816E9B4C57858697AEBE25364") } - func testRecover() { + func testSignatureUnmarshal() { let privateKey = Data(hexString: "fd230007d4a39352f50d8c481456c1f86ddc5ff155df170af0100a62269852f0") let publicKey = Data(hexString: "0432f507f6a3029028faa5913838c50f5ff3355b9b000b51889d03a2bdb96570cd750e8187482a27ca9d2dd0c92c632155d0384521ed406753c9883621ad0da68c") @@ -153,6 +152,22 @@ class CryptoUtilsTests: XCTestCase { XCTAssertEqual(unmarshalled?.v.hexString, "1C") } + func testRecoverPublicKey() throws { + let privateKey = Data(hexString: "fd230007d4a39352f50d8c481456c1f86ddc5ff155df170af0100a62269852f0") + let publicKey = Data(hexString: "0432f507f6a3029028faa5913838c50f5ff3355b9b000b51889d03a2bdb96570cd750e8187482a27ca9d2dd0c92c632155d0384521ed406753c9883621ad0da68c") + let dummyData = Data(repeating: UInt8(1), count: 64) + let hash = dummyData.getSha256() + + let signature = try Secp256k1Utils().sign(dummyData, with: privateKey) + let unmarshalled = try Secp256k1Signature(with: signature).unmarshal(with: publicKey, hash: hash) + + let key = try Secp256k1Key(with: unmarshalled, hash: hash) + XCTAssertEqual(try key.decompress().hexString, publicKey.hexString) + + let key1 = try Secp256k1Key(with: unmarshalled, message: dummyData) + XCTAssertEqual(try key1.decompress().hexString, publicKey.hexString) + } + func testSecp256k1PrivateKeyValidation() { let utils = Secp256k1Utils() diff --git a/TangemSdk/TangemSdkTests/DataExtensionTests.swift b/TangemSdk/TangemSdkTests/DataExtensionTests.swift index 079c34ec0..2378a62ba 100644 --- a/TangemSdk/TangemSdkTests/DataExtensionTests.swift +++ b/TangemSdk/TangemSdkTests/DataExtensionTests.swift @@ -8,7 +8,6 @@ import XCTest @testable import TangemSdk -@available(iOS 13.0, *) class DataExtensionTests: XCTestCase { override func setUp() { // Put setup code here. This method is called before the invocation of each test method in the class. diff --git a/TangemSdk/TangemSdkTests/Ed25519Slip0010Tests.swift b/TangemSdk/TangemSdkTests/Ed25519Slip0010Tests.swift index bf5d9d00c..eb1622ece 100644 --- a/TangemSdk/TangemSdkTests/Ed25519Slip0010Tests.swift +++ b/TangemSdk/TangemSdkTests/Ed25519Slip0010Tests.swift @@ -12,8 +12,8 @@ import XCTest class Ed25519Slip0010Tests { /// Compare with trustwallet. Test only first part of the long key because second part is equal too func testDerivation() { - let seed = "gravity machine north sort system female filter attitude volume fold club stay feature office ecology stable narrow fog" - let passphrase = "TREZOR" + // let seed = "gravity machine north sort system female filter attitude volume fold club stay feature office ecology stable narrow fog" + // let passphrase = "TREZOR" // m/44/501/0/0/0 and m/44/501/0/2/0 // long key A0D68D1417418A5D80B9BB61F160237597D6DED8582475BCA248C7F0C79D5A01D09EEF00267D028F0FDD6741DE8330A6F54F27DD47C85AAB6945CD1DE501EB4AB59EF7C83690EB70E890CA5DD58BE027C3DED4ECF2496EF06F7D8B0688F3F5C2B57A196F9D6D4C90ADF790D4ABFFBA7E26F3632758774305D6E932C67B7F76E8 diff --git a/TangemSdk/TangemSdkTests/ExtendedKeyTests.swift b/TangemSdk/TangemSdkTests/ExtendedKeyTests.swift index 33b3a163b..8093d0d0b 100644 --- a/TangemSdk/TangemSdkTests/ExtendedKeyTests.swift +++ b/TangemSdk/TangemSdkTests/ExtendedKeyTests.swift @@ -10,7 +10,6 @@ import XCTest import Foundation @testable import TangemSdk -@available(iOS 13.0, *) class ExtendedKeyTests: XCTestCase { func testRoundTripPub() throws { let key = try ExtendedPublicKey( diff --git a/TangemSdk/TangemSdkTests/HDWalletTests.swift b/TangemSdk/TangemSdkTests/HDWalletTests.swift index 5716edbf5..6eea0b553 100644 --- a/TangemSdk/TangemSdkTests/HDWalletTests.swift +++ b/TangemSdk/TangemSdkTests/HDWalletTests.swift @@ -10,7 +10,6 @@ import Foundation import XCTest @testable import TangemSdk -@available(iOS 13.0, *) class HDWalletTests: XCTestCase { func testDerivation1() { let masterKey = ExtendedPublicKey(publicKey: Data(hexString: "0339a36013301597daef41fbe593a02cc513d0b55527ec2df1050e2e8ff49c85c2"), diff --git a/TangemSdk/TangemSdkTests/HKDFTests.swift b/TangemSdk/TangemSdkTests/HKDFTests.swift index 9cf9da4b4..fc8446f3d 100644 --- a/TangemSdk/TangemSdkTests/HKDFTests.swift +++ b/TangemSdk/TangemSdkTests/HKDFTests.swift @@ -11,7 +11,6 @@ import XCTest import CryptoKit @testable import TangemSdk -@available(iOS 13.0, *) /// https://www.rfc-editor.org/rfc/rfc5869 without SHA1 class HKDFTests: XCTestCase { func testCase1() { diff --git a/TangemSdk/TangemSdkTests/IntUtilsTests.swift b/TangemSdk/TangemSdkTests/IntUtilsTests.swift index 01750faf0..2b77a9cf0 100644 --- a/TangemSdk/TangemSdkTests/IntUtilsTests.swift +++ b/TangemSdk/TangemSdkTests/IntUtilsTests.swift @@ -10,7 +10,6 @@ import Foundation import XCTest @testable import TangemSdk -@available(iOS 13.0, *) class IntUtilsTests: XCTestCase { func testFromHexConversion() { let testData = Data(hexString: "9569") diff --git a/TangemSdk/TangemSdkTests/JSONRPCTests.swift b/TangemSdk/TangemSdkTests/JSONRPCTests.swift index 6f3d03221..8353cae0a 100644 --- a/TangemSdk/TangemSdkTests/JSONRPCTests.swift +++ b/TangemSdk/TangemSdkTests/JSONRPCTests.swift @@ -10,7 +10,6 @@ import Foundation import XCTest @testable import TangemSdk -@available(iOS 13.0, *) class JSONRPCTests: XCTestCase { var testCard: Card { get throws { diff --git a/TangemSdk/TangemSdkTests/JsonTests.swift b/TangemSdk/TangemSdkTests/JsonTests.swift index ab249a64e..50623883c 100644 --- a/TangemSdk/TangemSdkTests/JsonTests.swift +++ b/TangemSdk/TangemSdkTests/JsonTests.swift @@ -9,7 +9,6 @@ import XCTest @testable import TangemSdk -@available(iOS 13.0, *) class JsonTests: XCTestCase { override func setUp() { diff --git a/TangemSdk/TangemSdkTests/KeysImportTests.swift b/TangemSdk/TangemSdkTests/KeysImportTests.swift index 19681df55..b00a3e9b0 100644 --- a/TangemSdk/TangemSdkTests/KeysImportTests.swift +++ b/TangemSdk/TangemSdkTests/KeysImportTests.swift @@ -12,7 +12,6 @@ import CryptoKit @testable import TangemSdk /// Test that keys uploaded to a card are equal to locally computed. Firmware 6.31 -@available(iOS 13.0, *) class KeysImportTests: XCTestCase { private let entropy = Data(hexString: "6610b25967cdcca9d59875f5cb50b0ea75433311869e930b") private let mnemonicString = "gravity machine north sort system female filter attitude volume fold club stay feature office ecology stable narrow fog" diff --git a/TangemSdk/TangemSdkTests/SLIP10Tests.swift b/TangemSdk/TangemSdkTests/SLIP10Tests.swift index aee352740..e433c146b 100644 --- a/TangemSdk/TangemSdkTests/SLIP10Tests.swift +++ b/TangemSdk/TangemSdkTests/SLIP10Tests.swift @@ -13,7 +13,6 @@ import CryptoKit /// Tests for firmware 6.33 /// test vectors for secp356k1 are equal to BIP32 test vectors -@available(iOS 13.0, *) class SLIP10Tests: XCTestCase { // MARK: - Test seed retry for nist256p1 @@ -26,8 +25,6 @@ class SLIP10Tests: XCTestCase { } // MARK: - SLIP10FWTests - -@available(iOS 13.0, *) class SLIP10FWTests: FWTestCase { @available(iOS 16.0, *) func testVector1Secp256r1() { diff --git a/TangemSdk/TangemSdkTests/SLIP23Tests.swift b/TangemSdk/TangemSdkTests/SLIP23Tests.swift index a60cf971a..a68f3c75b 100644 --- a/TangemSdk/TangemSdkTests/SLIP23Tests.swift +++ b/TangemSdk/TangemSdkTests/SLIP23Tests.swift @@ -11,7 +11,6 @@ import XCTest @testable import TangemSdk /// https://github.com/satoshilabs/slips/blob/master/slip-0023.md -@available(iOS 13.0, *) class SLIP23Tests: XCTestCase { // compare with TrustWallet's WalletCore implementaion func testIkarus() throws { diff --git a/TangemSdk/TangemSdkTests/StringUtilsTest.swift b/TangemSdk/TangemSdkTests/StringUtilsTest.swift index 39b6779d3..190abfac1 100644 --- a/TangemSdk/TangemSdkTests/StringUtilsTest.swift +++ b/TangemSdk/TangemSdkTests/StringUtilsTest.swift @@ -9,7 +9,6 @@ import XCTest @testable import TangemSdk -@available(iOS 13.0, *) class StringUtilsTest: XCTestCase { func testRemove() { let testString = "This is a test string" diff --git a/TangemSdk/TangemSdkTests/TlvTests.swift b/TangemSdk/TangemSdkTests/TlvTests.swift index a67810f1b..747a522b5 100644 --- a/TangemSdk/TangemSdkTests/TlvTests.swift +++ b/TangemSdk/TangemSdkTests/TlvTests.swift @@ -11,7 +11,6 @@ import XCTest import CoreNFC @testable import TangemSdk -@available(iOS 13.0, *) class TlvTests: XCTestCase { func testTlvSerialization() { let testData = Data(hexString: "0105000000000050020101") diff --git a/TangemSdk/TangemSdkTests/WIFTests.swift b/TangemSdk/TangemSdkTests/WIFTests.swift index 91e349082..65e7a82fb 100644 --- a/TangemSdk/TangemSdkTests/WIFTests.swift +++ b/TangemSdk/TangemSdkTests/WIFTests.swift @@ -10,7 +10,6 @@ import XCTest import Foundation @testable import TangemSdk -@available(iOS 13.0, *) class WIFTests: XCTestCase { func testRoundTrip() { let key = Data(hexString: "589aeb596710f33d7ac31598ec10440a7df8808cf2c3d69ba670ff3fae66aafb") diff --git a/VERSION b/VERSION index 30291cba2..afad81866 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.10.0 +3.11.0