-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathOSIABRouterSpy.swift
More file actions
38 lines (29 loc) · 1.08 KB
/
OSIABRouterSpy.swift
File metadata and controls
38 lines (29 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import OSInAppBrowserLib
import UIKit
struct OSIABExternalRouterSpy: OSIABRouter {
private var shouldOpenSafari: Bool
init(shouldOpenSafari: Bool) {
self.shouldOpenSafari = shouldOpenSafari
}
func handleOpen(_ url: URL, _ completionHandler: @escaping (Bool) -> Void) {
completionHandler(shouldOpenSafari)
}
}
struct OSIABSystemRouterSpy: OSIABRouter {
private var shouldOpenSafariViewController: UIViewController
init(shouldOpen viewController: UIViewController) {
self.shouldOpenSafariViewController = viewController
}
func handleOpen(_ url: URL, _ completionHandler: @escaping (UIViewController) -> Void) {
completionHandler(shouldOpenSafariViewController)
}
}
struct OSIABWebViewRouterSpy: OSIABRouter {
private var shouldOpenView: UIViewController
init(shouldOpen viewController: UIViewController) {
self.shouldOpenView = viewController
}
func handleOpen(_ url: URL, _ completionHandler: @escaping (UIViewController) -> Void) {
completionHandler(shouldOpenView)
}
}