From afdecc2d1f322fb5de418a623b97630fa3aae57e Mon Sep 17 00:00:00 2001 From: shannon Date: Thu, 6 Feb 2025 08:44:19 -0500 Subject: [PATCH] Remove unused code Contributes to #399 [BUG] Multiple interactions do not collapse into a single notification --- .../GroupedNotificationFeedLoader.swift | 69 ++----------------- 1 file changed, 5 insertions(+), 64 deletions(-) diff --git a/Mastodon/In Progress New Layout and Datamodel/GroupedNotificationFeedLoader.swift b/Mastodon/In Progress New Layout and Datamodel/GroupedNotificationFeedLoader.swift index c0761d05f..d5646a61d 100644 --- a/Mastodon/In Progress New Layout and Datamodel/GroupedNotificationFeedLoader.swift +++ b/Mastodon/In Progress New Layout and Datamodel/GroupedNotificationFeedLoader.swift @@ -176,57 +176,18 @@ extension GroupedNotificationFeedLoader { withScope scope: APIService.MastodonNotificationScope, olderThan maxID: String? = nil ) async throws -> [_NotificationViewModel] { - let useGroupedNotifications = UserDefaults.standard - .useGroupedNotifications - if useGroupedNotifications { - return try await _getGroupedNotifications( - withScope: scope, olderThan: maxID) - } else { - return try await _getUngroupedNotifications( - withScope: scope, olderThan: maxID) - } + return try await getGroupedNotifications( + withScope: scope, olderThan: maxID) } private func loadNotifications( withAccountID accountID: String, olderThan maxID: String? = nil ) async throws -> [_NotificationViewModel] { - let useGroupedNotifications = UserDefaults.standard - .useGroupedNotifications - if useGroupedNotifications { - return try await _getGroupedNotifications( - accountID: accountID, olderThan: maxID) - } else { - return try await _getUngroupedNotifications( - accountID: accountID, olderThan: maxID) - } + return try await getGroupedNotifications( + accountID: accountID, olderThan: maxID) } - private func _getUngroupedNotifications( - withScope scope: APIService.MastodonNotificationScope? = nil, - accountID: String? = nil, olderThan maxID: String? = nil - ) async throws -> [_NotificationViewModel] { - - assert(scope != nil || accountID != nil, "need a scope or an accountID") - guard - let authenticationBox = AuthenticationServiceProvider.shared - .currentActiveUser.value - else { throw APIService.APIError.implicit(.authenticationMissing) } - - let notifications = try await APIService.shared.notifications( - olderThan: maxID, fromAccount: accountID, scope: scope, - authenticationBox: authenticationBox - ).value - - return notifications.map { - _NotificationViewModel( - $0, - navigateToScene: navigateToScene, - presentError: { [weak self] error in self?.presentError(error) } - ) - } - } - - private func _getGroupedNotifications( + private func getGroupedNotifications( withScope scope: APIService.MastodonNotificationScope? = nil, accountID: String? = nil, olderThan maxID: String? = nil ) async throws -> [_NotificationViewModel] { @@ -252,26 +213,6 @@ extension GroupedNotificationFeedLoader { presentError: { [weak self] error in self?.presentError(error) } ) } - - private func _getGroupedNotificationResults( - withScope scope: APIService.MastodonNotificationScope? = nil, - accountID: String? = nil, olderThan maxID: String? = nil - ) async throws -> Mastodon.Entity.GroupedNotificationsResults { - - assert(scope != nil || accountID != nil, "need a scope or an accountID") - - guard - let authenticationBox = AuthenticationServiceProvider.shared - .currentActiveUser.value - else { throw APIService.APIError.implicit(.authenticationMissing) } - - let results = try await APIService.shared.groupedNotifications( - olderThan: maxID, fromAccount: accountID, scope: scope, - authenticationBox: authenticationBox - ).value - - return results - } }