* swiftui: Register AppDefaults. Issue #2190 Removed obsolete AppDefaults values Revert to using List for timeline and use infinite scrolling technique to speed up timeline loads Add action sheet for adding feed resources Stub out Article code Delete dead code Fix bad merge where we were missing a file reference # Conflicts: # NetNewsWire.xcodeproj/project.pbxproj
72 lines
1.7 KiB
Swift
72 lines
1.7 KiB
Swift
//
|
|
// SidebarToolbar.swift
|
|
// Multiplatform iOS
|
|
//
|
|
// Created by Stuart Breckenridge on 30/6/20.
|
|
// Copyright © 2020 Ranchero Software. All rights reserved.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
struct SidebarToolbar: View {
|
|
|
|
@EnvironmentObject private var appSettings: AppDefaults
|
|
@State private var showSettings: Bool = false
|
|
@State private var showAddSheet: Bool = false
|
|
|
|
var addActionSheetButtons = [
|
|
Button(action: {}, label: { Text("Add Feed") })
|
|
]
|
|
|
|
var body: some View {
|
|
VStack {
|
|
Divider()
|
|
HStack(alignment: .center) {
|
|
Button(action: {
|
|
showSettings = true
|
|
}, label: {
|
|
Image(systemName: "gear")
|
|
.font(.title3)
|
|
.foregroundColor(.accentColor)
|
|
}).help("Settings")
|
|
Spacer()
|
|
Text("Last updated")
|
|
.font(.caption)
|
|
.foregroundColor(.secondary)
|
|
Spacer()
|
|
Button(action: {
|
|
showAddSheet = true
|
|
}, label: {
|
|
Image(systemName: "plus")
|
|
.font(.title3)
|
|
.foregroundColor(.accentColor)
|
|
})
|
|
.help("Add")
|
|
.actionSheet(isPresented: $showAddSheet) {
|
|
ActionSheet(title: Text("Add"), buttons: [
|
|
.cancel(),
|
|
.default(Text("Add Web Feed")),
|
|
.default(Text("Add Twitter Feed")),
|
|
.default(Text("Add Reddit Feed")),
|
|
.default(Text("Add Folder"))
|
|
])
|
|
}
|
|
}
|
|
.padding(.horizontal, 16)
|
|
.padding(.bottom, 12)
|
|
.padding(.top, 4)
|
|
}
|
|
.background(VisualEffectBlur(blurStyle: .systemChromeMaterial).edgesIgnoringSafeArea(.bottom))
|
|
.sheet(isPresented: $showSettings, onDismiss: { showSettings = false }) {
|
|
SettingsView().modifier(PreferredColorSchemeModifier(preferredColorScheme: appSettings.userInterfaceColorPalette))
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
struct SidebarToolbar_Previews: PreviewProvider {
|
|
static var previews: some View {
|
|
SidebarToolbar()
|
|
}
|
|
}
|