From e3e4d98e6b21303988e051da93d503c59d58f386 Mon Sep 17 00:00:00 2001 From: Tim Date: Tue, 31 Aug 2021 13:04:37 -0500 Subject: [PATCH 1/2] adding FCM to enums --- src/PubNub/Enums/PNPushType.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/PubNub/Enums/PNPushType.php b/src/PubNub/Enums/PNPushType.php index be0450ad..c1c251b7 100644 --- a/src/PubNub/Enums/PNPushType.php +++ b/src/PubNub/Enums/PNPushType.php @@ -9,4 +9,6 @@ class PNPushType const APNS2 = "apns2"; const MPNS = "mpns"; const GCM = "gcm"; + // FCM is the new name of GCM. Pubnub still requires 'gcm' + const FCM = "gcm"; } \ No newline at end of file From 765890ab18b5c3f549e5f1bd4ce6f1cce3b17e7f Mon Sep 17 00:00:00 2001 From: Tim Date: Tue, 31 Aug 2021 18:30:47 -0500 Subject: [PATCH 2/2] adding FCM Mobile Apps return FCM --- src/PubNub/Endpoints/Push/AddChannelsToPush.php | 6 ++++++ src/PubNub/Endpoints/Push/ListPushProvisions.php | 6 ++++++ src/PubNub/Endpoints/Push/RemoveChannelsFromPush.php | 6 ++++++ src/PubNub/Endpoints/Push/RemoveDeviceFromPush.php | 6 ++++++ src/PubNub/Enums/PNPushType.php | 3 +-- 5 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/PubNub/Endpoints/Push/AddChannelsToPush.php b/src/PubNub/Endpoints/Push/AddChannelsToPush.php index e3cadfd8..dcd93e62 100644 --- a/src/PubNub/Endpoints/Push/AddChannelsToPush.php +++ b/src/PubNub/Endpoints/Push/AddChannelsToPush.php @@ -60,6 +60,12 @@ public function deviceId($deviceId) */ public function pushType($pushType) { + // FCM is new, GCM is still used internally + if( $pushType == PNPushType::FCM ) + { + $pushType = PNPushType::GCM; + } + $this->pushType = $pushType; return $this; diff --git a/src/PubNub/Endpoints/Push/ListPushProvisions.php b/src/PubNub/Endpoints/Push/ListPushProvisions.php index dbdae96c..952d7183 100644 --- a/src/PubNub/Endpoints/Push/ListPushProvisions.php +++ b/src/PubNub/Endpoints/Push/ListPushProvisions.php @@ -45,6 +45,12 @@ public function deviceId($deviceId) */ public function pushType($pushType) { + // FCM is new, GCM is still used internally + if( $pushType == PNPushType::FCM ) + { + $pushType = PNPushType::GCM; + } + $this->pushType = $pushType; return $this; diff --git a/src/PubNub/Endpoints/Push/RemoveChannelsFromPush.php b/src/PubNub/Endpoints/Push/RemoveChannelsFromPush.php index 3ff0e03e..ec5c12df 100644 --- a/src/PubNub/Endpoints/Push/RemoveChannelsFromPush.php +++ b/src/PubNub/Endpoints/Push/RemoveChannelsFromPush.php @@ -60,6 +60,12 @@ public function deviceId($deviceId) */ public function pushType($pushType) { + // FCM is new, GCM is still used internally + if( $pushType == PNPushType::FCM ) + { + $pushType = PNPushType::GCM; + } + $this->pushType = $pushType; return $this; diff --git a/src/PubNub/Endpoints/Push/RemoveDeviceFromPush.php b/src/PubNub/Endpoints/Push/RemoveDeviceFromPush.php index e74f6534..256a563d 100644 --- a/src/PubNub/Endpoints/Push/RemoveDeviceFromPush.php +++ b/src/PubNub/Endpoints/Push/RemoveDeviceFromPush.php @@ -45,6 +45,12 @@ public function deviceId($deviceId) */ public function pushType($pushType) { + // FCM is new, GCM is still used internally + if( $pushType == PNPushType::FCM ) + { + $pushType = PNPushType::GCM; + } + $this->pushType = $pushType; return $this; diff --git a/src/PubNub/Enums/PNPushType.php b/src/PubNub/Enums/PNPushType.php index c1c251b7..e118af07 100644 --- a/src/PubNub/Enums/PNPushType.php +++ b/src/PubNub/Enums/PNPushType.php @@ -9,6 +9,5 @@ class PNPushType const APNS2 = "apns2"; const MPNS = "mpns"; const GCM = "gcm"; - // FCM is the new name of GCM. Pubnub still requires 'gcm' - const FCM = "gcm"; + const FCM = "fcm"; } \ No newline at end of file