From e45ab9299fb0c78c65e124dba3943d07c75e3680 Mon Sep 17 00:00:00 2001 From: Ankit Rajendra Thanekar Date: Thu, 30 May 2024 16:30:53 -0700 Subject: [PATCH 1/2] Issue 981 Fixes --- .../Utilities/PBMUIApplicationProtocol.h | 1 - .../RenderingTests/Mocks/MockUIApplication.swift | 6 +----- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/PrebidMobile/PrebidMobileRendering/Utilities/PBMUIApplicationProtocol.h b/PrebidMobile/PrebidMobileRendering/Utilities/PBMUIApplicationProtocol.h index 8149c8be4..17664ca6d 100644 --- a/PrebidMobile/PrebidMobileRendering/Utilities/PBMUIApplicationProtocol.h +++ b/PrebidMobile/PrebidMobileRendering/Utilities/PBMUIApplicationProtocol.h @@ -25,7 +25,6 @@ @property (nonatomic, assign) UIInterfaceOrientation statusBarOrientation; @property (nonatomic, assign, readonly) CGRect statusBarFrame; -- (BOOL)openURL:(nonnull NSURL*)url NS_DEPRECATED_IOS(2_0, 10_0, "Please use openURL:options:completionHandler: instead") NS_EXTENSION_UNAVAILABLE_IOS(""); - (void)openURL:(nonnull NSURL*)url options:(nullable NSDictionary *)options completionHandler:(void (^ __nullable)(BOOL success))completion NS_AVAILABLE_IOS(10_0) NS_EXTENSION_UNAVAILABLE_IOS(""); @end diff --git a/PrebidMobileTests/RenderingTests/Mocks/MockUIApplication.swift b/PrebidMobileTests/RenderingTests/Mocks/MockUIApplication.swift index ee4b20ed8..de4c97e04 100644 --- a/PrebidMobileTests/RenderingTests/Mocks/MockUIApplication.swift +++ b/PrebidMobileTests/RenderingTests/Mocks/MockUIApplication.swift @@ -23,12 +23,8 @@ class MockUIApplication : PBMUIApplicationProtocol { var openURLClosure:((URL)->Bool)? - func open(_ url: URL) -> Bool { - return self.openURLClosure?(url) ?? false - } - func open(_ url: URL, options: [String : Any]? = [:], completionHandler completion: ((Bool) -> Void)? = nil) { - let result = open(url) + let result = self.openURLClosure?(url) ?? false completion?(result) } } From 75318b04a9a0a12abc0dd825f879dea88f073388 Mon Sep 17 00:00:00 2001 From: Ankit Rajendra Thanekar Date: Fri, 31 May 2024 09:22:55 -0700 Subject: [PATCH 2/2] Add NS_SWIFT_NAME to remove deprecation warning. --- .../Utilities/PBMUIApplicationProtocol.h | 2 ++ .../RenderingTests/Mocks/MockUIApplication.swift | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/PrebidMobile/PrebidMobileRendering/Utilities/PBMUIApplicationProtocol.h b/PrebidMobile/PrebidMobileRendering/Utilities/PBMUIApplicationProtocol.h index 17664ca6d..7144546ea 100644 --- a/PrebidMobile/PrebidMobileRendering/Utilities/PBMUIApplicationProtocol.h +++ b/PrebidMobile/PrebidMobileRendering/Utilities/PBMUIApplicationProtocol.h @@ -25,6 +25,8 @@ @property (nonatomic, assign) UIInterfaceOrientation statusBarOrientation; @property (nonatomic, assign, readonly) CGRect statusBarFrame; +- (BOOL)openURL:(nonnull NSURL*)url NS_SWIFT_NAME(openURL(url:)) NS_DEPRECATED_IOS(2_0, 10_0, "Please use openURL:options:completionHandler: instead") NS_EXTENSION_UNAVAILABLE_IOS(""); + - (void)openURL:(nonnull NSURL*)url options:(nullable NSDictionary *)options completionHandler:(void (^ __nullable)(BOOL success))completion NS_AVAILABLE_IOS(10_0) NS_EXTENSION_UNAVAILABLE_IOS(""); @end diff --git a/PrebidMobileTests/RenderingTests/Mocks/MockUIApplication.swift b/PrebidMobileTests/RenderingTests/Mocks/MockUIApplication.swift index de4c97e04..9814afef1 100644 --- a/PrebidMobileTests/RenderingTests/Mocks/MockUIApplication.swift +++ b/PrebidMobileTests/RenderingTests/Mocks/MockUIApplication.swift @@ -23,8 +23,12 @@ class MockUIApplication : PBMUIApplicationProtocol { var openURLClosure:((URL)->Bool)? + func openURL(url: URL) -> Bool { + return self.openURLClosure?(url) ?? false + } + func open(_ url: URL, options: [String : Any]? = [:], completionHandler completion: ((Bool) -> Void)? = nil) { - let result = self.openURLClosure?(url) ?? false + let result = openURL(url: url) completion?(result) } }