From 4cd57cac0f8dd843b6d6a896bbeb453609c5b584 Mon Sep 17 00:00:00 2001 From: denysdanyliukboosters Date: Mon, 16 Oct 2023 20:41:24 +0300 Subject: [PATCH] Release: 2.0.3 --- .../ConfiguredPanda/ConfiguredPanda+WebViewModel.swift | 3 +++ Sources/PandaSDK/Views/WebViewController.swift | 7 +++++++ Sources/PandaSDK/Views/WebViewModel.swift | 3 ++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Sources/PandaSDK/ConfiguredPanda/ConfiguredPanda+WebViewModel.swift b/Sources/PandaSDK/ConfiguredPanda/ConfiguredPanda+WebViewModel.swift index 533208d..4883d80 100644 --- a/Sources/PandaSDK/ConfiguredPanda/ConfiguredPanda+WebViewModel.swift +++ b/Sources/PandaSDK/ConfiguredPanda/ConfiguredPanda+WebViewModel.swift @@ -103,6 +103,9 @@ extension Panda { viewModel.onFinishLoadingIndicator = { [weak self] in self?.send(event: .onFinishLoading) } + viewModel.onFreeForUkraineButtonTap = { [weak self] result in + self?.send(event: .trackOpenLink(link: "Free for Ukraine", result: result.description)) + } return viewModel } diff --git a/Sources/PandaSDK/Views/WebViewController.swift b/Sources/PandaSDK/Views/WebViewController.swift index 7c4a411..a746d82 100644 --- a/Sources/PandaSDK/Views/WebViewController.swift +++ b/Sources/PandaSDK/Views/WebViewController.swift @@ -199,6 +199,13 @@ final class WebViewController: UIViewController, WKScriptMessageHandler { ) } } + if viewModel?.screenData.id.string == "b0bff24a-a023-4a02-95a7-20b6af6e59cc" { + UIApplication.shared.open(url) + viewModel?.onFreeForUkraineButtonTap?(true) + onFinishLoad() + return + } + UIApplication.shared.open(url) onFinishLoad() isAutoDismissable = true diff --git a/Sources/PandaSDK/Views/WebViewModel.swift b/Sources/PandaSDK/Views/WebViewModel.swift index 763ad6a..ce7abfd 100644 --- a/Sources/PandaSDK/Views/WebViewModel.swift +++ b/Sources/PandaSDK/Views/WebViewModel.swift @@ -56,7 +56,8 @@ final class WebViewModel: WebViewModelProtocol { var onScreenDataUpdate: ((ScreenData) -> Void)? var onSupportUkraineAnyButtonTap: (() -> Void)? - + var onFreeForUkraineButtonTap: ((Bool) -> Void)? + var onStartLoadingIndicator: (() -> Void)? var onFinishLoadingIndicator: (() -> Void)?