Skip to content

Commit 98edec1

Browse files
authored
Merge pull request #3954 from bbirman/actionable-notifications-options
Fix actionable notifications options
2 parents bc63575 + e122204 commit 98edec1

File tree

1 file changed

+1
-28
lines changed

1 file changed

+1
-28
lines changed

libs/SalesforceSDKCore/SalesforceSDKCore/Classes/Extensions/PushNotificationManager+ActionableNotifications.swift

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ internal extension PushNotificationManager {
153153
}
154154

155155
let categories = filterTypes
156-
.flatMap { createNotificationCategories(from: $0) }
156+
.flatMap { NotificationCategoryFactory.shared.createCategories(from: [$0]) }
157157
UNUserNotificationCenter.current().setNotificationCategories(Set(categories))
158158
}
159159

@@ -163,34 +163,7 @@ internal extension PushNotificationManager {
163163
}
164164

165165
private extension PushNotificationManager {
166-
167-
func createNotificationCategories(from type: NotificationType) -> [UNNotificationCategory] {
168-
guard let actionGroups = type.actionGroups else { return [] }
169166

170-
return actionGroups.map { group in
171-
let actions = createActions(from: group)
172-
return UNNotificationCategory(
173-
identifier: group.name,
174-
actions: actions,
175-
intentIdentifiers: []
176-
)
177-
}
178-
}
179-
180-
func createActions(from actionGroup: ActionGroup?) -> [UNNotificationAction] {
181-
guard let actionGroup = actionGroup else {
182-
return []
183-
}
184-
185-
return actionGroup.actions.compactMap { action in
186-
UNNotificationAction(
187-
identifier: action.identifier,
188-
title: action.label,
189-
options: [.foreground] // Ensures the app opens if needed
190-
)
191-
}
192-
}
193-
194167
func getNotificationType(apiName: String, account: UserAccount) -> NotificationType? {
195168
guard let notificationTypes = account.notificationTypes else { return nil }
196169
return notificationTypes.first { $0.apiName == apiName }

0 commit comments

Comments
 (0)