mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Merge pull request #3467 from stuartbreckenridge/ios-ui
Aa as More Menu
This commit is contained in:
@@ -51,6 +51,7 @@ final class AppDefaults {
|
||||
static let timelineSortDirection = "timelineSortDirection"
|
||||
static let articleFullscreenAvailable = "articleFullscreenAvailable"
|
||||
static let articleFullscreenEnabled = "articleFullscreenEnabled"
|
||||
static let hasUsedFullScreenPreviously = "hasUsedFullScreenPreviously"
|
||||
static let confirmMarkAllAsRead = "confirmMarkAllAsRead"
|
||||
static let lastRefresh = "lastRefresh"
|
||||
static let addWebFeedAccountID = "addWebFeedAccountID"
|
||||
@@ -123,6 +124,15 @@ final class AppDefaults {
|
||||
}
|
||||
}
|
||||
|
||||
var hasUsedFullScreenPreviously: Bool {
|
||||
get {
|
||||
return UserDefaults.standard.bool(forKey: Key.hasUsedFullScreenPreviously)
|
||||
}
|
||||
set {
|
||||
UserDefaults.standard.set(newValue, forKey: Key.hasUsedFullScreenPreviously)
|
||||
}
|
||||
}
|
||||
|
||||
var useSystemBrowser: Bool {
|
||||
get {
|
||||
return UserDefaults.standard.bool(forKey: Key.useSystemBrowser)
|
||||
|
||||
@@ -265,9 +265,8 @@ class ArticleViewController: UIViewController, MainControllerIdentifiable {
|
||||
let customThemeMenu = UIMenu(title: "", image: nil, identifier: nil, options: .displayInline, children: themeActions)
|
||||
|
||||
let themeMenu = UIMenu(title: "Theme", image: AppAssets.themeImage, identifier: nil, options: .singleSelection, children: [ defaultThemeMenu, customThemeMenu])
|
||||
themeMenu.subtitle = NSLocalizedString("Change the look of articles.", comment: "Change theme")
|
||||
|
||||
var children: [UIMenuElement] = [themeMenu]
|
||||
var appearanceChildren: [UIMenuElement] = [themeMenu]
|
||||
|
||||
if let currentWebViewController = currentWebViewController {
|
||||
if currentWebViewController.isFullScreenAvailable {
|
||||
@@ -278,18 +277,66 @@ class ArticleViewController: UIViewController, MainControllerIdentifiable {
|
||||
attributes: [],
|
||||
state: .off) { [weak self] _ in
|
||||
self?.currentWebViewController?.hideBars()
|
||||
if AppDefaults.shared.hasUsedFullScreenPreviously == false {
|
||||
let alert = UIAlertController(title: NSLocalizedString("Exit Full Screen", comment: "Full Screen"),
|
||||
message: NSLocalizedString("To exit Full Screen mode tap the top of the screen.\n\nYou'll only see this message once.", comment: "Full screen explainer."),
|
||||
preferredStyle: .alert)
|
||||
alert.addAction(UIAlertAction(title: NSLocalizedString("Dismiss", comment: "Dismiss"), style: .default, handler: { _ in
|
||||
AppDefaults.shared.hasUsedFullScreenPreviously = true
|
||||
}))
|
||||
self?.present(alert, animated: true, completion: nil)
|
||||
}
|
||||
}
|
||||
fullScreenAction.subtitle = NSLocalizedString("Tap the top of the screen to exit Full Screen.", comment: "Exit criteria.")
|
||||
children.append(fullScreenAction)
|
||||
appearanceChildren.append(fullScreenAction)
|
||||
}
|
||||
}
|
||||
|
||||
let appearanceMenu = UIMenu(title: NSLocalizedString("Article Appearance", comment: "Appearance"), image: UIImage(systemName: "textformat.size") , identifier: nil, options: .displayInline, children: children)
|
||||
var feedManagementChildren = [UIMenuElement]()
|
||||
|
||||
appearanceBarButtonItem.menu = appearanceMenu
|
||||
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
|
||||
} else {
|
||||
feed.isArticleExtractorAlwaysOn?.toggle()
|
||||
}
|
||||
self?.configureAppearanceMenu()
|
||||
}
|
||||
feedManagementChildren.append(readerAction)
|
||||
|
||||
let notifyOn = feed.isNotifyAboutNewArticles ?? false
|
||||
let notifyAction = UIAction(title: NSLocalizedString("Notify About New Articles", comment: "Notify About New Articles"),
|
||||
image: AppAssets.appBadgeImage,
|
||||
identifier: nil,
|
||||
discoverabilityTitle: nil,
|
||||
attributes: [],
|
||||
state: notifyOn ? .on : .off) { [weak self] _ in
|
||||
if feed.isNotifyAboutNewArticles == nil {
|
||||
feed.isNotifyAboutNewArticles = true
|
||||
} else {
|
||||
feed.isNotifyAboutNewArticles?.toggle()
|
||||
}
|
||||
self?.configureAppearanceMenu()
|
||||
}
|
||||
feedManagementChildren.append(notifyAction)
|
||||
}
|
||||
|
||||
let appearanceMenu = UIMenu(title: NSLocalizedString("Article Appearance", comment: "Appearance"), image: nil, identifier: nil, options: .displayInline, children: appearanceChildren)
|
||||
let feedMgmtMenu = UIMenu(title: NSLocalizedString("Feed Management", comment: "Feed Management"), image: nil , identifier: nil, options: .displayInline, children: feedManagementChildren)
|
||||
|
||||
let menu = UIMenu(title: "", image: nil, identifier: nil, options: .displayInline, children: [appearanceMenu, feedMgmtMenu])
|
||||
|
||||
appearanceBarButtonItem.menu = menu
|
||||
|
||||
}
|
||||
|
||||
|
||||
@objc
|
||||
func reloadDueToThemeChange(_ notification: Notification) {
|
||||
currentWebViewController?.fullReload()
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<view hidden="YES" contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="h1Q-FS-jlg" customClass="ArticleSearchBar" customModule="NetNewsWire" customModuleProvider="target">
|
||||
<view hidden="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="h1Q-FS-jlg" customClass="ArticleSearchBar" customModule="NetNewsWire" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="782" width="414" height="31"/>
|
||||
<color key="backgroundColor" name="barBackgroundColor"/>
|
||||
</view>
|
||||
@@ -90,7 +90,7 @@
|
||||
<action selector="prevArticle:" destination="JEX-9P-axG" id="cMZ-tk-I4W"/>
|
||||
</connections>
|
||||
</barButtonItem>
|
||||
<barButtonItem image="textformat.size" catalog="system" id="SoN-ax-tEE">
|
||||
<barButtonItem image="ellipsis.circle" catalog="system" id="SoN-ax-tEE">
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="accLabelText" value="Appearance"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
@@ -420,6 +420,7 @@
|
||||
<image name="chevron.down.circle" catalog="system" width="128" height="121"/>
|
||||
<image name="chevron.up" catalog="system" width="128" height="72"/>
|
||||
<image name="circle" catalog="system" width="128" height="121"/>
|
||||
<image name="ellipsis.circle" catalog="system" width="128" height="121"/>
|
||||
<image name="gear" catalog="system" width="128" height="119"/>
|
||||
<image name="line.3.horizontal.decrease.circle" catalog="system" width="128" height="121"/>
|
||||
<image name="markAllAsRead" width="13" height="20"/>
|
||||
@@ -427,7 +428,6 @@
|
||||
<image name="square.and.arrow.up" catalog="system" width="115" height="128"/>
|
||||
<image name="square.and.arrow.up.fill" catalog="system" width="115" height="128"/>
|
||||
<image name="star" catalog="system" width="128" height="116"/>
|
||||
<image name="textformat.size" catalog="system" width="128" height="80"/>
|
||||
<namedColor name="barBackgroundColor">
|
||||
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</namedColor>
|
||||
|
||||
Reference in New Issue
Block a user