Skip to content
Merged
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
5 changes: 5 additions & 0 deletions .changeset/short-cameras-see.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@knocklabs/expo": patch
---

updates KnockExpoPushNotificationProvider to ignore messages that do not come from knock
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,20 @@
async (
notification: Notifications.Notification,
status: MessageEngagementStatus,
): Promise<Message> => {
const messageId = notification.request.content.data[
): Promise<Message | void> => {
const messageId = notification.request.content.data?.[

Check warning on line 173 in packages/expo/src/modules/push/KnockExpoPushNotificationProvider.tsx

View check run for this annotation

Codecov / codecov/patch

packages/expo/src/modules/push/KnockExpoPushNotificationProvider.tsx#L172-L173

Added lines #L172 - L173 were not covered by tests
"knock_message_id"
] as string;
] as string | undefined;

Check warning on line 175 in packages/expo/src/modules/push/KnockExpoPushNotificationProvider.tsx

View check run for this annotation

Codecov / codecov/patch

packages/expo/src/modules/push/KnockExpoPushNotificationProvider.tsx#L175

Added line #L175 was not covered by tests

// Skip status update if this isn't a Knock notification
// Fixes issue: https://github.com/knocklabs/javascript/issues/589
if (!messageId) {
knockClient.log(
"[Knock] Skipping status update for non-Knock notification",
);
return;
}

Check warning on line 184 in packages/expo/src/modules/push/KnockExpoPushNotificationProvider.tsx

View check run for this annotation

Codecov / codecov/patch

packages/expo/src/modules/push/KnockExpoPushNotificationProvider.tsx#L179-L184

Added lines #L179 - L184 were not covered by tests

return knockClient.messages.updateStatus(messageId, status);
},
[knockClient],
Expand Down
Loading