Skip to content

Commit 53fc80a

Browse files
Merge pull request #1190 from GetStream/develop
Next Release
2 parents 4ceba0b + 234cc38 commit 53fc80a

File tree

9 files changed

+33
-24
lines changed

9 files changed

+33
-24
lines changed

.github/workflows/sample-distribution.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: sample-distribution
33
on:
44
push:
55
branches:
6-
- v4.0.0
6+
- develop
77
jobs:
88
build_and_deploy_ios_testflight_qa:
99
runs-on: [macos-latest]

docusaurus/docs/reactnative/basics/upgrade_helper.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ api doesn't support pagination and it resulted into confusing user experience.
449449

450450
#### Autocomplete suggestions
451451

452-
Following two new props on `Channel` componenent allows customizing UI for autocomplete suggestions list:
452+
The following three new props on `Channel` component allows customizing UI for autocomplete suggestions list:
453453

454454
- [`AutoCompleteSuggestionHeader`](../core-components/channel.mdx#autocompletesuggestionheader)
455455
- [`AutoCompleteSuggestionList`](../core-components/channel.mdx#autocompletesuggestionlist)

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@
495495
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
496496
CLANG_ENABLE_MODULES = YES;
497497
CODE_SIGN_IDENTITY = "iPhone Distribution";
498-
CURRENT_PROJECT_VERSION = 65;
498+
CURRENT_PROJECT_VERSION = 66;
499499
DEVELOPMENT_TEAM = EHV7XZLAHA;
500500
ENABLE_BITCODE = NO;
501501
INFOPLIST_FILE = SampleApp/Info.plist;
@@ -525,7 +525,7 @@
525525
CLANG_ENABLE_MODULES = YES;
526526
CODE_SIGN_IDENTITY = "iPhone Distribution";
527527
CODE_SIGN_STYLE = Manual;
528-
CURRENT_PROJECT_VERSION = 65;
528+
CURRENT_PROJECT_VERSION = 66;
529529
DEVELOPMENT_TEAM = EHV7XZLAHA;
530530
INFOPLIST_FILE = SampleApp/Info.plist;
531531
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>0.1.1</string>
20+
<string>1.0.0</string>
2121
<key>CFBundleSignature</key>
2222
<string>????</string>
2323
<key>CFBundleVersion</key>
24-
<string>65</string>
24+
<string>66</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>0.1.1</string>
18+
<string>1.0.0</string>
1919
<key>CFBundleSignature</key>
2020
<string>????</string>
2121
<key>CFBundleVersion</key>
22-
<string>65</string>
22+
<string>66</string>
2323
</dict>
2424
</plist>

package/src/components/ChannelPreview/ChannelPreviewMessenger.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,16 @@ export type ChannelPreviewMessengerPropsWithContext<
7373
* bold: true,
7474
* text: 'This is the message preview text'
7575
* },
76-
* status: 0 | 1 | 2 // read states of latest message.
76+
* status: 0 | 1 | 2 // read states of the latest message.
7777
* }
7878
* ```
7979
*
80+
* The read status is either of the following:
81+
*
82+
* 0: The message was not sent by the current user
83+
* 1: The message was sent by the current user and is unread
84+
* 2: The message was sent by the current user and is read
85+
*
8086
* @overrideType object
8187
*/
8288
latestMessagePreview: LatestMessagePreview<StreamChatGenerics>;

package/src/components/ChannelPreview/ChannelPreviewStatus.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import React from 'react';
22
import { StyleSheet, Text, View } from 'react-native';
33

44
import type { ChannelPreviewProps } from './ChannelPreview';
5-
65
import type { ChannelPreviewMessengerPropsWithContext } from './ChannelPreviewMessenger';
6+
import { MessageReadStatus } from './hooks/useLatestMessagePreview';
77

88
import { useTheme } from '../../contexts/themeContext/ThemeContext';
99
import { Check, CheckAll } from '../../icons';
@@ -48,9 +48,9 @@ export const ChannelPreviewStatus = <
4848

4949
return (
5050
<View style={styles.flexRow}>
51-
{status === 2 ? (
51+
{status === MessageReadStatus.READ ? (
5252
<CheckAll pathFill={accent_blue} {...checkAllIcon} />
53-
) : status === 1 ? (
53+
) : status === MessageReadStatus.UNREAD ? (
5454
<Check pathFill={grey} {...checkIcon} />
5555
) : null}
5656
<Text style={[styles.date, { color: grey }, date]}>

package/src/components/ChannelPreview/hooks/useLatestMessagePreview.ts

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -115,22 +115,24 @@ const getLatestMessageDisplayDate = <
115115
return parserOutput;
116116
};
117117

118-
/**
119-
* set up enum
120-
* 0 = latest message is not current user's message
121-
* 1 = nobody has read latest message which is the current user's message
122-
* 2 = someone has read latest message which is the current user's message
123-
*/
118+
export enum MessageReadStatus {
119+
NOT_SENT_BY_CURRENT_USER = 0,
120+
UNREAD = 1,
121+
READ = 2,
122+
}
123+
124124
const getLatestMessageReadStatus = <
125125
StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
126126
>(
127127
channel: Channel<StreamChatGenerics>,
128128
client: StreamChat<StreamChatGenerics>,
129129
message: LatestMessage<StreamChatGenerics> | undefined,
130130
readEvents: boolean,
131-
) => {
131+
): MessageReadStatus => {
132132
const currentUserId = client.userID;
133-
if (!message || currentUserId !== message.user?.id || readEvents === false) return 0;
133+
if (!message || currentUserId !== message.user?.id || readEvents === false) {
134+
return MessageReadStatus.NOT_SENT_BY_CURRENT_USER;
135+
}
134136

135137
const readList = channel.state.read;
136138
if (currentUserId) {
@@ -146,8 +148,8 @@ const getLatestMessageReadStatus = <
146148
return Object.values(readList).some(
147149
({ last_read }) => messageUpdatedAt && messageUpdatedAt < last_read,
148150
)
149-
? 2
150-
: 1;
151+
? MessageReadStatus.READ
152+
: MessageReadStatus.UNREAD;
151153
};
152154

153155
const getLatestMessagePreview = <
@@ -176,7 +178,7 @@ const getLatestMessagePreview = <
176178
text: t('Nothing yet...'),
177179
},
178180
],
179-
status: 0,
181+
status: MessageReadStatus.NOT_SENT_BY_CURRENT_USER,
180182
};
181183
}
182184
const message = lastMessage || messages.length ? messages[messages.length - 1] : undefined;
@@ -229,7 +231,7 @@ export const useLatestMessagePreview = <
229231
text: '',
230232
},
231233
],
232-
status: 0,
234+
status: MessageReadStatus.NOT_SENT_BY_CURRENT_USER,
233235
});
234236

235237
const readStatus = getLatestMessageReadStatus(

package/src/contexts/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export * from './messagesContext/MessagesContext';
1313
export * from './paginatedMessageListContext/PaginatedMessageListContext';
1414
export * from './overlayContext/OverlayContext';
1515
export * from './overlayContext/OverlayProvider';
16+
export * from './ownCapabilitiesContext/OwnCapabilitiesContext';
1617
export * from './suggestionsContext/SuggestionsContext';
1718
export * from './themeContext/ThemeContext';
1819
export * from './themeContext/utils/theme';

0 commit comments

Comments
 (0)