mirror of
https://github.com/mastodon/mastodon-ios
synced 2025-04-11 22:58:02 +02:00
Remove unused code
Contributes to #399 [BUG] Multiple interactions do not collapse into a single notification
This commit is contained in:
parent
966cef6541
commit
afdecc2d1f
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user