Skip to content

Commit f1004d0

Browse files
authored
Merge pull request #1614 from GetStream/develop
Next Release
2 parents 1ce3ef4 + 12207c5 commit f1004d0

File tree

9 files changed

+42
-12
lines changed

9 files changed

+42
-12
lines changed

docusaurus/docs/reactnative/guides/push_notifications_v2.mdx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,10 +279,15 @@ messaging().setBackgroundMessageHandler(async remoteMessage => {
279279
});
280280

281281
// display the notification
282+
const { stream, ...rest } = remoteMessage.data ?? {};
283+
const data = {
284+
...rest,
285+
...((stream as unknown as Record<string, string> | undefined) ?? {}), // extract and merge stream object if present
286+
};
282287
await notifee.displayNotification({
283288
title: 'New message from ' + message.message.user.name,
284289
body: message.message.text,
285-
data: remoteMessage.data,
290+
data,
286291
android: {
287292
channelId,
288293
// add a press action to open the app on press
@@ -546,10 +551,15 @@ useEffect(() => {
546551
});
547552

548553
// display the notification
554+
const { stream, ...rest } = remoteMessage.data ?? {};
555+
const data = {
556+
...rest,
557+
...((stream as unknown as Record<string, string> | undefined) ?? {}), // extract and merge stream object if present
558+
};
549559
await notifee.displayNotification({
550560
title: 'New message from ' + message.message.user.name,
551561
body: message.message.text,
552-
data: remoteMessage.data,
562+
data,
553563
android: {
554564
channelId,
555565
pressAction: {

examples/SampleApp/ios/SampleApp.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@
514514
CLANG_ENABLE_MODULES = YES;
515515
CODE_SIGN_ENTITLEMENTS = SampleApp/SampleAppDebug.entitlements;
516516
CODE_SIGN_IDENTITY = "iPhone Developer";
517-
CURRENT_PROJECT_VERSION = 148;
517+
CURRENT_PROJECT_VERSION = 150;
518518
DEVELOPMENT_TEAM = EHV7XZLAHA;
519519
ENABLE_BITCODE = NO;
520520
INFOPLIST_FILE = SampleApp/Info.plist;
@@ -545,7 +545,7 @@
545545
CODE_SIGN_ENTITLEMENTS = SampleApp/SampleAppRelease.entitlements;
546546
CODE_SIGN_IDENTITY = "iPhone Distribution";
547547
CODE_SIGN_STYLE = Manual;
548-
CURRENT_PROJECT_VERSION = 148;
548+
CURRENT_PROJECT_VERSION = 150;
549549
DEVELOPMENT_TEAM = EHV7XZLAHA;
550550
INFOPLIST_FILE = SampleApp/Info.plist;
551551
LD_RUNPATH_SEARCH_PATHS = (

examples/SampleApp/ios/SampleApp/Info.plist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
<key>CFBundlePackageType</key>
1818
<string>APPL</string>
1919
<key>CFBundleShortVersionString</key>
20-
<string>1.10.0</string>
20+
<string>1.10.1</string>
2121
<key>CFBundleSignature</key>
2222
<string>????</string>
2323
<key>CFBundleVersion</key>
24-
<string>148</string>
24+
<string>150</string>
2525
<key>LSRequiresIPhoneOS</key>
2626
<true />
2727
<key>NSAppTransportSecurity</key>

examples/SampleApp/ios/SampleAppTests/Info.plist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
<key>CFBundlePackageType</key>
1616
<string>BNDL</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>1.10.0</string>
18+
<string>1.10.1</string>
1919
<key>CFBundleSignature</key>
2020
<string>????</string>
2121
<key>CFBundleVersion</key>
22-
<string>148</string>
22+
<string>150</string>
2323
</dict>
2424
</plist>

examples/SampleApp/src/hooks/useChatClient.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ messaging().setBackgroundMessageHandler(async (remoteMessage) => {
4545
});
4646

4747
if (message.message.user?.name && message.message.text) {
48+
const { stream, ...rest } = remoteMessage.data ?? {};
49+
const data = {
50+
...rest,
51+
...((stream as unknown as Record<string, string> | undefined) ?? {}), // extract and merge stream object if present
52+
};
4853
await notifee.displayNotification({
4954
android: {
5055
channelId,
@@ -53,7 +58,7 @@ messaging().setBackgroundMessageHandler(async (remoteMessage) => {
5358
},
5459
},
5560
body: message.message.text,
56-
data: remoteMessage.data,
61+
data,
5762
title: 'New message from ' + message.message.user.name,
5863
});
5964
}
@@ -111,6 +116,11 @@ export const useChatClient = () => {
111116
name: 'Foreground Messages',
112117
});
113118
// display the notification on foreground
119+
const { stream, ...rest } = remoteMessage.data ?? {};
120+
const data = {
121+
...rest,
122+
...((stream as unknown as Record<string, string> | undefined) ?? {}), // extract and merge stream object if present
123+
};
114124
await notifee.displayNotification({
115125
android: {
116126
channelId,
@@ -119,7 +129,7 @@ export const useChatClient = () => {
119129
},
120130
},
121131
body: message.message.text,
122-
data: remoteMessage.data,
132+
data,
123133
title: 'New message from ' + message.message.user.name,
124134
});
125135
}

package/src/components/Attachment/Card.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,7 @@ export const Card = <
309309

310310
return (
311311
<MemoizedCard
312+
key={`${message?.id}${message?.updated_at}`} // press listeners must change on message update, updating key ensures this
312313
{...{
313314
additionalTouchableProps,
314315
CardCover,

package/src/components/Attachment/Gallery.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,9 @@ const areEqual = <StreamChatGenerics extends DefaultStreamChatGenerics = Default
525525
videos: nextVideos,
526526
} = nextProps;
527527

528-
const messageEqual = prevMessage?.id === nextMessage?.id;
528+
const messageEqual =
529+
prevMessage?.id === nextMessage?.id &&
530+
`${prevMessage?.updated_at}` === `${nextMessage?.updated_at}`;
529531
if (!messageEqual) return false;
530532

531533
const groupStylesEqual =

package/src/components/Attachment/Giphy.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,11 +392,13 @@ const areEqual = <StreamChatGenerics extends DefaultStreamChatGenerics = Default
392392
attachment: { actions: prevActions, image_url: prevImageUrl, thumb_url: prevThumbUrl },
393393
giphyVersion: prevGiphyVersion,
394394
isMyMessage: prevIsMyMessage,
395+
message: prevMessage,
395396
} = prevProps;
396397
const {
397398
attachment: { actions: nextActions, image_url: nextImageUrl, thumb_url: nextThumbUrl },
398399
giphyVersion: nextGiphyVersion,
399400
isMyMessage: nextIsMyMessage,
401+
message: nextMessage,
400402
} = nextProps;
401403

402404
const imageUrlEqual = prevImageUrl === nextImageUrl;
@@ -419,6 +421,11 @@ const areEqual = <StreamChatGenerics extends DefaultStreamChatGenerics = Default
419421
const isMyMessageEqual = prevIsMyMessage === nextIsMyMessage;
420422
if (!isMyMessageEqual) return false;
421423

424+
const messageEqual =
425+
prevMessage?.id === nextMessage?.id &&
426+
`${prevMessage?.updated_at}` === `${nextMessage?.updated_at}`;
427+
428+
if (!messageEqual) return false;
422429
return true;
423430
};
424431

package/src/components/Message/Message.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,7 @@ const areEqual = <StreamChatGenerics extends DefaultStreamChatGenerics = Default
763763
prevMessage.type === nextMessage.type &&
764764
prevMessage.text === nextMessage.text &&
765765
prevMessage.pinned === nextMessage.pinned &&
766-
prevMessage.updated_at === nextMessage.updated_at;
766+
`${prevMessage?.updated_at}` === `${nextMessage?.updated_at}`;
767767

768768
if (!messageEqual) return false;
769769

0 commit comments

Comments
 (0)