From 1389008b31b9652ececc6ea3411781cc9d52c557 Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Sun, 5 Jul 2020 18:53:18 -0500 Subject: [PATCH] Add Article toolbar --- Multiplatform/Shared/AppAssets.swift | 44 +++- .../Shared/Article/ArticleContainerView.swift | 1 + .../Article/ArticleToolbarModifier.swift | 93 ++++++++ .../ArticleExtractorError.pdf | Bin 0 -> 4308 bytes .../Contents.json | 15 ++ .../Contents.json | 12 + .../doc.plaintext.on.svg | 218 ++++++++++++++++++ Multiplatform/Shared/MainApp.swift | 4 +- .../Shared/Timeline/TimelineView.swift | 10 +- NetNewsWire.xcodeproj/project.pbxproj | 6 + 10 files changed, 389 insertions(+), 14 deletions(-) create mode 100644 Multiplatform/Shared/Article/ArticleToolbarModifier.swift create mode 100644 Multiplatform/Shared/Assets.xcassets/ArticleExtractorError.imageset/ArticleExtractorError.pdf create mode 100644 Multiplatform/Shared/Assets.xcassets/ArticleExtractorError.imageset/Contents.json create mode 100644 Multiplatform/Shared/Assets.xcassets/ArticleExtractorOn.symbolset/Contents.json create mode 100644 Multiplatform/Shared/Assets.xcassets/ArticleExtractorOn.symbolset/doc.plaintext.on.svg diff --git a/Multiplatform/Shared/AppAssets.swift b/Multiplatform/Shared/AppAssets.swift index 334948dd2..47fc26d7e 100644 --- a/Multiplatform/Shared/AppAssets.swift +++ b/Multiplatform/Shared/AppAssets.swift @@ -52,6 +52,18 @@ struct AppAssets { return Image(systemName: "plus") }() + static var articleExtractorError: Image = { + return Image("ArticleExtractorError") + }() + + static var articleExtractorOff: Image = { + return Image(systemName: "doc.plaintext") + }() + + static var articleExtractorOn: Image = { + return Image("ArticleExtractorOn") + }() + static var copyImage: Image = { return Image(systemName: "doc.on.doc") }() @@ -92,6 +104,14 @@ struct AppAssets { return Image(systemName: "info.circle") }() + static var nextArticleImage: Image = { + return Image(systemName: "chevron.down") + }() + + static var prevArticleImage: Image = { + return Image(systemName: "chevron.up") + }() + static var renameImage: Image = { return Image(systemName: "textformat") }() @@ -129,6 +149,14 @@ struct AppAssets { return Image(systemName: "safari") }() + static var readClosedImage: Image = { + return Image(systemName: "largecircle.fill.circle") + }() + + static var readOpenImage: Image = { + return Image(systemName: "circle") + }() + static var refreshImage: Image = { return Image(systemName: "arrow.clockwise") }() @@ -154,6 +182,14 @@ struct AppAssets { Image(systemName: "square.and.arrow.up") }() + static var starClosedImage: Image = { + return Image(systemName: "star.fill") + }() + + static var starOpenImage: Image = { + return Image(systemName: "star") + }() + static var smartFeedImage: RSImage = { #if os(macOS) return NSImage(systemSymbolName: "gear", accessibilityDescription: nil)! @@ -215,14 +251,6 @@ struct AppAssets { #endif }() - static var toggleStarred: Image = { - return Image(systemName: "star.fill") - }() - - static var toggleRead: Image = { - return Image(systemName: "largecircle.fill.circle") - }() - static var unreadFeedImage: IconImage { #if os(macOS) let image = NSImage(systemSymbolName: "largecircle.fill.circle", accessibilityDescription: nil)! diff --git a/Multiplatform/Shared/Article/ArticleContainerView.swift b/Multiplatform/Shared/Article/ArticleContainerView.swift index 8db0c6318..50f247015 100644 --- a/Multiplatform/Shared/Article/ArticleContainerView.swift +++ b/Multiplatform/Shared/Article/ArticleContainerView.swift @@ -17,6 +17,7 @@ struct ArticleContainerView: View { @ViewBuilder var body: some View { ArticleView() + .modifier(ArticleToolbarModifier()) .environmentObject(articleModel) .onAppear { sceneModel.articleModel = articleModel diff --git a/Multiplatform/Shared/Article/ArticleToolbarModifier.swift b/Multiplatform/Shared/Article/ArticleToolbarModifier.swift new file mode 100644 index 000000000..12bb4ae20 --- /dev/null +++ b/Multiplatform/Shared/Article/ArticleToolbarModifier.swift @@ -0,0 +1,93 @@ +// +// ArticleToolbarModifier.swift +// NetNewsWire +// +// Created by Maurice Parker on 7/5/20. +// Copyright © 2020 Ranchero Software. All rights reserved. +// + +import SwiftUI + +struct ArticleToolbarModifier: ViewModifier { + + func body(content: Content) -> some View { + content + .toolbar { + #if os(iOS) + + ToolbarItem(placement: .navigation) { + HStack(spacing: 20) { + Button(action: { + }, label: { + AppAssets.prevArticleImage + .font(.title3) + }).help("Previouse Unread") + Button(action: { + }, label: { + AppAssets.nextArticleImage + .font(.title3) + }).help("Next Unread") + } + } + + ToolbarItem { + Button(action: { + }, label: { + AppAssets.readOpenImage + .font(.title3) + }).help("Mark as Unread") + } + + ToolbarItem { + Spacer() + } + + ToolbarItem { + Button(action: { + }, label: { + AppAssets.starOpenImage + .font(.title3) + }).help("Mark as Starred") + } + + ToolbarItem { + Spacer() + } + + ToolbarItem { + Button(action: { + }, label: { + AppAssets.nextUnreadArticleImage + .font(.title3) + }).help("Next Unread") + } + + ToolbarItem { + Spacer() + } + + ToolbarItem { + Button(action: { + }, label: { + AppAssets.articleExtractorOff + .font(.title3) + }).help("Reader View") + } + + ToolbarItem { + Spacer() + } + + ToolbarItem { + Button(action: { + }, label: { + AppAssets.shareImage + .font(.title3) + }).help("Share") + } + + #endif + } + } + +} diff --git a/Multiplatform/Shared/Assets.xcassets/ArticleExtractorError.imageset/ArticleExtractorError.pdf b/Multiplatform/Shared/Assets.xcassets/ArticleExtractorError.imageset/ArticleExtractorError.pdf new file mode 100644 index 0000000000000000000000000000000000000000..7d1450ec6cdff7bb7c48e701f79b778ca66c8a24 GIT binary patch literal 4308 zcmai&2UHVVx5p`w5~_+IMH#pRM1?d6pwdf>qEwMkO-O*yf*~}KD&R#x1VM@d(wh_o zr5O;Us+Wi~Q32__2~tI0u)OQN-+SwuHEZUq|Ji4+GrO$yI|DJ)(UXJABf*fS@lWHk zc`Nr{H?@Ej02n~VJAqG~0-*XtHwUUCpvaJn0jM6yg-WC_-Yz&QQHN+pCJ+HNHLwSj zLd3a(eVB>y=bWVA++pi#VSTL2Q>{<3J04&%MW_UL%Y)3%Srl@Md~B`Xc>h(e^$!mpCmp7ND-CC@`b9lQuqr8h(z2D;3f2iG zzN@C~9_{>2NuKoxH?eL$f4o_7cUy}oLe72viAj8ROU6B?6&o`HQ5 z7v)La_m$u%rI2i)c@Hi#rWr5nz|Vf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4b$X0EO}j;T@JX+57?I% zJH1bowCVhee>rkv!~pUkZgvRke{pl*)mrF0EoUuf+xw#zhxdnp>6#VuWIWcU|8>bn z>*DcOpE5sH)?S>eGs9V4zQjk0A;eT5@*mO8lsch%@@BGUf<E-0 z>^a%prH|H5gR zo%FRQuPts^Wb}UMjd+rcBKhh24NV7ir5@@yB&UA&+tt;mwd9oY7Y=9Xu^k8Q-Bn5V z4)~uTFBcMv97 zqI(b5rroif3m{EDUUa2RyO;0W87;n9x5s~S%X%9+xK`soe)C(ZC~G9!)`EPU-#42N zs?+|1JDuzWd^YN@t|;#~?%2(ZX3BsKj;0l=7w`0J^w}5CR_E^bU80x&=@1iMr49X- zuvu#Gd=I^VeoU`IZw6hArblf?4P1G++Pw5KDzR%ctX}r(ll6qoqVxdoZJGnVy=lq0 zb2eH1%wT?<%2w~1>m*@ntjn9Un45QFu&7RbEqEtm+itZrc6!cW!yq9&THX69=a)}D z(ysOsL+ha{+yBYWyA=8zno)4XFW}wf*IkVPxfpG2Eu06D0PF&+F<|}6WEY};G4bDw z?Eyf~5eX!m7TE`|gfUFuDgXlc9g;m6XyN1kA%MEzfOC`O|HxfZFY{2%_1O7P$IOr_vR zE=0=rUj-(lD@4Zk0#IWznUV3`tTKKXVBGAo5x7lp; + + + Untitled + Created with Sketch. + + + + + + + Weight/Scale Variations + + + Ultralight + + + Thin + + + Light + + + Regular + + + Medium + + + Semibold + + + Bold + + + Heavy + + + Black + + + + + + + + + + + + + Design Variations + + + Symbols are supported in up to nine weights and three scales. + + + For optimal layout with text and other symbols, vertically align + + + symbols with the adjacent text. + + + + + + + + Margins + + + Leading and trailing margins on the left and right side of each symbol + + + can be adjusted by modifying the width of the blue rectangles. + + + Modifications are automatically applied proportionally to all + + + scales and weights. + + + + + + Exporting + + + Symbols should be outlined when exporting to ensure the + + + design is preserved when submitting to Xcode. + + + Template v.1.0 + + + Generated from doc.plaintext + + + Typeset at 100 points + + + Small + + + Medium + + + Large + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Multiplatform/Shared/MainApp.swift b/Multiplatform/Shared/MainApp.swift index 1be5b3720..3e8200009 100644 --- a/Multiplatform/Shared/MainApp.swift +++ b/Multiplatform/Shared/MainApp.swift @@ -73,12 +73,12 @@ struct MainApp: App { ToolbarItem { Button(action: {}, label: { - AppAssets.toggleStarred + AppAssets.starOpenImage }).help("Mark as Starred") } ToolbarItem { Button(action: {}, label: { - AppAssets.toggleRead + AppAssets.readClosedImage }).help("Mark as Unread") } ToolbarItem { diff --git a/Multiplatform/Shared/Timeline/TimelineView.swift b/Multiplatform/Shared/Timeline/TimelineView.swift index 8711b1cf5..a1414408a 100644 --- a/Multiplatform/Shared/Timeline/TimelineView.swift +++ b/Multiplatform/Shared/Timeline/TimelineView.swift @@ -14,10 +14,12 @@ struct TimelineView: View { var body: some View { List(timelineModel.timelineItems) { timelineItem in - TimelineItemView(timelineItem: timelineItem) - .onAppear { - timelineModel.loadMoreTimelineItemsIfNecessary(timelineItem) - } + NavigationLink(destination: (ArticleContainerView(article: timelineItem.article))) { + TimelineItemView(timelineItem: timelineItem) + .onAppear { + timelineModel.loadMoreTimelineItemsIfNecessary(timelineItem) + } + } } } diff --git a/NetNewsWire.xcodeproj/project.pbxproj b/NetNewsWire.xcodeproj/project.pbxproj index 094ee4a6a..71d0571f9 100644 --- a/NetNewsWire.xcodeproj/project.pbxproj +++ b/NetNewsWire.xcodeproj/project.pbxproj @@ -216,6 +216,8 @@ 517630232336657E00E15FFF /* WebViewProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 517630222336657E00E15FFF /* WebViewProvider.swift */; }; 5177470324B2657F00EB0F74 /* TimeilneToolbarModifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5177470224B2657F00EB0F74 /* TimeilneToolbarModifier.swift */; }; 5177470424B2657F00EB0F74 /* TimeilneToolbarModifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5177470224B2657F00EB0F74 /* TimeilneToolbarModifier.swift */; }; + 5177470624B2910300EB0F74 /* ArticleToolbarModifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5177470524B2910300EB0F74 /* ArticleToolbarModifier.swift */; }; + 5177470724B2910300EB0F74 /* ArticleToolbarModifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5177470524B2910300EB0F74 /* ArticleToolbarModifier.swift */; }; 517A745B2443665000B553B9 /* UIPageViewController-Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 517A745A2443665000B553B9 /* UIPageViewController-Extensions.swift */; }; 517A757724451BFC00B553B9 /* OAuthSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 517A755524451BD500B553B9 /* OAuthSwift.framework */; }; 517A757824451BFC00B553B9 /* OAuthSwift.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 517A755524451BD500B553B9 /* OAuthSwift.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; @@ -1862,6 +1864,7 @@ 517630032336215100E15FFF /* main.js */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.javascript; path = main.js; sourceTree = ""; }; 517630222336657E00E15FFF /* WebViewProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WebViewProvider.swift; sourceTree = ""; }; 5177470224B2657F00EB0F74 /* TimeilneToolbarModifier.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimeilneToolbarModifier.swift; sourceTree = ""; }; + 5177470524B2910300EB0F74 /* ArticleToolbarModifier.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArticleToolbarModifier.swift; sourceTree = ""; }; 517A745A2443665000B553B9 /* UIPageViewController-Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIPageViewController-Extensions.swift"; sourceTree = ""; }; 517A754424451BD500B553B9 /* OAuthSwift.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = OAuthSwift.xcodeproj; path = submodules/OAuthSwift/OAuthSwift.xcodeproj; sourceTree = ""; }; 5181C5AC24AF89B1002E0F70 /* PreferredColorSchemeModifier.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PreferredColorSchemeModifier.swift; sourceTree = ""; }; @@ -2740,6 +2743,7 @@ children = ( 51A5769524AE617200078888 /* ArticleContainerView.swift */, 51A576BA24AE621800078888 /* ArticleModel.swift */, + 5177470524B2910300EB0F74 /* ArticleToolbarModifier.swift */, 51A576BD24AE637400078888 /* ArticleView.swift */, ); path = Article; @@ -4843,6 +4847,7 @@ 514E6C0924AD39AD00AC6F6E /* ArticleIconImageLoader.swift in Sources */, 6594CA3B24AF6F2A005C7D7C /* OPMLExporter.swift in Sources */, FA80C13E24B072AA00974098 /* AddFolderModel.swift in Sources */, + 5177470624B2910300EB0F74 /* ArticleToolbarModifier.swift in Sources */, 51919FAF24AA8EFA00541E64 /* SidebarItemView.swift in Sources */, 514E6BDA24ACEA0400AC6F6E /* TimelineItemView.swift in Sources */, FA80C11724B0728000974098 /* AddFolderView.swift in Sources */, @@ -4952,6 +4957,7 @@ 51919FB024AA8EFA00541E64 /* SidebarItemView.swift in Sources */, 51919FEF24AB85E400541E64 /* TimelineContainerView.swift in Sources */, 51E4996624A8760B00B667CB /* ArticleStyle.swift in Sources */, + 5177470724B2910300EB0F74 /* ArticleToolbarModifier.swift in Sources */, FA80C11824B0728000974098 /* AddFolderView.swift in Sources */, 51E4996C24A8762D00B667CB /* ExtractedArticle.swift in Sources */, 51E4990824A808C300B667CB /* RSHTMLMetadata+Extension.swift in Sources */,