diff --git a/src/Khrizt/PushNotiphications/Model/Apns/Response.php b/src/Khrizt/PushNotiphications/Model/Apns/Response.php index b096c33..a886737 100644 --- a/src/Khrizt/PushNotiphications/Model/Apns/Response.php +++ b/src/Khrizt/PushNotiphications/Model/Apns/Response.php @@ -205,6 +205,16 @@ public function isUnregisteredToken(): bool return $this->status === 410; } + /** + * Returns if notification was sent to an unregistered token. + * + * @return bool + */ + public function isInvalidToken(): bool + { + return $this->errorCode === "BadDeviceToken"; + } + /** * Gets the value of status. * diff --git a/src/Khrizt/PushNotiphications/Model/Fcm/Response.php b/src/Khrizt/PushNotiphications/Model/Fcm/Response.php index b2f017f..277a6e0 100644 --- a/src/Khrizt/PushNotiphications/Model/Fcm/Response.php +++ b/src/Khrizt/PushNotiphications/Model/Fcm/Response.php @@ -124,6 +124,16 @@ public function isUnregisteredToken(): bool return $this->errorCode === 'NotRegistered'; } + /** + * Returns if notification was sent to an unregistered token. + * + * @return bool + */ + public function isInvalidToken(): bool + { + return $this->errorCode === "InvalidRegistration"; + } + /** * Gets the value of errorCode. * diff --git a/src/Khrizt/PushNotiphications/Model/ResponseInterface.php b/src/Khrizt/PushNotiphications/Model/ResponseInterface.php index e80c400..f76b987 100644 --- a/src/Khrizt/PushNotiphications/Model/ResponseInterface.php +++ b/src/Khrizt/PushNotiphications/Model/ResponseInterface.php @@ -10,6 +10,8 @@ public function getToken(): string; public function isUnregisteredToken(): bool; + public function isInvalidToken(): bool; + public function isOk(): bool; public function getErrorCode(): ?string;