Skip to content

Commit

Permalink
Fix parameter value for push provisioning (#102)
Browse files Browse the repository at this point in the history
* Fix parameter value for push provisioning
* PubNub SDK v6.2.1 release.

---------

Co-authored-by: PubNub Release Bot <[email protected]>
  • Loading branch information
seba-aln and pubnub-release-bot committed Jun 11, 2024
1 parent 20de5d8 commit 6f576b3
Show file tree
Hide file tree
Showing 20 changed files with 38 additions and 28 deletions.
11 changes: 8 additions & 3 deletions .pubnub.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
name: php
version: 6.2.0
version: 6.2.1
schema: 1
scm: github.com/pubnub/php
changelog:
- date: 2024-06-11
version: v6.2.1
changes:
- type: bug
text: "Fix value for FCM push type provisioning key."
- date: 2024-06-11
version: v6.2.0
changes:
Expand Down Expand Up @@ -412,8 +417,8 @@ sdks:
- x86-64
- distribution-type: library
distribution-repository: GitHub release
package-name: php-6.2.0.zip
location: https://github.com/pubnub/php/releases/tag/v6.2.0
package-name: php-6.2.1.zip
location: https://github.com/pubnub/php/releases/tag/v6.2.1
requires:
- name: rmccue/requests
min-version: 1.0.0
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## v6.2.1
June 11 2024

#### Fixed
- Fix value for FCM push type provisioning key.

## v6.2.0
June 11 2024

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ You will need the publish and subscribe keys to authenticate your app. Get your
{
"require": {
<!-- include the latest version from the badge at the top -->
"pubnub/pubnub": "6.2.0"
"pubnub/pubnub": "6.2.1"
}
}
```
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"keywords": ["api", "real-time", "realtime", "real time", "ajax", "push"],
"homepage": "http://www.pubnub.com/",
"license": "proprietary",
"version": "6.2.0",
"version": "6.2.1",
"authors": [
{
"name": "PubNub",
Expand Down
3 changes: 1 addition & 2 deletions src/PubNub/Endpoints/Push/AddChannelsToPush.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ protected function customParams()
];

if ($this->pushType != PNPushType::APNS2) {
// v1 push -> add type
$params['type'] = $this->pushType;
$params['type'] = $this->getPushType();
} else {
// apns2 push -> add topic and environment
$params['topic'] = $this->topic;
Expand Down
4 changes: 1 addition & 3 deletions src/PubNub/Endpoints/Push/ListPushProvisions.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use PubNub\Enums\PNHttpMethod;
use PubNub\Enums\PNOperationType;
use PubNub\Enums\PNPushType;
use PubNub\Exceptions\PubNubValidationException;
use PubNub\Models\Consumer\Push\PNPushListProvisionsResult;

class ListPushProvisions extends PushEndpoint
Expand All @@ -23,8 +22,7 @@ protected function customParams()
$params = [];

if ($this->pushType != PNPushType::APNS2) {
// v1 push -> add type
$params['type'] = $this->pushType;
$params['type'] = $this->getPushType();
} else {
// apns2 push -> add topic and environment
$params['topic'] = $this->topic;
Expand Down
5 changes: 5 additions & 0 deletions src/PubNub/Endpoints/Push/PushEndpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,4 +146,9 @@ protected function getName()
{
return static::OPERATION_NAME;
}

protected function getPushType(): string
{
return $this->pushType == PNPushType::FCM ? 'gcm' : $this->pushType;
}
}
3 changes: 1 addition & 2 deletions src/PubNub/Endpoints/Push/RemoveChannelsFromPush.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ protected function customParams()
];

if ($this->pushType != PNPushType::APNS2) {
// v1 push -> add type
$params['type'] = $this->pushType;
$params['type'] = $this->getPushType();
} else {
// apns2 push -> add topic and environment
$params['topic'] = $this->topic;
Expand Down
4 changes: 1 addition & 3 deletions src/PubNub/Endpoints/Push/RemoveDeviceFromPush.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
use PubNub\Enums\PNHttpMethod;
use PubNub\Enums\PNOperationType;
use PubNub\Enums\PNPushType;
use PubNub\Exceptions\PubNubValidationException;
use PubNub\Models\Consumer\Push\PNPushRemoveAllChannelsResult;

class RemoveDeviceFromPush extends PushEndpoint
Expand All @@ -24,8 +23,7 @@ protected function customParams()
$params = [];

if ($this->pushType != PNPushType::APNS2) {
// v1 push -> add type
$params['type'] = $this->pushType;
$params['type'] = $this->getPushType();
} else {
// apns2 push -> add topic and environment
$params['topic'] = $this->topic;
Expand Down
2 changes: 1 addition & 1 deletion src/PubNub/PubNub.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@

class PubNub implements LoggerAwareInterface
{
protected const SDK_VERSION = "6.2.0";
protected const SDK_VERSION = "6.2.1";
protected const SDK_NAME = "PubNub-PHP";

public static $MAX_SEQUENCE = 65535;
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/push/AddChannelsToPushTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public function testPushAddFCM()
$this->assertEquals([
"pnsdk" => PubNubUtil::urlEncode(PubNub::getSdkFullName()),
"uuid" => $this->pubnub->getConfiguration()->getUuid(),
"type" => "fcm",
"type" => "gcm",
"add" => "ch1,ch2,ch3"
], $add->buildParams());

Expand Down
2 changes: 1 addition & 1 deletion tests/functional/push/ListPushProvisionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public function testListChannelGroupFCM()
$this->assertEquals([
"pnsdk" => PubNubUtil::urlEncode(PubNub::getSdkFullName()),
"uuid" => $this->pubnub->getConfiguration()->getUuid(),
"type" => "fcm"
"type" => "gcm"
], $list->buildParams());
}

Expand Down
2 changes: 1 addition & 1 deletion tests/functional/push/RemoveChannelsFromPushTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function testPushRemoveFCM()
$this->assertEquals([
"pnsdk" => PubNubUtil::urlEncode(PubNub::getSdkFullName()),
"uuid" => $this->pubnub->getConfiguration()->getUuid(),
"type" => "fcm",
"type" => "gcm",
"remove" => "ch1,ch2,ch3"
], $remove->buildParams());
}
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/push/RemoveDeviceFromPushTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function testRemovePushFCM()
$this->assertEquals([
"pnsdk" => PubNubUtil::urlEncode(PubNub::getSdkFullName()),
"uuid" => $this->pubnub->getConfiguration()->getUuid(),
"type" => "fcm",
"type" => "gcm",
], $remove->buildParams());
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/integrational/ListPushProvisionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function testFCMSuccess()

$list->stubFor("/v1/push/sub-key/demo/devices/coolDevice")
->withQuery([
"type" => "fcm",
"type" => "gcm",
"pnsdk" => $this->encodedSdkName,
"uuid" => "sampleUUID"
])
Expand Down
6 changes: 3 additions & 3 deletions tests/integrational/ModifyPushChannelsForDeviceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function testFCMSuccessRemoveAll()

$listRemove->stubFor("/v1/push/sub-key/demo/devices/coolDevice/remove")
->withQuery([
"type" => "fcm",
"type" => "gcm",
"pnsdk" => $this->encodedSdkName,
"uuid" => "sampleUUID"
])
Expand Down Expand Up @@ -200,7 +200,7 @@ public function testAddFCMSuccessSync()
$listAdd->stubFor("/v1/push/sub-key/demo/devices/coolDevice")
->withQuery([
"add" => "ch1,ch2,ch3",
"type" => "fcm",
"type" => "gcm",
"pnsdk" => $this->encodedSdkName,
"uuid" => "sampleUUID"
])
Expand Down Expand Up @@ -383,7 +383,7 @@ public function testFCMSuccessRemove()
$remove->stubFor("/v1/push/sub-key/demo/devices/coolDevice")
->withQuery([
"remove" => "ch1,ch2,ch3",
"type" => "fcm",
"type" => "gcm",
"pnsdk" => $this->encodedSdkName,
"uuid" => "sampleUUID"
])
Expand Down
2 changes: 1 addition & 1 deletion tests/integrational/push/AddChannelsToPushEndpointTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public function testPushAddFCM()
->withQuery([
"pnsdk" => $this->encodedSdkName,
"add" => "ch1,ch2,ch3",
"type" => "fcm",
"type" => "gcm",
"uuid" => "sampleUUID",
])
->setResponseBody('[1, "Modified Channels"]');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function testListChannelGroupFCM()
$list->stubFor("/v1/push/sub-key/demo/devices/coolDevice")
->withQuery([
"pnsdk" => $this->encodedSdkName,
"type" => "fcm",
"type" => "gcm",
"uuid" => "sampleUUID",
])
->setResponseBody('[1, "Modified Channels"]');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public function testPushRemoveFCM()
$remove->stubFor("/v1/push/sub-key/demo/devices/coolDevice")
->withQuery([
"pnsdk" => $this->encodedSdkName,
"type" => "fcm",
"type" => "gcm",
"uuid" => "sampleUUID",
"remove" => "ch1,ch2,ch3"
])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function testRemovePushFCM()
$remove->stubFor("/v1/push/sub-key/demo/devices/coolDevice/remove")
->withQuery([
"pnsdk" => $this->encodedSdkName,
"type" => "fcm",
"type" => "gcm",
"uuid" => "sampleUUID",
])
->setResponseBody('[1, "Modified Channels"]');
Expand Down

0 comments on commit 6f576b3

Please sign in to comment.