Skip to content

Commit 3a09f1d

Browse files
authored
fix: duplicate android pns (#2978)
* fix: ignore background notification if it already exists * fix: debug logs
1 parent bc3b539 commit 3a09f1d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

examples/SampleApp/src/hooks/useChatClient.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ messaging.setBackgroundMessageHandler(async (remoteMessage) => {
5050
name: 'Chat Messages',
5151
});
5252

53-
if (message.message.user?.name && message.message.text) {
53+
if (message.message.user?.name && message.message.text && !remoteMessage.notification) {
5454
const { stream, ...rest } = remoteMessage.data ?? {};
5555
const data = {
5656
...rest,
@@ -63,9 +63,9 @@ messaging.setBackgroundMessageHandler(async (remoteMessage) => {
6363
id: 'default',
6464
},
6565
},
66+
title: 'New message from ' + message.message.user.name,
6667
body: message.message.text,
6768
data,
68-
title: 'New message from ' + message.message.user.name,
6969
});
7070
}
7171
});

0 commit comments

Comments
 (0)