mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2025-02-02 12:06:58 +01:00
adds add item context menu for iOS 14
This commit is contained in:
parent
55a9004a81
commit
7c4e93e1c4
@ -1,9 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="17506" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="17701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
||||
<device id="retina6_1" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17505"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17703"/>
|
||||
<capability name="Named colors" minToolsVersion="9.0"/>
|
||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||
<capability name="System colors in document resources" minToolsVersion="11.0"/>
|
||||
@ -196,9 +196,6 @@
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="accLabelText" value="Add Item"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
<connections>
|
||||
<action selector="add:" destination="7bK-jq-Zjz" id="d1n-0d-2gR"/>
|
||||
</connections>
|
||||
</barButtonItem>
|
||||
</toolbarItems>
|
||||
<navigationItem key="navigationItem" title="Feeds" id="Zdf-7t-Un8">
|
||||
@ -332,7 +329,7 @@
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Article Title" textAlignment="natural" lineBreakMode="wordWrap" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="iFp-rn-HhQ">
|
||||
<rect key="frame" x="20" y="74.5" width="136" height="33.5"/>
|
||||
<rect key="frame" x="20" y="74.5" width="135.5" height="33.5"/>
|
||||
<fontDescription key="fontDescription" style="UICTFontTextStyleTitle1"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
|
@ -17,7 +17,15 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner {
|
||||
|
||||
@IBOutlet weak var filterButton: UIBarButtonItem!
|
||||
private var refreshProgressView: RefreshProgressView?
|
||||
@IBOutlet weak var addNewItemButton: UIBarButtonItem!
|
||||
@IBOutlet weak var addNewItemButton: UIBarButtonItem! {
|
||||
didSet {
|
||||
if #available(iOS 14, *) {
|
||||
addNewItemButton.primaryAction = nil
|
||||
} else {
|
||||
addNewItemButton.action = #selector(MasterFeedViewController.add(_:))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private let operationQueue = MainThreadOperationQueue()
|
||||
lazy var dataSource = makeDataSource()
|
||||
@ -394,49 +402,56 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner {
|
||||
}
|
||||
|
||||
@IBAction func add(_ sender: UIBarButtonItem) {
|
||||
let title = NSLocalizedString("Add Item", comment: "Add Item")
|
||||
let alertController = UIAlertController(title: title, message: nil, preferredStyle: .actionSheet)
|
||||
|
||||
let cancelTitle = NSLocalizedString("Cancel", comment: "Cancel")
|
||||
let cancelAction = UIAlertAction(title: cancelTitle, style: .cancel)
|
||||
|
||||
let addWebFeedActionTitle = NSLocalizedString("Add Web Feed", comment: "Add Web Feed")
|
||||
let addWebFeedAction = UIAlertAction(title: addWebFeedActionTitle, style: .default) { _ in
|
||||
self.coordinator.showAddWebFeed()
|
||||
}
|
||||
|
||||
let addRedditFeedActionTitle = NSLocalizedString("Add Reddit Feed", comment: "Add Reddit Feed")
|
||||
let addRedditFeedAction = UIAlertAction(title: addRedditFeedActionTitle, style: .default) { _ in
|
||||
self.coordinator.showAddRedditFeed()
|
||||
}
|
||||
|
||||
let addTwitterFeedActionTitle = NSLocalizedString("Add Twitter Feed", comment: "Add Twitter Feed")
|
||||
let addTwitterFeedAction = UIAlertAction(title: addTwitterFeedActionTitle, style: .default) { _ in
|
||||
self.coordinator.showAddTwitterFeed()
|
||||
}
|
||||
|
||||
let addWebFolderdActionTitle = NSLocalizedString("Add Folder", comment: "Add Folder")
|
||||
let addWebFolderAction = UIAlertAction(title: addWebFolderdActionTitle, style: .default) { _ in
|
||||
self.coordinator.showAddFolder()
|
||||
}
|
||||
|
||||
alertController.addAction(addWebFeedAction)
|
||||
|
||||
if AccountManager.shared.activeAccounts.contains(where: { $0.type == .onMyMac || $0.type == .cloudKit }) {
|
||||
if ExtensionPointManager.shared.isRedditEnabled {
|
||||
alertController.addAction(addRedditFeedAction)
|
||||
if #available(iOS 14, *) {
|
||||
|
||||
} else {
|
||||
let title = NSLocalizedString("Add Item", comment: "Add Item")
|
||||
let alertController = UIAlertController(title: title, message: nil, preferredStyle: .actionSheet)
|
||||
|
||||
let cancelTitle = NSLocalizedString("Cancel", comment: "Cancel")
|
||||
let cancelAction = UIAlertAction(title: cancelTitle, style: .cancel)
|
||||
|
||||
let addWebFeedActionTitle = NSLocalizedString("Add Web Feed", comment: "Add Web Feed")
|
||||
let addWebFeedAction = UIAlertAction(title: addWebFeedActionTitle, style: .default) { _ in
|
||||
self.coordinator.showAddWebFeed()
|
||||
}
|
||||
if ExtensionPointManager.shared.isTwitterEnabled {
|
||||
alertController.addAction(addTwitterFeedAction)
|
||||
|
||||
let addRedditFeedActionTitle = NSLocalizedString("Add Reddit Feed", comment: "Add Reddit Feed")
|
||||
let addRedditFeedAction = UIAlertAction(title: addRedditFeedActionTitle, style: .default) { _ in
|
||||
self.coordinator.showAddRedditFeed()
|
||||
}
|
||||
}
|
||||
|
||||
alertController.addAction(addWebFolderAction)
|
||||
alertController.addAction(cancelAction)
|
||||
|
||||
alertController.popoverPresentationController?.barButtonItem = sender
|
||||
|
||||
let addTwitterFeedActionTitle = NSLocalizedString("Add Twitter Feed", comment: "Add Twitter Feed")
|
||||
let addTwitterFeedAction = UIAlertAction(title: addTwitterFeedActionTitle, style: .default) { _ in
|
||||
self.coordinator.showAddTwitterFeed()
|
||||
}
|
||||
|
||||
let addWebFolderdActionTitle = NSLocalizedString("Add Folder", comment: "Add Folder")
|
||||
let addWebFolderAction = UIAlertAction(title: addWebFolderdActionTitle, style: .default) { _ in
|
||||
self.coordinator.showAddFolder()
|
||||
}
|
||||
|
||||
alertController.addAction(addWebFeedAction)
|
||||
|
||||
if AccountManager.shared.activeAccounts.contains(where: { $0.type == .onMyMac || $0.type == .cloudKit }) {
|
||||
if ExtensionPointManager.shared.isRedditEnabled {
|
||||
alertController.addAction(addRedditFeedAction)
|
||||
}
|
||||
if ExtensionPointManager.shared.isTwitterEnabled {
|
||||
alertController.addAction(addTwitterFeedAction)
|
||||
}
|
||||
}
|
||||
|
||||
alertController.addAction(addWebFolderAction)
|
||||
alertController.addAction(cancelAction)
|
||||
|
||||
alertController.popoverPresentationController?.barButtonItem = sender
|
||||
|
||||
present(alertController, animated: true)
|
||||
present(alertController, animated: true)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@objc func toggleSectionHeader(_ sender: UITapGestureRecognizer) {
|
||||
@ -566,6 +581,48 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner {
|
||||
}
|
||||
refreshProgressView?.update()
|
||||
addNewItemButton?.isEnabled = !AccountManager.shared.activeAccounts.isEmpty
|
||||
|
||||
|
||||
if #available(iOS 14.0, *) {
|
||||
let addWebFeedActionTitle = NSLocalizedString("Add Web Feed", comment: "Add Web Feed")
|
||||
let addWebFeedAction = UIAction(title: addWebFeedActionTitle, image: UIImage(named: "faviconTemplateImage")?.withRenderingMode(.alwaysOriginal).withTintColor(.gray)) { _ in
|
||||
self.coordinator.showAddWebFeed()
|
||||
}
|
||||
|
||||
let addRedditFeedActionTitle = NSLocalizedString("Add Reddit Feed", comment: "Add Reddit Feed")
|
||||
let redditImage = UIImage(named: "redditWhite")?.withRenderingMode(.alwaysOriginal).withTintColor(.gray)
|
||||
let addRedditFeedAction = UIAction(title: addRedditFeedActionTitle, image: redditImage) { _ in
|
||||
self.coordinator.showAddRedditFeed()
|
||||
}
|
||||
|
||||
let addTwitterFeedActionTitle = NSLocalizedString("Add Twitter Feed", comment: "Add Twitter Feed")
|
||||
let addTwitterFeedAction = UIAction(title: addTwitterFeedActionTitle, image: UIImage(named: "twitterWhite")?.withRenderingMode(.alwaysOriginal).withTintColor(.gray)) { _ in
|
||||
self.coordinator.showAddTwitterFeed()
|
||||
}
|
||||
|
||||
let addWebFolderdActionTitle = NSLocalizedString("Add Folder", comment: "Add Folder")
|
||||
let folderImage = UIImage(systemName: "folder.badge.plus",
|
||||
withConfiguration: UIImage.SymbolConfiguration(pointSize: 16, weight: .black))?.withRenderingMode(.alwaysOriginal).withTintColor(.gray)
|
||||
let addWebFolderAction = UIAction(title: addWebFolderdActionTitle, image: folderImage) { _ in
|
||||
self.coordinator.showAddFolder()
|
||||
}
|
||||
|
||||
var children = [addWebFolderAction, addWebFeedAction]
|
||||
|
||||
|
||||
if AccountManager.shared.activeAccounts.contains(where: { $0.type == .onMyMac || $0.type == .cloudKit }) {
|
||||
if !ExtensionPointManager.shared.isRedditEnabled {
|
||||
children.insert(addRedditFeedAction, at: 0)
|
||||
}
|
||||
if !ExtensionPointManager.shared.isTwitterEnabled {
|
||||
children.insert(addTwitterFeedAction, at: 0)
|
||||
}
|
||||
}
|
||||
let menu = UIMenu(title: "Add Item", image: nil, identifier: nil, options: [], children: children)
|
||||
|
||||
self.addNewItemButton.menu = menu
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func focus() {
|
||||
|
12
iOS/Resources/Assets.xcassets/redditWhite.imageset/Contents.json
vendored
Normal file
12
iOS/Resources/Assets.xcassets/redditWhite.imageset/Contents.json
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "redditWhite.pdf",
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
BIN
iOS/Resources/Assets.xcassets/redditWhite.imageset/redditWhite.pdf
vendored
Normal file
BIN
iOS/Resources/Assets.xcassets/redditWhite.imageset/redditWhite.pdf
vendored
Normal file
Binary file not shown.
12
iOS/Resources/Assets.xcassets/twitterWhite.imageset/Contents.json
vendored
Normal file
12
iOS/Resources/Assets.xcassets/twitterWhite.imageset/Contents.json
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "twitter_white.png",
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
BIN
iOS/Resources/Assets.xcassets/twitterWhite.imageset/twitter_white.png
vendored
Normal file
BIN
iOS/Resources/Assets.xcassets/twitterWhite.imageset/twitter_white.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.9 KiB |
Loading…
x
Reference in New Issue
Block a user