Feature: make Reader use center window
This commit is contained in:
@@ -299,13 +299,26 @@ class BrowserViewController: UIViewController
|
||||
DispatchQueue.main.async {
|
||||
documentControls.dismiss(animated: true, completion: nil)
|
||||
|
||||
let readableViewController = ReaderViewController(readableHTMLString: string, baseURL: self.tab.bridge.webView.url)
|
||||
readableViewController.title = self.tab.bridge.webView.title
|
||||
readableViewController.darkModeEnabled = self.tab.bridge.darkModeEnabled
|
||||
readableViewController.delegate = self
|
||||
if self.traitCollection.userInterfaceIdiom == .phone {
|
||||
let readableViewController = ReaderViewController(readableHTMLString: string, baseURL: self.tab.bridge.webView.url)
|
||||
readableViewController.title = self.tab.bridge.webView.title
|
||||
readableViewController.darkModeEnabled = self.tab.bridge.darkModeEnabled
|
||||
readableViewController.delegate = self
|
||||
|
||||
let navigationController = UINavigationController(rootViewController: readableViewController)
|
||||
self.present(navigationController, animated: true, completion: nil)
|
||||
} else {
|
||||
let userActivity = NSUserActivity(activityType: SessionActivityType.ReaderWindow.rawValue)
|
||||
userActivity.title = self.tab.title
|
||||
userActivity.userInfo = [
|
||||
ReaderUserActivityKeys.baseURL.rawValue : self.tab.bridge.webView.url ?? NSNull(),
|
||||
ReaderUserActivityKeys.htmlString.rawValue : string,
|
||||
]
|
||||
let requestOptions = UIWindowScene.ActivationRequestOptions()
|
||||
requestOptions.preferredPresentationStyle = .prominent
|
||||
UIApplication.shared.requestSceneSessionActivation(nil, userActivity: userActivity, options: requestOptions)
|
||||
}
|
||||
|
||||
let navigationController = UINavigationController(rootViewController: readableViewController)
|
||||
self.present(navigationController, animated: true, completion: nil)
|
||||
}
|
||||
}
|
||||
}, for: .touchUpInside)
|
||||
|
||||
Reference in New Issue
Block a user