mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2026-12-02 02:22:25 +00:00
Create iOS Current Activity screen. Create and use shared CurrentActivityViewModel.
This commit is contained in:
1 parent
d199dd5c79
commit
5e8a3ac0df
8 files changed
+312
-129
No files matched your search
@@ -28,7 +28,7 @@ final class CloudKitStatsScanStatusView: NSView {
|
||||
spinner.startAnimation(nil)
|
||||
|
||||
statusIcon.translatesAutoresizingMaskIntoConstraints = false
|
||||
statusIcon.image = NSImage(systemSymbolName: "checkmark.circle.fill", accessibilityDescription: NSLocalizedString("Completed", comment: "Status icon accessibility description"))
|
||||
statusIcon.image = NSImage(systemSymbolName: "checkmark.circle.fill", accessibilityDescription: NSLocalizedString("Completed", comment: "Completed"))
|
||||
statusIcon.contentTintColor = .systemGreen
|
||||
statusIcon.isHidden = true
|
||||
|
||||
|
||||
@@ -25,15 +25,10 @@ import RSWeb
|
||||
|
||||
@IBOutlet private var tableView: NSTableView?
|
||||
|
||||
private let model = CurrentActivityViewModel()
|
||||
private var hasBeenShown = false
|
||||
private var updateTimer: Timer?
|
||||
private var needsUpdate = false
|
||||
private var displayedActivities = [Activity]()
|
||||
private var lingeringActivities = [Activity: Timer]()
|
||||
|
||||
private static let aboveCenterOffset: CGFloat = 40
|
||||
private static let updateCoalesceInterval: TimeInterval = 0.5
|
||||
private static let lingerDuration: TimeInterval = 2.0
|
||||
|
||||
convenience init() {
|
||||
self.init(windowNibName: "CurrentActivityWindow")
|
||||
@@ -42,7 +37,9 @@ import RSWeb
|
||||
override func windowDidLoad() {
|
||||
super.windowDidLoad()
|
||||
window?.delegate = self
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(handleActivityDidChange(_:)), name: .activityDidChange, object: nil)
|
||||
model.displayedActivitiesDidChange = { [weak self] in
|
||||
self?.tableView?.reloadData()
|
||||
}
|
||||
}
|
||||
|
||||
override func showWindow(_ sender: Any?) {
|
||||
@@ -55,7 +52,7 @@ import RSWeb
|
||||
}
|
||||
}
|
||||
super.showWindow(sender)
|
||||
scheduleUpdate()
|
||||
model.start()
|
||||
}
|
||||
|
||||
func saveState() {
|
||||
@@ -65,26 +62,25 @@ import RSWeb
|
||||
// MARK: - NSWindowDelegate
|
||||
|
||||
func windowWillClose(_ notification: Notification) {
|
||||
updateTimer?.invalidate()
|
||||
updateTimer = nil
|
||||
model.stop()
|
||||
}
|
||||
|
||||
// MARK: - NSTableViewDataSource
|
||||
|
||||
func numberOfRows(in tableView: NSTableView) -> Int {
|
||||
displayedActivities.count
|
||||
model.displayedActivities.count
|
||||
}
|
||||
|
||||
// MARK: - NSTableViewDelegate
|
||||
|
||||
func tableView(_ tableView: NSTableView, viewFor tableColumn: NSTableColumn?, row: Int) -> NSView? {
|
||||
guard let tableColumn, row < displayedActivities.count else {
|
||||
guard let tableColumn, row < model.displayedActivities.count else {
|
||||
return nil
|
||||
}
|
||||
guard let cell = tableView.makeView(withIdentifier: tableColumn.identifier, owner: self) as? NSTableCellView else {
|
||||
return nil
|
||||
}
|
||||
let activity = displayedActivities[row]
|
||||
let activity = model.displayedActivities[row]
|
||||
switch tableColumn.identifier.rawValue {
|
||||
case "source":
|
||||
cell.textField?.stringValue = activity.owner.displayName
|
||||
@@ -97,12 +93,6 @@ import RSWeb
|
||||
return cell
|
||||
}
|
||||
|
||||
// MARK: - Notifications
|
||||
|
||||
@objc func handleActivityDidChange(_ notification: Notification) {
|
||||
scheduleUpdate()
|
||||
}
|
||||
|
||||
// MARK: - Actions
|
||||
|
||||
@IBAction func showHelp(_ sender: Any?) {
|
||||
@@ -116,124 +106,27 @@ import RSWeb
|
||||
|
||||
private extension CurrentActivityWindowController {
|
||||
|
||||
func scheduleUpdate() {
|
||||
guard window?.isVisible == true else {
|
||||
return
|
||||
}
|
||||
|
||||
needsUpdate = true
|
||||
|
||||
if updateTimer == nil {
|
||||
updateTimer = Timer.scheduledTimer(withTimeInterval: Self.updateCoalesceInterval, repeats: true) { [weak self] _ in
|
||||
Task { @MainActor in
|
||||
self?.coalescedUpdate()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func coalescedUpdate() {
|
||||
guard needsUpdate else {
|
||||
if displayedActivities.isEmpty {
|
||||
updateTimer?.invalidate()
|
||||
updateTimer = nil
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
needsUpdate = false
|
||||
rebuildDisplayedActivities()
|
||||
tableView?.reloadData()
|
||||
}
|
||||
|
||||
func rebuildDisplayedActivities() {
|
||||
let manager = ActivityLog.shared
|
||||
|
||||
var activities = [Activity]()
|
||||
activities.append(contentsOf: manager.runningActivities)
|
||||
activities.append(contentsOf: manager.pendingActivities)
|
||||
|
||||
for activity in manager.completedActivities {
|
||||
if lingeringActivities[activity] != nil {
|
||||
activities.append(activity)
|
||||
} else if isRecentlyCompleted(activity) {
|
||||
startLingerTimer(for: activity)
|
||||
activities.append(activity)
|
||||
}
|
||||
}
|
||||
|
||||
displayedActivities = activities
|
||||
}
|
||||
|
||||
func isRecentlyCompleted(_ activity: Activity) -> Bool {
|
||||
guard let endDate = activity.endDate else {
|
||||
return false
|
||||
}
|
||||
return Date().timeIntervalSince(endDate) < Self.lingerDuration
|
||||
}
|
||||
|
||||
func startLingerTimer(for activity: Activity) {
|
||||
let timer = Timer.scheduledTimer(withTimeInterval: Self.lingerDuration, repeats: false) { [weak self] _ in
|
||||
Task { @MainActor in
|
||||
self?.lingerTimerFired(for: activity)
|
||||
}
|
||||
}
|
||||
lingeringActivities[activity] = timer
|
||||
}
|
||||
|
||||
func lingerTimerFired(for activity: Activity) {
|
||||
lingeringActivities.removeValue(forKey: activity)
|
||||
scheduleUpdate()
|
||||
}
|
||||
|
||||
func configureStateImage(_ cell: NSTableCellView, for activity: Activity) {
|
||||
let symbol: String
|
||||
let color: NSColor
|
||||
let label: String
|
||||
switch activity.state {
|
||||
case .pending:
|
||||
symbol = "circle"
|
||||
color = .tertiaryLabelColor
|
||||
label = "Pending"
|
||||
case .running:
|
||||
symbol = "circle.fill"
|
||||
color = .systemBlue
|
||||
label = "Running"
|
||||
case .completed:
|
||||
symbol = "checkmark.circle.fill"
|
||||
color = .systemGreen
|
||||
label = "Completed"
|
||||
case .failed:
|
||||
symbol = "xmark.circle.fill"
|
||||
color = .systemRed
|
||||
label = "Failed"
|
||||
}
|
||||
let symbol = CurrentActivityViewModel.symbolName(for: activity.state)
|
||||
let label = CurrentActivityViewModel.accessibilityLabel(for: activity.state)
|
||||
cell.imageView?.image = NSImage(systemSymbolName: symbol, accessibilityDescription: label)
|
||||
cell.imageView?.contentTintColor = color
|
||||
}
|
||||
|
||||
func attributedDisplayName(for activity: Activity) -> NSAttributedString {
|
||||
switch activity.kind {
|
||||
case .refreshFeedContent(let feedURL):
|
||||
if let feedName = activity.detail {
|
||||
return attributedActivity(primary: feedName, secondary: feedURL)
|
||||
}
|
||||
return attributedActivity(primary: feedURL)
|
||||
case .findFeed(let urlString):
|
||||
return attributedActivity(primary: NSLocalizedString("Finding feed", comment: "Activity kind — finding a feed"), secondary: urlString)
|
||||
case .fetchFeedCandidate(let urlString):
|
||||
return attributedActivity(primary: NSLocalizedString("Fetching", comment: "Activity kind — fetching a candidate URL during feed finding"), secondary: urlString)
|
||||
case .downloadFeedImage(let feedURL):
|
||||
return attributedActivity(primary: NSLocalizedString("Downloading image", comment: "Activity kind — downloading feed image"), secondary: feedURL)
|
||||
case .downloadFavicon(let faviconURL):
|
||||
return attributedActivity(primary: NSLocalizedString("Downloading favicon", comment: "Activity kind — downloading favicon"), secondary: faviconURL)
|
||||
case .downloadAvatar(let avatarURL):
|
||||
return attributedActivity(primary: NSLocalizedString("Downloading avatar", comment: "Activity kind — downloading avatar"), secondary: avatarURL)
|
||||
case .downloadHTMLMetadata(let urlString):
|
||||
return attributedActivity(primary: NSLocalizedString("Downloading metadata", comment: "Activity kind — downloading HTML metadata"), secondary: urlString)
|
||||
default:
|
||||
return attributedActivity(primary: activity.kind.simpleDisplayName ?? "", secondary: activity.detail)
|
||||
}
|
||||
let text = CurrentActivityViewModel.displayText(for: activity)
|
||||
return attributedActivity(primary: text.title, secondary: text.detail)
|
||||
}
|
||||
|
||||
/// Build a row label with optional secondary detail in secondary color. AppKit ignores
|
||||
@@ -254,5 +147,4 @@ private extension CurrentActivityWindowController {
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
}
|
||||
@@ -133,6 +133,7 @@ struct Assets {
|
||||
static var circleOpen: RSImage { RSImage(symbol: "circle")! }
|
||||
static var disclosure: RSImage { RSImage(named: "disclosure")! }
|
||||
static var deactivate: RSImage { RSImage(symbol: "minus.circle")! }
|
||||
static var currentActivity: RSImage { RSImage(symbol: "dot.radiowaves.up.forward")! }
|
||||
static var edit: RSImage { RSImage(symbol: "square.and.pencil")! }
|
||||
static var filter: RSImage { RSImage(symbol: "line.3.horizontal.decrease")! }
|
||||
static var folderOutlinePlus: RSImage { RSImage(symbol: "folder.badge.plus")! }
|
||||
|
||||
@@ -0,0 +1,146 @@
|
||||
//
|
||||
// CurrentActivityViewModel.swift
|
||||
// NetNewsWire
|
||||
//
|
||||
// Created by Brent Simmons on 6/9/26.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import ActivityLog
|
||||
|
||||
struct ActivityDisplayText {
|
||||
let title: String
|
||||
let detail: String?
|
||||
}
|
||||
|
||||
@MainActor final class CurrentActivityViewModel {
|
||||
|
||||
private(set) var displayedActivities = [Activity]() {
|
||||
didSet {
|
||||
displayedActivitiesDidChange?()
|
||||
}
|
||||
}
|
||||
|
||||
var displayedActivitiesDidChange: (() -> Void)?
|
||||
|
||||
private var isObserving = false
|
||||
private var updateTimer: Timer?
|
||||
|
||||
private static let updateInterval: TimeInterval = 0.5
|
||||
private static let lingerDuration: TimeInterval = 2.0
|
||||
|
||||
func start() {
|
||||
if !isObserving {
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(handleActivityDidChange(_:)), name: .activityDidChange, object: nil)
|
||||
isObserving = true
|
||||
}
|
||||
scheduleUpdate()
|
||||
}
|
||||
|
||||
func stop() {
|
||||
if isObserving {
|
||||
NotificationCenter.default.removeObserver(self, name: .activityDidChange, object: nil)
|
||||
isObserving = false
|
||||
}
|
||||
invalidateUpdateTimer()
|
||||
}
|
||||
|
||||
@objc func handleActivityDidChange(_ notification: Notification) {
|
||||
scheduleUpdate()
|
||||
}
|
||||
|
||||
static func symbolName(for state: ActivityState) -> String {
|
||||
switch state {
|
||||
case .pending:
|
||||
return "circle"
|
||||
case .running:
|
||||
return "circle.fill"
|
||||
case .completed:
|
||||
return "checkmark.circle.fill"
|
||||
case .failed:
|
||||
return "xmark.circle.fill"
|
||||
}
|
||||
}
|
||||
|
||||
static func accessibilityLabel(for state: ActivityState) -> String {
|
||||
switch state {
|
||||
case .pending:
|
||||
return NSLocalizedString("Pending", comment: "Pending")
|
||||
case .running:
|
||||
return NSLocalizedString("Running", comment: "Running")
|
||||
case .completed:
|
||||
return NSLocalizedString("Completed", comment: "Completed")
|
||||
case .failed:
|
||||
return NSLocalizedString("Failed", comment: "Failed")
|
||||
}
|
||||
}
|
||||
|
||||
static func displayText(for activity: Activity) -> ActivityDisplayText {
|
||||
switch activity.kind {
|
||||
case .refreshFeedContent(let feedURL):
|
||||
if let feedName = activity.detail {
|
||||
return ActivityDisplayText(title: feedName, detail: feedURL)
|
||||
}
|
||||
return ActivityDisplayText(title: feedURL, detail: nil)
|
||||
case .findFeed(let urlString):
|
||||
return ActivityDisplayText(title: NSLocalizedString("Finding feed", comment: "Finding feed"), detail: urlString)
|
||||
case .fetchFeedCandidate(let urlString):
|
||||
return ActivityDisplayText(title: NSLocalizedString("Fetching", comment: "Fetching"), detail: urlString)
|
||||
case .downloadFeedImage(let feedURL):
|
||||
return ActivityDisplayText(title: NSLocalizedString("Downloading image", comment: "Downloading image"), detail: feedURL)
|
||||
case .downloadFavicon(let faviconURL):
|
||||
return ActivityDisplayText(title: NSLocalizedString("Downloading favicon", comment: "Downloading favicon"), detail: faviconURL)
|
||||
case .downloadAvatar(let avatarURL):
|
||||
return ActivityDisplayText(title: NSLocalizedString("Downloading avatar", comment: "Downloading avatar"), detail: avatarURL)
|
||||
case .downloadHTMLMetadata(let urlString):
|
||||
return ActivityDisplayText(title: NSLocalizedString("Downloading metadata", comment: "Downloading metadata"), detail: urlString)
|
||||
default:
|
||||
return ActivityDisplayText(title: activity.kind.simpleDisplayName ?? "", detail: activity.detail)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Private
|
||||
|
||||
private extension CurrentActivityViewModel {
|
||||
|
||||
func scheduleUpdate() {
|
||||
guard updateTimer == nil else {
|
||||
return
|
||||
}
|
||||
updateTimer = Timer.scheduledTimer(timeInterval: Self.updateInterval, target: self, selector: #selector(update), userInfo: nil, repeats: true)
|
||||
update()
|
||||
}
|
||||
|
||||
@objc func update() {
|
||||
let activities = currentActivities()
|
||||
if activities != displayedActivities {
|
||||
displayedActivities = activities
|
||||
}
|
||||
if activities.isEmpty {
|
||||
invalidateUpdateTimer()
|
||||
}
|
||||
}
|
||||
|
||||
func currentActivities() -> [Activity] {
|
||||
let manager = ActivityLog.shared
|
||||
|
||||
var activities = [Activity]()
|
||||
activities.append(contentsOf: manager.runningActivities)
|
||||
activities.append(contentsOf: manager.pendingActivities)
|
||||
|
||||
let now = Date()
|
||||
for activity in manager.completedActivities {
|
||||
if let endDate = activity.endDate, now.timeIntervalSince(endDate) < Self.lingerDuration {
|
||||
activities.append(activity)
|
||||
}
|
||||
}
|
||||
|
||||
return activities
|
||||
}
|
||||
|
||||
func invalidateUpdateTimer() {
|
||||
updateTimer?.invalidate()
|
||||
updateTimer = nil
|
||||
}
|
||||
}
|
||||
@@ -205,7 +205,7 @@
|
||||
"comment" : "Disclosure button collapsed state for accessibility"
|
||||
},
|
||||
"Completed" : {
|
||||
"comment" : "Status icon accessibility description"
|
||||
"comment" : "Completed"
|
||||
},
|
||||
"Continue" : {
|
||||
|
||||
@@ -301,25 +301,25 @@
|
||||
"comment" : "Feed finder"
|
||||
},
|
||||
"Downloading avatar" : {
|
||||
"comment" : "Activity kind — downloading avatar"
|
||||
"comment" : "Downloading avatar"
|
||||
},
|
||||
"Downloading avatar %@" : {
|
||||
"comment" : "Activity kind — downloading an author avatar; %@ is the URL"
|
||||
},
|
||||
"Downloading favicon" : {
|
||||
"comment" : "Activity kind — downloading favicon"
|
||||
"comment" : "Downloading favicon"
|
||||
},
|
||||
"Downloading favicon %@" : {
|
||||
"comment" : "Activity kind — downloading a favicon; %@ is the URL"
|
||||
},
|
||||
"Downloading image" : {
|
||||
"comment" : "Activity kind — downloading feed image"
|
||||
"comment" : "Downloading image"
|
||||
},
|
||||
"Downloading image %@" : {
|
||||
"comment" : "Activity kind — downloading a feed image; %@ is the URL"
|
||||
},
|
||||
"Downloading metadata" : {
|
||||
"comment" : "Activity kind — downloading HTML metadata"
|
||||
"comment" : "Downloading metadata"
|
||||
},
|
||||
"Downloading metadata %@" : {
|
||||
"comment" : "Activity kind — downloading HTML metadata; %@ is the URL"
|
||||
@@ -394,7 +394,7 @@
|
||||
"comment" : "Feeds"
|
||||
},
|
||||
"Fetching" : {
|
||||
"comment" : "Activity kind — fetching a candidate URL during feed finding"
|
||||
"comment" : "Fetching"
|
||||
},
|
||||
"Fetching %@" : {
|
||||
"comment" : "Activity kind — fetching a candidate URL during feed finding"
|
||||
@@ -415,7 +415,7 @@
|
||||
"comment" : "FreshRSS SignUp"
|
||||
},
|
||||
"Finding feed" : {
|
||||
"comment" : "Activity kind — finding a feed"
|
||||
"comment" : "Finding feed"
|
||||
},
|
||||
"Finding feed %@" : {
|
||||
"comment" : "Activity kind — finding a feed at %@ URL"
|
||||
|
||||
@@ -0,0 +1,124 @@
|
||||
//
|
||||
// CurrentActivityView.swift
|
||||
// NetNewsWire-iOS
|
||||
//
|
||||
// Created by Brent Simmons on 6/9/26.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
import SafariServices
|
||||
import ActivityLog
|
||||
|
||||
struct CurrentActivityView: View {
|
||||
|
||||
private static let helpURL = URL(string: "https://netnewswire.com/help/current-activity.html")!
|
||||
|
||||
@State private var model = CurrentActivityViewModel()
|
||||
@State private var activities = [Activity]()
|
||||
@State private var showHelp = false
|
||||
@Environment(\.dismiss) private var dismiss
|
||||
|
||||
var body: some View {
|
||||
List {
|
||||
Section {
|
||||
if activities.isEmpty {
|
||||
Text(NSLocalizedString("No current activity.", comment: "Current Activity empty state"))
|
||||
.foregroundStyle(.secondary)
|
||||
} else {
|
||||
ForEach(activities, id: \.id) { activity in
|
||||
activityRow(activity)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Section {
|
||||
} footer: {
|
||||
helpLinkFooter
|
||||
}
|
||||
}
|
||||
.navigationTitle(NSLocalizedString("Current Activity", comment: "Current Activity"))
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
.toolbar {
|
||||
ToolbarItem(placement: .topBarTrailing) {
|
||||
Button(NSLocalizedString("Done", comment: "Done")) {
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
}
|
||||
.sheet(isPresented: $showHelp) {
|
||||
SafariView(url: Self.helpURL)
|
||||
}
|
||||
.onAppear {
|
||||
model.displayedActivitiesDidChange = {
|
||||
activities = model.displayedActivities
|
||||
}
|
||||
model.start()
|
||||
}
|
||||
.onDisappear {
|
||||
model.stop()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Private
|
||||
|
||||
private extension CurrentActivityView {
|
||||
|
||||
var helpLinkFooter: some View {
|
||||
Button(NSLocalizedString("Current Activity Help", comment: "Help link")) {
|
||||
showHelp = true
|
||||
}
|
||||
.font(.subheadline)
|
||||
.frame(maxWidth: .infinity)
|
||||
.padding(.top, 8)
|
||||
}
|
||||
|
||||
func activityRow(_ activity: Activity) -> some View {
|
||||
let text = CurrentActivityViewModel.displayText(for: activity)
|
||||
return HStack(alignment: .firstTextBaseline, spacing: 10) {
|
||||
Image(systemName: CurrentActivityViewModel.symbolName(for: activity.state))
|
||||
.foregroundStyle(stateColor(for: activity.state))
|
||||
.accessibilityLabel(CurrentActivityViewModel.accessibilityLabel(for: activity.state))
|
||||
VStack(alignment: .leading, spacing: 2) {
|
||||
Text(activity.owner.displayName)
|
||||
.font(.footnote)
|
||||
.foregroundStyle(.secondary)
|
||||
Text(text.title)
|
||||
.lineLimit(1)
|
||||
.truncationMode(.tail)
|
||||
if let detail = text.detail {
|
||||
Text(detail)
|
||||
.font(.footnote)
|
||||
.foregroundStyle(.secondary)
|
||||
.lineLimit(1)
|
||||
.truncationMode(.middle)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func stateColor(for state: ActivityState) -> Color {
|
||||
switch state {
|
||||
case .pending:
|
||||
return .secondary
|
||||
case .running:
|
||||
return .blue
|
||||
case .completed:
|
||||
return .green
|
||||
case .failed:
|
||||
return .red
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private struct SafariView: UIViewControllerRepresentable {
|
||||
|
||||
let url: URL
|
||||
|
||||
func makeUIViewController(context: Context) -> SFSafariViewController {
|
||||
SFSafariViewController(url: url)
|
||||
}
|
||||
|
||||
func updateUIViewController(_ uiViewController: SFSafariViewController, context: Context) {
|
||||
}
|
||||
}
|
||||
@@ -68,6 +68,7 @@ final class MainFeedCollectionViewController: UICollectionViewController, Undoab
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
registerForNotifications()
|
||||
configureCurrentActivityButton()
|
||||
configureCollectionView()
|
||||
configureDiffableDataSource()
|
||||
collectionView.dragDelegate = self
|
||||
@@ -75,6 +76,12 @@ final class MainFeedCollectionViewController: UICollectionViewController, Undoab
|
||||
becomeFirstResponder()
|
||||
}
|
||||
|
||||
func configureCurrentActivityButton() {
|
||||
let button = UIBarButtonItem(image: Assets.Images.currentActivity, style: .plain, target: self, action: #selector(showCurrentActivity(_:)))
|
||||
button.accessibilityLabel = NSLocalizedString("Current Activity", comment: "Current Activity")
|
||||
navigationItem.leftBarButtonItem = button
|
||||
}
|
||||
|
||||
override func viewWillAppear(_ animated: Bool) {
|
||||
Self.logger.debug("MainFeedCollectionViewController: viewWillAppear")
|
||||
navigationController?.isToolbarHidden = false
|
||||
@@ -365,6 +372,10 @@ final class MainFeedCollectionViewController: UICollectionViewController, Undoab
|
||||
coordinator.showSettings()
|
||||
}
|
||||
|
||||
@objc func showCurrentActivity(_ sender: Any?) {
|
||||
coordinator.showCurrentActivity()
|
||||
}
|
||||
|
||||
// MARK: UICollectionViewDelegate
|
||||
|
||||
override func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
|
||||
|
||||
@@ -1360,6 +1360,15 @@ struct SidebarItemNode: Hashable, Sendable {
|
||||
rootSplitViewController.present(settingsNavController, animated: true)
|
||||
}
|
||||
|
||||
func showCurrentActivity() {
|
||||
let hostingController = UIHostingController(rootView: NavigationStack { CurrentActivityView() })
|
||||
if let sheet = hostingController.sheetPresentationController {
|
||||
sheet.detents = [.medium(), .large()]
|
||||
sheet.prefersGrabberVisible = true
|
||||
}
|
||||
rootSplitViewController.present(hostingController, animated: true)
|
||||
}
|
||||
|
||||
func showAccountInspector(for account: Account) {
|
||||
let accountInspectorNavController =
|
||||
UIStoryboard.inspector.instantiateViewController(identifier: "AccountInspectorNavigationViewController") as! UINavigationController
|
||||
|
||||
Reference in new issue
Block a user