From f7dfac3e6a1c150ea1cb7e22763ee093f6e438c6 Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Mon, 29 Sep 2025 13:50:01 -0700 Subject: [PATCH] Create and use shared HelpURL for various help URLs. --- Mac/AppDelegate.swift | 32 +++++++++-------------- Mac/Base.lproj/Main.storyboard | 10 +++++-- Shared/HelpURL.swift | 28 ++++++++++++++++++++ iOS/Settings/SettingsViewController.swift | 7 +++-- 4 files changed, 52 insertions(+), 25 deletions(-) create mode 100644 Shared/HelpURL.swift diff --git a/Mac/AppDelegate.swift b/Mac/AppDelegate.swift index 3e253fba1..fb78c9bd1 100644 --- a/Mac/AppDelegate.swift +++ b/Mac/AppDelegate.swift @@ -616,45 +616,39 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidat } @IBAction func openWebsite(_ sender: Any?) { - - Browser.open("https://netnewswire.com/", inBackground: false) + HelpURL.website.open() } @IBAction func openReleaseNotes(_ sender: Any?) { - Browser.open(URL.releaseNotes.absoluteString, inBackground: false) + HelpURL.releaseNotes.open() } - @IBAction func openHowToSupport(_ sender: Any?) { - - Browser.open("https://github.com/brentsimmons/NetNewsWire/blob/main/Technotes/HowToSupportNetNewsWire.markdown", inBackground: false) + HelpURL.howToSupportNetNewsWire.open() } - - @IBAction func openRepository(_ sender: Any?) { - Browser.open("https://github.com/brentsimmons/NetNewsWire", inBackground: false) + @IBAction func openTechnotes(_ sender: Any?) { + HelpURL.technotes.open() + } + + @IBAction func openRepository(_ sender: Any?) { + HelpURL.githubRepo.open() } @IBAction func openBugTracker(_ sender: Any?) { - - Browser.open("https://github.com/brentsimmons/NetNewsWire/issues", inBackground: false) + HelpURL.bugTracker.open() } @IBAction func openSlackGroup(_ sender: Any?) { - Browser.open("https://netnewswire.com/slack", inBackground: false) + HelpURL.slack.open() } @IBAction func showHelp(_ sender: Any?) { - - Browser.open("https://netnewswire.com/help/mac/6.1/en/", inBackground: false) - } - - @IBAction func donateToAppCampForGirls(_ sender: Any?) { - Browser.open("https://appcamp4girls.com/contribute/", inBackground: false) + HelpURL.helpHome.open() } @IBAction func showPrivacyPolicy(_ sender: Any?) { - Browser.open("https://netnewswire.com/privacypolicy.html", inBackground: false) + HelpURL.privacyPolicy.open() } @IBAction func gotoToday(_ sender: Any?) { diff --git a/Mac/Base.lproj/Main.storyboard b/Mac/Base.lproj/Main.storyboard index f7a0cba32..99034aed2 100644 --- a/Mac/Base.lproj/Main.storyboard +++ b/Mac/Base.lproj/Main.storyboard @@ -646,10 +646,16 @@ - + - + + + + + + + diff --git a/Shared/HelpURL.swift b/Shared/HelpURL.swift new file mode 100644 index 000000000..9b1174ed7 --- /dev/null +++ b/Shared/HelpURL.swift @@ -0,0 +1,28 @@ +// +// HelpURL.swift +// NetNewsWire +// +// Created by Brent Simmons on 9/29/25. +// Copyright © 2025 Ranchero Software. All rights reserved. +// + +import Foundation + +enum HelpURL: String { + + case helpHome = "https://netnewswire.com/help/" + case website = "https://netnewswire.com/" + case releaseNotes = "https://github.com/Ranchero-Software/NetNewsWire/releases/" + case howToSupportNetNewsWire = "https://github.com/Ranchero-Software/NetNewsWire/blob/main/Technotes/HowToSupportNetNewsWire.markdown" + case githubRepo = "https://github.com/Ranchero-Software/NetNewsWire" + case bugTracker = "https://github.com/Ranchero-Software/NetNewsWire/issues" + case slack = "https://netnewswire.com/slack" + case technotes = "https://github.com/Ranchero-Software/NetNewsWire/tree/main/Technotes" + case privacyPolicy = "https://netnewswire.com/privacypolicy.html" + +#if os(macOS) + func open() { + Browser.open(self.rawValue, inBackground: false) + } +#endif +} diff --git a/iOS/Settings/SettingsViewController.swift b/iOS/Settings/SettingsViewController.swift index 85d2cd0ca..f3a7036bd 100644 --- a/iOS/Settings/SettingsViewController.swift +++ b/iOS/Settings/SettingsViewController.swift @@ -222,13 +222,13 @@ final class SettingsViewController: UITableViewController { case 6: switch indexPath.row { case 0: - openURL("https://netnewswire.com/help/ios/6.1/en/") + openURL(HelpURL.helpHome.rawValue) tableView.selectRow(at: nil, animated: true, scrollPosition: .none) case 1: - openURL(URL.releaseNotes.absoluteString) + openURL(HelpURL.releaseNotes.rawValue) tableView.selectRow(at: nil, animated: true, scrollPosition: .none) case 2: - openURL("https://github.com/brentsimmons/NetNewsWire/issues") + openURL(HelpURL.bugTracker.rawValue) tableView.selectRow(at: nil, animated: true, scrollPosition: .none) case 3: let timeline = UIStoryboard.settings.instantiateController(ofType: AboutViewController.self) @@ -476,5 +476,4 @@ private extension SettingsViewController { vc.modalPresentationStyle = .pageSheet present(vc, animated: true) } - }