From bbcd842d466ceb3b6d41949420be34798405ed39 Mon Sep 17 00:00:00 2001 From: YehorKyrylov <> Date: Thu, 25 May 2023 09:44:26 +0200 Subject: [PATCH] [WBIOS-3030] Bugfix: Enable to use dismiss on old panda screens --- Sources/PandaSDK/Views/WebViewController.swift | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Sources/PandaSDK/Views/WebViewController.swift b/Sources/PandaSDK/Views/WebViewController.swift index 17294a7..3c5523e 100644 --- a/Sources/PandaSDK/Views/WebViewController.swift +++ b/Sources/PandaSDK/Views/WebViewController.swift @@ -82,7 +82,12 @@ final class WebViewController: UIViewController, WKScriptMessageHandler { wv.alpha = 0 if let html = html { - load(html: html, baseURL: URL(fileURLWithPath: Bundle.main.bundlePath)) + load( + html: html, + baseURL: html.contains(Constants.oldDismiss) // We are still using old panda screens that do not yet use JS dismiss functions, so we need to check whether it is the old screen or the new + ? nil + : URL(fileURLWithPath: Bundle.main.bundlePath) + ) } } @@ -829,5 +834,6 @@ extension WebViewController { private enum Constants { static let hideTrialJSFunctionName = "removeTrialUi()" + static let oldDismiss = "dismiss?type=dismiss" } }