commit
e6e77c10f3
|
@ -106,11 +106,11 @@
|
||||||
</dict>
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
<key>title</key>
|
<key>title</key>
|
||||||
<string>Open in Browser</string>
|
<string>Open in App Browser</string>
|
||||||
<key>key</key>
|
<key>key</key>
|
||||||
<string>[return]</string>
|
<string>[return]</string>
|
||||||
<key>action</key>
|
<key>action</key>
|
||||||
<string>openInBrowser:</string>
|
<string>openFeedInAppBrowser:</string>
|
||||||
</dict>
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
<key>key</key>
|
<key>key</key>
|
||||||
|
|
|
@ -47,14 +47,20 @@ private extension UserNotificationManager {
|
||||||
let content = UNMutableNotificationContent()
|
let content = UNMutableNotificationContent()
|
||||||
|
|
||||||
content.title = webFeed.nameForDisplay
|
content.title = webFeed.nameForDisplay
|
||||||
content.body = ArticleStringFormatter.truncatedTitle(article)
|
|
||||||
if content.body.isEmpty {
|
if !ArticleStringFormatter.truncatedTitle(article).isEmpty {
|
||||||
content.body = ArticleStringFormatter.truncatedSummary(article)
|
content.subtitle = ArticleStringFormatter.truncatedTitle(article)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
content.body = ArticleStringFormatter.truncatedSummary(article)
|
||||||
|
|
||||||
|
content.threadIdentifier = webFeed.webFeedID
|
||||||
|
content.summaryArgument = "\(webFeed.nameForDisplay)"
|
||||||
|
content.summaryArgumentCount = 1
|
||||||
|
|
||||||
content.sound = UNNotificationSound.default
|
content.sound = UNNotificationSound.default
|
||||||
content.userInfo = [UserInfoKey.articlePath: article.pathUserInfo]
|
content.userInfo = [UserInfoKey.articlePath: article.pathUserInfo]
|
||||||
|
|
||||||
let request = UNNotificationRequest.init(identifier: "articleID:\(article.articleID)", content: content, trigger: nil)
|
let request = UNNotificationRequest.init(identifier: "articleID:\(article.articleID)", content: content, trigger: nil)
|
||||||
UNUserNotificationCenter.current().add(request)
|
UNUserNotificationCenter.current().add(request)
|
||||||
}
|
}
|
||||||
|
|
|
@ -256,6 +256,7 @@ class ArticleViewController: UIViewController {
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: Keyboard Shortcuts
|
// MARK: Keyboard Shortcuts
|
||||||
|
|
||||||
@objc func navigateToTimeline(_ sender: Any?) {
|
@objc func navigateToTimeline(_ sender: Any?) {
|
||||||
coordinator.navigateToTimeline()
|
coordinator.navigateToTimeline()
|
||||||
}
|
}
|
||||||
|
@ -277,7 +278,10 @@ class ArticleViewController: UIViewController {
|
||||||
func stopArticleExtractorIfProcessing() {
|
func stopArticleExtractorIfProcessing() {
|
||||||
currentWebViewController?.stopArticleExtractorIfProcessing()
|
currentWebViewController?.stopArticleExtractorIfProcessing()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func openInAppBrowser() {
|
||||||
|
currentWebViewController?.openInAppBrowser()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: WebViewControllerDelegate
|
// MARK: WebViewControllerDelegate
|
||||||
|
|
|
@ -60,7 +60,7 @@ class WebViewController: UIViewController {
|
||||||
|
|
||||||
private(set) var article: Article?
|
private(set) var article: Article?
|
||||||
|
|
||||||
let scrollPositionQueue = CoalescingQueue(name: "Article Scroll Position", interval: 0.3, maxInterval: 1.0)
|
let scrollPositionQueue = CoalescingQueue(name: "Article Scroll Position", interval: 0.3, maxInterval: 0.3)
|
||||||
var windowScrollY = 0
|
var windowScrollY = 0
|
||||||
|
|
||||||
override func viewDidLoad() {
|
override func viewDidLoad() {
|
||||||
|
@ -227,7 +227,15 @@ class WebViewController: UIViewController {
|
||||||
activityViewController.popoverPresentationController?.barButtonItem = popOverBarButtonItem
|
activityViewController.popoverPresentationController?.barButtonItem = popOverBarButtonItem
|
||||||
present(activityViewController, animated: true)
|
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
|
// MARK: ArticleExtractorDelegate
|
||||||
|
@ -291,7 +299,7 @@ extension WebViewController: UIContextMenuInteractionDelegate {
|
||||||
extension WebViewController: WKNavigationDelegate {
|
extension WebViewController: WKNavigationDelegate {
|
||||||
|
|
||||||
func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
|
func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
|
||||||
if view.subviews.count > 1 {
|
while view.subviews.count > 1 {
|
||||||
view.subviews.last?.removeFromSuperview()
|
view.subviews.last?.removeFromSuperview()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -177,6 +177,9 @@ private extension KeyboardManager {
|
||||||
let openInBrowserTitle = NSLocalizedString("Open In Browser", comment: "Open In Browser")
|
let openInBrowserTitle = NSLocalizedString("Open In Browser", comment: "Open In Browser")
|
||||||
keys.append(KeyboardManager.createKeyCommand(title: openInBrowserTitle, action: "openInBrowser:", input: UIKeyCommand.inputRightArrow, modifiers: [.command]))
|
keys.append(KeyboardManager.createKeyCommand(title: openInBrowserTitle, action: "openInBrowser:", input: UIKeyCommand.inputRightArrow, modifiers: [.command]))
|
||||||
|
|
||||||
|
let openInAppBrowserTitle = NSLocalizedString("Open In App Browser", comment: "Open In App Browser")
|
||||||
|
keys.append(KeyboardManager.createKeyCommand(title: openInAppBrowserTitle, action: "openInAppBrowser:", input: "\r", modifiers: []))
|
||||||
|
|
||||||
let toggleReadTitle = NSLocalizedString("Toggle Read Status", comment: "Toggle Read Status")
|
let toggleReadTitle = NSLocalizedString("Toggle Read Status", comment: "Toggle Read Status")
|
||||||
keys.append(KeyboardManager.createKeyCommand(title: toggleReadTitle, action: "toggleRead:", input: "u", modifiers: [.command, .shift]))
|
keys.append(KeyboardManager.createKeyCommand(title: toggleReadTitle, action: "toggleRead:", input: "u", modifiers: [.command, .shift]))
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@ import Account
|
||||||
import Articles
|
import Articles
|
||||||
import RSCore
|
import RSCore
|
||||||
import RSTree
|
import RSTree
|
||||||
|
import SafariServices
|
||||||
|
|
||||||
class MasterFeedViewController: UITableViewController, UndoableCommandRunner {
|
class MasterFeedViewController: UITableViewController, UndoableCommandRunner {
|
||||||
|
|
||||||
|
@ -514,7 +515,14 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner {
|
||||||
func focus() {
|
func focus() {
|
||||||
becomeFirstResponder()
|
becomeFirstResponder()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func openInAppBrowser() {
|
||||||
|
if let indexPath = coordinator.currentFeedIndexPath,
|
||||||
|
let url = coordinator.homePageURLForFeed(indexPath) {
|
||||||
|
let vc = SFSafariViewController(url: url)
|
||||||
|
present(vc, animated: true)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: UIContextMenuInteractionDelegate
|
// MARK: UIContextMenuInteractionDelegate
|
||||||
|
|
|
@ -81,6 +81,14 @@ class RootSplitViewController: UISplitViewController {
|
||||||
@objc func openInBrowser(_ sender: Any?) {
|
@objc func openInBrowser(_ sender: Any?) {
|
||||||
coordinator.showBrowserForCurrentArticle()
|
coordinator.showBrowserForCurrentArticle()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@objc func openInAppBrowser(_ sender: Any?) {
|
||||||
|
coordinator.showInAppBrowserForCurrentArticle()
|
||||||
|
}
|
||||||
|
|
||||||
|
@objc func openFeedInAppBrowser(_ sender: Any?) {
|
||||||
|
coordinator.showInAppBrowserForCurrentFeed()
|
||||||
|
}
|
||||||
|
|
||||||
@objc func articleSearch(_ sender: Any?) {
|
@objc func articleSearch(_ sender: Any?) {
|
||||||
coordinator.showSearch()
|
coordinator.showSearch()
|
||||||
|
|
|
@ -12,6 +12,7 @@ import Account
|
||||||
import Articles
|
import Articles
|
||||||
import RSCore
|
import RSCore
|
||||||
import RSTree
|
import RSTree
|
||||||
|
import SafariServices
|
||||||
|
|
||||||
enum PanelMode {
|
enum PanelMode {
|
||||||
case unset
|
case unset
|
||||||
|
@ -749,7 +750,7 @@ class SceneCoordinator: NSObject, UndoableCommandRunner, UnreadCountProvider {
|
||||||
|
|
||||||
setTimelineFeed(nil, animated: false) {
|
setTimelineFeed(nil, animated: false) {
|
||||||
if self.isReadFeedsFiltered {
|
if self.isReadFeedsFiltered {
|
||||||
self.queueRebuildBackingStores()
|
self.rebuildBackingStores()
|
||||||
}
|
}
|
||||||
self.activityManager.invalidateSelecting()
|
self.activityManager.invalidateSelecting()
|
||||||
if self.rootSplitViewController.isCollapsed && self.navControllerForTimeline().viewControllers.last is MasterTimelineViewController {
|
if self.rootSplitViewController.isCollapsed && self.navControllerForTimeline().viewControllers.last is MasterTimelineViewController {
|
||||||
|
@ -1183,6 +1184,14 @@ class SceneCoordinator: NSObject, UndoableCommandRunner, UnreadCountProvider {
|
||||||
}
|
}
|
||||||
UIApplication.shared.open(url, options: [:])
|
UIApplication.shared.open(url, options: [:])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func showInAppBrowserForCurrentArticle() {
|
||||||
|
articleViewController?.openInAppBrowser()
|
||||||
|
}
|
||||||
|
|
||||||
|
func showInAppBrowserForCurrentFeed() {
|
||||||
|
masterFeedViewController.openInAppBrowser()
|
||||||
|
}
|
||||||
|
|
||||||
func navigateToFeeds() {
|
func navigateToFeeds() {
|
||||||
masterFeedViewController?.focus()
|
masterFeedViewController?.focus()
|
||||||
|
|
Loading…
Reference in New Issue