From ae6fca4d2329e68dd99e527953a271df1f008fde Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Mon, 30 Sep 2024 04:02:33 -0600 Subject: [PATCH] Update NotificationAppGatewayService --- app/Services/NotificationAppGatewayService.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/app/Services/NotificationAppGatewayService.php b/app/Services/NotificationAppGatewayService.php index 334c08547..c22d2c2e2 100644 --- a/app/Services/NotificationAppGatewayService.php +++ b/app/Services/NotificationAppGatewayService.php @@ -67,14 +67,16 @@ class NotificationAppGatewayService if (! $token || empty($token)) { return false; } - $starts = str_starts_with($token, 'Expo'); - if (! $starts) { + + if (str_starts_with($token, 'ExponentPushToken[') && mb_strlen($token) < 26) { return false; } - if (! str_contains($token, 'PushToken[') || ! str_contains($token, ']')) { + + if (! str_starts_with($token, 'ExponentPushToken[') && ! str_starts_with($token, 'ExpoPushToken[')) { return false; } - if (substr($token, -1) !== ']') { + + if (! str_ends_with($token, ']')) { return false; } @@ -91,7 +93,7 @@ class NotificationAppGatewayService return false; } - $types = ['new_follower', 'like', 'comment', 'share']; + $types = PushNotificationService::NOTIFY_TYPES; if (! $type || empty($type) || ! in_array($type, $types)) { return false;