Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased

### Features

- Users now receive an event when the navigation occurs (for openInWebView option only) (https://outsystemsrd.atlassian.net/browse/RMET-4122).

### Fixes

- **BREAKING:** Fix an issue where the application freezes when 'OpenInExternalBrowser' is called

## 1.0.0

### Features
Expand Down
3 changes: 2 additions & 1 deletion OSInAppBrowserLib.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ Pod::Spec.new do |spec|
spec.author = { 'OutSystems Mobile Ecosystem' => '[email protected]' }

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

spec.ios.deployment_target = '13.0'
spec.swift_versions = ['5.0', '5.1', '5.2', '5.3', '5.4', '5.5', '5.6', '5.7', '5.8', '5.9']
end
end
8 changes: 0 additions & 8 deletions OSInAppBrowserLib.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@
754451F62C04AB69003D7361 /* OSIABViewStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 754451F52C04AB69003D7361 /* OSIABViewStyle.swift */; };
754451FB2C04C76C003D7361 /* OSIABAnimationEffect.swift in Sources */ = {isa = PBXBuildFile; fileRef = 754451FA2C04C76C003D7361 /* OSIABAnimationEffect.swift */; };
754451FD2C04D38D003D7361 /* OSIABSystemBrowserOptions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 754451FC2C04D38D003D7361 /* OSIABSystemBrowserOptions.swift */; };
756346462C00D6DD00685AA3 /* OSApplicationStub.swift in Sources */ = {isa = PBXBuildFile; fileRef = 756346452C00D6DD00685AA3 /* OSApplicationStub.swift */; };
756346482C00DD4700685AA3 /* OSIABSafariViewControllerRouterAdapterTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 756346472C00DD4600685AA3 /* OSIABSafariViewControllerRouterAdapterTests.swift */; };
7563464A2C00DE1300685AA3 /* OSIABApplicationRouterAdapterTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 756346492C00DE1300685AA3 /* OSIABApplicationRouterAdapterTests.swift */; };
756346622C00F21000685AA3 /* OSIABRouter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7563465D2C00F21000685AA3 /* OSIABRouter.swift */; };
756346632C00F21000685AA3 /* OSIABSafariViewControllerRouterAdapter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7563465F2C00F21000685AA3 /* OSIABSafariViewControllerRouterAdapter.swift */; };
756346642C00F21000685AA3 /* OSIABApplicationRouterAdapter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 756346602C00F21000685AA3 /* OSIABApplicationRouterAdapter.swift */; };
Expand Down Expand Up @@ -74,9 +72,7 @@
754451F52C04AB69003D7361 /* OSIABViewStyle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OSIABViewStyle.swift; sourceTree = "<group>"; };
754451FA2C04C76C003D7361 /* OSIABAnimationEffect.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OSIABAnimationEffect.swift; sourceTree = "<group>"; };
754451FC2C04D38D003D7361 /* OSIABSystemBrowserOptions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OSIABSystemBrowserOptions.swift; sourceTree = "<group>"; };
756346452C00D6DD00685AA3 /* OSApplicationStub.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OSApplicationStub.swift; sourceTree = "<group>"; };
756346472C00DD4600685AA3 /* OSIABSafariViewControllerRouterAdapterTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OSIABSafariViewControllerRouterAdapterTests.swift; sourceTree = "<group>"; };
756346492C00DE1300685AA3 /* OSIABApplicationRouterAdapterTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OSIABApplicationRouterAdapterTests.swift; sourceTree = "<group>"; };
7563465D2C00F21000685AA3 /* OSIABRouter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OSIABRouter.swift; sourceTree = "<group>"; };
7563465F2C00F21000685AA3 /* OSIABSafariViewControllerRouterAdapter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OSIABSafariViewControllerRouterAdapter.swift; sourceTree = "<group>"; };
756346602C00F21000685AA3 /* OSIABApplicationRouterAdapter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OSIABApplicationRouterAdapter.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -213,7 +209,6 @@
isa = PBXGroup;
children = (
7575CF7E2BFCEEEA008F3FD0 /* Helper Files */,
756346492C00DE1300685AA3 /* OSIABApplicationRouterAdapterTests.swift */,
75EF1AFC2C1306B1005D7164 /* OSIABCacheManagerTests.swift */,
7575CF7D2BFCEEEA008F3FD0 /* OSIABEngineTests.swift */,
756346472C00DD4600685AA3 /* OSIABSafariViewControllerRouterAdapterTests.swift */,
Expand All @@ -227,7 +222,6 @@
isa = PBXGroup;
children = (
7575CF7F2BFCEEEA008F3FD0 /* OSIABRouterSpy.swift */,
756346452C00D6DD00685AA3 /* OSApplicationStub.swift */,
75094A062C121BD9006843E1 /* OSIABCacheManagerStub.swift */,
75EF1B002C134878005D7164 /* OSIABWebViewStub.swift */,
);
Expand Down Expand Up @@ -399,10 +393,8 @@
files = (
756346482C00DD4700685AA3 /* OSIABSafariViewControllerRouterAdapterTests.swift in Sources */,
75EF1AFB2C13069E005D7164 /* OSIABViewModelTests.swift in Sources */,
7563464A2C00DE1300685AA3 /* OSIABApplicationRouterAdapterTests.swift in Sources */,
7575CF812BFCEEEA008F3FD0 /* OSIABRouterSpy.swift in Sources */,
75094A072C121BD9006843E1 /* OSIABCacheManagerStub.swift in Sources */,
756346462C00D6DD00685AA3 /* OSApplicationStub.swift in Sources */,
75EF1AFD2C1306B1005D7164 /* OSIABCacheManagerTests.swift in Sources */,
7575CF802BFCEEEA008F3FD0 /* OSIABEngineTests.swift in Sources */,
75EF1B012C134878005D7164 /* OSIABWebViewStub.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,37 +1,14 @@
import UIKit

/// Protocol to be implemented by the objects that can handle opening URLs.
/// This is implemented by the `UIApplication` object that can be used as an External Browser.
public protocol OSIABApplicationDelegate: AnyObject {
func canOpenURL(_ url: URL) -> Bool
func open(_ url: URL, options: [UIApplication.OpenExternalURLOptionsKey: Any], completionHandler completion: ((Bool) -> Void)?)
}

/// Provide a default implementations that abstracts the options parameter.
extension OSIABApplicationDelegate {
public func open(_ url: URL, options: [UIApplication.OpenExternalURLOptionsKey: Any] = [:], completionHandler completion: ((Bool) -> Void)?) {
self.open(url, options: options, completionHandler: completion)
}
}

/// Make `UIApplication` conform to the `OSIABApplicationDelegate` protocol.
extension UIApplication: OSIABApplicationDelegate {}

/// Adapter that makes the required calls so that an `OSIABApplicationDelegate` implementation can perform the External Browser routing.
/// Adapter that makes the required calls so that can perform the External Browser routing.
public class OSIABApplicationRouterAdapter: OSIABRouter {
public typealias ReturnType = Bool

/// The object that will performing the URL opening.
private let application: OSIABApplicationDelegate


/// Constructor method.
/// - Parameter application: The object that will performing the URL opening.
public init(_ application: OSIABApplicationDelegate) {
self.application = application
}
public init() {}

public func handleOpen(_ url: URL, _ completionHandler: @escaping (ReturnType) -> Void) {
guard self.application.canOpenURL(url) else { return completionHandler(false) }
self.application.open(url, completionHandler: completionHandler)
guard UIApplication.shared.canOpenURL(url) else { return completionHandler(false) }
UIApplication.shared.open(url, completionHandler: completionHandler)
}
}
20 changes: 0 additions & 20 deletions OSInAppBrowserLibTests/Helper Files/OSApplicationStub.swift

This file was deleted.

27 changes: 0 additions & 27 deletions OSInAppBrowserLibTests/OSIABApplicationRouterAdapterTests.swift

This file was deleted.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func openExternalBrowser(_ url: URL, routerDelegate: ExternalBrowser, _ completi

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:
- **url**: the URL for the web page to be opened.
- **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.
- **routerDelegate**: The External Browser interface that will open the URL. Its return type should be `Bool`.
- **completionHandler**: The callback with the result of opening the URL with the External Browser interface.

### Open a URL in a System Browser
Expand All @@ -84,4 +84,4 @@ func openWebView(_ url: URL, routerDelegate: WebView, _ completionHandler: @esca
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:
- **url**: the URL for the web page to be opened.
- **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.
- **completionHandler**: The callback with the result of opening the URL with the Web View interface.
- **completionHandler**: The callback with the result of opening the URL with the Web View interface.
Loading