From ddbf0fffb608070067868de9b3049540cc0ced78 Mon Sep 17 00:00:00 2001 From: Stuart Breckenridge Date: Sat, 15 Aug 2020 15:01:00 +0800 Subject: [PATCH 1/3] Fixes #2335 The `ReleaseNotes` struct has been replaced with an extension on URL. Release Notes can now be opened on all versions of NNW. --- Mac/AppDelegate.swift | 5 + Mac/Base.lproj/Main.storyboard | 6 + Mac/Base.lproj/MainWindow.storyboard | 4 +- .../Shared/Release Notes/ReleaseNotes.swift | 1 + .../iOS/Settings/SettingsModel.swift | 2 +- NetNewsWire.xcodeproj/project.pbxproj | 14 -- Shared/Extensions/URL-Extensions.swift | 13 ++ iOS/Settings/Settings.storyboard | 142 ++++++++++++------ iOS/Settings/SettingsViewController.swift | 13 +- 9 files changed, 133 insertions(+), 67 deletions(-) diff --git a/Mac/AppDelegate.swift b/Mac/AppDelegate.swift index 07f3d1162..11089f18b 100644 --- a/Mac/AppDelegate.swift +++ b/Mac/AppDelegate.swift @@ -588,6 +588,11 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations, Browser.open("https://ranchero.com/netnewswire/", inBackground: false) } + + @IBAction func openReleaseNotes(_ sender: Any?) { + Browser.open(URL.releaseNotes.absoluteString, inBackground: false) + } + @IBAction func openHowToSupport(_ sender: Any?) { diff --git a/Mac/Base.lproj/Main.storyboard b/Mac/Base.lproj/Main.storyboard index b17af2ae5..9e3bdf707 100644 --- a/Mac/Base.lproj/Main.storyboard +++ b/Mac/Base.lproj/Main.storyboard @@ -615,6 +615,12 @@ + + + + + + diff --git a/Mac/Base.lproj/MainWindow.storyboard b/Mac/Base.lproj/MainWindow.storyboard index 4bf8a0137..c6d56fd14 100644 --- a/Mac/Base.lproj/MainWindow.storyboard +++ b/Mac/Base.lproj/MainWindow.storyboard @@ -639,9 +639,9 @@ - + - + diff --git a/Multiplatform/Shared/Release Notes/ReleaseNotes.swift b/Multiplatform/Shared/Release Notes/ReleaseNotes.swift index d9a91fbba..592aeeebb 100644 --- a/Multiplatform/Shared/Release Notes/ReleaseNotes.swift +++ b/Multiplatform/Shared/Release Notes/ReleaseNotes.swift @@ -10,6 +10,7 @@ import Foundation struct ReleaseNotes { + @available(*, unavailable, message: "Use URL.releaseNotes") var url: URL { var gitHub = "https://github.com/Ranchero-Software/NetNewsWire/releases/tag/" #if os(macOS) diff --git a/Multiplatform/iOS/Settings/SettingsModel.swift b/Multiplatform/iOS/Settings/SettingsModel.swift index 2710601bd..63443d3fc 100644 --- a/Multiplatform/iOS/Settings/SettingsModel.swift +++ b/Multiplatform/iOS/Settings/SettingsModel.swift @@ -31,7 +31,7 @@ class SettingsModel: ObservableObject { case .netNewsWireSlack: return URL(string: "https://ranchero.com/netnewswire/slack")! case .releaseNotes: - return ReleaseNotes().url + return URL.releaseNotes case .none: return nil } diff --git a/NetNewsWire.xcodeproj/project.pbxproj b/NetNewsWire.xcodeproj/project.pbxproj index 37c5c2141..7ea6da89a 100644 --- a/NetNewsWire.xcodeproj/project.pbxproj +++ b/NetNewsWire.xcodeproj/project.pbxproj @@ -56,8 +56,6 @@ 17A1598624E3DEDD005DA32A /* RSDatabase in Embed Frameworks */ = {isa = PBXBuildFile; productRef = 17A1598424E3DEDD005DA32A /* RSDatabase */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; 17A1598824E3DEDD005DA32A /* RSParser in Frameworks */ = {isa = PBXBuildFile; productRef = 17A1598724E3DEDD005DA32A /* RSParser */; }; 17A1598924E3DEDD005DA32A /* RSParser in Embed Frameworks */ = {isa = PBXBuildFile; productRef = 17A1598724E3DEDD005DA32A /* RSParser */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; - 17AC0ABB24E4B65E004C1231 /* ReleaseNotes.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17AC0ABA24E4B65E004C1231 /* ReleaseNotes.swift */; }; - 17AC0ABC24E4B65E004C1231 /* ReleaseNotes.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17AC0ABA24E4B65E004C1231 /* ReleaseNotes.swift */; }; 17D232A824AFF10A0005F075 /* AddWebFeedModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17D232A724AFF10A0005F075 /* AddWebFeedModel.swift */; }; 17D232A924AFF10A0005F075 /* AddWebFeedModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17D232A724AFF10A0005F075 /* AddWebFeedModel.swift */; }; 17D5F17124B0BC6700375168 /* SidebarToolbarModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17D5F17024B0BC6700375168 /* SidebarToolbarModel.swift */; }; @@ -1474,7 +1472,6 @@ 1799E6A824C2F93F00511E91 /* InspectorPlatformModifier.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InspectorPlatformModifier.swift; sourceTree = ""; }; 1799E6CC24C320D600511E91 /* InspectorModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InspectorModel.swift; sourceTree = ""; }; 179DBBA2B22A659F81EED6F9 /* AccountsNewsBlurWindowController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AccountsNewsBlurWindowController.swift; sourceTree = ""; }; - 17AC0ABA24E4B65E004C1231 /* ReleaseNotes.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReleaseNotes.swift; sourceTree = ""; }; 17B223DB24AC24D2001E4592 /* TimelineLayoutView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimelineLayoutView.swift; sourceTree = ""; }; 17D232A724AFF10A0005F075 /* AddWebFeedModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddWebFeedModel.swift; sourceTree = ""; }; 17D5F17024B0BC6700375168 /* SidebarToolbarModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SidebarToolbarModel.swift; sourceTree = ""; }; @@ -2282,14 +2279,6 @@ path = Add; sourceTree = ""; }; - 17AC0ACB24E4B66A004C1231 /* Release Notes */ = { - isa = PBXGroup; - children = ( - 17AC0ABA24E4B65E004C1231 /* ReleaseNotes.swift */, - ); - path = "Release Notes"; - sourceTree = ""; - }; 510289CE2451BA1E00426DDF /* Twitter */ = { isa = PBXGroup; children = ( @@ -2706,7 +2695,6 @@ 514E6C0424AD2B0400AC6F6E /* SwiftUI Extensions */, 51919FCB24AB855000541E64 /* Timeline */, 171BCBB124CBD569006E22D9 /* Account Management */, - 17AC0ACB24E4B66A004C1231 /* Release Notes */, ); path = Shared; sourceTree = ""; @@ -4575,7 +4563,6 @@ 51E4991724A8090400B667CB /* ArticleUtilities.swift in Sources */, 51E4991B24A8091000B667CB /* IconImage.swift in Sources */, 51E4995424A8734D00B667CB /* ExtensionPointIdentifer.swift in Sources */, - 17AC0ABB24E4B65E004C1231 /* ReleaseNotes.swift in Sources */, 51E4996924A8760C00B667CB /* ArticleStylesManager.swift in Sources */, 5177471E24B387E100EB0F74 /* ImageTransition.swift in Sources */, 51E498F324A8085D00B667CB /* PseudoFeed.swift in Sources */, @@ -4792,7 +4779,6 @@ 51E4990724A808C300B667CB /* AuthorAvatarDownloader.swift in Sources */, 51E4997424A8784400B667CB /* DefaultFeedsImporter.swift in Sources */, 51919FF524AB869C00541E64 /* TimelineItem.swift in Sources */, - 17AC0ABC24E4B65E004C1231 /* ReleaseNotes.swift in Sources */, 51E4992024A8095000B667CB /* RSImage-Extensions.swift in Sources */, 51E499FE24A9137600B667CB /* SidebarModel.swift in Sources */, 51E498FE24A808BA00B667CB /* FaviconDownloader.swift in Sources */, diff --git a/Shared/Extensions/URL-Extensions.swift b/Shared/Extensions/URL-Extensions.swift index 4fb9b8d7f..a9577c9e1 100644 --- a/Shared/Extensions/URL-Extensions.swift +++ b/Shared/Extensions/URL-Extensions.swift @@ -15,4 +15,17 @@ extension URL { scheme == "mailto" ? URLComponents(url: self, resolvingAgainstBaseURL: false)?.path : nil } + /// URL pointing to current app version release notes. + static var releaseNotes: URL { + let appVersion = Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String ?? "" + var gitHub = "https://github.com/Ranchero-Software/NetNewsWire/releases/tag/" + #if os(macOS) + gitHub += "mac-\(String(describing: appVersion))" + return URL(string: gitHub)! + #else + gitHub += "ios-\(String(describing: appVersion))" + return URL(string: gitHub)! + #endif + } + } diff --git a/iOS/Settings/Settings.storyboard b/iOS/Settings/Settings.storyboard index 78e2a1dfb..6dd97105e 100644 --- a/iOS/Settings/Settings.storyboard +++ b/iOS/Settings/Settings.storyboard @@ -1,10 +1,12 @@ - + - + + + @@ -144,7 +146,7 @@ - + @@ -780,13 +799,13 @@ @@ -801,7 +820,7 @@ - + @@ -820,7 +839,8 @@ - + + @@ -835,7 +855,6 @@ - @@ -878,7 +897,7 @@ - + @@ -891,14 +910,14 @@ - + + - @@ -915,7 +934,7 @@ - + @@ -963,18 +982,18 @@ - + - +