Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/firebase notifications #30

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions symfony/.env.dist
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,7 @@ JWT_PASSPHRASE=d18b3a23aecce6de9a75dc3d00bc2489

# Elastic search
ELASTICSEARCH_HOST=elastic:changeme@localhost:9200

###> symfony/firebase-notifier ###
# FIREBASE_DSN=firebase://TOKEN@default
###< symfony/firebase-notifier ###
3 changes: 2 additions & 1 deletion symfony/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
"symfony/console": "5.2.*",
"symfony/dotenv": "^5.1",
"symfony/expression-language": "5.2.*",
"symfony/firebase-notifier": "^5.1",
"symfony/flex": "^1.2",
"symfony/form": "5.2.*",
"symfony/framework-bundle": "^5.1",
Expand All @@ -63,7 +64,7 @@
"symfony/mime": "5.2.*",
"symfony/monolog-bridge": "^5.1",
"symfony/monolog-bundle": "^3.1",
"symfony/notifier": "5.2.*",
"symfony/notifier": "^5.1",
"symfony/process": "5.2.*",
"symfony/property-access": "5.2.*",
"symfony/property-info": "5.2.*",
Expand Down
114 changes: 97 additions & 17 deletions symfony/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions symfony/config/packages/notifier.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
framework:
notifier:
#chatter_transports:
# firebase: '%env(FIREBASE_DSN)%'
# slack: '%env(SLACK_DSN)%'
# telegram: '%env(TELEGRAM_DSN)%'
#texter_transports:
Expand Down
64 changes: 64 additions & 0 deletions symfony/src/Command/IcappsFirebaseTestCommand.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?php

namespace App\Command;

use Psr\Log\LoggerInterface;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Component\Notifier\ChatterInterface;
use Symfony\Component\Notifier\Message\ChatMessage;
use Symfony\Component\Notifier\Notification\Notification;
use Symfony\Component\Notifier\Recipient\Recipient;
use Symfony\Contracts\HttpClient\HttpClientInterface;

class IcappsFirebaseTestCommand extends Command
{
protected static $defaultName = 'icapps:firebase-test';
protected static $defaultDescription = 'Test Firebase Notifications';

/**
* @var ChatterInterface
*/
// protected $notifier;

/**
* IcappsFirebaseTestCommand constructor.
* @param ChatterInterface $notifier
*/
/*public function __construct(ChatterInterface $notifier)
{
parent::__construct();
$this->notifier = $notifier;
}*/

protected function configure()
{
$this
->setDescription(self::$defaultDescription)
->addArgument('message', InputArgument::OPTIONAL, 'Notification message')
;
}

protected function execute(InputInterface $input, OutputInterface $output): int
{
$io = new SymfonyStyle($input, $output);
$message = $input->getArgument('message');

if (empty($message)) {
$message = 'Sending a Firebase Notification from Icapps <3';
}

$io->note(sprintf('You are sending a notification to Firebase : %s', $message));
// TODO: figure out how we can test this?
//$chat = new ChatMessage($message);
//$this->notifier->send($chat);

$io->success("Notification sent, please check Firebase! Good job! Now it's time for coffee ;)");

return Command::SUCCESS;
}
}
12 changes: 12 additions & 0 deletions symfony/symfony.lock
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,9 @@
"namshi/jose": {
"version": "7.2.3"
},
"nesbot/carbon": {
"version": "2.48.1"
},
"nikic/php-parser": {
"version": "v4.10.4"
},
Expand Down Expand Up @@ -631,6 +634,15 @@
"symfony/finder": {
"version": "v5.2.4"
},
"symfony/firebase-notifier": {
"version": "5.1",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "5.1",
"ref": "a6e63ab1ddcc32c93bc064a19084810bfa673c7b"
}
},
"symfony/flex": {
"version": "1.0",
"recipe": {
Expand Down