forked from aeharding/voyager
-
Notifications
You must be signed in to change notification settings - Fork 0
46 lines (45 loc) · 2.69 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
39
40
41
42
43
44
45
46
diff --git a/dist/esm/definitions.d.ts b/dist/esm/definitions.d.ts
index e554f0d9d3f90722ab434ac58f05fe020f27e67d..6f052077acbb889861c8548620de5662b34af616 100644
--- a/dist/esm/definitions.d.ts
+++ b/dist/esm/definitions.d.ts
@@ -88,6 +88,7 @@ export interface OpenOptions {
* @since 4.0.0
*/
height?: number;
+ entersReaderIfAvailable?: boolean;
}
/**
* @deprecated Use `OpenOptions`.
diff --git a/ios/Sources/BrowserPlugin/Browser.swift b/ios/Sources/BrowserPlugin/Browser.swift
index 3f1d1ade3e05d142a2295b354228d0a21ba0a01f..225101acfe73c068705fb18074460d8bd3c815a8 100644
--- a/ios/Sources/BrowserPlugin/Browser.swift
+++ b/ios/Sources/BrowserPlugin/Browser.swift
@@ -15,9 +15,12 @@ import SafariServices
return safariViewController
}
- @objc public func prepare(for url: URL, withTint tint: UIColor? = nil, modalPresentation style: UIModalPresentationStyle = .fullScreen) -> Bool {
+ @objc public func prepare(for url: URL, withTint tint: UIColor? = nil, modalPresentation style: UIModalPresentationStyle = .fullScreen, entersReaderIfAvailable: Bool = false) -> Bool {
if safariViewController == nil, let scheme = url.scheme?.lowercased(), ["http", "https"].contains(scheme) {
- let safariVC = SFSafariViewController(url: url)
+ let config = SFSafariViewController.Configuration()
+ config.entersReaderIfAvailable = entersReaderIfAvailable
+
+ let safariVC = SFSafariViewController(url: url, configuration: config)
safariVC.delegate = self
if let color = tint {
safariVC.preferredBarTintColor = color
diff --git a/ios/Sources/BrowserPlugin/BrowserPlugin.swift b/ios/Sources/BrowserPlugin/BrowserPlugin.swift
index 83f3ec5d0eab17f82e82d7f6ff07c8c50a5856c0..ae31df607cc96589ed9de959d6d926174ed24a5d 100644
--- a/ios/Sources/BrowserPlugin/BrowserPlugin.swift
+++ b/ios/Sources/BrowserPlugin/BrowserPlugin.swift
@@ -23,8 +23,9 @@ public class CAPBrowserPlugin: CAPPlugin, CAPBridgedPlugin {
color = UIColor.capacitor.color(fromHex: toolbarColor)
}
let style = self.presentationStyle(for: call.getString("presentationStyle"))
+ let entersReaderIfAvailable = call.getBool("entersReaderIfAvailable") ?? false
// prepare for display
- guard implementation.prepare(for: url, withTint: color, modalPresentation: style), let viewController = implementation.viewController else {
+ guard implementation.prepare(for: url, withTint: color, modalPresentation: style, entersReaderIfAvailable: entersReaderIfAvailable), let viewController = implementation.viewController else {
call.reject("Unable to display URL")
return
}