Skip to content
Merged
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
9 changes: 9 additions & 0 deletions Sources/Segment/Plugins/Platforms/iOS/iOSDelegation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,29 @@ import UIKit
// MARK: - Remote Notifications

public protocol RemoteNotifications: Plugin {
func declinedRemoteNotifications()
func registeredForRemoteNotifications(deviceToken: Data)
func failedToRegisterForRemoteNotification(error: Error?)
func receivedRemoteNotification(userInfo: [AnyHashable: Any])
func handleAction(identifier: String, userInfo: [String: Any])
}

extension RemoteNotifications {
public func declinedRemoteNotifications() {}
public func registeredForRemoteNotifications(deviceToken: Data) {}
public func failedToRegisterForRemoteNotification(error: Error?) {}
public func receivedRemoteNotification(userInfo: [AnyHashable: Any]) {}
public func handleAction(identifier: String, userInfo: [String: Any]) {}
}

extension Analytics {
public func declinedRemoteNotifications() {
apply { plugin in
if let p = plugin as? RemoteNotifications {
p.declinedRemoteNotifications()
}
}
}
public func registeredForRemoteNotifications(deviceToken: Data) {
setDeviceToken(deviceToken.hexString)

Expand Down