Skip to content

Commit 5e815ea

Browse files
authored
feat: added thread type in GroupChannel
fixed issue with mention suggestion list sorting fixed issue with file upload size limit exceeded
1 parent 3836c10 commit 5e815ea

File tree

57 files changed

+3180
-785
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+3180
-785
lines changed
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import { ApplicationAttributes, PremiumFeatures, SendbirdChatSDK } from '@sendbird/uikit-utils';
22

33
export const useAppFeatures = (sdk: SendbirdChatSDK) => {
4-
const { premiumFeatureList = [], applicationAttributes = [] } = sdk.appInfo ?? {};
4+
const { premiumFeatureList = [], applicationAttributes = [], uploadSizeLimit } = sdk.appInfo ?? {};
55
return {
66
deliveryReceiptEnabled: premiumFeatureList.includes(PremiumFeatures.delivery_receipt),
77
broadcastChannelEnabled: applicationAttributes.includes(ApplicationAttributes.allow_broadcast_channel),
88
superGroupChannelEnabled: applicationAttributes.includes(ApplicationAttributes.allow_super_group_channel),
99
reactionEnabled: applicationAttributes.includes(ApplicationAttributes.reactions),
10+
uploadSizeLimit: uploadSizeLimit,
1011
};
1112
};
458 Bytes
Loading
756 Bytes
Loading
1.06 KB
Loading

packages/uikit-react-native-foundation/src/assets/icon/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ const IconAssets = {
6464
'streaming': require('./icon-streaming.png'),
6565
'supergroup': require('./icon-supergroup.png'),
6666
'theme': require('./icon-theme.png'),
67+
'thread': require('./icon-thread.png'),
6768
'thumbnail-none': require('./icon-thumbnail-none.png'),
6869
'unarchive': require('./icon-unarchive.png'),
6970
'user': require('./icon-user.png'),

packages/uikit-react-native-foundation/src/ui/GroupChannelMessage/Message.file.voice.tsx

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ type Props = GroupChannelMessageProps<
2525
{
2626
durationMetaArrayKey?: string;
2727
onUnmount: () => void;
28+
initialCurrentTime?: number;
29+
onSubscribeStatus?: (channelUrl: string, messageId: number, subscriber: (currentTime: number) => void) => void;
30+
onUnsubscribeStatus?: (channelUrl: string, messageId: number, subscriber: (currentTime: number) => void) => void;
2831
}
2932
>;
3033
const VoiceFileMessage = (props: Props) => {
@@ -35,6 +38,9 @@ const VoiceFileMessage = (props: Props) => {
3538
message,
3639
durationMetaArrayKey = 'KEY_VOICE_MESSAGE_DURATION',
3740
onUnmount,
41+
initialCurrentTime,
42+
onSubscribeStatus,
43+
onUnsubscribeStatus,
3844
} = props;
3945

4046
const { colors } = useUIKitTheme();
@@ -45,7 +51,7 @@ const VoiceFileMessage = (props: Props) => {
4551
const initialDuration = value ? parseInt(value, 10) : 0;
4652
return {
4753
status: 'paused',
48-
currentTime: 0,
54+
currentTime: initialCurrentTime || 0,
4955
duration: initialDuration,
5056
};
5157
});
@@ -56,6 +62,16 @@ const VoiceFileMessage = (props: Props) => {
5662
};
5763
}, []);
5864

65+
useEffect(() => {
66+
const updateCurrentTime = (currentTime: number) => {
67+
setState((prev) => ({ ...prev, currentTime }));
68+
};
69+
onSubscribeStatus?.(props.channel.url, props.message.messageId, updateCurrentTime);
70+
return () => {
71+
onUnsubscribeStatus?.(props.channel.url, props.message.messageId, updateCurrentTime);
72+
};
73+
}, []);
74+
5975
const uiColors = colors.ui.groupChannelMessage[variant];
6076
const remainingTime = state.duration - state.currentTime;
6177

