DID THIS ARTICLE SOLVE YOUR ISSUE?
Let us know so we can improve!
Let us know so we can improve!
Class
The main API class of PushFeature module
1@objc(SFPushFeature)
2public final class PushFeature: NSObject,
3 SFMCModule,
4 Subscriber,
5 Publisher
6
7@objc
8public static func requestSdk(_ callback: @escaping (_ pushFeature: PushFeatureApi?) -> Void)
9
10public func setDeviceToken(_ deviceToken: Data)
11
12public func deviceToken() -> String?
13
14public func setPushEnabled(pushEnabled: Bool)
15
16public func isPushEnabled() -> Bool
17
18public func setNotificationResponse(_ response: UNNotificationResponse)
19
20public func notificationResponse() -> UNNotificationResponse?
21
22public func setNotificationUserInfo(_ userInfo: [AnyHashable : Any])
23
24public func notificationUserInfo() -> [AnyHashable : Any]
25
26public func setURLHandlingDelegate(_ delegate: URLHandlingDelegate)Requests the Push Feature Module when it’s operational and safe to use. The provided callback will be invoked with the Push Feature Module when it’s ready. All push feature module-related API calls should be made within this function.
1@objc
2public static func requestSdk(_ callback: @escaping (_ pushFeature: PushFeatureApi?) -> Void)Responsible for sending the Apple device token back to all the subscribers. It marks the end of the token registration flow. If it is unable to reach Salesforce server, it will save the token and try again later. This method is necessary to the implementation of Salesforce Push.
1public func setDeviceToken(_ deviceToken: Data)Returns the device token as a String.
1public func deviceToken() -> String?Developer override to set the state of push enablement to true/false. If set to false, the application will not receive any push notifications once the Marketing Cloud server has been updated. When this value is false, it takes precedence (overrides) the user notifications settings (i.e., setting this to false will always disable push.) Conversely, if the user has notifications settings disabled, the developer cannot enable push via this method. A false value from either source (user settings or developer interface) always wins.
1public func setPushEnabled(pushEnabled: Bool)Combination of push enabled from user notifications settings and push enabled by sdk.
1public func isPushEnabled() -> BoolInforms the module of the current notification response when user clicks a notification.
1public func setNotificationResponse(_ response: UNNotificationResponse)Returns the last notification response delivered to the module.
1public func notificationResponse() -> UNNotificationResponse?Informs the module of the current userInfo when user clicks a notification.
1public func setNotificationUserInfo(_ userInfo: [AnyHashable : Any])Returns the user info of the last notification delivered to the module.
1public func notificationUserInfo() -> [AnyHashable : Any]Set URLHandling delegate to handle URLs in OpenDirect URLs, CloudPage URLs, CloudPage URLs from inbox messages.This value takes precedence over the config setting which is passed during the SDK initialization.
1public func setURLHandlingDelegate(_ delegate: URLHandlingDelegate)