-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #89 from utopia-php/feat-apns-content-available
Add push flags
- Loading branch information
Showing
10 changed files
with
497 additions
and
344 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
namespace Utopia\Messaging; | ||
|
||
enum Priority: int | ||
{ | ||
case NORMAL = 0; | ||
case HIGH = 1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
<?php | ||
|
||
namespace Utopia\Tests\Adapter\Push; | ||
|
||
use Utopia\Messaging\Adapter; | ||
use Utopia\Messaging\Messages\Push; | ||
use Utopia\Messaging\Priority; | ||
use Utopia\Tests\Adapter\Base as TestBase; | ||
|
||
abstract class Base extends TestBase | ||
{ | ||
protected Adapter $adapter; | ||
|
||
/** | ||
* @return array<string> | ||
*/ | ||
abstract protected function getTo(): array; | ||
|
||
public function testSend(): void | ||
{ | ||
$message = new Push( | ||
to: $this->getTo(), | ||
title: 'Test title', | ||
body: 'Test body', | ||
data: null, | ||
action: null, | ||
sound: 'default', | ||
icon: null, | ||
color: null, | ||
tag: null, | ||
badge: 1, | ||
); | ||
|
||
$response = $this->adapter->send($message); | ||
|
||
$this->assertResponse($response); | ||
} | ||
|
||
public function testSendSilent(): void | ||
{ | ||
$message = new Push( | ||
to: $this->getTo(), | ||
data: [ | ||
'key' => 'value', | ||
], | ||
contentAvailable: true | ||
); | ||
|
||
$response = $this->adapter->send($message); | ||
|
||
$this->assertResponse($response); | ||
} | ||
|
||
public function testSendCritical(): void | ||
{ | ||
$message = new Push( | ||
to: $this->getTo(), | ||
title: 'Test title', | ||
body: 'Test body', | ||
critical: true | ||
); | ||
|
||
$response = $this->adapter->send($message); | ||
|
||
$this->assertResponse($response); | ||
} | ||
|
||
public function testSendPriority(): void | ||
{ | ||
$message = new Push( | ||
to: $this->getTo(), | ||
title: 'Test title', | ||
body: 'Test body', | ||
priority: Priority::HIGH | ||
); | ||
|
||
$response = $this->adapter->send($message); | ||
|
||
$this->assertResponse($response); | ||
} | ||
} |
Oops, something went wrong.