Clearer notification settings
This commit is contained in:
parent
767e815f61
commit
2bab10b0fb
|
@ -209,7 +209,7 @@
|
|||
"preferences.notification-types.reblog" = "Reblog";
|
||||
"preferences.notification-types.mention" = "Mention";
|
||||
"preferences.notification-types.poll" = "Poll";
|
||||
"preferences.notification-types.status" = "Status";
|
||||
"preferences.notification-types.status" = "Subscription";
|
||||
"preferences.notifications" = "Notifications";
|
||||
"preferences.notifications.include-account-name" = "Include account name";
|
||||
"preferences.notifications.include-pictures" = "Include pictures";
|
||||
|
|
|
@ -23,7 +23,7 @@ struct NotificationPreferencesView: View {
|
|||
}
|
||||
Section(header: Text("preferences.notifications.sounds")) {
|
||||
ForEach(MastodonNotification.NotificationType.allCasesExceptUnknown) { type in
|
||||
Toggle(type.localizedStringKey, isOn: .init {
|
||||
Toggle(isOn: .init {
|
||||
viewModel.identityContext.appPreferences.notificationSounds.contains(type)
|
||||
} set: {
|
||||
if $0 {
|
||||
|
@ -31,7 +31,9 @@ struct NotificationPreferencesView: View {
|
|||
} else {
|
||||
viewModel.identityContext.appPreferences.notificationSounds.remove(type)
|
||||
}
|
||||
})
|
||||
}) {
|
||||
Label(type.localizedStringKey, systemImage: type.systemImageName)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -60,6 +62,25 @@ extension MastodonNotification.NotificationType {
|
|||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
var systemImageName: String {
|
||||
switch self {
|
||||
case .follow, .followRequest:
|
||||
return "person.badge.plus"
|
||||
case .mention:
|
||||
return "at"
|
||||
case .reblog:
|
||||
return "arrow.2.squarepath"
|
||||
case .favourite:
|
||||
return "star.fill"
|
||||
case .poll:
|
||||
return "chart.bar.xaxis"
|
||||
case .status:
|
||||
return "bell.fill"
|
||||
case .unknown:
|
||||
return "app.badge"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// Copyright © 2020 Metabolist. All rights reserved.
|
||||
|
||||
import Mastodon
|
||||
import SwiftUI
|
||||
import ViewModels
|
||||
|
||||
|
@ -8,20 +9,34 @@ struct NotificationTypesPreferencesView: View {
|
|||
|
||||
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.follow-request",
|
||||
isOn: $viewModel.pushSubscriptionAlerts.followRequest)
|
||||
Toggle("preferences.notification-types.poll",
|
||||
isOn: $viewModel.pushSubscriptionAlerts.poll)
|
||||
Toggle("preferences.notification-types.status",
|
||||
isOn: $viewModel.pushSubscriptionAlerts.status)
|
||||
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)
|
||||
}
|
||||
}
|
||||
.navigationTitle("preferences.notification-types")
|
||||
.alertItem($viewModel.alertItem)
|
||||
|
|
|
@ -253,22 +253,3 @@ private extension NotificationView {
|
|||
}
|
||||
// swiftlint:enable function_body_length
|
||||
}
|
||||
|
||||
extension MastodonNotification.NotificationType {
|
||||
var systemImageName: String {
|
||||
switch self {
|
||||
case .follow, .followRequest:
|
||||
return "person.badge.plus"
|
||||
case .reblog:
|
||||
return "arrow.2.squarepath"
|
||||
case .favourite:
|
||||
return "star.fill"
|
||||
case .poll:
|
||||
return "chart.bar.doc.horizontal"
|
||||
case .status:
|
||||
return "house"
|
||||
case .mention, .unknown:
|
||||
return "at"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue