Add simulated refresh interval picker
This commit is contained in:
parent
ac93dfbd91
commit
46c1dabe62
|
@ -26,6 +26,7 @@
|
|||
512E094D2268B8AB00BDCFDD /* DeleteCommand.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84B99C9C1FAE83C600ECDEDB /* DeleteCommand.swift */; };
|
||||
51322855232EED360033D4ED /* VibrantSelectAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51322854232EED360033D4ED /* VibrantSelectAction.swift */; };
|
||||
51322859232FDDB80033D4ED /* VibrantButtonStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51322858232FDDB80033D4ED /* VibrantButtonStyle.swift */; };
|
||||
5132285B232FF2C40033D4ED /* SettingsRefreshSelectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5132285A232FF2C40033D4ED /* SettingsRefreshSelectionView.swift */; };
|
||||
513C5CE9232571C2003D4054 /* ShareViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 513C5CE8232571C2003D4054 /* ShareViewController.swift */; };
|
||||
513C5CEC232571C2003D4054 /* MainInterface.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 513C5CEA232571C2003D4054 /* MainInterface.storyboard */; };
|
||||
513C5CF0232571C2003D4054 /* NetNewsWire iOS Share Extension.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 513C5CE6232571C2003D4054 /* NetNewsWire iOS Share Extension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
|
||||
|
@ -766,6 +767,7 @@
|
|||
512E092B2268B25500BDCFDD /* UISplitViewController-Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UISplitViewController-Extensions.swift"; sourceTree = "<group>"; };
|
||||
51322854232EED360033D4ED /* VibrantSelectAction.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VibrantSelectAction.swift; sourceTree = "<group>"; };
|
||||
51322858232FDDB80033D4ED /* VibrantButtonStyle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VibrantButtonStyle.swift; sourceTree = "<group>"; };
|
||||
5132285A232FF2C40033D4ED /* SettingsRefreshSelectionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsRefreshSelectionView.swift; sourceTree = "<group>"; };
|
||||
513C5CE6232571C2003D4054 /* NetNewsWire iOS Share Extension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = "NetNewsWire iOS Share Extension.appex"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
513C5CE8232571C2003D4054 /* ShareViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareViewController.swift; sourceTree = "<group>"; };
|
||||
513C5CEB232571C2003D4054 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/MainInterface.storyboard; sourceTree = "<group>"; };
|
||||
|
@ -1231,6 +1233,7 @@
|
|||
isa = PBXGroup;
|
||||
children = (
|
||||
51F35D0822AFD4760003CE1B /* SettingsView.swift */,
|
||||
5132285A232FF2C40033D4ED /* SettingsRefreshSelectionView.swift */,
|
||||
5194B5F122B69FCC00144881 /* SettingsSubscriptionsExportDocumentPickerView.swift */,
|
||||
5194B5ED22B6965300144881 /* SettingsSubscriptionsImportDocumentPickerView.swift */,
|
||||
515E4F06232506240057B0E7 /* Account */,
|
||||
|
@ -2662,6 +2665,7 @@
|
|||
510BD15D232D765D002692E4 /* SettingsReaderAPIAccountView.swift in Sources */,
|
||||
51C4525C226508DF00C03939 /* String-Extensions.swift in Sources */,
|
||||
51C452792265091600C03939 /* MasterTimelineTableViewCell.swift in Sources */,
|
||||
5132285B232FF2C40033D4ED /* SettingsRefreshSelectionView.swift in Sources */,
|
||||
51C452852265093600C03939 /* FlattenedAccountFolderPickerData.swift in Sources */,
|
||||
51C4526B226508F600C03939 /* MasterFeedViewController.swift in Sources */,
|
||||
5126EE97226CB48A00C22AFC /* SceneCoordinator.swift in Sources */,
|
||||
|
|
|
@ -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,6 +18,7 @@ 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
|
||||
|
|
Loading…
Reference in New Issue