Skip to content

Commit a4e1504

Browse files
committed
fix: infinite recursion
1 parent 566ce0a commit a4e1504

File tree

3 files changed

+9
-31
lines changed

3 files changed

+9
-31
lines changed

OSInAppBrowserLib.podspec

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@ Pod::Spec.new do |spec|
2222
spec.author = { 'OutSystems Mobile Ecosystem' => '[email protected]' }
2323

2424
spec.source = { :http => "https://github.com/OutSystems/OSInAppBrowserLib-iOS/releases/download/#{spec.version}/OSInAppBrowserLib.zip", :type => "zip" }
25+
spec.source_files = "OSInAppBrowserLib/**/*"
2526
spec.vendored_frameworks = "OSInAppBrowserLib.xcframework"
2627

2728
spec.ios.deployment_target = '13.0'
2829
spec.swift_versions = ['5.0', '5.1', '5.2', '5.3', '5.4', '5.5', '5.6', '5.7', '5.8', '5.9']
29-
end
30+
end
Lines changed: 5 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,14 @@
11
import UIKit
22

3-
/// Protocol to be implemented by the objects that can handle opening URLs.
4-
/// This is implemented by the `UIApplication` object that can be used as an External Browser.
5-
public protocol OSIABApplicationDelegate: AnyObject {
6-
func canOpenURL(_ url: URL) -> Bool
7-
func open(_ url: URL, options: [UIApplication.OpenExternalURLOptionsKey: Any], completionHandler completion: ((Bool) -> Void)?)
8-
}
9-
10-
/// Provide a default implementations that abstracts the options parameter.
11-
extension OSIABApplicationDelegate {
12-
public func open(_ url: URL, options: [UIApplication.OpenExternalURLOptionsKey: Any] = [:], completionHandler completion: ((Bool) -> Void)?) {
13-
self.open(url, options: options, completionHandler: completion)
14-
}
15-
}
16-
17-
/// Make `UIApplication` conform to the `OSIABApplicationDelegate` protocol.
18-
extension UIApplication: OSIABApplicationDelegate {}
19-
20-
/// Adapter that makes the required calls so that an `OSIABApplicationDelegate` implementation can perform the External Browser routing.
3+
/// Adapter that makes the required calls so that can perform the External Browser routing.
214
public class OSIABApplicationRouterAdapter: OSIABRouter {
225
public typealias ReturnType = Bool
23-
24-
/// The object that will performing the URL opening.
25-
private let application: OSIABApplicationDelegate
26-
6+
277
/// Constructor method.
28-
/// - Parameter application: The object that will performing the URL opening.
29-
public init(_ application: OSIABApplicationDelegate) {
30-
self.application = application
31-
}
8+
public init() {}
329

3310
public func handleOpen(_ url: URL, _ completionHandler: @escaping (ReturnType) -> Void) {
34-
guard self.application.canOpenURL(url) else { return completionHandler(false) }
35-
self.application.open(url, completionHandler: completionHandler)
11+
guard UIApplication.shared.canOpenURL(url) else { return completionHandler(false) }
12+
UIApplication.shared.open(url, completionHandler: completionHandler)
3613
}
3714
}

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ func openExternalBrowser(_ url: URL, routerDelegate: ExternalBrowser, _ completi
6161

6262
Uses the parameter `routerDelegate` - an object that offers an External Browser interface - to open the parameter `url`. The method is composed of the following input parameters:
6363
- **url**: the URL for the web page to be opened.
64-
- **routerDelegate**: The External Browser interface that will open the URL. Its return type should be `Bool`. The library provides an `OSIABApplicationRouterAdapter` class that allows a class that implements `OSIABApplicationDelegate` (like `UIApplication`, that uses the device's default browser) to open it.
64+
- **routerDelegate**: The External Browser interface that will open the URL. Its return type should be `Bool`.
6565
- **completionHandler**: The callback with the result of opening the URL with the External Browser interface.
6666

6767
### Open a URL in a System Browser
@@ -84,4 +84,4 @@ func openWebView(_ url: URL, routerDelegate: WebView, _ completionHandler: @esca
8484
Uses the parameter `routerDelegate` - an object that offers a Web View interface - to open the parameter `url`. The method is composed of the following input parameters:
8585
- **url**: the URL for the web page to be opened.
8686
- **routerDelegate**: The Web View interface that will open the URL. Its return type should be `UIViewController` or a subclass. The library provides an `OSIABWebViewRouterAdapter` class that uses `WKWebView` to open it.
87-
- **completionHandler**: The callback with the result of opening the URL with the Web View interface.
87+
- **completionHandler**: The callback with the result of opening the URL with the Web View interface.

0 commit comments

Comments
 (0)