From 741545fc1f5d9e51dd047654fb49b931cf1a40db Mon Sep 17 00:00:00 2001 From: Justin Mazzocchi <2831158+jzzocc@users.noreply.github.com> Date: Thu, 28 Jan 2021 19:15:06 -0800 Subject: [PATCH] Follow request notification type --- Localizations/Localizable.strings | 1 + Mastodon/Sources/Mastodon/Entities/PushSubscription.swift | 2 ++ .../MastodonAPI/Endpoints/PushSubscriptionEndpoint.swift | 2 ++ Views/NotificationTypesPreferencesView.swift | 2 ++ 4 files changed, 7 insertions(+) diff --git a/Localizations/Localizable.strings b/Localizations/Localizable.strings index 29fd865..902088a 100644 --- a/Localizations/Localizable.strings +++ b/Localizations/Localizable.strings @@ -141,6 +141,7 @@ "preferences.notification-types" = "Notification Types"; "preferences.notification-types.follow" = "Follow"; "preferences.notification-types.favourite" = "Favorite"; +"preferences.notification-types.follow-request" = "Follow Request"; "preferences.notification-types.reblog" = "Reblog"; "preferences.notification-types.mention" = "Mention"; "preferences.notification-types.poll" = "Poll"; diff --git a/Mastodon/Sources/Mastodon/Entities/PushSubscription.swift b/Mastodon/Sources/Mastodon/Entities/PushSubscription.swift index 83e241a..6e82805 100644 --- a/Mastodon/Sources/Mastodon/Entities/PushSubscription.swift +++ b/Mastodon/Sources/Mastodon/Entities/PushSubscription.swift @@ -8,6 +8,7 @@ public struct PushSubscription: Codable { public var favourite: Bool public var reblog: Bool public var mention: Bool + @DecodableDefault.True public var followRequest: Bool @DecodableDefault.True public var poll: Bool @DecodableDefault.True public var status: Bool } @@ -23,6 +24,7 @@ public extension PushSubscription.Alerts { favourite: true, reblog: true, mention: true, + followRequest: DecodableDefault.True(), poll: DecodableDefault.True(), status: DecodableDefault.True()) } diff --git a/MastodonAPI/Sources/MastodonAPI/Endpoints/PushSubscriptionEndpoint.swift b/MastodonAPI/Sources/MastodonAPI/Endpoints/PushSubscriptionEndpoint.swift index 39d51a1..92c9666 100644 --- a/MastodonAPI/Sources/MastodonAPI/Endpoints/PushSubscriptionEndpoint.swift +++ b/MastodonAPI/Sources/MastodonAPI/Endpoints/PushSubscriptionEndpoint.swift @@ -47,6 +47,7 @@ extension PushSubscriptionEndpoint: Endpoint { "favourite": alerts.favourite, "reblog": alerts.reblog, "mention": alerts.mention, + "follow_request": alerts.followRequest, "poll": alerts.poll, "status": alerts.status ]]] @@ -57,6 +58,7 @@ extension PushSubscriptionEndpoint: Endpoint { "favourite": alerts.favourite, "reblog": alerts.reblog, "mention": alerts.mention, + "follow_request": alerts.followRequest, "poll": alerts.poll, "status": alerts.status]]] default: return nil diff --git a/Views/NotificationTypesPreferencesView.swift b/Views/NotificationTypesPreferencesView.swift index f8f97fb..c522b5a 100644 --- a/Views/NotificationTypesPreferencesView.swift +++ b/Views/NotificationTypesPreferencesView.swift @@ -16,6 +16,8 @@ struct NotificationTypesPreferencesView: View { 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",