metatext/Views/NotificationTypesPreferencesView.swift

36 lines
1.2 KiB
Swift
Raw Normal View History

2020-08-14 21:41:55 +00:00
// Copyright © 2020 Metabolist. All rights reserved.
import SwiftUI
2020-09-01 07:33:49 +00:00
import ViewModels
2020-08-14 21:41:55 +00:00
struct NotificationTypesPreferencesView: View {
@StateObject var viewModel: NotificationTypesPreferencesViewModel
var body: some View {
Form {
Toggle("preferences.notification-types.follow",
isOn: $viewModel.pushSubscriptionAlerts.follow)
Toggle("preferences.notification-types.favourite",
isOn: $viewModel.pushSubscriptionAlerts.favourite)
Toggle("preferences.notification-types.reblog",
isOn: $viewModel.pushSubscriptionAlerts.reblog)
Toggle("preferences.notification-types.mention",
isOn: $viewModel.pushSubscriptionAlerts.mention)
Toggle("preferences.notification-types.poll",
isOn: $viewModel.pushSubscriptionAlerts.poll)
}
.navigationTitle("preferences.notification-types")
.alertItem($viewModel.alertItem)
}
}
#if DEBUG
2020-09-01 07:33:49 +00:00
import PreviewViewModels
2020-08-14 21:41:55 +00:00
struct NotificationTypesPreferencesView_Previews: PreviewProvider {
static var previews: some View {
2021-01-26 00:06:35 +00:00
NotificationTypesPreferencesView(viewModel: .init(identityContext: .preview))
2020-08-14 21:41:55 +00:00
}
}
#endif