mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Adds long press menu to article extractor button
This commit is contained in:
@@ -234,6 +234,7 @@ class ArticleViewController: UIViewController, MainControllerIdentifiable {
|
||||
}
|
||||
|
||||
configureAppearanceMenu()
|
||||
configureArticleExtractorMenu()
|
||||
|
||||
}
|
||||
|
||||
@@ -311,6 +312,29 @@ class ArticleViewController: UIViewController, MainControllerIdentifiable {
|
||||
appearanceBarButtonItem.menu = menu
|
||||
}
|
||||
|
||||
private func configureArticleExtractorMenu() {
|
||||
if let feed = article?.webFeed {
|
||||
let extractorOn = feed.isArticleExtractorAlwaysOn ?? false
|
||||
let readerAction = UIAction(title: NSLocalizedString("Always Use Reader View", comment: "Always Use Reader View"),
|
||||
image: AppAssets.articleExtractorOffSF,
|
||||
identifier: nil,
|
||||
discoverabilityTitle: nil,
|
||||
attributes: [],
|
||||
state: extractorOn ? .on : .off) { [weak self] _ in
|
||||
if feed.isArticleExtractorAlwaysOn == nil {
|
||||
feed.isArticleExtractorAlwaysOn = true
|
||||
self?.currentWebViewController?.toggleArticleExtractor()
|
||||
} else {
|
||||
feed.isArticleExtractorAlwaysOn?.toggle()
|
||||
}
|
||||
self?.configureArticleExtractorMenu()
|
||||
}
|
||||
let menu = UIMenu(title: feed.nameForDisplay, image: AppAssets.articleExtractorOffSF, identifier: nil, options: .displayInline, children: [readerAction])
|
||||
articleExtractorButton.menu = menu
|
||||
articleExtractorButton.showsMenuAsPrimaryAction = false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@objc
|
||||
func reloadDueToThemeChange(_ notification: Notification) {
|
||||
|
||||
Reference in New Issue
Block a user