From 1bd0bfce371a92b715352f75aef87420f6a2412c Mon Sep 17 00:00:00 2001 From: Stuart Breckenridge Date: Wed, 22 Jul 2020 21:47:40 +0800 Subject: [PATCH] Minor changes for #2287 --- .../Shared/Sidebar/SidebarContextMenu.swift | 5 ++- .../Shared/Sidebar/SidebarModel.swift | 35 ++++++++++--------- NetNewsWire.xcodeproj/project.pbxproj | 4 --- 3 files changed, 23 insertions(+), 21 deletions(-) diff --git a/Multiplatform/Shared/Sidebar/SidebarContextMenu.swift b/Multiplatform/Shared/Sidebar/SidebarContextMenu.swift index 4f06af01a..d9a27f295 100644 --- a/Multiplatform/Shared/Sidebar/SidebarContextMenu.swift +++ b/Multiplatform/Shared/Sidebar/SidebarContextMenu.swift @@ -20,7 +20,7 @@ struct SidebarContextMenu: View { @ViewBuilder var body: some View { - + // MARK: Account Context Menu if sidebarItem.representedType == .account { Button { showInspector = true @@ -40,6 +40,7 @@ struct SidebarContextMenu: View { } } + // MARK: Pseudofeed Context Menu if sidebarItem.representedType == .pseudoFeed { Button { guard let feed = sidebarItem.feed else { @@ -54,6 +55,7 @@ struct SidebarContextMenu: View { } } + // MARK: Webfeed Context Menu if sidebarItem.representedType == .webFeed { Button { showInspector = true @@ -130,6 +132,7 @@ struct SidebarContextMenu: View { } } + // MARK: Folder Context Menu if sidebarItem.representedType == .folder { Button { showInspector = true diff --git a/Multiplatform/Shared/Sidebar/SidebarModel.swift b/Multiplatform/Shared/Sidebar/SidebarModel.swift index bb2c802ba..07e2f278a 100644 --- a/Multiplatform/Shared/Sidebar/SidebarModel.swift +++ b/Multiplatform/Shared/Sidebar/SidebarModel.swift @@ -99,9 +99,11 @@ extension SidebarModel { } func deleteItems(item: SidebarItem) { + #if os(macOS) if selectedFeeds.count > 0 { for feed in selectedFeeds { if feed is WebFeed { + print(feed.nameForDisplay) let account = (feed as! WebFeed).account account?.removeWebFeed(feed as! WebFeed) } @@ -117,23 +119,24 @@ extension SidebarModel { }) } } - } else { - if item.feed is WebFeed { - let account = (item.feed as! WebFeed).account - account?.removeWebFeed(item.feed as! WebFeed) - } - if item.feed is Folder { - let account = (item.feed as! Folder).account - account?.removeFolder(item.feed as! Folder, completion: { (result) in - switch result { - case .success( _): - print("Deleted folder") - case .failure(let err): - print(err.localizedDescription) - } - }) - } } + #else + if item.feed is WebFeed { + let account = (item.feed as! WebFeed).account + account?.removeWebFeed(item.feed as! WebFeed) + } + if item.feed is Folder { + let account = (item.feed as! Folder).account + account?.removeFolder(item.feed as! Folder, completion: { (result) in + switch result { + case .success( _): + print("Deleted folder") + case .failure(let err): + print(err.localizedDescription) + } + }) + } + #endif } } diff --git a/NetNewsWire.xcodeproj/project.pbxproj b/NetNewsWire.xcodeproj/project.pbxproj index 2cca6f94b..f8ad4b4e8 100644 --- a/NetNewsWire.xcodeproj/project.pbxproj +++ b/NetNewsWire.xcodeproj/project.pbxproj @@ -17,8 +17,6 @@ 1729529524AA1CAA00D65E66 /* GeneralPreferencesView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1729529224AA1CAA00D65E66 /* GeneralPreferencesView.swift */; }; 1729529724AA1CD000D65E66 /* MacPreferencesView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1729529624AA1CD000D65E66 /* MacPreferencesView.swift */; }; 1729529B24AA1FD200D65E66 /* MacSearchField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1729529A24AA1FD200D65E66 /* MacSearchField.swift */; }; - 173A66B024C6C5C800DDA840 /* DeleteCommand.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84B99C9C1FAE83C600ECDEDB /* DeleteCommand.swift */; }; - 173A66D224C6C5C800DDA840 /* DeleteCommand.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84B99C9C1FAE83C600ECDEDB /* DeleteCommand.swift */; }; 175942AA24AD533200585066 /* RefreshInterval.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5183CCE4226F4DFA0010922C /* RefreshInterval.swift */; }; 175942AB24AD533200585066 /* RefreshInterval.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5183CCE4226F4DFA0010922C /* RefreshInterval.swift */; }; 1769E32224BC5925000E1E8E /* AccountsPreferencesModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1769E32124BC5925000E1E8E /* AccountsPreferencesModel.swift */; }; @@ -5257,7 +5255,6 @@ 51E498F724A8085D00B667CB /* SearchTimelineFeedDelegate.swift in Sources */, 175942AA24AD533200585066 /* RefreshInterval.swift in Sources */, 51E4993524A867E800B667CB /* AppNotifications.swift in Sources */, - 173A66D224C6C5C800DDA840 /* DeleteCommand.swift in Sources */, 51C0515E24A77DF800194D5E /* MainApp.swift in Sources */, 51919FF724AB8B7700541E64 /* TimelineView.swift in Sources */, 51E4993D24A870F800B667CB /* UserNotificationManager.swift in Sources */, @@ -5403,7 +5400,6 @@ 1799E6CE24C320D600511E91 /* InspectorModel.swift in Sources */, 514E6C0024AD255D00AC6F6E /* PreviewArticles.swift in Sources */, 1729529524AA1CAA00D65E66 /* GeneralPreferencesView.swift in Sources */, - 173A66B024C6C5C800DDA840 /* DeleteCommand.swift in Sources */, 1769E32724BC5B6C000E1E8E /* AddAccountModel.swift in Sources */, 1729529424AA1CAA00D65E66 /* AdvancedPreferencesView.swift in Sources */, 5177470424B2657F00EB0F74 /* TimelineToolbarModifier.swift in Sources */,