Merge pull request #2073 from rizwankce/open-in-safari-shortcut

Keyboard shortcuts for "Open in App Browser"
This commit is contained in:
Maurice Parker
2020-05-15 04:38:26 -05:00
committed by GitHub
7 changed files with 45 additions and 5 deletions

View File

@@ -256,6 +256,7 @@ class ArticleViewController: UIViewController {
}
// MARK: Keyboard Shortcuts
@objc func navigateToTimeline(_ sender: Any?) {
coordinator.navigateToTimeline()
}
@@ -277,7 +278,10 @@ class ArticleViewController: UIViewController {
func stopArticleExtractorIfProcessing() {
currentWebViewController?.stopArticleExtractorIfProcessing()
}
func openInAppBrowser() {
currentWebViewController?.openInAppBrowser()
}
}
// MARK: WebViewControllerDelegate

View File

@@ -227,7 +227,15 @@ class WebViewController: UIViewController {
activityViewController.popoverPresentationController?.barButtonItem = popOverBarButtonItem
present(activityViewController, animated: true)
}
func openInAppBrowser() {
guard let preferredLink = article?.preferredLink, let url = URL(string: preferredLink) else {
return
}
let vc = SFSafariViewController(url: url)
present(vc, animated: true)
}
}
// MARK: ArticleExtractorDelegate