Skip to content

Commit

Permalink
Merge pull request #11 from deskpro/feat/push-notifications
Browse files Browse the repository at this point in the history
check if push notification is sent by Deskpro
  • Loading branch information
qsd-faris authored Feb 13, 2024
2 parents c1fb10f + 35a2c38 commit faa86e0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
11 changes: 7 additions & 4 deletions Sources/Deskpro.swift
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,17 @@ public final class DeskPro: Messenger {
///
/// This method examines the provided push notification data to determine whether it is intended for the DeskPro SDK.
///
/// - Parameter pushNotification: The push notification data to be analyzed.
/// - Parameter data: The push notification data to be analyzed.
///
/// - Returns: `true` if the push notification is related to DeskPro; `false` otherwise.
///
/// - Tag: isDeskProPushNotification
public final func isDeskProPushNotification(pushNotification: PushNotificationData) -> Bool {
// TODO: Not yet implemented
return true
public final func isDeskProPushNotification(data: [AnyHashable: Any]) -> Bool {
if let issuer = data["issuer"] as? String {
return issuer == "deskpro-messenger"
} else {
return false
}
}

/// Handles the incoming push notification data if it is related to DeskPro.
Expand Down
4 changes: 2 additions & 2 deletions Sources/Messenger.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ protocol Messenger {
///
/// This method examines the provided push notification data to determine whether it is intended for the DeskPro SDK.
///
/// - Parameter pushNotification: The push notification data to be analyzed.
/// - Parameter data: The push notification data to be analyzed.
///
/// - Returns: `true` if the push notification is related to DeskPro; `false` otherwise.
///
/// - Tag: isDeskProPushNotification
func isDeskProPushNotification(pushNotification: PushNotificationData) -> Bool
func isDeskProPushNotification(data: [AnyHashable: Any]) -> Bool

/// Handles the incoming push notification data if it is related to DeskPro.
///
Expand Down

0 comments on commit faa86e0

Please sign in to comment.