Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ internal extension PushNotificationManager {
}

let categories = filterTypes
.flatMap { createNotificationCategories(from: $0) }
.flatMap { NotificationCategoryFactory.shared.createCategories(from: [$0]) }
UNUserNotificationCenter.current().setNotificationCategories(Set(categories))
}

Expand All @@ -163,34 +163,7 @@ internal extension PushNotificationManager {
}

private extension PushNotificationManager {

func createNotificationCategories(from type: NotificationType) -> [UNNotificationCategory] {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like the deleted code is duplicative of the methods in NotificationCategoryFactory.swift

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does NotificationCategoryFactory.shared.createCategories behave differently from the duplicate?

guard let actionGroups = type.actionGroups else { return [] }

return actionGroups.map { group in
let actions = createActions(from: group)
return UNNotificationCategory(
identifier: group.name,
actions: actions,
intentIdentifiers: []
)
}
}

func createActions(from actionGroup: ActionGroup?) -> [UNNotificationAction] {
guard let actionGroup = actionGroup else {
return []
}

return actionGroup.actions.compactMap { action in
UNNotificationAction(
identifier: action.identifier,
title: action.label,
options: [.foreground] // Ensures the app opens if needed
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the line causing the issue and the updated logic is already in the other class here

)
}
}

func getNotificationType(apiName: String, account: UserAccount) -> NotificationType? {
guard let notificationTypes = account.notificationTypes else { return nil }
return notificationTypes.first { $0.apiName == apiName }
Expand Down
Loading