Adds history browser view
This commit is contained in:
@@ -156,6 +156,10 @@ extension BrowserViewController: ShortcutResponder
|
||||
showSettingsWindow()
|
||||
}
|
||||
|
||||
func showHistory(_ sender: Any?) {
|
||||
showHistoryWindow()
|
||||
}
|
||||
|
||||
func toggleDarkMode(_ sender: Any?) {
|
||||
self.darkModeEnabled = !self.darkModeEnabled
|
||||
}
|
||||
@@ -163,4 +167,14 @@ extension BrowserViewController: ShortcutResponder
|
||||
func openInReaderMode(_ sender: Any?) {
|
||||
showReaderWindow()
|
||||
}
|
||||
|
||||
func handleOpenURL(_ sender: Any?, url: URL?) {
|
||||
guard let url else { return }
|
||||
|
||||
if tab.url == nil {
|
||||
tab.beginLoadingURL(url)
|
||||
} else {
|
||||
createNewTab(withURL: url)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -333,6 +333,12 @@ class BrowserViewController: UIViewController
|
||||
showShareSheetForCurrentURL(fromViewController: documentControls)
|
||||
}, for: .touchUpInside)
|
||||
|
||||
// History
|
||||
documentControls.historyView.addAction(UIAction { [unowned self] action in
|
||||
documentControls.dismiss(animated: false, completion: nil)
|
||||
showHistory(action)
|
||||
}, for: .touchUpInside)
|
||||
|
||||
present(documentControls, animated: true, completion: nil)
|
||||
}), for: .touchUpInside)
|
||||
|
||||
@@ -463,6 +469,17 @@ class BrowserViewController: UIViewController
|
||||
}
|
||||
}
|
||||
|
||||
internal func showHistoryWindow() {
|
||||
let historyViewController = HistoryBrowserViewController()
|
||||
historyViewController.title = "History"
|
||||
historyViewController.navigationItem.rightBarButtonItem = UIBarButtonItem(systemItem: .done, primaryAction: UIAction { _ in
|
||||
historyViewController.dismiss(animated: true)
|
||||
})
|
||||
|
||||
let navigationController = UINavigationController(rootViewController: historyViewController)
|
||||
present(navigationController, animated: true)
|
||||
}
|
||||
|
||||
internal func updateLoadProgress(forWebView webView: WKWebView) {
|
||||
if let loadError = tab.loadError {
|
||||
toolbarController.urlBar.loadProgress = .error(error: loadError)
|
||||
|
||||
Reference in New Issue
Block a user