Skip to content

Commit ef59c30

Browse files
authored
Added additional method for declining remote notifications (#225)
1 parent c7e3c1c commit ef59c30

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Sources/Segment/Plugins/Platforms/iOS/iOSDelegation.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,29 @@ import UIKit
1414
// MARK: - Remote Notifications
1515

1616
public protocol RemoteNotifications: Plugin {
17+
func declinedRemoteNotifications()
1718
func registeredForRemoteNotifications(deviceToken: Data)
1819
func failedToRegisterForRemoteNotification(error: Error?)
1920
func receivedRemoteNotification(userInfo: [AnyHashable: Any])
2021
func handleAction(identifier: String, userInfo: [String: Any])
2122
}
2223

2324
extension RemoteNotifications {
25+
public func declinedRemoteNotifications() {}
2426
public func registeredForRemoteNotifications(deviceToken: Data) {}
2527
public func failedToRegisterForRemoteNotification(error: Error?) {}
2628
public func receivedRemoteNotification(userInfo: [AnyHashable: Any]) {}
2729
public func handleAction(identifier: String, userInfo: [String: Any]) {}
2830
}
2931

3032
extension Analytics {
33+
public func declinedRemoteNotifications() {
34+
apply { plugin in
35+
if let p = plugin as? RemoteNotifications {
36+
p.declinedRemoteNotifications()
37+
}
38+
}
39+
}
3140
public func registeredForRemoteNotifications(deviceToken: Data) {
3241
setDeviceToken(deviceToken.hexString)
3342

0 commit comments

Comments
 (0)