2020-08-07 01:41:59 +00:00
|
|
|
// Copyright © 2020 Metabolist. All rights reserved.
|
|
|
|
|
|
|
|
import SwiftUI
|
2020-09-01 07:33:49 +00:00
|
|
|
import ViewModels
|
2020-08-07 01:41:59 +00:00
|
|
|
|
2020-08-07 10:59:48 +00:00
|
|
|
struct PreferencesView: View {
|
|
|
|
@StateObject var viewModel: PreferencesViewModel
|
2020-09-08 02:12:38 +00:00
|
|
|
@EnvironmentObject var identification: Identification
|
2020-08-07 10:59:48 +00:00
|
|
|
|
2020-08-07 01:41:59 +00:00
|
|
|
var body: some View {
|
2020-08-07 10:14:14 +00:00
|
|
|
Form {
|
2020-08-07 10:59:48 +00:00
|
|
|
Section(header: Text(viewModel.handle)) {
|
|
|
|
NavigationLink("preferences.posting-reading",
|
|
|
|
destination: PostingReadingPreferencesView(
|
2020-09-08 02:12:38 +00:00
|
|
|
viewModel: .init(identification: identification)))
|
2020-08-29 10:26:26 +00:00
|
|
|
NavigationLink("preferences.filters",
|
|
|
|
destination: FiltersView(
|
2020-09-08 02:12:38 +00:00
|
|
|
viewModel: .init(identification: identification)))
|
2020-08-16 20:30:28 +00:00
|
|
|
if viewModel.shouldShowNotificationTypePreferences {
|
|
|
|
NavigationLink("preferences.notification-types",
|
|
|
|
destination: NotificationTypesPreferencesView(
|
2020-09-08 02:12:38 +00:00
|
|
|
viewModel: .init(identification: identification)))
|
2020-08-16 20:30:28 +00:00
|
|
|
}
|
2020-12-01 23:23:47 +00:00
|
|
|
NavigationLink("preferences.muted-users",
|
2020-12-02 18:59:02 +00:00
|
|
|
destination: TableView(viewModelClosure: viewModel.mutedUsersViewModel)
|
2020-12-01 23:23:47 +00:00
|
|
|
.navigationTitle(Text("preferences.muted-users")))
|
|
|
|
NavigationLink("preferences.blocked-users",
|
2020-12-02 18:59:02 +00:00
|
|
|
destination: TableView(viewModelClosure: viewModel.blockedUsersViewModel)
|
2020-12-01 23:23:47 +00:00
|
|
|
.navigationTitle(Text("preferences.blocked-users")))
|
2020-12-04 03:13:18 +00:00
|
|
|
NavigationLink("preferences.blocked-domains",
|
|
|
|
destination: DomainBlocksView(viewModel: viewModel.domainBlocksViewModel()))
|
2020-08-07 10:14:14 +00:00
|
|
|
}
|
2020-10-15 07:44:01 +00:00
|
|
|
Section(header: Text("preferences.app")) {
|
|
|
|
NavigationLink("preferences.media",
|
|
|
|
destination: MediaPreferencesView(
|
|
|
|
viewModel: .init(identification: identification)))
|
2020-10-27 03:01:12 +00:00
|
|
|
NavigationLink("preferences.startup-and-syncing",
|
|
|
|
destination: StartupAndSyncingPreferencesView())
|
2020-10-15 07:44:01 +00:00
|
|
|
}
|
2020-08-07 10:14:14 +00:00
|
|
|
}
|
2020-08-07 10:59:48 +00:00
|
|
|
.navigationTitle("preferences")
|
2020-08-07 01:41:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-12 07:37:14 +00:00
|
|
|
#if DEBUG
|
2020-09-01 07:33:49 +00:00
|
|
|
import PreviewViewModels
|
|
|
|
|
2020-08-07 01:41:59 +00:00
|
|
|
struct PreferencesView_Previews: PreviewProvider {
|
|
|
|
static var previews: some View {
|
2020-09-08 02:12:38 +00:00
|
|
|
PreferencesView(viewModel: .init(identification: .preview))
|
2020-08-07 01:41:59 +00:00
|
|
|
}
|
|
|
|
}
|
2020-08-12 07:37:14 +00:00
|
|
|
#endif
|