diff --git a/Shared/Dinosaurs/DinosaursViewModel.swift b/Shared/Dinosaurs/DinosaursViewModel.swift index fcc34fac6..95fd39f87 100644 --- a/Shared/Dinosaurs/DinosaursViewModel.swift +++ b/Shared/Dinosaurs/DinosaursViewModel.swift @@ -29,6 +29,7 @@ struct DinosaurRow: Identifiable { let containers: [Container] } +@Observable @MainActor final class DinosaursViewModel { private(set) var rows = [DinosaurRow]() diff --git a/Shared/Localizable.xcstrings b/Shared/Localizable.xcstrings index 7d8d90532..64a8e0dd6 100644 --- a/Shared/Localizable.xcstrings +++ b/Shared/Localizable.xcstrings @@ -39,9 +39,19 @@ "%i Unread" : { "comment" : "14 Unread" }, + "%lld months" : { + "comment" : "Dinosaur staleness threshold in months" + }, + "🦖 Dinosaurs" : { + "comment" : "The title of the Dinosaurs screen.", + "isCommentAutoGenerated" : true + }, "A web browser will open the Feedly login for you to authorize access." : { "comment" : "Alert informative text when adding a Feedly account and waiting for authorization from the user." }, + "Account" : { + "comment" : "Account" + }, "Account Error" : { "comment" : "Account Error" }, @@ -105,6 +115,9 @@ "Are you sure you want to delete the feed “%@”?" : { "comment" : "Delete feed alert message" }, + "Are you sure you want to delete the feed ”%@”?" : { + "comment" : "Delete feed confirmation text." + }, "Are you sure you want to delete the theme “%@”?." : { "comment" : "Delete Theme Message" }, @@ -220,7 +233,7 @@ "comment" : "Command" }, "Copy Feed URL" : { - "comment" : "Command" + "comment" : "Command\nCopy Feed URL" }, "Copy Home Page URL" : { "comment" : "Command" @@ -256,7 +269,7 @@ "comment" : "Default" }, "Delete" : { - "comment" : "Delete button" + "comment" : "Delete\nDelete button" }, "Delete Feed" : { "comment" : "Delete Feed" @@ -548,6 +561,12 @@ "Large" : { "comment" : "Large" }, + "Last Article" : { + "comment" : "Last Article Date" + }, + "Last Response" : { + "comment" : "Last HTTP Response" + }, "Light" : { "comment" : "Light" }, @@ -620,6 +639,10 @@ "Medium" : { "comment" : "Medium" }, + "Menu: Show Feed, Open Home Page, Copy Feed URL" : { + "comment" : "A menu that displays the options to show the feed, open the feed's home page, and copy the feed's URL.", + "isCommentAutoGenerated" : true + }, "More" : { "comment" : "More\nMore menu label" }, @@ -708,7 +731,7 @@ "comment" : "Open" }, "Open Home Page" : { - "comment" : "Command" + "comment" : "Command\nOpen Home Page" }, "Open in Browser" : { "comment" : "Command" @@ -872,9 +895,15 @@ "Share…" : { "comment" : "Share…" }, + "Show Feed" : { + "comment" : "Show Feed" + }, "Show Feed Article" : { "comment" : "Show Feed Article" }, + "Show feeds that haven’t updated in…" : { + "comment" : "Show stale feeds text" + }, "Show notifications for new articles" : { "comment" : "Show notifications for new articles" }, @@ -987,6 +1016,9 @@ "Theme installed" : { "comment" : "Theme installed" }, + "There are no dinosaurs. All feeds have published articles within the last %lld months." : { + "comment" : "No dinosaurs footer text." + }, "There is already a Feedbin account with that username created." : { "comment" : "Duplicate Error" }, diff --git a/iOS/MainTimeline/MainTimelineModernViewController.swift b/iOS/MainTimeline/MainTimelineModernViewController.swift index ef1907f9f..b7805c5e1 100644 --- a/iOS/MainTimeline/MainTimelineModernViewController.swift +++ b/iOS/MainTimeline/MainTimelineModernViewController.swift @@ -397,7 +397,7 @@ final class MainTimelineModernViewController: UIViewController, UndoableCommandR guard let dataSource = self.dataSource else { return } - dataSource.apply(snapshot, animatingDifferences: false) { [weak self] in + dataSource.apply(snapshot, animatingDifferences: false) { [weak self = self] in self?.restoreSelectionIfNecessary(adjustScroll: false) } }) diff --git a/iOS/Settings/DinosaurRowView.swift b/iOS/Settings/DinosaurRowView.swift new file mode 100644 index 000000000..d97e85e04 --- /dev/null +++ b/iOS/Settings/DinosaurRowView.swift @@ -0,0 +1,57 @@ +// +// DinosaurRowView.swift +// NetNewsWire +// +// Created by Stuart Breckenridge on 10/06/2026. +// Copyright © 2026 Ranchero Software. All rights reserved. +// + +import SwiftUI + +struct DinosaurRowView: View { + + // MARK: Variables + var dinosaur: DinosaurRow + + var body: some View { + VStack(alignment: .leading) { + HStack(alignment: .top) { + if let img = IconImageCache.shared.imageFor(dinosaur.feed.sidebarItemID!) { + IconImageView(icon: img) + } else if let img = dinosaur.feed.smallIcon { + IconImageView(icon: img) + } + VStack(alignment: .leading) { + Text(verbatim: dinosaur.feedName) + .font(.headline) + Text(verbatim: dinosaur.feedURL) + .font(.caption) + .monospaced() + LabeledContent { + Text(verbatim: dinosaur.accountName) + } label: { + Text("Account", comment: "Account") + } + .font(.caption) + if let lastArticleDate = dinosaur.lastArticleDate { + LabeledContent { + Text(verbatim: lastArticleDate.formatted(date: .abbreviated, time: .shortened)) + } label: { + Text("Last Article", comment: "Last Article Date") + } + .font(.caption) + } + if let lastResponseCode = dinosaur.lastResponseCode { + LabeledContent { + Text(verbatim: lastResponseCode.formatted()) + } label: { + Text("Last Response", comment: "Last HTTP Response") + } + .font(.caption) + } + } + } + + } + } +} diff --git a/iOS/Settings/DinosaursView.swift b/iOS/Settings/DinosaursView.swift new file mode 100644 index 000000000..50c03f51a --- /dev/null +++ b/iOS/Settings/DinosaursView.swift @@ -0,0 +1,112 @@ +// +// DinosaursView.swift +// NetNewsWire-iOS +// +// Created by Stuart Breckenridge on 09/06/2026. +// Copyright © 2026 Ranchero Software. All rights reserved. +// + +import SwiftUI + +struct DinosaursView: View { + + // MARK: State + @State private var model = DinosaursViewModel() + @State private var dinosaurPendingDeletion: DinosaurRow? + @State private var showDeleteConfirmation = false + + // MARK: Constants + let dismissAndPresent: (_ dinosaur: DinosaurRow) -> Void + + var body: some View { + List { + Section { + ForEach(model.rows) { dinosaur in + DinosaurRowView(dinosaur: dinosaur) + .swipeActions(edge: .trailing, allowsFullSwipe: false) { + Button { + dinosaurPendingDeletion = dinosaur + showDeleteConfirmation = true + } label: { + Image(systemName: "trash") + } + .tint(.red) + .help("Delete Feed") + + Menu { + Button { + dismissAndPresent(dinosaur) + } label: { + Text("Show Feed", comment: "Show Feed") + Image(systemName: "arrow.up.right") + } + Button { + guard let homePage = dinosaur.feed.homePageURL, + let url = URL(string: homePage) else { return } + UIApplication.shared.open(url) + } label: { + Text("Open Home Page", comment: "Open Home Page") + Image(systemName: "safari") + } + + Button { + UIPasteboard.general.string = dinosaur.feedURL + } label: { + Text("Copy Feed URL", comment: "Copy Feed URL") + Image(systemName: "document.on.document") + } + } label: { + Image(systemName: "ellipsis") + } + .help("Menu: Show Feed, Open Home Page, Copy Feed URL") + } + } + } header: { + VStack(alignment: .leading) { + Text("Show feeds that haven’t updated in…", comment: "Show stale feeds text") + .font(.subheadline) + Picker("", selection: $model.monthThreshold) { + ForEach([3, 6, 12, 24], id: \.self) { month in + Text("\(month) months", comment: "Dinosaur staleness threshold in months").tag(month) + } + } + .pickerStyle(.segmented) + .onChange(of: model.monthThreshold) { + Task { @MainActor in + await model.refresh() + } + } + } + } footer: { + if model.rows.count == 0 { + Text("There are no dinosaurs. All feeds have published articles within the last \(model.monthThreshold) months.", comment: "No dinosaurs footer text.") + } + } + } + .navigationTitle("🦖 Dinosaurs") + .navigationBarTitleDisplayMode(.inline) + .task { + await model.refresh() + } + .alert("Delete Feed", isPresented: $showDeleteConfirmation, actions: { + Button(role: .destructive) { + if let dinosaur = dinosaurPendingDeletion { + let deletion = DinosaurDeletion(feed: dinosaur.feed, + account: dinosaur.account, + containers: dinosaur.account.existingContainers(withFeed: dinosaur.feed)) + model.performDeletions([deletion]) + Task { @MainActor in + await model.refresh() + } + dinosaurPendingDeletion = nil + } + + } label: { + Text("Delete", comment: "Delete") + } + }, message: { + Text("Are you sure you want to delete the feed ”\(dinosaurPendingDeletion?.feedName ?? "")”?", comment: "Delete feed confirmation text.") + }) + + } +} diff --git a/iOS/Settings/Settings.storyboard b/iOS/Settings/Settings.storyboard index 60a43e6cd..dd5f31a06 100644 --- a/iOS/Settings/Settings.storyboard +++ b/iOS/Settings/Settings.storyboard @@ -1,8 +1,8 @@ - + - + @@ -131,7 +131,7 @@ - + @@ -143,7 +143,7 @@ - + @@ -164,7 +164,7 @@ - + @@ -172,7 +172,7 @@ - + @@ -197,7 +197,7 @@ - + @@ -209,7 +209,7 @@ - + @@ -217,20 +217,20 @@ - + - + - - + @@ -277,7 +277,7 @@ - + @@ -309,20 +309,20 @@ - + - + - + @@ -333,7 +333,7 @@ - + @@ -343,7 +343,7 @@ - + @@ -356,7 +356,7 @@ - + @@ -375,7 +375,7 @@ - + @@ -384,7 +384,7 @@ - + @@ -397,7 +397,7 @@ - + @@ -415,7 +415,7 @@ - + @@ -429,10 +429,10 @@ - + - +