- Add SwiftUI views for feed list, detail, add feed, settings, and bookmarks - Connect all views to ViewModels using @StateObject - Implement pull-to-refresh for feed list - Add error handling and loading states to all views - Create FeedItemRow view for consistent feed item display - Add toFeedItem() extension to Bookmark for UI integration - Update FeedDetailView to use sync methods - Update BookmarkView to use FeedService for unstar operations Co-Authored-By: Paperclip <noreply@paperclip.ing>
70 lines
2.1 KiB
Swift
70 lines
2.1 KiB
Swift
import SwiftUI
|
|
|
|
struct SettingsView: View {
|
|
@State private var showError: Bool = false
|
|
@State private var errorMessage: String = ""
|
|
|
|
private let syncService: BackgroundSyncService
|
|
private let settingsStore = SettingsStore.shared
|
|
|
|
init(syncService: BackgroundSyncService = BackgroundSyncService.shared) {
|
|
self.syncService = syncService
|
|
}
|
|
|
|
var body: some View {
|
|
Form {
|
|
Section(header: Text("Sync Settings")) {
|
|
Button("Sync Now") {
|
|
syncNow()
|
|
}
|
|
.disabled(syncService.isSyncing)
|
|
|
|
if syncService.isSyncing {
|
|
ProgressView("Syncing...")
|
|
}
|
|
|
|
Text("Sync interval is managed in BackgroundSyncService")
|
|
.foregroundColor(.secondary)
|
|
}
|
|
|
|
Section(header: Text("Appearance")) {
|
|
Text("Appearance settings are managed in ReadingPreferences")
|
|
.foregroundColor(.secondary)
|
|
}
|
|
|
|
Section(header: Text("Notifications")) {
|
|
Text("Notification preferences are managed in NotificationPreferences")
|
|
.foregroundColor(.secondary)
|
|
}
|
|
|
|
Section(header: Text("About")) {
|
|
Text("RSSuper")
|
|
.font(.headline)
|
|
|
|
Text("Version 1.0")
|
|
.foregroundColor(.secondary)
|
|
|
|
Link("GitHub", destination: URL(string: "https://github.com/rssuper/rssuper")!)
|
|
Link("Privacy Policy", destination: URL(string: "https://rssuper.example.com/privacy")!)
|
|
}
|
|
}
|
|
.navigationTitle("Settings")
|
|
.alert("Error", isPresented: $showError) {
|
|
Button("OK", role: .cancel) { errorMessage = "" }
|
|
} message: {
|
|
Text(errorMessage)
|
|
}
|
|
.onAppear {
|
|
// Load settings from SettingsStore
|
|
}
|
|
}
|
|
|
|
private func syncNow() {
|
|
syncService.forceSync()
|
|
}
|
|
}
|
|
|
|
#Preview {
|
|
SettingsView()
|
|
}
|