2020-07-05 14:52:04 -05:00
|
|
|
//
|
2020-07-08 17:50:18 -05:00
|
|
|
// TimelineToolbarModifier.swift
|
2020-07-05 14:52:04 -05:00
|
|
|
// NetNewsWire
|
|
|
|
//
|
|
|
|
// Created by Maurice Parker on 7/5/20.
|
|
|
|
// Copyright © 2020 Ranchero Software. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
import SwiftUI
|
|
|
|
|
|
|
|
struct TimelineToolbarModifier: ViewModifier {
|
|
|
|
|
2020-07-12 15:03:43 -05:00
|
|
|
@EnvironmentObject private var timelineModel: TimelineModel
|
|
|
|
|
2020-07-05 14:52:04 -05:00
|
|
|
func body(content: Content) -> some View {
|
|
|
|
content
|
|
|
|
.toolbar {
|
|
|
|
#if os(iOS)
|
2020-07-05 15:11:45 -05:00
|
|
|
ToolbarItem(placement: .navigation) {
|
2020-07-12 15:03:43 -05:00
|
|
|
Button (action: {
|
|
|
|
withAnimation {
|
2020-07-12 16:48:39 -05:00
|
|
|
timelineModel.toggleReadFilter()
|
2020-07-12 15:03:43 -05:00
|
|
|
}
|
2020-07-05 15:11:45 -05:00
|
|
|
}, label: {
|
2020-07-12 16:48:39 -05:00
|
|
|
if timelineModel.isReadFiltered ?? false {
|
2020-07-12 15:03:43 -05:00
|
|
|
AppAssets.filterActiveImage.font(.title3)
|
|
|
|
} else {
|
|
|
|
AppAssets.filterInactiveImage.font(.title3)
|
|
|
|
}
|
2020-07-12 16:48:39 -05:00
|
|
|
})
|
|
|
|
.hidden(timelineModel.isReadFiltered == nil)
|
|
|
|
.help(timelineModel.isReadFiltered ?? false ? "Show Read Articles" : "Filter Read Articles")
|
2020-07-05 15:11:45 -05:00
|
|
|
}
|
|
|
|
|
2020-07-05 14:52:04 -05:00
|
|
|
ToolbarItem {
|
|
|
|
Button(action: {
|
|
|
|
}, label: {
|
|
|
|
AppAssets.markAllAsReadImage
|
|
|
|
.foregroundColor(.accentColor)
|
|
|
|
}).help("Mark All As Read")
|
|
|
|
}
|
2020-07-05 15:11:45 -05:00
|
|
|
|
2020-07-05 14:52:04 -05:00
|
|
|
ToolbarItem {
|
|
|
|
Spacer()
|
|
|
|
}
|
2020-07-05 15:11:45 -05:00
|
|
|
|
2020-07-05 14:52:04 -05:00
|
|
|
ToolbarItem(placement: .automatic) {
|
|
|
|
RefreshProgressView()
|
|
|
|
}
|
2020-07-05 15:11:45 -05:00
|
|
|
|
2020-07-05 14:52:04 -05:00
|
|
|
ToolbarItem {
|
|
|
|
Spacer()
|
|
|
|
}
|
2020-07-05 15:11:45 -05:00
|
|
|
|
2020-07-05 14:52:04 -05:00
|
|
|
ToolbarItem {
|
|
|
|
Button(action: {
|
|
|
|
}, label: {
|
|
|
|
AppAssets.nextUnreadArticleImage
|
2020-07-05 15:01:02 -05:00
|
|
|
.font(.title3)
|
|
|
|
}).help("Next Unread")
|
2020-07-05 14:52:04 -05:00
|
|
|
}
|
2020-07-05 15:11:45 -05:00
|
|
|
|
2020-07-05 14:52:04 -05:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|