Add TimeilneToolbar. Issue #2195

This commit is contained in:
Maurice Parker 2020-07-03 21:55:27 -05:00
parent 6a0f9b63ac
commit 4486d2bd09
4 changed files with 75 additions and 12 deletions

View File

@ -13,19 +13,15 @@ struct ArticleContainerView: View {
@EnvironmentObject private var sceneModel: SceneModel
@StateObject private var articleModel = ArticleModel()
var article: Article? = nil
var article: Article
@ViewBuilder var body: some View {
if let article = article {
ArticleView()
.environmentObject(articleModel)
.onAppear {
sceneModel.articleModel = articleModel
articleModel.delegate = sceneModel
}
} else {
EmptyView()
}
ArticleView()
.environmentObject(articleModel)
.onAppear {
sceneModel.articleModel = articleModel
articleModel.delegate = sceneModel
}
}
}

View File

@ -24,6 +24,11 @@ struct TimelineContainerView: View {
timelineModel.delegate = sceneModel
timelineModel.rebuildTimelineItems(feed)
}
.overlay(Group {
#if os(iOS)
TimelineToolbar()
#endif
},alignment: .bottom)
} else {
EmptyView()
}

View File

@ -0,0 +1,56 @@
//
// TimelineToolbar.swift
// NetNewsWire
//
// Created by Maurice Parker on 7/3/20.
// Copyright © 2020 Ranchero Software. All rights reserved.
//
import SwiftUI
struct TimelineToolbar: View {
var body: some View {
VStack {
Divider()
HStack(alignment: .center) {
Button(action: {
}, label: {
AppAssets.markAllAsReadImage
.resizable()
.scaledToFit()
.frame(width: 24, height: 24, alignment: .center)
.foregroundColor(.accentColor)
}).help("Mark All As Read")
Spacer()
Text("Last updated")
.font(.caption)
.foregroundColor(.secondary)
Spacer()
Button(action: {
}, label: {
AppAssets.nextUnreadArticleImage
.font(.title3)
.foregroundColor(.accentColor)
})
.help("Next Unread")
}
.padding(.horizontal, 16)
.padding(.bottom, 12)
.padding(.top, 4)
}
.background(VisualEffectBlur(blurStyle: .systemChromeMaterial).edgesIgnoringSafeArea(.bottom))
}
}
struct TimelineToolbar_Previews: PreviewProvider {
static var previews: some View {
TimelineToolbar()
}
}

View File

@ -222,6 +222,8 @@
517A757C24451C1500B553B9 /* OAuthSwift.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 517A755324451BD500B553B9 /* OAuthSwift.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
5181C5AD24AF89B1002E0F70 /* PreferredColorSchemeModifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5181C5AC24AF89B1002E0F70 /* PreferredColorSchemeModifier.swift */; };
5181C5AE24AF89B1002E0F70 /* PreferredColorSchemeModifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5181C5AC24AF89B1002E0F70 /* PreferredColorSchemeModifier.swift */; };
5181C64C24B024B4002E0F70 /* TimelineToolbar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5181C64B24B024B4002E0F70 /* TimelineToolbar.swift */; };
5181C64D24B024B4002E0F70 /* TimelineToolbar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5181C64B24B024B4002E0F70 /* TimelineToolbar.swift */; };
5183CCD0226E1E880010922C /* NonIntrinsicLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5183CCCF226E1E880010922C /* NonIntrinsicLabel.swift */; };
5183CCDA226E31A50010922C /* NonIntrinsicImageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5183CCD9226E31A50010922C /* NonIntrinsicImageView.swift */; };
5183CCE5226F4DFA0010922C /* RefreshInterval.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5183CCE4226F4DFA0010922C /* RefreshInterval.swift */; };
@ -1848,6 +1850,7 @@
517A745A2443665000B553B9 /* UIPageViewController-Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIPageViewController-Extensions.swift"; sourceTree = "<group>"; };
517A754424451BD500B553B9 /* OAuthSwift.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = OAuthSwift.xcodeproj; path = submodules/OAuthSwift/OAuthSwift.xcodeproj; sourceTree = "<group>"; };
5181C5AC24AF89B1002E0F70 /* PreferredColorSchemeModifier.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PreferredColorSchemeModifier.swift; sourceTree = "<group>"; };
5181C64B24B024B4002E0F70 /* TimelineToolbar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimelineToolbar.swift; sourceTree = "<group>"; };
5183CCCF226E1E880010922C /* NonIntrinsicLabel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NonIntrinsicLabel.swift; sourceTree = "<group>"; };
5183CCD9226E31A50010922C /* NonIntrinsicImageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NonIntrinsicImageView.swift; sourceTree = "<group>"; };
5183CCE4226F4DFA0010922C /* RefreshInterval.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RefreshInterval.swift; sourceTree = "<group>"; };
@ -2688,10 +2691,11 @@
children = (
51919FED24AB85E400541E64 /* TimelineContainerView.swift */,
51919FF324AB869C00541E64 /* TimelineItem.swift */,
514E6C0124AD29A300AC6F6E /* TimelineItemStatusView.swift */,
514E6BD924ACEA0400AC6F6E /* TimelineItemView.swift */,
51919FF024AB864A00541E64 /* TimelineModel.swift */,
5181C64B24B024B4002E0F70 /* TimelineToolbar.swift */,
51919FF624AB8B7700541E64 /* TimelineView.swift */,
514E6C0124AD29A300AC6F6E /* TimelineItemStatusView.swift */,
);
path = Timeline;
sourceTree = "<group>";
@ -4811,6 +4815,7 @@
514E6BDA24ACEA0400AC6F6E /* TimelineItemView.swift in Sources */,
51E4990D24A808C500B667CB /* RSHTMLMetadata+Extension.swift in Sources */,
51919FF424AB869C00541E64 /* TimelineItem.swift in Sources */,
5181C64C24B024B4002E0F70 /* TimelineToolbar.swift in Sources */,
514E6C0224AD29A300AC6F6E /* TimelineItemStatusView.swift in Sources */,
51E49A0024A91FC100B667CB /* RegularSidebarContainerView.swift in Sources */,
51E4995C24A875F300B667CB /* ArticleRenderer.swift in Sources */,
@ -4923,6 +4928,7 @@
17D232A924AFF10A0005F075 /* AddWebFeedModel.swift in Sources */,
51E4993324A867E700B667CB /* AppNotifications.swift in Sources */,
51E4990624A808C300B667CB /* ImageDownloader.swift in Sources */,
5181C64D24B024B4002E0F70 /* TimelineToolbar.swift in Sources */,
51E4994F24A8734C00B667CB /* TwitterFeedProvider-Extensions.swift in Sources */,
51E498CA24A8085D00B667CB /* SmartFeedDelegate.swift in Sources */,
51E4990524A808C300B667CB /* FeaturedImageDownloader.swift in Sources */,