53 lines
1.8 KiB
Swift
53 lines
1.8 KiB
Swift
// Copyright © 2020 Metabolist. All rights reserved.
|
|
|
|
import SwiftUI
|
|
import ViewModels
|
|
|
|
struct StartupAndSyncingPreferencesView: View {
|
|
@StateObject var identityContext: IdentityContext
|
|
|
|
var body: some View {
|
|
Form {
|
|
Section(header: Text("preferences.startup-and-syncing.home-timeline")) {
|
|
Picker("preferences.startup-and-syncing.position-on-startup",
|
|
selection: $identityContext.appPreferences.homeTimelineBehavior) {
|
|
ForEach(AppPreferences.PositionBehavior.allCases) { option in
|
|
Text(option.localizedStringKey).tag(option)
|
|
}
|
|
}
|
|
}
|
|
Section(header: Text("preferences.startup-and-syncing.notifications-tab")) {
|
|
Picker("preferences.startup-and-syncing.position-on-startup",
|
|
selection: $identityContext.appPreferences.notificationsTabBehavior) {
|
|
ForEach(AppPreferences.PositionBehavior.allCases) { option in
|
|
Text(option.localizedStringKey).tag(option)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
extension AppPreferences.PositionBehavior {
|
|
var localizedStringKey: LocalizedStringKey {
|
|
switch self {
|
|
case .rememberPosition:
|
|
return "preferences.startup-and-syncing.remember-position"
|
|
case .syncPosition:
|
|
return "preferences.startup-and-syncing.sync-position"
|
|
case .newest:
|
|
return "preferences.startup-and-syncing.newest"
|
|
}
|
|
}
|
|
}
|
|
|
|
#if DEBUG
|
|
import PreviewViewModels
|
|
|
|
struct StartupAndSyncingPreferencesView_Previews: PreviewProvider {
|
|
static var previews: some View {
|
|
StartupAndSyncingPreferencesView(identityContext: .preview)
|
|
}
|
|
}
|
|
#endif
|