Ferrite-backup/Ferrite/Views/SettingsViews/SettingsSourceUrlView.swift
kingbri 064a68fbb2 Sources: Add RSS, descriptions, and settings
RSS parsing has been added as a method to parse source since they're
easier on the website's end to parse.

Source settings have been added. The only current setting is the fetch
mode which selects which parser/scraper to use. By default, if an RSS
parser is found, it's selected.

A source now has info shown regarding versioning and authorship. A source
list's repository name and author string are now required.

Signed-off-by: kingbri <bdashore3@gmail.com>
2022-08-31 00:41:38 -04:00

58 lines
1.5 KiB
Swift

//
// SettingsSourceUrlView.swift
// Ferrite
//
// Created by Brian Dashore on 7/25/22.
//
import SwiftUI
struct SettingsSourceListView: View {
let backgroundContext = PersistenceController.shared.backgroundContext
@FetchRequest(
entity: SourceList.entity(),
sortDescriptors: []
) var sourceUrls: FetchedResults<SourceList>
@State private var presentSourceSheet = false
var body: some View {
List {
ForEach(sourceUrls, id: \.self) { sourceUrl in
Text(sourceUrl.name)
}
.onDelete { offsets in
for index in offsets {
if let sourceUrl = sourceUrls[safe: index] {
PersistenceController.shared.delete(sourceUrl, context: backgroundContext)
}
}
}
}
.sheet(isPresented: $presentSourceSheet) {
if #available(iOS 16, *) {
SourceListEditorView()
.presentationDetents([.medium])
} else {
SourceListEditorView()
}
}
.navigationTitle("Source lists")
.toolbar {
ToolbarItem(placement: .navigationBarTrailing) {
Button {
presentSourceSheet.toggle()
} label: {
Image(systemName: "plus")
}
}
}
}
}
struct SettingsSourceListView_Previews: PreviewProvider {
static var previews: some View {
SettingsSourceListView()
}
}