Skip to content

Commit

Permalink
Rename to OneSignal prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
mpociot committed Aug 12, 2016
1 parent 6399ca2 commit baf078d
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 15 deletions.
15 changes: 8 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,9 @@ Add your OneSignal App ID and REST API Key to your `config/services.php`:
Now you can use the channel in your `via()` method inside the notification:

``` php
use NotificationChannels\OneSignal\Channel;
use NotificationChannels\OneSignal\Message;
use NotificationChannels\OneSignal\OneSignalChannel;
use NotificationChannels\OneSignal\OneSignalMessage;
use NotificationChannels\OneSignal\OneSignalWebButton;
use Illuminate\Notifications\Notification;

class AccountApproved extends Notification
Expand All @@ -79,7 +80,7 @@ class AccountApproved extends Notification
->subject("Your {$notifiable->service} account was approved!")
->body("Click here to see details.")
->url('http://onesignal.com')
->webButton(WebButton::create('link-1')
->webButton(OneSignalWebButton::create('link-1')
->text('Click here')
->icon('https://upload.wikimedia.org/wikipedia/commons/4/4f/Laravel_logo.png')
->url('http://laravel.com')
Expand All @@ -105,15 +106,15 @@ public function routeNotificationForOneSignal()
- `body('')`: Accepts a string value for the notification body.
- `icon('')`: Accepts an url for the icon.
- `url('')`: Accepts an url for the notification click event.
- `webButton(WebButton $button)`: Allows you to add action buttons to the notification (Chrome 48+ (web push) only).
- `button(Button $button)`: Allows you to add buttons to the notification (Supported by iOS 8.0 and Android 4.1+ devices. Icon only works for Android).
- `webButton(OneSignalWebButton $button)`: Allows you to add action buttons to the notification (Chrome 48+ (web push) only).
- `button(OneSignalButton $button)`: Allows you to add buttons to the notification (Supported by iOS 8.0 and Android 4.1+ devices. Icon only works for Android).
- `setData($key, $value)`: Allows you to set additional data for the message payload. For more information check the [OneSignal documentation](https://documentation.onesignal.com/docs/notifications-create-notification).

### Button usage

```php
OneSignalMessage::create()
->button(Button::create('id')
->button(OneSignalButton::create('id')
->text('button text')
->icon('button icon')
);
Expand All @@ -123,7 +124,7 @@ OneSignalMessage::create()

```php
OneSignalMessage::create()
->webButton(WebButton::create('id')
->webButton(OneSignalWebButton::create('id')
->text('button text')
->icon('button icon')
->url('button url')
Expand Down
4 changes: 2 additions & 2 deletions src/Button.php → src/OneSignalButton.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
namespace NotificationChannels\OneSignal;

/**
* Class Button.
* Class OneSignalButton.
*/
class Button
class OneSignalButton
{
/** @var string */
protected $id;
Expand Down
8 changes: 4 additions & 4 deletions src/OneSignalMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,11 @@ public function setData($key, $value)
/**
* Add a web button to the message.
*
* @param WebButton $button
* @param OneSignalWebButton $button
*
* @return $this
*/
public function webButton(WebButton $button)
public function webButton(OneSignalWebButton $button)
{
$this->webButtons[] = $button->toArray();

Expand All @@ -133,11 +133,11 @@ public function webButton(WebButton $button)
/**
* Add a native button to the message.
*
* @param Button $button
* @param OneSignalButton $button
*
* @return $this
*/
public function button(Button $button)
public function button(OneSignalButton $button)
{
$this->buttons[] = $button->toArray();

Expand Down
4 changes: 2 additions & 2 deletions src/WebButton.php → src/OneSignalWebButton.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
namespace NotificationChannels\OneSignal;

/**
* Class WebButton.
* Class OneSignalWebButton.
*/
class WebButton
class OneSignalWebButton
{
/** @var string */
protected $id;
Expand Down

0 comments on commit baf078d

Please sign in to comment.