diff --git a/Mac/About/AboutWindowController.swift b/Mac/About/AboutWindowController.swift
new file mode 100644
index 000000000..64a4a61cc
--- /dev/null
+++ b/Mac/About/AboutWindowController.swift
@@ -0,0 +1,78 @@
+//
+// AboutWindowController.swift
+// NetNewsWire
+//
+// Created by Stuart Breckenridge on 26/06/2025.
+// Copyright © 2025 Ranchero Software. All rights reserved.
+//
+
+import Cocoa
+
+class AboutWindowController: NSWindowController {
+
+ @IBOutlet weak var appIconImageView: NSImageView!
+ @IBOutlet weak var appTitleLabel: NSTextField!
+ @IBOutlet weak var versionLabel: NSTextField!
+ @IBOutlet weak var copyrightLabel: NSTextField!
+ @IBOutlet weak var websiteLabel: LinkLabel!
+ @IBOutlet weak var creditsTextView: NSTextView!
+
+ override func windowDidLoad() {
+ super.windowDidLoad()
+ configureWindow()
+ updateUI()
+ }
+
+ func configureWindow() {
+ window?.isOpaque = false
+ window?.backgroundColor = .clear
+ window?.titlebarAppearsTransparent = true
+ window?.titleVisibility = .hidden
+ window?.styleMask.insert(.fullSizeContentView)
+ if let contentView = window?.contentView {
+ let visualEffectView = NSGlassEffectView(frame: contentView.bounds)
+ visualEffectView.tintColor = .clear
+ visualEffectView.autoresizingMask = [.width, .height]
+ contentView.addSubview(visualEffectView, positioned: .below, relativeTo: nil)
+ }
+ }
+
+ private func updateUI() {
+
+ // App Icon
+ appIconImageView.image = NSApp.applicationIconImage
+
+ // Version
+ let version = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? "Unknown"
+ let build = Bundle.main.infoDictionary?["CFBundleVersion"] as? String ?? "Unknown"
+ let versionString = "Version \(version) (Build \(build))"
+ versionLabel.stringValue = versionString
+
+ // Copyright
+ let copyright = Bundle.main.infoDictionary?["NSHumanReadableCopyright"] as? String ?? "Copyright © 2002-2025 Brent Simmons. All rights reserved."
+ copyrightLabel.stringValue = copyright
+
+ // Credits
+ if let creditsURL = Bundle.main.url(forResource: "Credits", withExtension: "rtf"),
+ let creditsData = try? Data(contentsOf: creditsURL),
+ let attributedString = try? NSAttributedString(data: creditsData, options: [.documentType: NSAttributedString.DocumentType.rtf], documentAttributes: nil) {
+ creditsTextView.textStorage?.setAttributedString(attributedString)
+ } else {
+ creditsTextView.string = "Credits not available."
+ }
+
+ let fullRange = NSRange(location: 0, length: creditsTextView.string.utf16.count)
+ let leadingParagraphStyle = NSMutableParagraphStyle()
+ leadingParagraphStyle.alignment = .left
+ creditsTextView.textStorage?.addAttribute(.paragraphStyle, value: leadingParagraphStyle, range: fullRange)
+
+ // URL
+ let url = URL(string: "https://inessential.com")!
+ let attributedString = NSMutableAttributedString(string: "inessential.com")
+ attributedString.addAttribute(.link, value: url, range: NSRange(location: 0, length: attributedString.length))
+ attributedString.addAttribute(.foregroundColor, value: NSColor.systemBlue, range: NSRange(location: 0, length: attributedString.length))
+ attributedString.addAttribute(.underlineStyle, value: NSUnderlineStyle.single.rawValue, range: NSRange(location: 0, length: attributedString.length))
+ websiteLabel.attributedStringValue = attributedString
+ }
+
+}
diff --git a/Mac/About/AboutWindowController.xib b/Mac/About/AboutWindowController.xib
new file mode 100644
index 000000000..52857ec84
--- /dev/null
+++ b/Mac/About/AboutWindowController.xib
@@ -0,0 +1,116 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Mac/About/LinkLabel.swift b/Mac/About/LinkLabel.swift
new file mode 100644
index 000000000..4f298175b
--- /dev/null
+++ b/Mac/About/LinkLabel.swift
@@ -0,0 +1,16 @@
+//
+// LinkLabel.swift
+// NetNewsWire
+//
+// Created by Stuart Breckenridge on 26/06/2025.
+// Copyright © 2025 Ranchero Software. All rights reserved.
+//
+
+
+class LinkLabel: NSTextField {
+
+ /// pièces de résistance -- keeping it a mac-assed mac app.
+ override func resetCursorRects() {
+ addCursorRect(bounds, cursor: .pointingHand)
+ }
+}
diff --git a/Mac/AppAssets.swift b/Mac/AppAssets.swift
index cefbe0423..eb7f24dbb 100644
--- a/Mac/AppAssets.swift
+++ b/Mac/AppAssets.swift
@@ -161,6 +161,16 @@ struct AppAssets {
let image = RSImage(named: "markAllAsRead")
return image!
}()
+
+ static var markBelowAsReadImage: RSImage = {
+ let image = RSImage(named: "markBelowAsRead")
+ return image!
+ }()
+
+ static var markAboveAsReadImage: RSImage = {
+ let image = RSImage(named: "markAboveAsRead")
+ return image!
+ }()
static var nextUnreadImage: RSImage = {
diff --git a/Mac/AppDelegate.swift b/Mac/AppDelegate.swift
index adf91c8a5..1ff0799a5 100644
--- a/Mac/AppDelegate.swift
+++ b/Mac/AppDelegate.swift
@@ -277,7 +277,6 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations,
CrashReporter.check(crashReporter: self.crashReporter)
}
#endif
-
}
func application(_ application: NSApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([NSUserActivityRestoring]) -> Void) -> Bool {
@@ -675,6 +674,13 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations,
createAndShowMainWindowIfNecessary()
mainWindowController!.gotoStarred(sender)
}
+
+ @IBAction func showCustomAboutPanel(_ sender: Any?) {
+ let aboutWC = AboutWindowController(windowNibName: "AboutWindowController")
+ aboutWC.showWindow(nil)
+ aboutWC.window?.center()
+ aboutWC.window?.makeKeyAndOrderFront(nil)
+ }
@IBAction func sortByOldestArticleOnTop(_ sender: Any?) {
diff --git a/Mac/Base.lproj/Main.storyboard b/Mac/Base.lproj/Main.storyboard
index c2906ddec..536c5fe1c 100644
--- a/Mac/Base.lproj/Main.storyboard
+++ b/Mac/Base.lproj/Main.storyboard
@@ -1,8 +1,7 @@
-
+
-
-
+
@@ -18,7 +17,7 @@
diff --git a/Mac/MainWindow/Timeline/TimelineViewController+ContextualMenus.swift b/Mac/MainWindow/Timeline/TimelineViewController+ContextualMenus.swift
index 32ce32ac0..843a32f79 100644
--- a/Mac/MainWindow/Timeline/TimelineViewController+ContextualMenus.swift
+++ b/Mac/MainWindow/Timeline/TimelineViewController+ContextualMenus.swift
@@ -241,11 +241,11 @@ private extension TimelineViewController {
}
func markAboveReadMenuItem(_ articles: [Article]) -> NSMenuItem {
- return menuItem(NSLocalizedString("Mark Above as Read", comment: "Command"), #selector(markAboveArticlesReadFromContextualMenu(_:)), articles, image: nil)
+ return menuItem(NSLocalizedString("Mark Above as Read", comment: "Command"), #selector(markAboveArticlesReadFromContextualMenu(_:)), articles, image: AppAssets.markAboveAsReadImage)
}
func markBelowReadMenuItem(_ articles: [Article]) -> NSMenuItem {
- return menuItem(NSLocalizedString("Mark Below as Read", comment: "Command"), #selector(markBelowArticlesReadFromContextualMenu(_:)), articles, image: nil)
+ return menuItem(NSLocalizedString("Mark Below as Read", comment: "Command"), #selector(markBelowArticlesReadFromContextualMenu(_:)), articles, image: AppAssets.markBelowAsReadImage)
}
func selectFeedInSidebarMenuItem(_ feed: WebFeed) -> NSMenuItem {
diff --git a/Mac/Resources/Assets.xcassets/markAboveAsRead.symbolset/Contents.json b/Mac/Resources/Assets.xcassets/markAboveAsRead.symbolset/Contents.json
new file mode 100644
index 000000000..a564ef15f
--- /dev/null
+++ b/Mac/Resources/Assets.xcassets/markAboveAsRead.symbolset/Contents.json
@@ -0,0 +1,12 @@
+{
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ },
+ "symbols" : [
+ {
+ "filename" : "markAsReadAbove.svg",
+ "idiom" : "universal"
+ }
+ ]
+}
diff --git a/Mac/Resources/Assets.xcassets/markAboveAsRead.symbolset/markAsReadAbove.svg b/Mac/Resources/Assets.xcassets/markAboveAsRead.symbolset/markAsReadAbove.svg
new file mode 100644
index 000000000..33ae08783
--- /dev/null
+++ b/Mac/Resources/Assets.xcassets/markAboveAsRead.symbolset/markAsReadAbove.svg
@@ -0,0 +1,159 @@
+
+
\ No newline at end of file
diff --git a/Mac/Resources/Assets.xcassets/markBelowAsRead.symbolset/Contents.json b/Mac/Resources/Assets.xcassets/markBelowAsRead.symbolset/Contents.json
new file mode 100644
index 000000000..2a23fbc06
--- /dev/null
+++ b/Mac/Resources/Assets.xcassets/markBelowAsRead.symbolset/Contents.json
@@ -0,0 +1,12 @@
+{
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ },
+ "symbols" : [
+ {
+ "filename" : "markBelowAsRead.svg",
+ "idiom" : "universal"
+ }
+ ]
+}
diff --git a/Mac/Resources/Assets.xcassets/markBelowAsRead.symbolset/markBelowAsRead.svg b/Mac/Resources/Assets.xcassets/markBelowAsRead.symbolset/markBelowAsRead.svg
new file mode 100644
index 000000000..6edb2d188
--- /dev/null
+++ b/Mac/Resources/Assets.xcassets/markBelowAsRead.symbolset/markBelowAsRead.svg
@@ -0,0 +1,159 @@
+
+
\ No newline at end of file
diff --git a/Mac/Resources/Credits.rtf b/Mac/Resources/Credits.rtf
index ce67ed372..1291f7c3a 100644
--- a/Mac/Resources/Credits.rtf
+++ b/Mac/Resources/Credits.rtf
@@ -1,52 +1,64 @@
-{\rtf1\ansi\ansicpg1252\cocoartf2761
-\cocoatextscaling0\cocoaplatform0{\fonttbl\f0\fnil\fcharset0 LucidaGrande-Bold;\f1\fnil\fcharset0 LucidaGrande;}
+{\rtf1\ansi\ansicpg1252\cocoartf2859
+\cocoatextscaling0\cocoaplatform0{\fonttbl\f0\fnil\fcharset0 SFPro-Bold;\f1\fnil\fcharset0 SFPro-Regular;}
{\colortbl;\red255\green255\blue255;\red0\green0\blue0;}
{\*\expandedcolortbl;;\cssrgb\c0\c0\c0\cname textColor;}
\vieww14060\viewh15660\viewkind0
-\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\sl360\slmult1\pardirnatural\partightenfactor0
-{\field{\*\fldinst{HYPERLINK "https://ranchero.com/netnewswire/"}}{\fldrslt
-\f0\b\fs22 \cf2 NetNewsWire}}
-\f0\b\fs22 \cf2 \
-By Brent Simmons\
-\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\sl360\slmult1\pardirnatural\partightenfactor0
-{\field{\*\fldinst{HYPERLINK "http://inessential.com/"}}{\fldrslt \cf2 inessential.com}}
+\deftab720
+\pard\pardeftab720\sa60\partightenfactor0
+
+\f0\b\fs22 \cf2 Credits
\f1\b0 \
+\pard\pardeftab720\sl144\slmult1\sa60\partightenfactor0
+\cf2 \
+\pard\pardeftab720\sl168\slmult1\sa60\partightenfactor0
+\cf2 Contributing Developers \
+{\field{\*\fldinst{HYPERLINK "https://github.com/vincode-io"}}{\fldrslt Maurice Parker}}, {\field{\*\fldinst{HYPERLINK "https://stuartbreckenridge.net/"}}{\fldrslt Stuart Breckenridge}}\
+\
+App Icon\
+{\field{\*\fldinst{HYPERLINK "https://twitter.com/BradEllis"}}{\fldrslt Brad Ellis}}\
+\
+Feedly Syncing\
+{\field{\*\fldinst{HYPERLINK "https://twitter.com/kielgillard"}}{\fldrslt Kiel Gillard}}\
+\
+NewsBlur Syncing\
+{\field{\*\fldinst{HYPERLINK "https://twitter.com/quanganhdo"}}{\fldrslt Anh Do}}\
+\
+Under-the-Hood Magic and CSS Stylin's\
+{\field{\*\fldinst{HYPERLINK "https://github.com/wevah"}}{\fldrslt Nate Weaver}}\
+\
+Newsfoot (JS footnote displayer)\
+{\field{\*\fldinst{HYPERLINK "https://github.com/brehaut/"}}{\fldrslt Andrew Brehaut}}\
+\
+Help Book\
+{\field{\*\fldinst{HYPERLINK "https://nostodnayr.net/"}}{\fldrslt Ryan Dotson}}\
+\
+And featuring contributions from\
+{\field{\*\fldinst{HYPERLINK "https://github.com/danielpunkass"}}{\fldrslt Daniel Jalkut}}, {\field{\*\fldinst{HYPERLINK "https://rhonabwy.com/"}}{\fldrslt Joe Heck}}, {\field{\*\fldinst{HYPERLINK "https://github.com/olofhellman"}}{\fldrslt Olof Hellman}}, {\field{\*\fldinst{HYPERLINK "https://blog.rizwan.dev/"}}{\fldrslt Rizwan Mohamed Ibrahim}}, {\field{\*\fldinst{HYPERLINK "https://twitter.com/philviso"}}{\fldrslt Phil Viso}}, and {\field{\*\fldinst{HYPERLINK "https://github.com/Ranchero-Software/NetNewsWire/graphs/contributors"}}{\fldrslt many more}}!\
\pard\pardeftab720\li360\sa60\partightenfactor0
\cf2 \
\pard\pardeftab720\sa60\partightenfactor0
-\f0\b \cf2 Credits:
-\f1\b0 \
-\pard\pardeftab720\li360\sa60\partightenfactor0
-\cf2 Contributing developers: {\field{\*\fldinst{HYPERLINK "https://github.com/vincode-io"}}{\fldrslt Maurice Parker}}, {\field{\*\fldinst{HYPERLINK "https://stuartbreckenridge.net/"}}{\fldrslt Stuart Breckenridge}}\
-App icon: {\field{\*\fldinst{HYPERLINK "https://twitter.com/BradEllis"}}{\fldrslt Brad Ellis}}\
-Feedly syncing: {\field{\*\fldinst{HYPERLINK "https://twitter.com/kielgillard"}}{\fldrslt Kiel Gillard}}\
-NewsBlur syncing: {\field{\*\fldinst{HYPERLINK "https://twitter.com/quanganhdo"}}{\fldrslt Anh Do}}\
-Under-the-hood magic and CSS stylin\'92s: {\field{\*\fldinst{HYPERLINK "https://github.com/wevah"}}{\fldrslt Nate Weaver}}\
-Newsfoot (JS footnote displayer): {\field{\*\fldinst{HYPERLINK "https://github.com/brehaut/"}}{\fldrslt Andrew Brehaut}}\
-Help book: {\field{\*\fldinst{HYPERLINK "https://nostodnayr.net/"}}{\fldrslt Ryan Dotson}}\
-And featuring contributions from {\field{\*\fldinst{HYPERLINK "https://github.com/danielpunkass"}}{\fldrslt Daniel Jalkut}}, {\field{\*\fldinst{HYPERLINK "https://rhonabwy.com/"}}{\fldrslt Joe Heck}}, {\field{\*\fldinst{HYPERLINK "https://github.com/olofhellman"}}{\fldrslt Olof Hellman}}, {\field{\*\fldinst{HYPERLINK "https://blog.rizwan.dev/"}}{\fldrslt Rizwan Mohamed Ibrahim}}, {\field{\*\fldinst{HYPERLINK "https://twitter.com/philviso"}}{\fldrslt Phil Viso}}, and {\field{\*\fldinst{HYPERLINK "https://github.com/Ranchero-Software/NetNewsWire/graphs/contributors"}}{\fldrslt many more}}!\
-\
-\pard\pardeftab720\sa60\partightenfactor0
+\f0\b \cf2 Acknowledgments\
-\f0\b \cf2 Acknowledgments:
\f1\b0 \
-\pard\pardeftab720\li360\sa60\partightenfactor0
+\pard\pardeftab720\sl168\slmult1\sa60\partightenfactor0
{\field{\*\fldinst{HYPERLINK "https://github.com/ccgus/fmdb"}}{\fldrslt \cf2 FMDB}} (greatest SQLite wrapper ever in history) is by {\field{\*\fldinst{HYPERLINK "http://flyingmeat.com/"}}{\fldrslt Flying Meat Software}}.\
-\pard\pardeftab720\li360\sa60\partightenfactor0
-{\field{\*\fldinst{HYPERLINK "https://sparkle-project.org/"}}{\fldrslt \cf2 Sparkle}} is by Sparkle Project.\
\
+{\field{\*\fldinst{HYPERLINK "https://sparkle-project.org/"}}{\fldrslt Sparkle}} is by Sparkle Project.\
+\pard\pardeftab720\li360\sa60\partightenfactor0
+\cf2 \
\pard\pardeftab720\sa60\partightenfactor0
-\f0\b \cf2 Thanks:\
-\pard\pardeftab720\li360\sa60\partightenfactor0
-
-\f1\b0 \cf2 Thanks to Sheila and my family; thanks to my friends in Seattle and around the globe; thanks to the ever-patient and ever-awesome NetNewsWire beta testers. Thanks to {\field{\*\fldinst{HYPERLINK "https://github.com/"}}{\fldrslt GitHub}} and {\field{\*\fldinst{HYPERLINK "https://slack.com/"}}{\fldrslt Slack}} for making open source collaboration easy and fun.\
+\f0\b \cf2 Thanks\
\
+
+\f1\b0 Thanks to Sheila and my family; thanks to my friends in Seattle and around the globe; thanks to the ever-patient and ever-awesome NetNewsWire beta testers. Thanks to {\field{\*\fldinst{HYPERLINK "https://github.com/"}}{\fldrslt GitHub}} and {\field{\*\fldinst{HYPERLINK "https://slack.com/"}}{\fldrslt Slack}} for making open source collaboration easy and fun.\
+\pard\pardeftab720\li360\sa60\partightenfactor0
+\cf2 \
\pard\pardeftab720\sa60\partightenfactor0
-\f0\b \cf2 Dedication:\
-\pard\pardeftab720\li360\sa60\partightenfactor0
+\f0\b \cf2 Dedication\
+\
-\f1\b0 \cf2 NetNewsWire 6 is dedicated to everyone working to save democracy around the world.\
+\f1\b0 NetNewsWire 6 is dedicated to everyone working to save democracy around the world.\
}
\ No newline at end of file
diff --git a/iOS/AppAssets.swift b/iOS/AppAssets.swift
index 9ccc8ec72..601f72727 100644
--- a/iOS/AppAssets.swift
+++ b/iOS/AppAssets.swift
@@ -144,11 +144,11 @@ struct AppAssets {
}()
static var mainFolderImage: IconImage = {
- return IconImage(UIImage(systemName: "folder.fill")!, isSymbol: true, isBackgroundSuppressed: true, preferredColor: AppAssets.secondaryAccentColor.cgColor)
+ return IconImage(UIImage(systemName: "folder")!, isSymbol: true, isBackgroundSuppressed: true, preferredColor: AppAssets.secondaryAccentColor.cgColor)
}()
static var mainFolderImageNonIcon: UIImage = {
- return UIImage(systemName: "folder.fill")!.withRenderingMode(.alwaysOriginal).withTintColor(.secondaryLabel)
+ return UIImage(systemName: "folder")!.withRenderingMode(.alwaysOriginal).withTintColor(.secondaryLabel)
}()
static var moreImage: UIImage = {
@@ -238,6 +238,11 @@ struct AppAssets {
return UIImage(systemName: "trash")!
}()
+ static var unreadCellIndicatorImage: IconImage {
+ let image = UIImage(systemName: "circle.fill")!
+ return IconImage(image, isSymbol: true, isBackgroundSuppressed: true, preferredColor: AppAssets.secondaryAccentColor.cgColor)
+ }
+
static var unreadFeedImage: IconImage {
let image = UIImage(systemName: "largecircle.fill.circle")!
return IconImage(image, isSymbol: true, isBackgroundSuppressed: true, preferredColor: AppAssets.secondaryAccentColor.cgColor)
diff --git a/iOS/Article/ArticleViewController.swift b/iOS/Article/ArticleViewController.swift
index c49facc64..875443183 100644
--- a/iOS/Article/ArticleViewController.swift
+++ b/iOS/Article/ArticleViewController.swift
@@ -193,7 +193,7 @@ class ArticleViewController: UIViewController {
override func willTransition(to newCollection: UITraitCollection, with coordinator: any UIViewControllerTransitionCoordinator) {
// We only want to show bars when rotating to horizontalSizeClass == .regular
// (i.e., big) iPhones to resolve crash #4483.
- if UIDevice.current.userInterfaceIdiom == .phone && newCollection.horizontalSizeClass == .regular {
+ if traitCollection.userInterfaceIdiom == .phone && newCollection.horizontalSizeClass == .regular {
currentWebViewController?.showBars()
}
}
diff --git a/iOS/Article/ImageViewController.swift b/iOS/Article/ImageViewController.swift
index fd1f17d79..941f68409 100644
--- a/iOS/Article/ImageViewController.swift
+++ b/iOS/Article/ImageViewController.swift
@@ -79,7 +79,7 @@ class ImageViewController: UIViewController {
private func layoutTitleLabel(){
let width = view.frame.width
- let multiplier = UIDevice.current.userInterfaceIdiom == .pad ? CGFloat(0.1) : CGFloat(0.04)
+ let multiplier = traitCollection.userInterfaceIdiom == .pad ? CGFloat(0.1) : CGFloat(0.04)
titleLeading.constant += width * multiplier
titleTrailing.constant -= width * multiplier
titleLabel.layoutIfNeeded()
diff --git a/iOS/Base.lproj/LaunchScreenPad.storyboard b/iOS/Base.lproj/LaunchScreenPad.storyboard
index 06c951431..b11498457 100644
--- a/iOS/Base.lproj/LaunchScreenPad.storyboard
+++ b/iOS/Base.lproj/LaunchScreenPad.storyboard
@@ -1,9 +1,10 @@
-
+
-
+
+
@@ -14,8 +15,8 @@
-
+
@@ -29,36 +30,7 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -70,7 +42,7 @@
-
+
@@ -83,11 +55,10 @@
-
+
-
@@ -101,19 +72,37 @@
-
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
diff --git a/iOS/Base.lproj/LaunchScreenPhone.storyboard b/iOS/Base.lproj/LaunchScreenPhone.storyboard
index 61a86ee99..41ef8fc7d 100644
--- a/iOS/Base.lproj/LaunchScreenPhone.storyboard
+++ b/iOS/Base.lproj/LaunchScreenPhone.storyboard
@@ -1,9 +1,10 @@
-
+
-
+
+
@@ -14,51 +15,23 @@
-
+
-
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
@@ -70,24 +43,23 @@
-
+
-
+
-
+
-
@@ -96,24 +68,45 @@
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
diff --git a/iOS/Base.lproj/Main.storyboard b/iOS/Base.lproj/Main.storyboard
index 0fcd14b0e..7d1888b23 100644
--- a/iOS/Base.lproj/Main.storyboard
+++ b/iOS/Base.lproj/Main.storyboard
@@ -1,12 +1,15 @@
-
-
+
+
+
-
+
+
+
@@ -15,11 +18,11 @@
-
+
-
+
@@ -112,19 +115,159 @@
-
+
-
+
-
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -145,15 +288,15 @@
-
-
+
+
-
+
@@ -162,7 +305,7 @@
-
+
@@ -174,14 +317,14 @@
-
+
-
+
-
+
@@ -229,14 +372,236 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -245,33 +610,34 @@
-
+
-
+
-
+
@@ -416,7 +785,9 @@
+
+
@@ -429,11 +800,23 @@
+
+
+
+
+
+
+
+
+
-
+
+
+
+
diff --git a/iOS/IconView.swift b/iOS/IconView.swift
index 4545b550c..af6247ea0 100644
--- a/iOS/IconView.swift
+++ b/iOS/IconView.swift
@@ -8,6 +8,7 @@
import UIKit
+@IBDesignable
final class IconView: UIView {
var iconImage: IconImage? = nil {
@@ -34,7 +35,7 @@ final class IconView: UIView {
let imageView = NonIntrinsicImageView(image: AppAssets.faviconTemplateImage)
imageView.contentMode = .scaleAspectFit
imageView.clipsToBounds = true
- imageView.layer.cornerRadius = 6.0
+ imageView.layer.cornerRadius = 2.0
imageView.layer.cornerCurve = .continuous
return imageView
}()
@@ -120,3 +121,4 @@ private extension IconView {
}
}
}
+
diff --git a/iOS/MainFeed/Collection View Cells/MainFeedCollectionHeaderReusableView.swift b/iOS/MainFeed/Collection View Cells/MainFeedCollectionHeaderReusableView.swift
new file mode 100644
index 000000000..e88b6e911
--- /dev/null
+++ b/iOS/MainFeed/Collection View Cells/MainFeedCollectionHeaderReusableView.swift
@@ -0,0 +1,128 @@
+//
+// MainFeedCollectionHeaderReusableView.swift
+// NetNewsWire-iOS
+//
+// Created by Stuart Breckenridge on 12/07/2025.
+// Copyright © 2025 Ranchero Software. All rights reserved.
+//
+
+import UIKit
+
+protocol MainFeedCollectionHeaderReusableViewDelegate: AnyObject {
+ func mainFeedCollectionHeaderReusableViewDidTapDisclosureIndicator(_ view: MainFeedCollectionHeaderReusableView)
+}
+
+class MainFeedCollectionHeaderReusableView: UICollectionReusableView {
+
+ var delegate: MainFeedCollectionHeaderReusableViewDelegate?
+
+ @IBOutlet weak var headerTitle: UILabel!
+ @IBOutlet weak var disclosureIndicator: UIImageView!
+ @IBOutlet weak var unreadCountLabel: UILabel!
+ private var unreadLabelWidthConstraint: NSLayoutConstraint?
+
+
+ override var accessibilityLabel: String? {
+ set {}
+ get {
+ if unreadCount > 0 {
+ let unreadLabel = NSLocalizedString("unread", comment: "Unread label for accessibility")
+ return "\(headerTitle.text ?? "") \(unreadCount) \(unreadLabel) \(expandedStateMessage) "
+ } else {
+ return "\(headerTitle.text ?? "") \(expandedStateMessage) "
+ }
+ }
+ }
+
+ private var expandedStateMessage: String {
+ set {}
+ get {
+ if disclosureExpanded {
+ return NSLocalizedString("Expanded", comment: "Disclosure button expanded state for accessibility")
+ }
+ return NSLocalizedString("Collapsed", comment: "Disclosure button collapsed state for accessibility")
+ }
+ }
+
+
+ private var _unreadCount: Int = 0
+
+ var unreadCount: Int {
+ get {
+ return _unreadCount
+ }
+ set {
+ _unreadCount = newValue
+ updateUnreadCount()
+ unreadCountLabel.text = newValue.formatted()
+ }
+ }
+
+ var disclosureExpanded = true {
+ didSet {
+ updateExpandedState(animate: true)
+ updateUnreadCount()
+ }
+ }
+
+ override func awakeFromNib() {
+ super.awakeFromNib()
+ unreadLabelWidthConstraint = unreadCountLabel.widthAnchor.constraint(lessThanOrEqualToConstant: 80)
+ unreadLabelWidthConstraint?.isActive = true
+ configureUI()
+ addTapGesture()
+ }
+
+ func configureUI() {
+ headerTitle.textColor = traitCollection.userInterfaceIdiom == .pad ? .tertiaryLabel : .label
+ }
+
+ private func addTapGesture() {
+ let tapGesture = UITapGestureRecognizer(target: self, action: #selector(containerHeaderTapped))
+ self.addGestureRecognizer(tapGesture)
+ self.isUserInteractionEnabled = true
+ }
+
+ @objc private func containerHeaderTapped() {
+ delegate?.mainFeedCollectionHeaderReusableViewDidTapDisclosureIndicator(self)
+ }
+
+ func configureContainer(withTitle title: String) {
+ headerTitle.text = title
+ disclosureIndicator.transform = .identity
+ }
+
+ func updateExpandedState(animate: Bool) {
+
+ if disclosureExpanded == false {
+ unreadLabelWidthConstraint = unreadCountLabel.widthAnchor.constraint(lessThanOrEqualToConstant: 80)
+ } else {
+ unreadLabelWidthConstraint = unreadCountLabel.widthAnchor.constraint(lessThanOrEqualToConstant: 0)
+ unreadLabelWidthConstraint?.isActive = false
+ }
+
+ let angle: CGFloat = disclosureExpanded ? 0 : -.pi / 2
+ let transform = CGAffineTransform(rotationAngle: angle)
+ let animations = {
+ self.disclosureIndicator.transform = transform
+ }
+ if animate {
+ UIView.animate(withDuration: 0.3, animations: animations)
+ } else {
+ animations()
+ }
+ }
+
+ func updateUnreadCount() {
+ if !disclosureExpanded && unreadCount > 0 {
+ UIView.animate(withDuration: 0.3) {
+ self.unreadCountLabel.alpha = 1
+ }
+ } else {
+ UIView.animate(withDuration: 0.3) {
+ self.unreadCountLabel.alpha = 0
+ }
+ }
+ }
+
+}
diff --git a/iOS/MainFeed/Collection View Cells/MainFeedCollectionViewCell.swift b/iOS/MainFeed/Collection View Cells/MainFeedCollectionViewCell.swift
new file mode 100644
index 000000000..4cf19e605
--- /dev/null
+++ b/iOS/MainFeed/Collection View Cells/MainFeedCollectionViewCell.swift
@@ -0,0 +1,114 @@
+//
+// MainFeedCollectionViewCell.swift
+// NetNewsWire-iOS
+//
+// Created by Stuart Breckenridge on 23/06/2025.
+// Copyright © 2025 Ranchero Software. All rights reserved.
+//
+
+import UIKit
+import RSCore
+import Account
+import RSTree
+
+
+class MainFeedCollectionViewCell: UICollectionViewCell {
+
+ @IBOutlet weak var feedTitle: UILabel!
+ @IBOutlet weak var faviconView: IconView!
+ @IBOutlet weak var unreadCountLabel: UILabel!
+ private var faviconLeadingConstraint: NSLayoutConstraint?
+
+ var iconImage: IconImage? {
+ didSet {
+ faviconView.iconImage = iconImage
+ if let preferredColor = iconImage?.preferredColor {
+ faviconView.tintColor = UIColor(cgColor: preferredColor)
+ } else {
+ faviconView.tintColor = AppAssets.secondaryAccentColor
+ }
+ }
+ }
+
+ private var _unreadCount: Int = 0
+
+ var unreadCount: Int {
+ get {
+ return _unreadCount
+ }
+ set {
+ _unreadCount = newValue
+ if newValue == 0 {
+ unreadCountLabel.isHidden = true
+ } else {
+ unreadCountLabel.isHidden = false
+ }
+ unreadCountLabel.text = newValue.formatted()
+ }
+ }
+
+ /// If the feed is contained in a folder, the indentation level is 1
+ /// and the cell's favicon leading constrain is increased. Otherwise,
+ /// it has the standard leading constraint.
+ ///
+ /// On the storyboard, no leading constraint is set.
+ var indentationLevel: Int = 0 {
+ didSet {
+ if indentationLevel == 1 {
+ faviconLeadingConstraint?.constant = 32
+ } else {
+ faviconLeadingConstraint?.constant = 16
+ }
+ }
+ }
+
+ override var accessibilityLabel: String? {
+ set {}
+ get {
+ if unreadCount > 0 {
+ let unreadLabel = NSLocalizedString("unread", comment: "Unread label for accessibility")
+ return "\(String(describing: feedTitle.text)) \(unreadCount) \(unreadLabel)"
+ } else {
+ return (String(describing: feedTitle.text))
+ }
+ }
+ }
+
+ override func awakeFromNib() {
+ super.awakeFromNib()
+ faviconLeadingConstraint = faviconView.leadingAnchor.constraint(equalTo: contentView.safeAreaLayoutGuide.leadingAnchor)
+ faviconLeadingConstraint?.isActive = true
+ }
+
+ override func updateConfiguration(using state: UICellConfigurationState) {
+ var backgroundConfig = UIBackgroundConfiguration.listCell().updated(for: state)
+
+ switch (state.isHighlighted || state.isSelected || state.isFocused, traitCollection.userInterfaceIdiom) {
+ case (true, .pad):
+ backgroundConfig.backgroundColor = .tertiarySystemFill
+ feedTitle.textColor = AppAssets.primaryAccentColor
+ case (true, .phone):
+ backgroundConfig.backgroundColor = AppAssets.primaryAccentColor
+ feedTitle.textColor = .white
+ unreadCountLabel.textColor = .lightText
+ if feedTitle.text == "All Unread" {
+ faviconView.tintColor = .white
+ }
+ default:
+ feedTitle.textColor = .label
+ unreadCountLabel.textColor = .secondaryLabel
+ if traitCollection.userInterfaceIdiom == .phone {
+ if feedTitle.text == "All Unread" {
+ if let preferredColor = iconImage?.preferredColor {
+ faviconView.tintColor = UIColor(cgColor: preferredColor)
+ } else {
+ faviconView.tintColor = AppAssets.secondaryAccentColor
+ }
+ }
+ }
+ }
+ self.backgroundConfiguration = backgroundConfig
+ }
+
+}
+
diff --git a/iOS/MainFeed/Collection View Cells/MainFeedCollectionViewFolderCell.swift b/iOS/MainFeed/Collection View Cells/MainFeedCollectionViewFolderCell.swift
new file mode 100644
index 000000000..6faa6fff8
--- /dev/null
+++ b/iOS/MainFeed/Collection View Cells/MainFeedCollectionViewFolderCell.swift
@@ -0,0 +1,135 @@
+//
+// MainFeedCollectionViewFolderCell.swift
+// NetNewsWire-iOS
+//
+// Created by Stuart Breckenridge on 14/07/2025.
+// Copyright © 2025 Ranchero Software. All rights reserved.
+//
+
+import UIKit
+
+protocol MainFeedCollectionViewFolderCellDelegate: AnyObject {
+ func mainFeedCollectionFolderViewCellDisclosureDidToggle(_ sender: MainFeedCollectionViewFolderCell, expanding: Bool)
+}
+
+class MainFeedCollectionViewFolderCell: UICollectionViewCell {
+
+ @IBOutlet weak var folderTitle: UILabel!
+ @IBOutlet weak var faviconView: IconView!
+ @IBOutlet weak var unreadCountLabel: UILabel!
+ @IBOutlet weak var disclosureButton: UIButton!
+
+ var delegate: MainFeedCollectionViewFolderCellDelegate?
+
+ private var _unreadCount: Int = 0
+ var unreadCount: Int {
+ get {
+ return _unreadCount
+ }
+ set {
+ _unreadCount = newValue
+ if newValue == 0 {
+ unreadCountLabel.isHidden = true
+ } else {
+ unreadCountLabel.isHidden = false
+ }
+ unreadCountLabel.text = newValue.formatted()
+ }
+ }
+
+ var iconImage: IconImage? {
+ didSet {
+ faviconView.iconImage = iconImage
+ if let preferredColor = iconImage?.preferredColor {
+ faviconView.tintColor = UIColor(cgColor: preferredColor)
+ } else {
+ faviconView.tintColor = AppAssets.secondaryAccentColor
+ }
+ }
+ }
+
+ var disclosureExpanded = true {
+ didSet {
+ updateExpandedState(animate: true)
+ updateUnreadCount()
+ }
+ }
+
+ override func awakeFromNib() {
+ super.awakeFromNib()
+ disclosureButton.addInteraction(UIPointerInteraction())
+ }
+
+ func updateExpandedState(animate: Bool) {
+ let angle: CGFloat = disclosureExpanded ? 0 : -.pi / 2
+ let transform = CGAffineTransform(rotationAngle: angle)
+ let animations = {
+ self.disclosureButton.transform = transform
+ }
+ if animate {
+ UIView.animate(withDuration: 0.3, animations: animations)
+ } else {
+ animations()
+ }
+ }
+
+ func updateUnreadCount() {
+ if !disclosureExpanded && unreadCount > 0 {
+ UIView.animate(withDuration: 0.3) {
+ self.unreadCountLabel.alpha = 1
+ }
+ } else {
+ UIView.animate(withDuration: 0.3) {
+ self.unreadCountLabel.alpha = 0
+ }
+ }
+ }
+
+ @IBAction
+ func toggleDisclosure() {
+ setDisclosure(isExpanded: !disclosureExpanded, animated: true)
+ delegate?.mainFeedCollectionFolderViewCellDisclosureDidToggle(self, expanding: disclosureExpanded)
+ }
+
+ func setDisclosure(isExpanded: Bool, animated: Bool) {
+ disclosureExpanded = isExpanded
+ }
+
+
+ override var accessibilityLabel: String? {
+ set {}
+ get {
+ if unreadCount > 0 {
+ let unreadLabel = NSLocalizedString("unread", comment: "Unread label for accessibility")
+ return "\(String(describing: folderTitle.text)) \(unreadCount) \(unreadLabel)"
+ } else {
+ return (String(describing: folderTitle.text))
+ }
+ }
+ }
+
+ override func updateConfiguration(using state: UICellConfigurationState) {
+ var backgroundConfig = UIBackgroundConfiguration.listCell().updated(for: state)
+
+ switch (state.isHighlighted || state.isSelected || state.isFocused, traitCollection.userInterfaceIdiom) {
+ case (true, .pad):
+ backgroundConfig.backgroundColor = .tertiarySystemFill
+ folderTitle.textColor = AppAssets.primaryAccentColor
+ case (true, .phone):
+ backgroundConfig.backgroundColor = AppAssets.primaryAccentColor
+ folderTitle.textColor = .white
+ unreadCountLabel.textColor = .lightText
+ faviconView.tintColor = .white
+ default:
+ folderTitle.textColor = .label
+ faviconView.tintColor = AppAssets.primaryAccentColor
+ }
+
+ if state.cellDropState == .targeted {
+ backgroundConfig.backgroundColor = .tertiarySystemFill
+ }
+
+ self.backgroundConfiguration = backgroundConfig
+ }
+
+}
diff --git a/iOS/MainFeed/MainFeedCollectionViewController+Drag.swift b/iOS/MainFeed/MainFeedCollectionViewController+Drag.swift
new file mode 100644
index 000000000..899982fcd
--- /dev/null
+++ b/iOS/MainFeed/MainFeedCollectionViewController+Drag.swift
@@ -0,0 +1,40 @@
+//
+// MainFeedCollectionViewController+Drag.swift
+// NetNewsWire-iOS
+//
+// Created by Stuart Breckenridge on 14/07/2025.
+// Copyright © 2025 Ranchero Software. All rights reserved.
+//
+
+import UIKit
+import WebKit
+import Account
+import Articles
+import RSCore
+import RSTree
+import RSWeb
+import SafariServices
+import UniformTypeIdentifiers
+
+extension MainFeedCollectionViewController: UICollectionViewDragDelegate {
+ func collectionView(_ collectionView: UICollectionView, itemsForBeginning session: any UIDragSession, at indexPath: IndexPath) -> [UIDragItem] {
+ guard let node = coordinator.nodeFor(indexPath), let webFeed = node.representedObject as? WebFeed else {
+ return [UIDragItem]()
+ }
+
+ let data = webFeed.url.data(using: .utf8)
+ let itemProvider = NSItemProvider()
+
+ itemProvider.registerDataRepresentation(forTypeIdentifier: UTType.url.identifier, visibility: .ownProcess) { completion in
+ completion(data, nil)
+ return nil
+ }
+
+ let dragItem = UIDragItem(itemProvider: itemProvider)
+ dragItem.localObject = node
+ return [dragItem]
+ }
+
+
+
+}
diff --git a/iOS/MainFeed/MainFeedCollectionViewController+Drop.swift b/iOS/MainFeed/MainFeedCollectionViewController+Drop.swift
new file mode 100644
index 000000000..e9db8bc13
--- /dev/null
+++ b/iOS/MainFeed/MainFeedCollectionViewController+Drop.swift
@@ -0,0 +1,174 @@
+//
+// MainFeedCollectionViewController+Drop.swift
+// NetNewsWire-iOS
+//
+// Created by Stuart Breckenridge on 14/07/2025.
+// Copyright © 2025 Ranchero Software. All rights reserved.
+//
+
+import UIKit
+import WebKit
+import Account
+import Articles
+import RSCore
+import RSTree
+import RSWeb
+import SafariServices
+import UniformTypeIdentifiers
+
+
+extension MainFeedCollectionViewController: UICollectionViewDropDelegate {
+
+ func collectionView(_ collectionView: UICollectionView, performDropWith coordinator: any UICollectionViewDropCoordinator) {
+ guard let dragItem = coordinator.items.first?.dragItem,
+ let dragNode = dragItem.localObject as? Node,
+ let source = dragNode.parent?.representedObject as? Container,
+ let destIndexPath = coordinator.destinationIndexPath else {
+ return
+ }
+
+ let isFolderDrop: Bool = {
+ if self.coordinator.nodeFor(destIndexPath)?.representedObject is Folder, let propCell = collectionView.cellForItem(at: destIndexPath) {
+ return coordinator.session.location(in: propCell).y >= 0
+ }
+ return false
+ }()
+
+ // Based on the drop we have to determine a node to start looking for a parent container.
+ let destNode: Node? = {
+
+ if isFolderDrop {
+ return self.coordinator.nodeFor(destIndexPath)
+ } else {
+ if destIndexPath.row == 0 {
+ return self.coordinator.nodeFor(IndexPath(row: 0, section: destIndexPath.section))
+ } else if destIndexPath.row > 0 {
+ return self.coordinator.nodeFor(IndexPath(row: destIndexPath.row - 1, section: destIndexPath.section))
+ } else {
+ return nil
+ }
+ }
+
+ }()
+
+ // Now we start looking for the parent container
+ let destinationContainer: Container? = {
+ if let container = (destNode?.representedObject as? Container) ?? (destNode?.parent?.representedObject as? Container) {
+ return container
+ } else {
+ // If we got here, we are trying to drop on an empty section header. Go and find the Account for this section
+ return self.coordinator.rootNode.childAtIndex(destIndexPath.section)?.representedObject as? Account
+ }
+ }()
+
+ guard let destination = destinationContainer, let webFeed = dragNode.representedObject as? WebFeed else { return }
+
+ if source.account == destination.account {
+ moveWebFeedInAccount(feed: webFeed, sourceContainer: source, destinationContainer: destination)
+ } else {
+ moveWebFeedBetweenAccounts(feed: webFeed, sourceContainer: source, destinationContainer: destination)
+ }
+ }
+
+ func collectionView(_ collectionView: UICollectionView, dropSessionDidUpdate session: any UIDropSession, withDestinationIndexPath destinationIndexPath: IndexPath?) -> UICollectionViewDropProposal {
+
+ guard let destIndexPath = destinationIndexPath, destIndexPath.section > 0, collectionView.hasActiveDrag else {
+ return UICollectionViewDropProposal(operation: .forbidden)
+ }
+
+ guard let destFeed = coordinator.nodeFor(destIndexPath)?.representedObject as? Feed,
+ let destAccount = destFeed.account,
+ let destCell = collectionView.cellForItem(at: destIndexPath) else {
+ return UICollectionViewDropProposal(operation: .forbidden)
+ }
+
+ // Validate account specific behaviors...
+ if destAccount.behaviors.contains(.disallowFeedInMultipleFolders),
+ let sourceNode = session.localDragSession?.items.first?.localObject as? Node,
+ let sourceWebFeed = sourceNode.representedObject as? WebFeed,
+ sourceWebFeed.account?.accountID != destAccount.accountID && destAccount.hasWebFeed(withURL: sourceWebFeed.url) {
+ return UICollectionViewDropProposal(operation: .forbidden)
+ }
+
+ // Determine the correct drop proposal
+ if destFeed is Folder {
+ if session.location(in: destCell).y >= 0 {
+ return UICollectionViewDropProposal(operation: .move, intent: .insertIntoDestinationIndexPath)
+ } else {
+ return UICollectionViewDropProposal(operation: .move, intent: .unspecified)
+ }
+ } else {
+ return UICollectionViewDropProposal(operation: .move, intent: .insertAtDestinationIndexPath)
+ }
+ }
+
+ func collectionView(_ collectionView: UICollectionView, canHandle session: any UIDropSession) -> Bool {
+ return session.localDragSession != nil
+ }
+
+ func collectionView(_ collectionView: UICollectionView, dropSessionDidEnd session: UIDropSession) {
+ }
+
+ func moveWebFeedInAccount(feed: WebFeed, sourceContainer: Container, destinationContainer: Container) {
+ guard sourceContainer !== destinationContainer else { return }
+
+ BatchUpdate.shared.start()
+ sourceContainer.account?.moveWebFeed(feed, from: sourceContainer, to: destinationContainer) { result in
+ BatchUpdate.shared.end()
+ switch result {
+ case .success:
+ break
+ case .failure(let error):
+ self.presentError(error)
+ }
+ }
+ }
+
+ func moveWebFeedBetweenAccounts(feed: WebFeed, sourceContainer: Container, destinationContainer: Container) {
+
+ if let existingFeed = destinationContainer.account?.existingWebFeed(withURL: feed.url) {
+
+ BatchUpdate.shared.start()
+ destinationContainer.account?.addWebFeed(existingFeed, to: destinationContainer) { result in
+ switch result {
+ case .success:
+ sourceContainer.account?.removeWebFeed(feed, from: sourceContainer) { result in
+ BatchUpdate.shared.end()
+ switch result {
+ case .success:
+ break
+ case .failure(let error):
+ self.presentError(error)
+ }
+ }
+ case .failure(let error):
+ BatchUpdate.shared.end()
+ self.presentError(error)
+ }
+ }
+
+ } else {
+
+ BatchUpdate.shared.start()
+ destinationContainer.account?.createWebFeed(url: feed.url, name: feed.editedName, container: destinationContainer, validateFeed: false) { result in
+ switch result {
+ case .success:
+ sourceContainer.account?.removeWebFeed(feed, from: sourceContainer) { result in
+ BatchUpdate.shared.end()
+ switch result {
+ case .success:
+ break
+ case .failure(let error):
+ self.presentError(error)
+ }
+ }
+ case .failure(let error):
+ BatchUpdate.shared.end()
+ self.presentError(error)
+ }
+ }
+
+ }
+ }
+
+}
diff --git a/iOS/MainFeed/MainFeedCollectionViewController.swift b/iOS/MainFeed/MainFeedCollectionViewController.swift
new file mode 100644
index 000000000..71bb8a650
--- /dev/null
+++ b/iOS/MainFeed/MainFeedCollectionViewController.swift
@@ -0,0 +1,1202 @@
+//
+// MainFeedCollectionViewController.swift
+// NetNewsWire-iOS
+//
+// Created by Stuart Breckenridge on 23/06/2025.
+// Copyright © 2025 Ranchero Software. All rights reserved.
+//
+
+import UIKit
+import WebKit
+import Account
+import Articles
+import RSCore
+import RSTree
+import RSWeb
+import SafariServices
+import UniformTypeIdentifiers
+
+private let reuseIdentifier = "FeedCell"
+private let folderIdentifier = "Folder"
+private let containerReuseIdentifier = "Container"
+
+class MainFeedCollectionViewController: UICollectionViewController, UndoableCommandRunner {
+
+ @IBOutlet weak var filterButton: UIBarButtonItem!
+ @IBOutlet weak var addNewItemButton: UIBarButtonItem! {
+ didSet {
+ if #available(iOS 14, *) {
+ addNewItemButton.primaryAction = nil
+ } else {
+ addNewItemButton.action = #selector(MainFeedViewController.add(_:))
+ }
+ }
+ }
+
+ private let keyboardManager = KeyboardManager(type: .sidebar)
+ override var keyCommands: [UIKeyCommand]? {
+
+ // If the first responder is the WKWebView (PreloadedWebView) we don't want to supply any keyboard
+ // commands that the system is looking for by going up the responder chain. They will interfere with
+ // the WKWebViews built in hardware keyboard shortcuts, specifically the up and down arrow keys.
+ guard let current = UIResponder.currentFirstResponder, !(current is PreloadedWebView) else { return nil }
+
+ return keyboardManager.keyCommands
+ }
+
+ override var canBecomeFirstResponder: Bool {
+ return true
+ }
+
+ var undoableCommands = [UndoableCommand]()
+ weak var coordinator: SceneCoordinator!
+
+ /// On iPhone, this property is used to prevent the user from selecting a new feed while the current feed is being deselected.
+ /// While `isAnimating` is `true`, `shouldSelectItemAt()` will not allow new selection.
+ /// The value is set to `true` in `viewWillAppear(_:)` if a feed is selected, and reset to `false` in
+ /// `viewDidAppear(_:)` after a delay to allow the deselection animation to complete.
+ private var isAnimating: Bool = false
+
+
+ override func viewDidLoad() {
+ super.viewDidLoad()
+ registerForNotifications()
+ configureCollectionView()
+ collectionView.dragDelegate = self
+ collectionView.dropDelegate = self
+ becomeFirstResponder()
+ }
+
+ override func viewWillAppear(_ animated: Bool) {
+ navigationController?.isToolbarHidden = false
+ updateUI()
+ super.viewWillAppear(animated)
+
+ collectionView.refreshControl = UIRefreshControl()
+ collectionView.refreshControl!.addTarget(self, action: #selector(refreshAccounts(_:)), for: .valueChanged)
+
+ if traitCollection.userInterfaceIdiom == .phone {
+ self.navigationController?.navigationBar.prefersLargeTitles = false
+
+ /// On iPhone, we want to deselect the feed when the user navigates
+ /// back to the feeds view. To prevent the user from selecting a new feed while
+ /// the current feed is being deselected, set `isAnimating` to true.
+ ///
+ /// `shouldSelectItemAt()` will not allow selection when `isAnimating`
+ /// is `true.`
+ if let _ = collectionView.indexPathsForSelectedItems {
+ isAnimating = true
+ }
+ }
+ }
+
+ override func viewDidAppear(_ animated: Bool) {
+ super.viewDidAppear(animated)
+
+ /// On iPhone, once the deselection animation has completed, set `isAnimating`
+ /// to false and this will allow selection.
+ if traitCollection.userInterfaceIdiom == .phone {
+ if let _ = collectionView.indexPathsForSelectedItems {
+ coordinator.selectFeed(indexPath: nil, animations: [.select])
+ DispatchQueue.main.asyncAfter(deadline: .now() + 0.3, execute: {
+ self.isAnimating = false
+ })
+ }
+ }
+ }
+
+ func registerForNotifications() {
+ NotificationCenter.default.addObserver(self, selector: #selector(unreadCountDidChange(_:)), name: .UnreadCountDidChange, object: nil)
+ NotificationCenter.default.addObserver(self, selector: #selector(faviconDidBecomeAvailable(_:)), name: .FaviconDidBecomeAvailable, object: nil)
+ // TODO: fix this temporary hack, which will probably require refactoring image handling.
+ // We want to know when to possibly reconfigure our cells with a new image, and we don’t
+ // always know when an image is available — but watching the .htmlMetadataAvailable Notification
+ // lets us know that it’s time to request an image.
+ NotificationCenter.default.addObserver(self, selector: #selector(faviconDidBecomeAvailable(_:)), name: .htmlMetadataAvailable, object: nil)
+ NotificationCenter.default.addObserver(self, selector: #selector(webFeedIconDidBecomeAvailable(_:)), name: .feedIconDidBecomeAvailable, object: nil)
+ NotificationCenter.default.addObserver(self, selector: #selector(webFeedSettingDidChange(_:)), name: .WebFeedSettingDidChange, object: nil)
+
+ registerForTraitChanges([UITraitPreferredContentSizeCategory.self], target: self, action: #selector(preferredContentSizeCategoryDidChange))
+ }
+
+ // MARK: - Collection View Configuration
+ func configureCollectionView() {
+ var config = UICollectionLayoutListConfiguration(appearance: traitCollection.userInterfaceIdiom == .pad ? .sidebar : .insetGrouped)
+ config.separatorConfiguration.color = .tertiarySystemFill
+ config.headerMode = .supplementary
+
+ config.trailingSwipeActionsConfigurationProvider = { [unowned self] indexPath in
+ if indexPath.section == 0 { return UISwipeActionsConfiguration(actions: []) }
+ var actions = [UIContextualAction]()
+
+ // Set up the delete action
+ let deleteTitle = NSLocalizedString("Delete", comment: "Delete")
+ let deleteAction = UIContextualAction(style: .destructive, title: nil) { [weak self] (action, view, completion) in
+ self?.delete(indexPath: indexPath)
+ completion(true)
+ }
+ deleteAction.image = UIImage(systemName: "trash")
+ deleteAction.accessibilityLabel = deleteTitle
+ deleteAction.backgroundColor = UIColor.systemRed
+ actions.append(deleteAction)
+
+ // Set up the rename action
+ let renameTitle = NSLocalizedString("Rename", comment: "Rename")
+ let renameAction = UIContextualAction(style: .normal, title: nil) { [weak self] (action, view, completion) in
+ self?.rename(indexPath: indexPath)
+ completion(true)
+ }
+ renameAction.backgroundColor = UIColor.systemOrange
+ renameAction.image = UIImage(systemName: "pencil")
+ renameAction.accessibilityLabel = renameTitle
+ actions.append(renameAction)
+
+ if let webFeed = coordinator.nodeFor(indexPath)?.representedObject as? WebFeed {
+ let moreTitle = NSLocalizedString("More", comment: "More")
+ let moreAction = UIContextualAction(style: .normal, title: nil) { [weak self] (action, view, completion) in
+
+ if let self = self {
+
+ let alert = UIAlertController(title: webFeed.nameForDisplay, message: nil, preferredStyle: .actionSheet)
+ if let popoverController = alert.popoverPresentationController {
+ popoverController.sourceView = view
+ popoverController.sourceRect = CGRect(x: view.frame.size.width/2, y: view.frame.size.height/2, width: 1, height: 1)
+ }
+
+ if let action = self.getInfoAlertAction(indexPath: indexPath, completion: completion) {
+ alert.addAction(action)
+ }
+
+ if let action = self.homePageAlertAction(indexPath: indexPath, completion: completion) {
+ alert.addAction(action)
+ }
+
+ if let action = self.copyFeedPageAlertAction(indexPath: indexPath, completion: completion) {
+ alert.addAction(action)
+ }
+
+ if let action = self.copyHomePageAlertAction(indexPath: indexPath, completion: completion) {
+ alert.addAction(action)
+ }
+
+ if let action = self.markAllAsReadAlertAction(indexPath: indexPath, completion: completion) {
+ alert.addAction(action)
+ }
+
+ let cancelTitle = NSLocalizedString("Cancel", comment: "Cancel")
+ alert.addAction(UIAlertAction(title: cancelTitle, style: .cancel) { _ in
+ completion(true)
+ })
+
+ self.present(alert, animated: true)
+
+ }
+
+ }
+
+ moreAction.backgroundColor = UIColor.systemGray
+ moreAction.image = UIImage(systemName: "ellipsis")
+ moreAction.accessibilityLabel = moreTitle
+ actions.append(moreAction)
+ }
+
+ let config = UISwipeActionsConfiguration(actions: actions)
+ config.performsFirstActionWithFullSwipe = false
+
+ return config
+ }
+
+ let layout = UICollectionViewCompositionalLayout.list(using: config)
+ collectionView.setCollectionViewLayout(layout, animated: false)
+ collectionView.refreshControl = UIRefreshControl()
+ collectionView.refreshControl!.addTarget(self, action: #selector(refreshAccounts(_:)), for: .valueChanged)
+
+ if config.appearance == .sidebar {
+ // This defrosts the glass.
+ collectionView.backgroundColor = .clear
+ }
+ }
+
+ @IBAction func settings(_ sender: UIBarButtonItem) {
+ coordinator.showSettings()
+ }
+
+ // MARK: UICollectionViewDataSource
+
+ override func numberOfSections(in collectionView: UICollectionView) -> Int {
+ // #warning Incomplete implementation, return the number of sections
+ return coordinator.numberOfSections()
+ }
+
+
+ override func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
+ // #warning Incomplete implementation, return the number of items
+ return coordinator.numberOfRows(in: section)
+ }
+
+ override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
+ guard let node = coordinator.nodeFor(indexPath), let _ = node.representedObject as? Folder else {
+ let cell = collectionView.dequeueReusableCell(withReuseIdentifier: reuseIdentifier, for: indexPath) as? MainFeedCollectionViewCell
+ configure(cell!, indexPath: indexPath)
+ return cell!
+ }
+
+ let cell = collectionView.dequeueReusableCell(withReuseIdentifier: folderIdentifier, for: indexPath) as! MainFeedCollectionViewFolderCell
+ configure(cell, indexPath: indexPath)
+ cell.delegate = self
+ return cell
+
+ }
+
+ override func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView {
+ guard kind == UICollectionView.elementKindSectionHeader else {
+ return UICollectionReusableView()
+ }
+
+ let headerView = collectionView.dequeueReusableSupplementaryView(
+ ofKind: kind,
+ withReuseIdentifier: containerReuseIdentifier,
+ for: indexPath
+ ) as! MainFeedCollectionHeaderReusableView
+
+
+ guard let nameProvider = coordinator.rootNode.childAtIndex(indexPath.section)?.representedObject as? DisplayNameProvider else {
+ return UICollectionReusableView()
+ }
+
+ headerView.delegate = self
+ headerView.headerTitle.text = nameProvider.nameForDisplay
+
+ guard let sectionNode = coordinator.rootNode.childAtIndex(indexPath.section) else {
+ return headerView
+ }
+
+ if let account = sectionNode.representedObject as? Account {
+ headerView.unreadCount = account.unreadCount
+ } else {
+ headerView.unreadCount = 0
+ }
+
+ headerView.tag = indexPath.section
+ headerView.disclosureExpanded = coordinator.isExpanded(sectionNode)
+
+ if indexPath.section != 0 {
+ headerView.addInteraction(UIContextMenuInteraction(delegate: self))
+ }
+
+ return headerView
+ }
+
+ override func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
+ becomeFirstResponder()
+ coordinator.selectFeed(indexPath: indexPath, animations: [.navigation, .select, .scroll])
+ }
+
+ // MARK: UICollectionViewDelegate
+
+ /*
+ // Uncomment this method to specify if the specified item should be highlighted during tracking
+ override func collectionView(_ collectionView: UICollectionView, shouldHighlightItemAt indexPath: IndexPath) -> Bool {
+ return true
+ }
+ */
+
+
+ // Uncomment this method to specify if the specified item should be selected
+ override func collectionView(_ collectionView: UICollectionView, shouldSelectItemAt indexPath: IndexPath) -> Bool {
+ if traitCollection.userInterfaceIdiom == .pad { return true }
+ return !isAnimating
+ }
+
+
+
+ override func collectionView(_ collectionView: UICollectionView, shouldShowMenuForItemAt indexPath: IndexPath) -> Bool {
+ return true
+ }
+
+ override func collectionView(_ collectionView: UICollectionView, canPerformAction action: Selector, forItemAt indexPath: IndexPath, withSender sender: Any?) -> Bool {
+ return false
+ }
+
+ override func collectionView(_ collectionView: UICollectionView, performAction action: Selector, forItemAt indexPath: IndexPath, withSender sender: Any?) {
+
+ }
+
+ override func collectionView(_ collectionView: UICollectionView, contextMenuConfigurationForItemAt indexPath: IndexPath, point: CGPoint) -> UIContextMenuConfiguration? {
+ guard let feed = coordinator.nodeFor(indexPath)?.representedObject as? Feed else {
+ return nil
+ }
+ if feed is WebFeed {
+ return makeWebFeedContextMenu(indexPath: indexPath, includeDeleteRename: true)
+ } else if feed is Folder {
+ return makeFolderContextMenu(indexPath: indexPath)
+ } else if feed is PseudoFeed {
+ return makePseudoFeedContextMenu(indexPath: indexPath)
+ } else {
+ return nil
+ }
+ }
+
+ // MARK: - Key Commands
+
+ // MARK: Keyboard shortcuts
+
+ @objc func collapseAllExceptForGroupItems(_ sender: Any?) {
+ coordinator.collapseAllFolders()
+ }
+
+ @objc func collapseSelectedRows(_ sender: Any?) {
+ if let indexPath = coordinator.currentFeedIndexPath, let node = coordinator.nodeFor(indexPath) {
+ coordinator.collapse(node)
+ if let folder = collectionView.cellForItem(at: indexPath) as? MainFeedCollectionViewFolderCell {
+ folder.disclosureExpanded = false
+ }
+ }
+ }
+
+ @objc override func delete(_ sender: Any?) {
+ if let indexPath = coordinator.currentFeedIndexPath {
+ delete(indexPath: indexPath)
+ }
+ }
+
+ @objc func expandAll(_ sender: Any?) {
+ coordinator.expandAllSectionsAndFolders()
+ }
+
+ @objc func expandSelectedRows(_ sender: Any?) {
+ if let indexPath = coordinator.currentFeedIndexPath, let node = coordinator.nodeFor(indexPath) {
+ coordinator.expand(node)
+ if let folder = collectionView.cellForItem(at: indexPath) as? MainFeedCollectionViewFolderCell {
+ folder.disclosureExpanded = true
+ }
+ }
+ }
+
+ @objc func markAllAsRead(_ sender: Any) {
+ guard let indexPath = collectionView.indexPathsForSelectedItems?.first, let contentView = collectionView.cellForItem(at: indexPath)?.contentView else {
+ return
+ }
+
+ let title = NSLocalizedString("Mark All as Read", comment: "Mark All as Read")
+ MarkAsReadAlertController.confirm(self, coordinator: coordinator, confirmTitle: title, sourceType: contentView) { [weak self] in
+ self?.coordinator.markAllAsReadInTimeline()
+ }
+ }
+
+ @objc func navigateToTimeline(_ sender: Any?) {
+ coordinator.navigateToTimeline()
+ }
+
+ @objc func openInBrowser(_ sender: Any?) {
+ coordinator.showBrowserForCurrentFeed()
+ }
+
+ @objc func selectNextDown(_ sender: Any?) {
+ coordinator.selectNextFeed()
+ }
+
+ @objc func selectNextUp(_ sender: Any?) {
+ coordinator.selectPrevFeed()
+ }
+
+ @objc func showFeedInspector(_ sender: Any?) {
+ coordinator.showFeedInspector()
+ }
+
+
+
+ // MARK: - API
+
+ func focus() {
+ becomeFirstResponder()
+ }
+
+ func updateUI() {
+ if coordinator.isReadFeedsFiltered {
+ setFilterButtonToActive()
+ } else {
+ setFilterButtonToInactive()
+ }
+ addNewItemButton?.isEnabled = !AccountManager.shared.activeAccounts.isEmpty
+
+
+ configureContextMenu()
+ }
+
+
+ func updateFeedSelection(animations: Animations) {
+ if let indexPath = coordinator.currentFeedIndexPath {
+ collectionView.selectItemAndScrollIfNotVisible(at: indexPath, animations: animations)
+ } else {
+ if let indexPath = collectionView.indexPathsForSelectedItems?.first {
+ if animations.contains(.select) {
+ collectionView.deselectItem(at: indexPath, animated: true)
+ } else {
+ collectionView.deselectItem(at: indexPath, animated: false)
+ }
+ }
+ }
+ }
+
+ func openInAppBrowser() {
+ if let indexPath = coordinator.currentFeedIndexPath,
+ let url = coordinator.homePageURLForFeed(indexPath) {
+ let vc = SFSafariViewController(url: url)
+ vc.modalPresentationStyle = .overFullScreen
+ present(vc, animated: true)
+ }
+ }
+
+ func reloadFeeds(initialLoad: Bool, changes: ShadowTableChanges, completion: (() -> Void)? = nil) {
+ updateUI()
+
+ guard !initialLoad else {
+ collectionView.reloadData()
+ completion?()
+ return
+ }
+
+ collectionView.performBatchUpdates {
+ if let deletes = changes.deletes, !deletes.isEmpty {
+ collectionView.deleteSections(IndexSet(deletes))
+ }
+
+ if let inserts = changes.inserts, !inserts.isEmpty {
+ collectionView.insertSections(IndexSet(inserts))
+ }
+
+ if let moves = changes.moves, !moves.isEmpty {
+ for move in moves {
+ collectionView.moveSection(move.from, toSection: move.to)
+ }
+ }
+
+ if let rowChanges = changes.rowChanges {
+ for rowChange in rowChanges {
+ if let deletes = rowChange.deleteIndexPaths, !deletes.isEmpty {
+ collectionView.deleteItems(at: deletes)
+ }
+
+ if let inserts = rowChange.insertIndexPaths, !inserts.isEmpty {
+ collectionView.insertItems(at: inserts)
+ }
+
+ if let moves = rowChange.moveIndexPaths, !moves.isEmpty {
+ for move in moves {
+ collectionView.moveItem(at: move.0, to: move.1)
+ }
+ }
+ }
+ }
+ }
+
+ if let rowChanges = changes.rowChanges {
+ for rowChange in rowChanges {
+ if let reloads = rowChange.reloadIndexPaths, !reloads.isEmpty {
+ collectionView.reloadItems(at: reloads)
+ }
+ }
+ }
+
+ completion?()
+ }
+
+ func applyToAvailableCells(_ completion: (MainFeedCollectionViewCell, IndexPath) -> Void) {
+ collectionView.visibleCells.forEach { cell in
+ guard let indexPath = collectionView.indexPath(for: cell) else { return }
+ if let cell = collectionView.cellForItem(at: indexPath) as? MainFeedCollectionViewCell {
+ completion(cell, indexPath)
+ }
+ }
+ }
+
+ func configureIcon(_ cell: MainFeedCollectionViewCell, _ indexPath: IndexPath) {
+ guard let node = coordinator.nodeFor(indexPath), let feed = node.representedObject as? Feed, let feedID = feed.feedID else {
+ return
+ }
+ cell.iconImage = IconImageCache.shared.imageFor(feedID)
+ }
+
+ func configureIcon(_ cell: MainFeedCollectionViewFolderCell, _ indexPath: IndexPath) {
+ guard let node = coordinator.nodeFor(indexPath), let feed = node.representedObject as? Feed, let feedID = feed.feedID else {
+ return
+ }
+ cell.iconImage = IconImageCache.shared.imageFor(feedID)
+ }
+
+ func configureCellsForRepresentedObject(_ representedObject: AnyObject) {
+ //applyToCellsForRepresentedObject(representedObject, configure)
+ }
+
+ func applyToCellsForRepresentedObject(_ representedObject: AnyObject, _ completion: (MainFeedCollectionViewCell, IndexPath) -> Void) {
+ applyToAvailableCells { (cell, indexPath) in
+ if let node = coordinator.nodeFor(indexPath),
+ let representedFeed = representedObject as? Feed,
+ let candidate = node.representedObject as? Feed,
+ representedFeed.feedID == candidate.feedID {
+ completion(cell, indexPath)
+ }
+ }
+ }
+
+ func restoreSelectionIfNecessary(adjustScroll: Bool) {
+ if let indexPath = coordinator.mainFeedIndexPathForCurrentTimeline() {
+ if adjustScroll {
+ collectionView.selectItemAndScrollIfNotVisible(at: indexPath, animations: [])
+ } else {
+ collectionView.selectItem(at: indexPath, animated: false, scrollPosition: .centeredVertically)
+ }
+ }
+ }
+
+
+ // MARK: - Private
+
+
+ /// Configure standard feed cells
+ func configure(_ cell: MainFeedCollectionViewCell, indexPath: IndexPath) {
+ guard let node = coordinator.nodeFor(indexPath) else { return }
+ var indentationLevel = 0
+ if let _ = node.parent?.representedObject as? Folder {
+ indentationLevel = 1
+ }
+
+ if let feed = node.representedObject as? Feed {
+ cell.feedTitle.text = feed.nameForDisplay
+ cell.unreadCount = feed.unreadCount
+ cell.indentationLevel = indentationLevel
+ configureIcon(cell, indexPath)
+ }
+ }
+
+ /// Configure folders
+ func configure(_ cell: MainFeedCollectionViewFolderCell, indexPath: IndexPath) {
+ guard let node = coordinator.nodeFor(indexPath) else { return }
+
+ if let folder = node.representedObject as? Folder {
+ cell.folderTitle.text = folder.nameForDisplay
+ cell.unreadCount = folder.unreadCount
+ configureIcon(cell, indexPath)
+ }
+
+ if let containerID = (node.representedObject as? Container)?.containerID {
+ cell.setDisclosure(isExpanded: coordinator.isExpanded(containerID), animated: false)
+ }
+ }
+
+ private func headerViewForAccount(_ account: Account) -> MainFeedCollectionHeaderReusableView? {
+
+ guard let node = coordinator.rootNode.childNodeRepresentingObject(account),
+ let sectionIndex = coordinator.rootNode.indexOfChild(node) else {
+ return nil
+ }
+ if sectionIndex == 0 { return nil }
+
+ return collectionView.supplementaryView(forElementKind: UICollectionView.elementKindSectionHeader, at: IndexPath(item: 0, section: sectionIndex)) as? MainFeedCollectionHeaderReusableView
+ }
+
+ private func reloadAllVisibleCells(completion: (() -> Void)? = nil) {
+ guard let indexPaths = collectionView.indexPathsForSelectedItems else { return }
+ collectionView.reloadItems(at: indexPaths)
+ restoreSelectionIfNecessary(adjustScroll: false)
+ }
+
+ func setFilterButtonToActive() {
+ filterButton.tintColor = AppAssets.primaryAccentColor
+ filterButton?.accLabelText = NSLocalizedString("Selected - Filter Read Feeds", comment: "Selected - Filter Read Feeds")
+ }
+
+ func setFilterButtonToInactive() {
+ filterButton.tintColor = nil
+ filterButton?.accLabelText = NSLocalizedString("Filter Read Feeds", comment: "Filter Read Feeds")
+ }
+
+
+
+ // MARK: - Notifications
+
+
+ @objc func preferredContentSizeCategoryDidChange() {
+ IconImageCache.shared.emptyCache()
+ reloadAllVisibleCells()
+ }
+
+ @objc func unreadCountDidChange(_ note: Notification) {
+ updateUI()
+
+ guard let unreadCountProvider = note.object as? UnreadCountProvider else {
+ return
+ }
+
+ if let account = unreadCountProvider as? Account {
+ if let headerView = headerViewForAccount(account) {
+ headerView.unreadCount = account.unreadCount
+ }
+ return
+ }
+
+ var node: Node? = nil
+ if let coordinator = unreadCountProvider as? SceneCoordinator, let feed = coordinator.timelineFeed {
+ node = coordinator.rootNode.descendantNodeRepresentingObject(feed as AnyObject)
+ } else {
+ node = coordinator.rootNode.descendantNodeRepresentingObject(unreadCountProvider as AnyObject)
+ }
+
+ guard let unreadCountNode = node, let indexPath = coordinator.indexPathFor(unreadCountNode) else { return }
+
+ if let cell = collectionView.cellForItem(at: indexPath) as? MainFeedCollectionViewCell {
+ cell.unreadCount = unreadCountProvider.unreadCount
+ }
+
+ if let cell = collectionView.cellForItem(at: indexPath) as? MainFeedCollectionViewFolderCell {
+ cell.unreadCount = unreadCountProvider.unreadCount
+ }
+ }
+
+ @objc func webFeedSettingDidChange(_ note: Notification) {
+ guard let webFeed = note.object as? WebFeed, let key = note.userInfo?[WebFeed.WebFeedSettingUserInfoKey] as? String else {
+ return
+ }
+ if key == WebFeed.WebFeedSettingKey.homePageURL || key == WebFeed.WebFeedSettingKey.faviconURL {
+ configureCellsForRepresentedObject(webFeed)
+ }
+ }
+
+ @objc func faviconDidBecomeAvailable(_ note: Notification) {
+ applyToAvailableCells(configureIcon)
+ }
+
+ @objc func webFeedIconDidBecomeAvailable(_ note: Notification) {
+ guard let webFeed = note.userInfo?[UserInfoKey.webFeed] as? WebFeed else {
+ return
+ }
+ applyToCellsForRepresentedObject(webFeed, configureIcon(_:_:))
+ }
+
+ // MARK: - Actions
+ @objc
+ func configureContextMenu(_: Any? = nil) {
+ /*
+ Context Menu Order:
+ 1. Add Web Feed
+ 2. Add Folder
+ */
+
+ var menuItems: [UIAction] = []
+
+ let addWebFeedActionTitle = NSLocalizedString("Add Feed", comment: "Add Feed")
+ let addWebFeedAction = UIAction(title: addWebFeedActionTitle, image: AppAssets.plus) { _ in
+ self.coordinator.showAddWebFeed()
+ }
+ menuItems.append(addWebFeedAction)
+
+ let addWebFolderActionTitle = NSLocalizedString("Add Folder", comment: "Add Folder")
+ let addWebFolderAction = UIAction(title: addWebFolderActionTitle, image: AppAssets.folderOutlinePlus) { _ in
+ self.coordinator.showAddFolder()
+ }
+
+ menuItems.append(addWebFolderAction)
+
+ let contextMenu = UIMenu(title: NSLocalizedString("Add Item", comment: "Add Item"), image: nil, identifier: nil, options: [], children: menuItems.reversed())
+
+ self.addNewItemButton.menu = contextMenu
+ }
+
+ @objc func refreshAccounts(_ sender: Any) {
+ collectionView.refreshControl?.endRefreshing()
+
+ // This is a hack to make sure that an error dialog doesn't interfere with dismissing the refreshControl.
+ // If the error dialog appears too closely to the call to endRefreshing, then the refreshControl never disappears.
+ DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
+ appDelegate.manualRefresh(errorHandler: ErrorHandler.present(self))
+ }
+ }
+
+
+ @IBAction func toggleFilter(_ sender: Any) {
+ coordinator.toggleReadFeedsFilter()
+ }
+
+
+ func toggle(_ headerView: MainFeedCollectionHeaderReusableView) {
+ guard let sectionNode = coordinator.rootNode.childAtIndex(headerView.tag) else {
+ return
+ }
+
+ if coordinator.isExpanded(sectionNode) {
+ headerView.disclosureExpanded = false
+ coordinator.collapse(sectionNode)
+ } else {
+ headerView.disclosureExpanded = true
+ coordinator.expand(sectionNode)
+ }
+ }
+
+}
+
+extension MainFeedCollectionViewController: MainFeedCollectionHeaderReusableViewDelegate {
+ func mainFeedCollectionHeaderReusableViewDidTapDisclosureIndicator(_ view: MainFeedCollectionHeaderReusableView) {
+ toggle(view)
+ }
+
+}
+
+
+extension MainFeedCollectionViewController: MainFeedCollectionViewFolderCellDelegate {
+ func mainFeedCollectionFolderViewCellDisclosureDidToggle(_ sender: MainFeedCollectionViewFolderCell, expanding: Bool) {
+ if expanding {
+ expand(sender)
+ } else {
+ collapse(sender)
+ }
+ }
+
+
+ func expand(_ cell: MainFeedCollectionViewFolderCell) {
+ guard let indexPath = collectionView.indexPath(for: cell), let node = coordinator.nodeFor(indexPath) else {
+ return
+ }
+ coordinator.expand(node)
+ }
+
+ func collapse(_ cell: MainFeedCollectionViewFolderCell) {
+ guard let indexPath = collectionView.indexPath(for: cell), let node = coordinator.nodeFor(indexPath) else {
+ return
+ }
+ coordinator.collapse(node)
+ }
+
+
+
+}
+
+
+extension MainFeedCollectionViewController: UIContextMenuInteractionDelegate {
+ func contextMenuInteraction(_ interaction: UIContextMenuInteraction, configurationForMenuAtLocation location: CGPoint) -> UIContextMenuConfiguration? {
+
+ guard let sectionIndex = interaction.view?.tag,
+ let sectionNode = coordinator.rootNode.childAtIndex(sectionIndex),
+ let account = sectionNode.representedObject as? Account
+ else {
+ return nil
+ }
+
+ return UIContextMenuConfiguration(identifier: sectionIndex as NSCopying, previewProvider: nil) { suggestedActions in
+
+ var menuElements = [UIMenuElement]()
+ menuElements.append(UIMenu(title: "", options: .displayInline, children: [self.getAccountInfoAction(account: account)]))
+
+ if let markAllAction = self.markAllAsReadAction(account: account, contentView: interaction.view) {
+ menuElements.append(UIMenu(title: "", options: .displayInline, children: [markAllAction]))
+ }
+
+ menuElements.append(UIMenu(title: "", options: .displayInline, children: [self.deactivateAccountAction(account: account)]))
+
+ return UIMenu(title: "", children: menuElements)
+ }
+ }
+
+ func contextMenuInteraction(_ interaction: UIContextMenuInteraction, previewForHighlightingMenuWithConfiguration configuration: UIContextMenuConfiguration) -> UITargetedPreview? {
+
+ guard let sectionIndex = configuration.identifier as? Int,
+ let cell = collectionView.supplementaryView(forElementKind: UICollectionView.elementKindSectionHeader, at: IndexPath(item: 0, section: sectionIndex)) as? MainFeedCollectionHeaderReusableView else {
+ return nil
+ }
+
+
+ return UITargetedPreview(view: cell, parameters: CroppingPreviewParameters(view: cell))
+ }
+
+
+}
+
+extension MainFeedCollectionViewController {
+ func makeWebFeedContextMenu(indexPath: IndexPath, includeDeleteRename: Bool) -> UIContextMenuConfiguration {
+ return UIContextMenuConfiguration(identifier: MainFeedRowIdentifier(indexPath: indexPath), previewProvider: nil, actionProvider: { [ weak self] suggestedActions in
+
+ guard let self = self else { return nil }
+
+ var menuElements = [UIMenuElement]()
+
+ if let inspectorAction = self.getInfoAction(indexPath: indexPath) {
+ menuElements.append(UIMenu(title: "", options: .displayInline, children: [inspectorAction]))
+ }
+
+ if let homePageAction = self.homePageAction(indexPath: indexPath) {
+ menuElements.append(UIMenu(title: "", options: .displayInline, children: [homePageAction]))
+ }
+
+ var pageActions = [UIAction]()
+ if let copyFeedPageAction = self.copyFeedPageAction(indexPath: indexPath) {
+ pageActions.append(copyFeedPageAction)
+ }
+ if let copyHomePageAction = self.copyHomePageAction(indexPath: indexPath) {
+ pageActions.append(copyHomePageAction)
+ }
+ if !pageActions.isEmpty {
+ menuElements.append(UIMenu(title: "", options: .displayInline, children: pageActions))
+ }
+
+ if let markAllAction = self.markAllAsReadAction(indexPath: indexPath) {
+ menuElements.append(UIMenu(title: "", options: .displayInline, children: [markAllAction]))
+ }
+
+ if includeDeleteRename {
+ menuElements.append(UIMenu(title: "",
+ options: .displayInline,
+ children: [
+ self.renameAction(indexPath: indexPath),
+ self.deleteAction(indexPath: indexPath)
+ ]))
+ }
+
+ return UIMenu(title: "", children: menuElements)
+
+ })
+
+ }
+
+ func makeFolderContextMenu(indexPath: IndexPath) -> UIContextMenuConfiguration {
+ return UIContextMenuConfiguration(identifier: MainFeedRowIdentifier(indexPath: indexPath), previewProvider: nil, actionProvider: { [weak self] suggestedActions in
+
+ guard let self = self else { return nil }
+
+ var menuElements = [UIMenuElement]()
+
+ if let markAllAction = self.markAllAsReadAction(indexPath: indexPath) {
+ menuElements.append(UIMenu(title: "", options: .displayInline, children: [markAllAction]))
+ }
+
+ menuElements.append(UIMenu(title: "",
+ options: .displayInline,
+ children: [
+ self.renameAction(indexPath: indexPath),
+ self.deleteAction(indexPath: indexPath)
+ ]))
+
+ return UIMenu(title: "", children: menuElements)
+
+ })
+ }
+
+ func makePseudoFeedContextMenu(indexPath: IndexPath) -> UIContextMenuConfiguration? {
+ guard let markAllAction = self.markAllAsReadAction(indexPath: indexPath) else {
+ return nil
+ }
+
+ return UIContextMenuConfiguration(identifier: MainFeedRowIdentifier(indexPath: indexPath), previewProvider: nil, actionProvider: { suggestedActions in
+ return UIMenu(title: "", children: [markAllAction])
+ })
+ }
+
+ func homePageAction(indexPath: IndexPath) -> UIAction? {
+ guard coordinator.homePageURLForFeed(indexPath) != nil else {
+ return nil
+ }
+
+ let title = NSLocalizedString("Open Home Page", comment: "Open Home Page")
+ let action = UIAction(title: title, image: AppAssets.safariImage) { [weak self] action in
+ self?.coordinator.showBrowserForFeed(indexPath)
+ }
+ return action
+ }
+
+ func homePageAlertAction(indexPath: IndexPath, completion: @escaping (Bool) -> Void) -> UIAlertAction? {
+ guard coordinator.homePageURLForFeed(indexPath) != nil else {
+ return nil
+ }
+
+ let title = NSLocalizedString("Open Home Page", comment: "Open Home Page")
+ let action = UIAlertAction(title: title, style: .default) { [weak self] action in
+ self?.coordinator.showBrowserForFeed(indexPath)
+ completion(true)
+ }
+ return action
+ }
+
+ func copyFeedPageAction(indexPath: IndexPath) -> UIAction? {
+ guard let webFeed = coordinator.nodeFor(indexPath)?.representedObject as? WebFeed,
+ let url = URL(string: webFeed.url) else {
+ return nil
+ }
+
+ let title = NSLocalizedString("Copy Feed URL", comment: "Copy Feed URL")
+ let action = UIAction(title: title, image: AppAssets.copyImage) { action in
+ UIPasteboard.general.url = url
+ }
+ return action
+ }
+
+ func copyFeedPageAlertAction(indexPath: IndexPath, completion: @escaping (Bool) -> Void) -> UIAlertAction? {
+ guard let webFeed = coordinator.nodeFor(indexPath)?.representedObject as? WebFeed,
+ let url = URL(string: webFeed.url) else {
+ return nil
+ }
+
+ let title = NSLocalizedString("Copy Feed URL", comment: "Copy Feed URL")
+ let action = UIAlertAction(title: title, style: .default) { action in
+ UIPasteboard.general.url = url
+ completion(true)
+ }
+ return action
+ }
+
+ func copyHomePageAction(indexPath: IndexPath) -> UIAction? {
+ guard let webFeed = coordinator.nodeFor(indexPath)?.representedObject as? WebFeed,
+ let homePageURL = webFeed.homePageURL,
+ let url = URL(string: homePageURL) else {
+ return nil
+ }
+
+ let title = NSLocalizedString("Copy Home Page URL", comment: "Copy Home Page URL")
+ let action = UIAction(title: title, image: AppAssets.copyImage) { action in
+ UIPasteboard.general.url = url
+ }
+ return action
+ }
+
+ func copyHomePageAlertAction(indexPath: IndexPath, completion: @escaping (Bool) -> Void) -> UIAlertAction? {
+ guard let webFeed = coordinator.nodeFor(indexPath)?.representedObject as? WebFeed,
+ let homePageURL = webFeed.homePageURL,
+ let url = URL(string: homePageURL) else {
+ return nil
+ }
+
+ let title = NSLocalizedString("Copy Home Page URL", comment: "Copy Home Page URL")
+ let action = UIAlertAction(title: title, style: .default) { action in
+ UIPasteboard.general.url = url
+ completion(true)
+ }
+ return action
+ }
+
+ func markAllAsReadAlertAction(indexPath: IndexPath, completion: @escaping (Bool) -> Void) -> UIAlertAction? {
+ guard let webFeed = coordinator.nodeFor(indexPath)?.representedObject as? WebFeed,
+ webFeed.unreadCount > 0,
+ let articles = try? webFeed.fetchArticles(), let contentView = self.collectionView.cellForItem(at: indexPath)?.contentView else {
+ return nil
+ }
+
+ let localizedMenuText = NSLocalizedString("Mark All as Read in “%@”", comment: "Command")
+ let title = NSString.localizedStringWithFormat(localizedMenuText as NSString, webFeed.nameForDisplay) as String
+ let cancel = {
+ completion(true)
+ }
+
+
+ let action = UIAlertAction(title: title, style: .default) { [weak self] action in
+ MarkAsReadAlertController.confirm(self, coordinator: self?.coordinator, confirmTitle: title, sourceType: contentView, cancelCompletion: cancel) { [weak self] in
+ self?.coordinator.markAllAsRead(Array(articles))
+ completion(true)
+ }
+ }
+ return action
+ }
+
+ func deleteAction(indexPath: IndexPath) -> UIAction {
+ let title = NSLocalizedString("Delete", comment: "Delete")
+
+ let action = UIAction(title: title, image: AppAssets.trashImage, attributes: .destructive) { [weak self] action in
+ self?.delete(indexPath: indexPath)
+ }
+ return action
+ }
+
+ func renameAction(indexPath: IndexPath) -> UIAction {
+ let title = NSLocalizedString("Rename", comment: "Rename")
+ let action = UIAction(title: title, image: AppAssets.editImage) { [weak self] action in
+ self?.rename(indexPath: indexPath)
+ }
+ return action
+ }
+
+ func getInfoAction(indexPath: IndexPath) -> UIAction? {
+ guard let webFeed = coordinator.nodeFor(indexPath)?.representedObject as? WebFeed else {
+ return nil
+ }
+
+ let title = NSLocalizedString("Get Info", comment: "Get Info")
+ let action = UIAction(title: title, image: AppAssets.infoImage) { [weak self] action in
+ self?.coordinator.showFeedInspector(for: webFeed)
+ }
+ return action
+ }
+
+ func getAccountInfoAction(account: Account) -> UIAction {
+ let title = NSLocalizedString("Get Info", comment: "Get Info")
+ let action = UIAction(title: title, image: AppAssets.infoImage) { [weak self] action in
+ self?.coordinator.showAccountInspector(for: account)
+ }
+ return action
+ }
+
+ func deactivateAccountAction(account: Account) -> UIAction {
+ let title = NSLocalizedString("Deactivate", comment: "Deactivate")
+ let action = UIAction(title: title, image: AppAssets.deactivateImage) { action in
+ account.isActive = false
+ }
+ return action
+ }
+
+ func getInfoAlertAction(indexPath: IndexPath, completion: @escaping (Bool) -> Void) -> UIAlertAction? {
+ guard let webFeed = coordinator.nodeFor(indexPath)?.representedObject as? WebFeed else {
+ return nil
+ }
+
+ let title = NSLocalizedString("Get Info", comment: "Get Info")
+ let action = UIAlertAction(title: title, style: .default) { [weak self] action in
+ self?.coordinator.showFeedInspector(for: webFeed)
+ completion(true)
+ }
+ return action
+ }
+
+ func markAllAsReadAction(indexPath: IndexPath) -> UIAction? {
+ guard let feed = coordinator.nodeFor(indexPath)?.representedObject as? Feed,
+ let contentView = self.collectionView.cellForItem(at: indexPath)?.contentView,
+ feed.unreadCount > 0 else {
+ return nil
+ }
+
+ let localizedMenuText = NSLocalizedString("Mark All as Read in “%@”", comment: "Command")
+ let title = NSString.localizedStringWithFormat(localizedMenuText as NSString, feed.nameForDisplay) as String
+ let action = UIAction(title: title, image: AppAssets.markAllAsReadImage) { [weak self] action in
+ MarkAsReadAlertController.confirm(self, coordinator: self?.coordinator, confirmTitle: title, sourceType: contentView) { [weak self] in
+ if let articles = try? feed.fetchUnreadArticles() {
+ self?.coordinator.markAllAsRead(Array(articles))
+ }
+ }
+ }
+
+ return action
+ }
+
+ func markAllAsReadAction(account: Account, contentView: UIView?) -> UIAction? {
+ guard account.unreadCount > 0, let contentView = contentView else {
+ return nil
+ }
+
+ let localizedMenuText = NSLocalizedString("Mark All as Read in “%@”", comment: "Command")
+ let title = NSString.localizedStringWithFormat(localizedMenuText as NSString, account.nameForDisplay) as String
+ let action = UIAction(title: title, image: AppAssets.markAllAsReadImage) { [weak self] action in
+ MarkAsReadAlertController.confirm(self, coordinator: self?.coordinator, confirmTitle: title, sourceType: contentView) { [weak self] in
+ // If you don't have this delay the screen flashes when it executes this code
+ DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
+ if let articles = try? account.fetchArticles(.unread()) {
+ self?.coordinator.markAllAsRead(Array(articles))
+ }
+ }
+ }
+ }
+
+ return action
+ }
+
+
+ func rename(indexPath: IndexPath) {
+ guard let feed = coordinator.nodeFor(indexPath)?.representedObject as? Feed else { return }
+
+ let formatString = NSLocalizedString("Rename “%@”", comment: "Rename feed")
+ let title = NSString.localizedStringWithFormat(formatString as NSString, feed.nameForDisplay) as String
+
+ let alertController = UIAlertController(title: title, message: nil, preferredStyle: .alert)
+
+ let cancelTitle = NSLocalizedString("Cancel", comment: "Cancel")
+ alertController.addAction(UIAlertAction(title: cancelTitle, style: .cancel))
+
+ let renameTitle = NSLocalizedString("Rename", comment: "Rename")
+ let renameAction = UIAlertAction(title: renameTitle, style: .default) { [weak self] action in
+
+ guard let name = alertController.textFields?[0].text, !name.isEmpty else {
+ return
+ }
+
+ if let webFeed = feed as? WebFeed {
+ webFeed.rename(to: name) { result in
+ switch result {
+ case .success:
+ break
+ case .failure(let error):
+ self?.presentError(error)
+ }
+ }
+ } else if let folder = feed as? Folder {
+ folder.rename(to: name) { result in
+ switch result {
+ case .success:
+ break
+ case .failure(let error):
+ self?.presentError(error)
+ }
+ }
+ }
+
+ }
+
+ alertController.addAction(renameAction)
+ alertController.preferredAction = renameAction
+
+ alertController.addTextField() { textField in
+ textField.text = feed.nameForDisplay
+ textField.placeholder = NSLocalizedString("Name", comment: "Name")
+ }
+
+ self.present(alertController, animated: true) {
+
+ }
+
+ }
+
+ func delete(indexPath: IndexPath) {
+ guard let feed = coordinator.nodeFor(indexPath)?.representedObject as? Feed else { return }
+
+ let title: String
+ let message: String
+ if feed is Folder {
+ title = NSLocalizedString("Delete Folder", comment: "Delete folder")
+ let localizedInformativeText = NSLocalizedString("Are you sure you want to delete the “%@” folder?", comment: "Folder delete text")
+ message = NSString.localizedStringWithFormat(localizedInformativeText as NSString, feed.nameForDisplay) as String
+ } else {
+ title = NSLocalizedString("Delete Feed", comment: "Delete feed")
+ let localizedInformativeText = NSLocalizedString("Are you sure you want to delete the “%@” feed?", comment: "Feed delete text")
+ message = NSString.localizedStringWithFormat(localizedInformativeText as NSString, feed.nameForDisplay) as String
+ }
+
+ let alertController = UIAlertController(title: title, message: message, preferredStyle: .alert)
+
+ let cancelTitle = NSLocalizedString("Cancel", comment: "Cancel")
+ alertController.addAction(UIAlertAction(title: cancelTitle, style: .cancel))
+
+ let deleteTitle = NSLocalizedString("Delete", comment: "Delete")
+ let deleteAction = UIAlertAction(title: deleteTitle, style: .destructive) { [weak self] action in
+ self?.performDelete(indexPath: indexPath)
+ }
+ alertController.addAction(deleteAction)
+ alertController.preferredAction = deleteAction
+
+ self.present(alertController, animated: true)
+ }
+
+ func performDelete(indexPath: IndexPath) {
+ guard let undoManager = undoManager,
+ let deleteNode = coordinator.nodeFor(indexPath),
+ let deleteCommand = DeleteCommand(nodesToDelete: [deleteNode], undoManager: undoManager, errorHandler: ErrorHandler.present(self)) else {
+ return
+ }
+
+ if let folder = deleteNode.representedObject as? Folder {
+ ActivityManager.cleanUp(folder)
+ } else if let feed = deleteNode.representedObject as? WebFeed {
+ ActivityManager.cleanUp(feed)
+ }
+
+ if indexPath == coordinator.currentFeedIndexPath {
+ coordinator.selectFeed(indexPath: nil)
+ }
+
+ pushUndoableCommand(deleteCommand)
+ deleteCommand.perform()
+ }
+}
+
diff --git a/iOS/MainTimeline/MainTimelineTitleView.xib b/iOS/MainTimeline/MainTimelineTitleView.xib
index 2c75c4244..80ab3c45d 100644
--- a/iOS/MainTimeline/MainTimelineTitleView.xib
+++ b/iOS/MainTimeline/MainTimelineTitleView.xib
@@ -1,8 +1,8 @@
-
+
-
+
@@ -14,7 +14,7 @@
-
+
@@ -25,7 +25,7 @@