2020-10-27 03:01:12 +00:00
|
|
|
// Copyright © 2020 Metabolist. All rights reserved.
|
|
|
|
|
|
|
|
import SwiftUI
|
|
|
|
import ViewModels
|
|
|
|
|
|
|
|
struct StartupAndSyncingPreferencesView: View {
|
2021-01-26 00:45:18 +00:00
|
|
|
@StateObject var identityContext: IdentityContext
|
2020-10-27 03:01:12 +00:00
|
|
|
|
|
|
|
var body: some View {
|
|
|
|
Form {
|
|
|
|
Section(header: Text("preferences.startup-and-syncing.home-timeline")) {
|
|
|
|
Picker("preferences.startup-and-syncing.position-on-startup",
|
2021-01-26 00:06:35 +00:00
|
|
|
selection: $identityContext.appPreferences.homeTimelineBehavior) {
|
2020-10-27 03:01:12 +00:00
|
|
|
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",
|
2021-01-26 00:06:35 +00:00
|
|
|
selection: $identityContext.appPreferences.notificationsTabBehavior) {
|
2020-10-27 03:01:12 +00:00
|
|
|
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 {
|
2021-01-26 00:45:18 +00:00
|
|
|
StartupAndSyncingPreferencesView(identityContext: .preview)
|
2020-10-27 03:01:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|