mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2024-11-14 05:21:12 +00:00
add add-new-feed for manager
This commit is contained in:
parent
22aa840b0f
commit
d9438cfe15
2 changed files with 25 additions and 7 deletions
|
@ -16,6 +16,9 @@ public struct RSSAddNewFeed: View {
|
|||
@State private var feed: RSSFeed? = nil
|
||||
@State private var downloadingTask: Task<(), Never>? = nil
|
||||
|
||||
public enum Context { case manager, sheet }
|
||||
let context: Context
|
||||
|
||||
public var body: some View {
|
||||
NavigationStack {
|
||||
Form {
|
||||
|
@ -35,12 +38,14 @@ public struct RSSAddNewFeed: View {
|
|||
.navigationTitle("rss.addNewFeed.title")
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
.toolbar {
|
||||
ToolbarItem(placement: .topBarLeading) {
|
||||
Button {
|
||||
dismiss()
|
||||
feed?.managedObjectContext?.rollback()
|
||||
} label: {
|
||||
Image(systemName: "xmark")
|
||||
if self.context == .sheet {
|
||||
ToolbarItem(placement: .topBarLeading) {
|
||||
Button {
|
||||
dismiss()
|
||||
feed?.managedObjectContext?.rollback()
|
||||
} label: {
|
||||
Image(systemName: "xmark")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -77,7 +82,9 @@ public struct RSSAddNewFeed: View {
|
|||
}
|
||||
}
|
||||
|
||||
public init() {}
|
||||
public init(context: Context = .sheet) {
|
||||
self.context = context
|
||||
}
|
||||
|
||||
private struct IndicatorView: View {
|
||||
@Binding var state: MachineState
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
import SwiftUI
|
||||
import DesignSystem
|
||||
import Env
|
||||
|
||||
public struct RSSFeedManager: View {
|
||||
@Environment(\.dismiss) private var dismiss
|
||||
|
@ -14,6 +15,8 @@ public struct RSSFeedManager: View {
|
|||
@FetchRequest(sortDescriptors: [SortDescriptor(\.title, order: .reverse)])
|
||||
private var feeds: FetchedResults<RSSFeed>
|
||||
|
||||
@State private var routerPath = RouterPath()
|
||||
|
||||
public var body: some View {
|
||||
NavigationStack{
|
||||
List {
|
||||
|
@ -39,6 +42,14 @@ public struct RSSFeedManager: View {
|
|||
}
|
||||
}
|
||||
|
||||
ToolbarItem(placement: .navigationBarTrailing) {
|
||||
NavigationLink {
|
||||
RSSAddNewFeed(context: .manager)
|
||||
} label: {
|
||||
Image(systemName: "plus")
|
||||
}
|
||||
}
|
||||
|
||||
ToolbarItem(placement: .topBarTrailing) {
|
||||
Button("rss.rssFeedManager.action.done") {
|
||||
dismiss()
|
||||
|
|
Loading…
Reference in a new issue