packages/uikit-react-native-foundation/src/ui/GroupChannelMessage/MessageContainer.tsx

Lines changed: 37 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ const MessageContainer = (props: Props) => {
2323

2424
MessageContainer.Incoming = function MessageContainerIncoming({
2525
children,
26+
replyInfo,
2627
groupedWithNext,
2728
groupedWithPrev,
2829
message,
@@ -34,43 +35,49 @@ MessageContainer.Incoming = function MessageContainerIncoming({
3435
const color = colors.ui.groupChannelMessage.incoming;
3536

3637
return (
37-
<Box flexDirection={'row'} justifyContent={'flex-start'} alignItems={'flex-end'}>
38-
<Box width={26} marginRight={12}>
39-
{(message.isFileMessage() || message.isUserMessage()) && !groupedWithNext && (
40-
<Pressable onPress={onPressAvatar}>
41-
<Avatar size={26} uri={message.sender?.profileUrl} />
42-
</Pressable>
43-
)}
44-
</Box>
45-
<Box flexShrink={1}>
46-
{parentMessage}
47-
{!groupedWithPrev && !message.parentMessage && (
48-
<Box marginLeft={12} marginBottom={4}>
49-
{(message.isFileMessage() || message.isUserMessage()) && (
50-
<Text caption1 color={color.enabled.textSenderName} numberOfLines={1}>
51-
{strings?.senderName ?? message.sender.nickname}
52-
</Text>
53-
)}
54-
</Box>
55-
)}
56-
57-
<Box flexDirection={'row'} alignItems={'flex-end'}>
58-
<Box style={styles.bubble}>{children}</Box>
59-
{!groupedWithNext && (
60-
<Box marginLeft={4}>
61-
<Text caption4 color={color.enabled.textTime}>
62-
{strings?.sentDate ?? getMessageTimeFormat(new Date(message.createdAt))}
63-
</Text>
38+
<Box flexDirection={'column'} justifyContent={'flex-start'} alignItems={'flex-start'}>
39+
<Box flexDirection={'row'} justifyContent={'flex-start'} alignItems={'flex-end'}>
40+
<Box width={26} marginRight={12}>
41+
{(message.isFileMessage() || message.isUserMessage()) && !groupedWithNext && (
42+
<Pressable onPress={onPressAvatar}>
43+
<Avatar size={26} uri={message.sender?.profileUrl} />
44+
</Pressable>
45+
)}
46+
</Box>
47+
<Box flexShrink={1}>
48+
{parentMessage}
49+
{!groupedWithPrev && !parentMessage && (
50+
<Box marginLeft={12} marginBottom={4}>
51+
{(message.isFileMessage() || message.isUserMessage()) && (
52+
<Text caption1 color={color.enabled.textSenderName} numberOfLines={1}>
53+
{strings?.senderName ?? message.sender.nickname}
54+
</Text>
55+
)}
6456
</Box>
6557
)}
58+
<Box flexDirection={'row'} alignItems={'flex-end'}>
59+
<Box style={styles.bubble}>{children}</Box>
60+
{!groupedWithNext && (
61+
<Box marginLeft={4}>
62+
<Text caption4 color={color.enabled.textTime}>
63+
{strings?.sentDate ?? getMessageTimeFormat(new Date(message.createdAt))}
64+
</Text>
65+
</Box>
66+
)}
67+
</Box>
6668
</Box>
6769
</Box>
70+
<Box flexDirection={'row'} marginTop={4}>
71+
<Box width={26} marginRight={12} justifyContent={'flex-start'} />
72+
{replyInfo}
73+
</Box>
6874
</Box>
6975
);
7076
};
7177

7278
MessageContainer.Outgoing = function MessageContainerOutgoing({
7379
children,
80+
replyInfo,
7481
message,
7582
groupedWithNext,
7683
strings,
@@ -96,6 +103,9 @@ MessageContainer.Outgoing = function MessageContainerOutgoing({
96103
</Box>
97104
<Box style={styles.bubble}>{children}</Box>
98105
</Box>
106+
<Box flexDirection={'row'} justifyContent={'flex-end'} marginTop={4}>
107+
{replyInfo}
108+
</Box>
99109
</Box>
100110
);
101111
};

packages/uikit-react-native-foundation/src/ui/GroupChannelMessage/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export type GroupChannelMessageProps<T extends SendbirdMessage, AdditionalProps
2828
children?: React.ReactNode;
2929
sendingStatus?: React.ReactNode;
3030
parentMessage?: React.ReactNode;
31+
replyInfo?: React.ReactNode;
3132

3233
groupedWithPrev: boolean;
3334
groupedWithNext: boolean;

packages/uikit-react-native/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
"@openspacelabs/react-native-zoomable-view": "^2.1.5",
6363
"@sendbird/uikit-chat-hooks": "3.5.4",
6464
"@sendbird/uikit-react-native-foundation": "3.5.4",
65-
"@sendbird/uikit-tools": "0.0.1-alpha.76",
65+
"@sendbird/uikit-tools": "0.0.1-alpha.77",
6666
"@sendbird/uikit-utils": "3.5.4"
6767
},
6868
"devDependencies": {

packages/uikit-react-native/src/components/ChannelInput/SendInput.tsx

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ const SendInput = forwardRef<RNTextInput, SendInputProps>(function SendInput(
5353
channel,
5454
messageToReply,
5555
setMessageToReply,
56+
messageForThread,
5657
},
5758
ref,
5859
) {
@@ -71,11 +72,22 @@ const SendInput = forwardRef<RNTextInput, SendInputProps>(function SendInput(
7172

7273
const messageReplyParams = useIIFE(() => {
7374
const { groupChannel } = sbOptions.uikit;
74-
if (!channel.isGroupChannel() || groupChannel.channel.replyType === 'none' || !messageToReply) return {};
75-
return {
76-
parentMessageId: messageToReply.messageId,
77-
isReplyToChannel: true,
78-
};
75+
76+
if (channel.isGroupChannel()) {
77+
if (groupChannel.channel.replyType === 'quote_reply' && messageToReply) {
78+
return {
79+
parentMessageId: messageToReply.messageId,
80+
isReplyToChannel: true,
81+
};
82+
} else if (groupChannel.channel.replyType === 'thread' && messageForThread) {
83+
return {
84+
parentMessageId: messageForThread.messageId,
85+
isReplyToChannel: true,
86+
};
87+
}
88+
}
89+
90+
return {};
7991
});
8092

8193
const messageMentionParams = useIIFE(() => {
@@ -152,6 +164,13 @@ const SendInput = forwardRef<RNTextInput, SendInputProps>(function SendInput(
152164
if (inputFrozen) return STRINGS.LABELS.CHANNEL_INPUT_PLACEHOLDER_DISABLED;
153165
if (inputDisabled) return STRINGS.LABELS.CHANNEL_INPUT_PLACEHOLDER_DISABLED;
154166
if (messageToReply) return STRINGS.LABELS.CHANNEL_INPUT_PLACEHOLDER_REPLY;
167+
if (messageForThread) {
168+
if (messageForThread.threadInfo && messageForThread.threadInfo.replyCount > 0) {
169+
return STRINGS.LABELS.CHANNEL_INPUT_PLACEHOLDER_REPLY_TO_THREAD;
170+
} else {
171+
return STRINGS.LABELS.CHANNEL_INPUT_PLACEHOLDER_REPLY_IN_THREAD;
172+
}
173+
}
155174

156175
return STRINGS.LABELS.CHANNEL_INPUT_PLACEHOLDER_ACTIVE;
157176
};

0 commit comments

Comments
 (0)