diff --git a/Mastodon/Scene/Notification/NotificationTimeline/NotificationTimelineViewModel+LoadOldestState.swift b/Mastodon/Scene/Notification/NotificationTimeline/NotificationTimelineViewModel+LoadOldestState.swift index bc67a6304..5461223cb 100644 --- a/Mastodon/Scene/Notification/NotificationTimeline/NotificationTimelineViewModel+LoadOldestState.swift +++ b/Mastodon/Scene/Notification/NotificationTimeline/NotificationTimelineViewModel+LoadOldestState.swift @@ -108,7 +108,7 @@ extension NotificationTimelineViewModel.LoadOldestState { logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): fetch statues failed: \(error.localizedDescription)") await self.enter(state: Fail.self) } - } // Task + } // end Task } } diff --git a/Mastodon/Scene/Notification/NotificationTimeline/NotificationTimelineViewModel.swift b/Mastodon/Scene/Notification/NotificationTimeline/NotificationTimelineViewModel.swift index ee2ac8a0e..c48ed1199 100644 --- a/Mastodon/Scene/Notification/NotificationTimeline/NotificationTimelineViewModel.swift +++ b/Mastodon/Scene/Notification/NotificationTimeline/NotificationTimelineViewModel.swift @@ -88,7 +88,6 @@ extension NotificationTimelineViewModel { } } - var excludeTypes: [MastodonNotificationType]? { switch self { case .everything: return nil diff --git a/Mastodon/Service/APIService/APIService+Notification.swift b/Mastodon/Service/APIService/APIService+Notification.swift index 6cc0dbba3..921f75d01 100644 --- a/Mastodon/Service/APIService/APIService+Notification.swift +++ b/Mastodon/Service/APIService/APIService+Notification.swift @@ -23,6 +23,28 @@ extension APIService { let query = Mastodon.API.Notifications.Query( maxID: maxID, + types: { + switch scope { + case .everything: + return [ + .follow, + .followRequest, + .mention, + .reblog, + .favourite, + .poll, + .status, + ] + case .mentions: + return [ + .follow, + .followRequest, + .reblog, + .favourite, + .poll + ] + } + }(), excludeTypes: { switch scope { case .everything: diff --git a/MastodonSDK/Sources/MastodonSDK/API/Mastodon+API+Notifications.swift b/MastodonSDK/Sources/MastodonSDK/API/Mastodon+API+Notifications.swift index c6b56c9e9..f70caaa1d 100644 --- a/MastodonSDK/Sources/MastodonSDK/API/Mastodon+API+Notifications.swift +++ b/MastodonSDK/Sources/MastodonSDK/API/Mastodon+API+Notifications.swift @@ -90,6 +90,7 @@ extension Mastodon.API.Notifications { public let sinceID: Mastodon.Entity.Status.ID? public let minID: Mastodon.Entity.Status.ID? public let limit: Int? + public let types: [Mastodon.Entity.Notification.NotificationType]? public let excludeTypes: [Mastodon.Entity.Notification.NotificationType]? public let accountID: String? @@ -98,6 +99,7 @@ extension Mastodon.API.Notifications { sinceID: Mastodon.Entity.Status.ID? = nil, minID: Mastodon.Entity.Status.ID? = nil, limit: Int? = nil, + types: [Mastodon.Entity.Notification.NotificationType]? = nil, excludeTypes: [Mastodon.Entity.Notification.NotificationType]? = nil, accountID: String? = nil ) { @@ -105,6 +107,7 @@ extension Mastodon.API.Notifications { self.sinceID = sinceID self.minID = minID self.limit = limit + self.types = types self.excludeTypes = excludeTypes self.accountID = accountID } @@ -115,6 +118,11 @@ extension Mastodon.API.Notifications { sinceID.flatMap { items.append(URLQueryItem(name: "since_id", value: $0)) } minID.flatMap { items.append(URLQueryItem(name: "min_id", value: $0)) } limit.flatMap { items.append(URLQueryItem(name: "limit", value: String($0))) } + if let types = types { + types.forEach { + items.append(URLQueryItem(name: "types[]", value: $0.rawValue)) + } + } if let excludeTypes = excludeTypes { excludeTypes.forEach { items.append(URLQueryItem(name: "exclude_types[]", value: $0.rawValue))