diff --git a/Podfile b/Podfile index 232cbf7382..9b53a26f06 100644 --- a/Podfile +++ b/Podfile @@ -24,7 +24,7 @@ use_frameworks! inhibit_all_warnings! def tangem_sdk_pod - pod 'TangemSdk', :git => 'https://github.com/Tangem/tangem-sdk-ios.git', :tag => 'develop-302' + pod 'TangemSdk', :git => 'https://github.com/Tangem/tangem-sdk-ios.git', :tag => 'develop-305' #pod 'TangemSdk', :path => '../tangem-sdk-ios' end diff --git a/Podfile.lock b/Podfile.lock index 1b16fce4c7..2fdde65d5a 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -233,7 +233,7 @@ DEPENDENCIES: - Moya - Solana.Swift (from `https://github.com/tangem/Solana.Swift`, tag `1.2.0-tangem11`) - SwiftyJSON (from `https://github.com/tangem/SwiftyJSON.git`, tag `5.0.1-tangem1`) - - TangemSdk (from `https://github.com/Tangem/tangem-sdk-ios.git`, tag `develop-302`) + - TangemSdk (from `https://github.com/Tangem/tangem-sdk-ios.git`, tag `develop-305`) - WalletConnectSwiftV2 (from `https://github.com/WalletConnect/WalletConnectSwiftV2`, tag `1.18.7`) SPEC REPOS: @@ -287,7 +287,7 @@ EXTERNAL SOURCES: :tag: 5.0.1-tangem1 TangemSdk: :git: https://github.com/Tangem/tangem-sdk-ios.git - :tag: develop-302 + :tag: develop-305 WalletConnectSwiftV2: :git: https://github.com/WalletConnect/WalletConnectSwiftV2 :tag: 1.18.7 @@ -310,7 +310,7 @@ CHECKOUT OPTIONS: :tag: 5.0.1-tangem1 TangemSdk: :git: https://github.com/Tangem/tangem-sdk-ios.git - :tag: develop-302 + :tag: develop-305 WalletConnectSwiftV2: :git: https://github.com/WalletConnect/WalletConnectSwiftV2 :tag: 1.18.7 @@ -354,6 +354,6 @@ SPEC CHECKSUMS: TangemSdk: 4a188873f9dbed6340cca9ad6a010240af6df432 WalletConnectSwiftV2: 5ea47db4d86e39fc749b66a05a661af9e87b277d -PODFILE CHECKSUM: 39c88afa827f141b4be8ae0e19ec89ead613922e +PODFILE CHECKSUM: 12f86daf305325609ee75b5b41a4192a4d4e5026 COCOAPODS: 1.15.2 diff --git a/Tangem/Modules/Onboarding/BaseModels/OnboardingViewModel.swift b/Tangem/Modules/Onboarding/BaseModels/OnboardingViewModel.swift index 68bb0075ac..4a42ac3b09 100644 --- a/Tangem/Modules/Onboarding/BaseModels/OnboardingViewModel.swift +++ b/Tangem/Modules/Onboarding/BaseModels/OnboardingViewModel.swift @@ -28,9 +28,10 @@ class OnboardingViewModel @Published var supplementCardSettings: AnimatedViewSettings = .zero @Published var isNavBarVisible: Bool = false @Published var alert: AlertBinder? - @Published var cardImage: Image? + @Published var mainImage: Image? @Published var customOnboardingImage: Image? @Published var secondImage: Image? + @Published var thirdImage: Image? private var confettiFired: Bool = false var bag: Set = [] @@ -184,12 +185,7 @@ class OnboardingViewModel isFromMain = input.isStandalone isNavBarVisible = input.isStandalone - let loadImageInput = input.cardInput.imageLoadInput - loadImage( - supportsOnlineImage: loadImageInput.supportsOnlineImage, - cardId: loadImageInput.cardId, - cardPublicKey: loadImageInput.cardPublicKey - ) + loadMainImage(imageLoadInput: input.cardInput.imageLoadInput) bindAnalytics() } @@ -212,20 +208,11 @@ class OnboardingViewModel userWalletRepository.add(userWalletModel) } - func loadImage(supportsOnlineImage: Bool, cardId: String?, cardPublicKey: Data?) { - guard let cardId = cardId, let cardPublicKey = cardPublicKey else { - return - } - + func loadImage(supportsOnlineImage: Bool, cardId: String, cardPublicKey: Data) -> AnyPublisher { CardImageProvider(supportsOnlineImage: supportsOnlineImage) .loadImage(cardId: cardId, cardPublicKey: cardPublicKey) .map { $0.image } - .sink { [weak self] image in - withAnimation { - self?.cardImage = image - } - } - .store(in: &bag) + .eraseToAnyPublisher() } func setupContainer(with size: CGSize) { @@ -327,6 +314,20 @@ class OnboardingViewModel Analytics.log(.onboardingEnableBiometric, params: [.state: Analytics.ParameterValue.toggleState(for: agreed)]) } + private func loadMainImage(imageLoadInput: OnboardingInput.ImageLoadInput) { + loadImage( + supportsOnlineImage: imageLoadInput.supportsOnlineImage, + cardId: imageLoadInput.cardId, + cardPublicKey: imageLoadInput.cardPublicKey + ) + .sink { [weak self] image in + withAnimation { + self?.mainImage = image + } + } + .store(in: &bag) + } + private func bindAnalytics() { $currentStepIndex .removeDuplicates() diff --git a/Tangem/Modules/Onboarding/Note/SingleCardOnboardingView.swift b/Tangem/Modules/Onboarding/Note/SingleCardOnboardingView.swift index 606a1dc06a..d893381896 100644 --- a/Tangem/Modules/Onboarding/Note/SingleCardOnboardingView.swift +++ b/Tangem/Modules/Onboarding/Note/SingleCardOnboardingView.swift @@ -106,7 +106,7 @@ struct SingleCardOnboardingView: View { AnimatedView(settings: viewModel.$mainCardSettings) { OnboardingCardView( placeholderCardType: .dark, - cardImage: viewModel.cardImage, + cardImage: viewModel.mainImage, cardScanned: viewModel.isInitialAnimPlayed && viewModel.isCardScanned ) } diff --git a/Tangem/Modules/Onboarding/Twins/TwinsOnboardingViewModel.swift b/Tangem/Modules/Onboarding/Twins/TwinsOnboardingViewModel.swift index 8fcd491ef1..5fb784a522 100644 --- a/Tangem/Modules/Onboarding/Twins/TwinsOnboardingViewModel.swift +++ b/Tangem/Modules/Onboarding/Twins/TwinsOnboardingViewModel.swift @@ -380,7 +380,7 @@ class TwinsOnboardingViewModel: OnboardingTopupViewModel= 2 || currentStep == .backupIntro) && viewModel.canDisplayCardImage ) } @@ -138,7 +138,7 @@ struct WalletOnboardingView: View { AnimatedView(settings: viewModel.$supplementCardSettings) { OnboardingCardView( placeholderCardType: secondCardPlaceholder, - cardImage: viewModel.secondImage ?? viewModel.cardImage, + cardImage: viewModel.secondImage, cardScanned: (viewModel.backupCardsAddedCount >= 1 || currentStep == .backupIntro) && viewModel.canDisplayCardImage ) } @@ -147,7 +147,7 @@ struct WalletOnboardingView: View { ZStack(alignment: .topTrailing) { OnboardingCardView( placeholderCardType: .dark, - cardImage: viewModel.customOnboardingImage ?? viewModel.cardImage, + cardImage: viewModel.customOnboardingImage ?? viewModel.mainImage, cardScanned: viewModel.isInitialAnimPlayed ) Text(Localization.commonOriginCard) diff --git a/Tangem/Modules/Onboarding/Wallet/WalletOnboardingViewModel.swift b/Tangem/Modules/Onboarding/Wallet/WalletOnboardingViewModel.swift index 2c102790fd..9f03dac1f3 100644 --- a/Tangem/Modules/Onboarding/Wallet/WalletOnboardingViewModel.swift +++ b/Tangem/Modules/Onboarding/Wallet/WalletOnboardingViewModel.swift @@ -329,19 +329,6 @@ class WalletOnboardingViewModel: OnboardingViewModel