From c33a164354ac4b7b8e7ac68bab34472beda9e284 Mon Sep 17 00:00:00 2001 From: Stefan Ceriu Date: Thu, 17 Apr 2025 13:12:11 +0300 Subject: [PATCH] Remove unused `removeDeliveredInviteNotifications` `NotificationManager` method --- .../Mocks/Generated/GeneratedMocks.swift | 35 ------------------- .../Manager/NotificationManager.swift | 8 ----- .../Manager/NotificationManagerProtocol.swift | 1 - 3 files changed, 44 deletions(-) diff --git a/ElementX/Sources/Mocks/Generated/GeneratedMocks.swift b/ElementX/Sources/Mocks/Generated/GeneratedMocks.swift index 7801677cc..b76bacb05 100644 --- a/ElementX/Sources/Mocks/Generated/GeneratedMocks.swift +++ b/ElementX/Sources/Mocks/Generated/GeneratedMocks.swift @@ -12026,41 +12026,6 @@ class NotificationManagerMock: NotificationManagerProtocol, @unchecked Sendable } await removeDeliveredMessageNotificationsForClosure?(roomID) } - //MARK: - removeDeliveredInviteNotifications - - var removeDeliveredInviteNotificationsUnderlyingCallsCount = 0 - var removeDeliveredInviteNotificationsCallsCount: Int { - get { - if Thread.isMainThread { - return removeDeliveredInviteNotificationsUnderlyingCallsCount - } else { - var returnValue: Int? = nil - DispatchQueue.main.sync { - returnValue = removeDeliveredInviteNotificationsUnderlyingCallsCount - } - - return returnValue! - } - } - set { - if Thread.isMainThread { - removeDeliveredInviteNotificationsUnderlyingCallsCount = newValue - } else { - DispatchQueue.main.sync { - removeDeliveredInviteNotificationsUnderlyingCallsCount = newValue - } - } - } - } - var removeDeliveredInviteNotificationsCalled: Bool { - return removeDeliveredInviteNotificationsCallsCount > 0 - } - var removeDeliveredInviteNotificationsClosure: (() async -> Void)? - - func removeDeliveredInviteNotifications() async { - removeDeliveredInviteNotificationsCallsCount += 1 - await removeDeliveredInviteNotificationsClosure?() - } } class NotificationSettingsProxyMock: NotificationSettingsProxyProtocol, @unchecked Sendable { var callbacks: PassthroughSubject { diff --git a/ElementX/Sources/Services/Notification/Manager/NotificationManager.swift b/ElementX/Sources/Services/Notification/Manager/NotificationManager.swift index 178e4a2d7..2abf06f0b 100644 --- a/ElementX/Sources/Services/Notification/Manager/NotificationManager.swift +++ b/ElementX/Sources/Services/Notification/Manager/NotificationManager.swift @@ -129,14 +129,6 @@ final class NotificationManager: NSObject, NotificationManagerProtocol { notificationCenter.removeDeliveredNotifications(withIdentifiers: notificationsIdentifiers) } - func removeDeliveredInviteNotifications() async { - let notificationsIdentifiers = await notificationCenter - .deliveredNotifications() - .filter { $0.request.content.categoryIdentifier == NotificationConstants.Category.invite } - .map(\.request.identifier) - notificationCenter.removeDeliveredNotifications(withIdentifiers: notificationsIdentifiers) - } - private func setPusher(with deviceToken: Data, clientProxy: ClientProxyProtocol) async -> Bool { do { let defaultPayload = APNSPayload(aps: APSInfo(mutableContent: 1, diff --git a/ElementX/Sources/Services/Notification/Manager/NotificationManagerProtocol.swift b/ElementX/Sources/Services/Notification/Manager/NotificationManagerProtocol.swift index 99ec58a8c..5162deb68 100644 --- a/ElementX/Sources/Services/Notification/Manager/NotificationManagerProtocol.swift +++ b/ElementX/Sources/Services/Notification/Manager/NotificationManagerProtocol.swift @@ -33,5 +33,4 @@ protocol NotificationManagerProtocol: AnyObject { func requestAuthorization() func removeDeliveredMessageNotifications(for roomID: String) async - func removeDeliveredInviteNotifications() async }