Skip to content

Commit 20aa316

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

File tree

7 files changed

+19
-86
lines changed

7 files changed

+19
-86
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## Unreleased
8+
9+
### Features
10+
11+
- Users now receive an event when the navigation occurs (for openInWebView option only) (https://outsystemsrd.atlassian.net/browse/RMET-4122).
12+
13+
### Fixes
14+
15+
- **BREAKING:** Fix an issue where the application freezes when 'OpenInExternalBrowser' is called
16+
717
## 1.0.0
818

919
### Features

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

OSInAppBrowserLib.xcodeproj/project.pbxproj

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@
2626
754451F62C04AB69003D7361 /* OSIABViewStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 754451F52C04AB69003D7361 /* OSIABViewStyle.swift */; };
2727
754451FB2C04C76C003D7361 /* OSIABAnimationEffect.swift in Sources */ = {isa = PBXBuildFile; fileRef = 754451FA2C04C76C003D7361 /* OSIABAnimationEffect.swift */; };
2828
754451FD2C04D38D003D7361 /* OSIABSystemBrowserOptions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 754451FC2C04D38D003D7361 /* OSIABSystemBrowserOptions.swift */; };
29-
756346462C00D6DD00685AA3 /* OSApplicationStub.swift in Sources */ = {isa = PBXBuildFile; fileRef = 756346452C00D6DD00685AA3 /* OSApplicationStub.swift */; };
3029
756346482C00DD4700685AA3 /* OSIABSafariViewControllerRouterAdapterTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 756346472C00DD4600685AA3 /* OSIABSafariViewControllerRouterAdapterTests.swift */; };
31-
7563464A2C00DE1300685AA3 /* OSIABApplicationRouterAdapterTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 756346492C00DE1300685AA3 /* OSIABApplicationRouterAdapterTests.swift */; };
3230
756346622C00F21000685AA3 /* OSIABRouter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7563465D2C00F21000685AA3 /* OSIABRouter.swift */; };
3331
756346632C00F21000685AA3 /* OSIABSafariViewControllerRouterAdapter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7563465F2C00F21000685AA3 /* OSIABSafariViewControllerRouterAdapter.swift */; };
3432
756346642C00F21000685AA3 /* OSIABApplicationRouterAdapter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 756346602C00F21000685AA3 /* OSIABApplicationRouterAdapter.swift */; };
@@ -74,9 +72,7 @@
7472
754451F52C04AB69003D7361 /* OSIABViewStyle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OSIABViewStyle.swift; sourceTree = "<group>"; };
7573
754451FA2C04C76C003D7361 /* OSIABAnimationEffect.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OSIABAnimationEffect.swift; sourceTree = "<group>"; };
7674
754451FC2C04D38D003D7361 /* OSIABSystemBrowserOptions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OSIABSystemBrowserOptions.swift; sourceTree = "<group>"; };
77-
756346452C00D6DD00685AA3 /* OSApplicationStub.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OSApplicationStub.swift; sourceTree = "<group>"; };
7875
756346472C00DD4600685AA3 /* OSIABSafariViewControllerRouterAdapterTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OSIABSafariViewControllerRouterAdapterTests.swift; sourceTree = "<group>"; };
79-
756346492C00DE1300685AA3 /* OSIABApplicationRouterAdapterTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OSIABApplicationRouterAdapterTests.swift; sourceTree = "<group>"; };
8076
7563465D2C00F21000685AA3 /* OSIABRouter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OSIABRouter.swift; sourceTree = "<group>"; };
8177
7563465F2C00F21000685AA3 /* OSIABSafariViewControllerRouterAdapter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OSIABSafariViewControllerRouterAdapter.swift; sourceTree = "<group>"; };
8278
756346602C00F21000685AA3 /* OSIABApplicationRouterAdapter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OSIABApplicationRouterAdapter.swift; sourceTree = "<group>"; };
@@ -213,7 +209,6 @@
213209
isa = PBXGroup;
214210
children = (
215211
7575CF7E2BFCEEEA008F3FD0 /* Helper Files */,
216-
756346492C00DE1300685AA3 /* OSIABApplicationRouterAdapterTests.swift */,
217212
75EF1AFC2C1306B1005D7164 /* OSIABCacheManagerTests.swift */,
218213
7575CF7D2BFCEEEA008F3FD0 /* OSIABEngineTests.swift */,
219214
756346472C00DD4600685AA3 /* OSIABSafariViewControllerRouterAdapterTests.swift */,
@@ -227,7 +222,6 @@
227222
isa = PBXGroup;
228223
children = (
229224
7575CF7F2BFCEEEA008F3FD0 /* OSIABRouterSpy.swift */,
230-
756346452C00D6DD00685AA3 /* OSApplicationStub.swift */,
231225
75094A062C121BD9006843E1 /* OSIABCacheManagerStub.swift */,
232226
75EF1B002C134878005D7164 /* OSIABWebViewStub.swift */,
233227
);
@@ -399,10 +393,8 @@
399393
files = (
400394
756346482C00DD4700685AA3 /* OSIABSafariViewControllerRouterAdapterTests.swift in Sources */,
401395
75EF1AFB2C13069E005D7164 /* OSIABViewModelTests.swift in Sources */,
402-
7563464A2C00DE1300685AA3 /* OSIABApplicationRouterAdapterTests.swift in Sources */,
403396
7575CF812BFCEEEA008F3FD0 /* OSIABRouterSpy.swift in Sources */,
404397
75094A072C121BD9006843E1 /* OSIABCacheManagerStub.swift in Sources */,
405-
756346462C00D6DD00685AA3 /* OSApplicationStub.swift in Sources */,
406398
75EF1AFD2C1306B1005D7164 /* OSIABCacheManagerTests.swift in Sources */,
407399
7575CF802BFCEEEA008F3FD0 /* OSIABEngineTests.swift in Sources */,
408400
75EF1B012C134878005D7164 /* OSIABWebViewStub.swift in Sources */,
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
}

OSInAppBrowserLibTests/Helper Files/OSApplicationStub.swift

Lines changed: 0 additions & 20 deletions
This file was deleted.

OSInAppBrowserLibTests/OSIABApplicationRouterAdapterTests.swift

Lines changed: 0 additions & 27 deletions
This file was deleted.

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)