mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Add simulated refresh interval picker
This commit is contained in:
35
iOS/Settings/SettingsRefreshSelectionView.swift
Normal file
35
iOS/Settings/SettingsRefreshSelectionView.swift
Normal file
@@ -0,0 +1,35 @@
|
||||
//
|
||||
// SettingsRefreshSelectionView.swift
|
||||
// NetNewsWire-iOS
|
||||
//
|
||||
// Created by Maurice Parker on 9/16/19.
|
||||
// Copyright © 2019 Ranchero Software. All rights reserved.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct SettingsRefreshSelectionView: View {
|
||||
|
||||
@Environment(\.presentationMode) var presentation
|
||||
@Binding var selectedInterval: RefreshInterval
|
||||
|
||||
var body: some View {
|
||||
Form {
|
||||
ForEach(RefreshInterval.allCases) { interval in
|
||||
Button(action: {
|
||||
self.selectedInterval = interval
|
||||
self.presentation.wrappedValue.dismiss()
|
||||
}) {
|
||||
HStack {
|
||||
Text(interval.description())
|
||||
Spacer()
|
||||
if interval == self.selectedInterval {
|
||||
Image(systemName: "checkmark")
|
||||
}
|
||||
}
|
||||
}.buttonStyle(VibrantButtonStyle(alignment: .leading))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -18,7 +18,8 @@ struct SettingsView : View {
|
||||
@Environment(\.sceneCoordinator) private var coordinator: SceneCoordinator?
|
||||
|
||||
@State private var accountAction: Int? = nil
|
||||
|
||||
@State private var refreshAction: Int? = nil
|
||||
|
||||
@State private var isWebsitePresented: Bool = false
|
||||
@State private var website: String? = nil
|
||||
|
||||
@@ -78,13 +79,18 @@ struct SettingsView : View {
|
||||
func buildDatabaseSection() -> some View {
|
||||
Section(header: Text("DATABASE")) {
|
||||
|
||||
Picker(selection: $viewModel.refreshInterval, label: Text("Refresh Interval")) {
|
||||
ForEach(RefreshInterval.allCases) { interval in
|
||||
Text(interval.description()).tag(interval)
|
||||
NavigationLink(destination: SettingsRefreshSelectionView(selectedInterval: $viewModel.refreshInterval), tag: 1, selection: $refreshAction) {
|
||||
HStack {
|
||||
Text("Refresh Interval")
|
||||
Spacer()
|
||||
Text(verbatim: self.viewModel.refreshInterval.description()).foregroundColor(.secondary)
|
||||
}
|
||||
}
|
||||
.modifier(VibrantSelectAction(action: {
|
||||
self.refreshAction = 1
|
||||
}))
|
||||
|
||||
Button("Import Subscriptions...") {
|
||||
Button("Import Subscriptions...") {
|
||||
if AccountManager.shared.activeAccounts.count == 1 {
|
||||
self.opmlAccount = AccountManager.shared.activeAccounts.first
|
||||
self.isOPMLImportDocPickerPresented = true
|
||||
|
||||
Reference in New Issue
Block a user