Removed old developement API key

This commit is contained in:
Josef Citrine 2016-06-12 02:51:40 +01:00
parent a29b5a62bb
commit 0c1a283867
3 changed files with 41 additions and 24 deletions

View file

@ -21,6 +21,7 @@
namespace Poniverse\Ponyfm\Library\Notifications\Drivers;
use Config;
use Poniverse\Ponyfm\Contracts\Favouritable;
use Poniverse\Ponyfm\Models\Activity;
use Poniverse\Ponyfm\Models\Comment;
@ -37,32 +38,34 @@ class NativeDriver extends AbstractDriver {
* @param User[] $recipients collection of {@link User} objects
*/
private function pushNotifications(Activity $activity, $recipients) {
$apiKeys = array(
'GCM' => 'AIzaSyCLmCVIgASWL280rHyPz8OP7il3pf8SrGg',
);
$webPush = new WebPush($apiKeys);
$data = [
'id' => $activity->id,
'text' => $activity->getTextAttribute(),
'title' => $activity->getTitleFromActivityType(),
'image' => $activity->getThumbnailUrlAttribute(),
'url' => $activity->url
];
$jsonData = json_encode($data);
foreach ($recipients as $recipient) {
$webPush->sendNotification(
$recipient->endpoint,
$jsonData,
$recipient->p256dh,
$recipient->auth
if (Config::get('ponyfm.gcm_key') != 'default') {
$apiKeys = array(
'GCM' => Config::get('ponyfm.gcm_key'),
);
}
$webPush->flush();
$webPush = new WebPush($apiKeys);
$data = [
'id' => $activity->id,
'text' => $activity->getTextAttribute(),
'title' => $activity->getTitleFromActivityType(),
'image' => $activity->getThumbnailUrlAttribute(),
'url' => $activity->url
];
$jsonData = json_encode($data);
foreach ($recipients as $recipient) {
$webPush->sendNotification(
$recipient->endpoint,
$jsonData,
$recipient->p256dh,
$recipient->auth
);
}
$webPush->flush();
}
}
/**

View file

@ -116,4 +116,17 @@ return [
*/
'user_slug_minimum_length' => 3
/*
|--------------------------------------------------------------------------
| Indexing queue name
|--------------------------------------------------------------------------
|
| Google Cloud Messaging API key. Needs to be generated in the Google Cloud
| Console as a browser key. This is used to send notifications to users
| with push notifications enabled.
|
*/
'gcm_key' => env('GCM_KEY', 'default'),
];

View file

@ -24,3 +24,4 @@ PONI_CLIENT_SECRET=null
PONYFM_DATASTORE=/vagrant/storage/app/datastore
GOOGLE_ANALYTICS_ID=null
GCM_KEY=12345