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