diff --git a/CHANGELOG.md b/CHANGELOG.md index 17b2f5d9..b3fa6ac6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ ## Next release +## 2.1.14 + * Use FCM always as fallback for GCM #80 + ## 2.1.13 * Update symfony/symfony and symfony/phpunit-bridge #79 diff --git a/app/config/parameters.yml.dist b/app/config/parameters.yml.dist index 89dd0002..42b7cfa1 100644 --- a/app/config/parameters.yml.dist +++ b/app/config/parameters.yml.dist @@ -38,10 +38,6 @@ parameters: # PCRE as accepted by preg_match (http://php.net/preg_match). mobile_app_user_agent_pattern: "/^.*$/" - # Flag to use Firebse as fallback when GCM fails with a MismatchSenderId. - # This is used to handle the push notification method rollover from GCM to Firebase. - use_firebase_fallback_for_gcm: true - # Options for the tiqr library tiqr_library_options: general: diff --git a/src/AppBundle/Controller/AuthenticationController.php b/src/AppBundle/Controller/AuthenticationController.php index 96bfb25a..dad06899 100644 --- a/src/AppBundle/Controller/AuthenticationController.php +++ b/src/AppBundle/Controller/AuthenticationController.php @@ -48,10 +48,6 @@ class AuthenticationController extends Controller private $authenticationRateLimitService; private $userRepository; private $stateHandler; - /** - * @var bool - */ - private $useFirebaseFallbackForGcm; public function __construct( AuthenticationService $authenticationService, @@ -59,8 +55,7 @@ public function __construct( TiqrServiceInterface $tiqrService, TiqrUserRepositoryInterface $userRepository, AuthenticationRateLimitServiceInterface $authenticationRateLimitService, - LoggerInterface $logger, - $useFirebaseFallbackForGcm + LoggerInterface $logger ) { $this->authenticationService = $authenticationService; $this->stateHandler = $stateHandler; @@ -68,7 +63,6 @@ public function __construct( $this->logger = $logger; $this->authenticationRateLimitService = $authenticationRateLimitService; $this->userRepository = $userRepository; - $this->useFirebaseFallbackForGcm = $useFirebaseFallbackForGcm; } /** @@ -379,28 +373,18 @@ private function sendNotification($notificationType, $notificationAddress) $notificationAddress )); - $result = $this->tiqrService->sendNotification($notificationType, $notificationAddress); - if (!$result - && $notificationType == 'GCM' - && $this->useFirebaseFallbackForGcm - && $this->tiqrService->getNotificationError()['message'] == 'MismatchSenderId' - ) { - // Retry with FCM if GCM + if ($notificationType == 'GCM') { + $notificationType = 'FCM'; + $this->logger->notice( sprintf( - 'Failed to send push notification for type "%s" and address "%s" retrying with FCM', - $notificationType, + 'GCM is not supported with address "%s" retrying with FCM', $notificationAddress - ), - [ - 'error_info' => $this->tiqrService->getNotificationError(), - ] + ) ); - - $notificationType = 'FCM'; - $result = $this->tiqrService->sendNotification($notificationType, $notificationAddress); } + $result = $this->tiqrService->sendNotification($notificationType, $notificationAddress); if (!$result) { $this->logger->warning( sprintf( diff --git a/src/AppBundle/Resources/config/services.yml b/src/AppBundle/Resources/config/services.yml index 3337773f..838931a0 100644 --- a/src/AppBundle/Resources/config/services.yml +++ b/src/AppBundle/Resources/config/services.yml @@ -56,7 +56,3 @@ services: AppBundle\Service\UserAgentMatcher: bind: $pattern: '%mobile_app_user_agent_pattern%' - - AppBundle\Controller\AuthenticationController: - bind: - $useFirebaseFallbackForGcm: '%use_firebase_fallback_for_gcm%' \ No newline at end of file