Skip to content

Commit 72752ff

Browse files
committed
fix: reconcile msg actions
1 parent 70d211a commit 72752ff

File tree

4 files changed

+62
-80
lines changed

4 files changed

+62
-80
lines changed

examples/SampleApp/src/screens/ChannelScreen.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import { useCreateDraftFocusEffect } from '../utils/useCreateDraftFocusEffect.ts
3131
import { channelMessageActions } from '../utils/messageActions.tsx';
3232
import { MessageLocation } from '../components/LocationSharing/MessageLocation.tsx';
3333
import { useStreamChatContext } from '../context/StreamChatContext.tsx';
34-
import { CustomAttachmentPickerSelectionBar } from '../components/AttachmentPickerSelectionBar.tsx';
34+
// import { CustomAttachmentPickerSelectionBar } from '../components/AttachmentPickerSelectionBar.tsx';
3535
import { MessageInfoBottomSheet } from '../components/MessageInfoBottomSheet.tsx';
3636
import { CustomAttachmentPickerContent } from '../components/AttachmentPickerContent.tsx';
3737
import { ThreadType } from 'stream-chat-react-native-core';
@@ -267,7 +267,7 @@ export const ChannelScreen: React.FC<ChannelScreenProps> = ({ navigation, route
267267
<View style={[styles.flex, { backgroundColor: 'transparent' }]}>
268268
<Channel
269269
audioRecordingEnabled={true}
270-
AttachmentPickerSelectionBar={CustomAttachmentPickerSelectionBar}
270+
// AttachmentPickerSelectionBar={CustomAttachmentPickerSelectionBar}
271271
AttachmentPickerContent={CustomAttachmentPickerContent}
272272
channel={channel}
273273
messageInputFloating={messageInputFloating}

examples/SampleApp/src/screens/ThreadScreen.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import { useCreateDraftFocusEffect } from '../utils/useCreateDraftFocusEffect.ts
2525
import { channelMessageActions } from '../utils/messageActions.tsx';
2626
import { useStreamChatContext } from '../context/StreamChatContext.tsx';
2727
import { NativeStackNavigationProp } from '@react-navigation/native-stack';
28-
import { CustomAttachmentPickerSelectionBar } from '../components/AttachmentPickerSelectionBar.tsx';
28+
// import { CustomAttachmentPickerSelectionBar } from '../components/AttachmentPickerSelectionBar.tsx';
2929
import { MessageLocation } from '../components/LocationSharing/MessageLocation.tsx';
3030
import { useAppContext } from '../context/AppContext.ts';
3131
import { useLegacyColors } from '../theme/useLegacyColors';
@@ -150,7 +150,7 @@ export const ThreadScreen: React.FC<ThreadScreenProps> = ({
150150
<View style={[styles.container, { backgroundColor: white }]}>
151151
<Channel
152152
audioRecordingEnabled={true}
153-
AttachmentPickerSelectionBar={CustomAttachmentPickerSelectionBar}
153+
// AttachmentPickerSelectionBar={CustomAttachmentPickerSelectionBar}
154154
channel={channel}
155155
enforceUniqueReaction
156156
keyboardVerticalOffset={0}

examples/SampleApp/src/utils/messageActions.tsx

Lines changed: 57 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
import React from 'react';
2-
import { Alert } from 'react-native';
1+
// import React from 'react';
2+
// import { Alert } from 'react-native';
33
import { LocalMessage, StreamChat } from 'stream-chat';
44
import {
55
Colors,
66
messageActions,
77
MessageActionsParams,
88
TranslationContextValue,
9-
Bell,
9+
// Bell,
1010
} from 'stream-chat-react-native';
1111
import { Theme } from 'stream-chat-react-native';
1212

1313
export function channelMessageActions({
1414
params,
15-
chatClient,
16-
t,
17-
// handleMessageInfo,
18-
semantics,
15+
// chatClient,
16+
// t,
17+
// // handleMessageInfo,
18+
// semantics,
1919
}: {
2020
params: MessageActionsParams;
2121
chatClient: StreamChat;
@@ -24,11 +24,11 @@ export function channelMessageActions({
2424
handleMessageInfo: (message: LocalMessage) => void;
2525
semantics: Theme['semantics'];
2626
}) {
27-
const { dismissOverlay, error /*deleteForMeMessage*/ } = params;
27+
// const { dismissOverlay, error /*deleteForMeMessage*/ } = params;
2828
const actions = messageActions(params);
2929

3030
// We cannot use the useMessageReminder hook here because it is a hook.
31-
const reminder = chatClient.reminders.getFromState(params.message.id);
31+
// const reminder = chatClient.reminders.getFromState(params.message.id);
3232

3333
// actions.push({
3434
// action: async () => {
@@ -48,54 +48,54 @@ export function channelMessageActions({
4848
// icon: <Time width={20} height={20} stroke={semantics.textSecondary} />,
4949
// type: 'standard',
5050
// });
51-
if (!error) {
52-
actions.push({
53-
action: () => {
54-
if (reminder) {
55-
Alert.alert('Remove Reminder', 'Are you sure you want to remove this reminder?', [
56-
{
57-
text: 'Cancel',
58-
style: 'cancel',
59-
},
60-
{
61-
text: 'Remove',
62-
onPress: () => {
63-
chatClient.reminders.deleteReminder(reminder.id).catch((err) => {
64-
console.error('Error deleting reminder:', err);
65-
});
66-
},
67-
style: 'destructive',
68-
},
69-
]);
70-
} else {
71-
Alert.alert(
72-
'Select Reminder Time',
73-
'When would you like to be reminded?',
74-
chatClient.reminders.scheduledOffsetsMs.map((offsetMs) => ({
75-
text: t('duration/Remind Me', { milliseconds: offsetMs }),
76-
onPress: () => {
77-
chatClient.reminders
78-
.upsertReminder({
79-
messageId: params.message.id,
80-
remind_at: new Date(new Date().getTime() + offsetMs).toISOString(),
81-
})
82-
.catch((_error) => {
83-
console.error('Error creating reminder:', _error);
84-
});
85-
},
86-
style: 'default',
87-
})),
88-
);
89-
}
90-
91-
dismissOverlay();
92-
},
93-
actionType: reminder ? 'remove-reminder' : 'remind-me',
94-
title: reminder ? 'Remove Reminder' : 'Remind Me',
95-
icon: <Bell height={20} width={20} stroke={semantics.textSecondary} />,
96-
type: 'standard',
97-
});
98-
}
51+
// if (!error) {
52+
// actions.push({
53+
// action: () => {
54+
// if (reminder) {
55+
// Alert.alert('Remove Reminder', 'Are you sure you want to remove this reminder?', [
56+
// {
57+
// text: 'Cancel',
58+
// style: 'cancel',
59+
// },
60+
// {
61+
// text: 'Remove',
62+
// onPress: () => {
63+
// chatClient.reminders.deleteReminder(reminder.id).catch((err) => {
64+
// console.error('Error deleting reminder:', err);
65+
// });
66+
// },
67+
// style: 'destructive',
68+
// },
69+
// ]);
70+
// } else {
71+
// Alert.alert(
72+
// 'Select Reminder Time',
73+
// 'When would you like to be reminded?',
74+
// chatClient.reminders.scheduledOffsetsMs.map((offsetMs) => ({
75+
// text: t('duration/Remind Me', { milliseconds: offsetMs }),
76+
// onPress: () => {
77+
// chatClient.reminders
78+
// .upsertReminder({
79+
// messageId: params.message.id,
80+
// remind_at: new Date(new Date().getTime() + offsetMs).toISOString(),
81+
// })
82+
// .catch((_error) => {
83+
// console.error('Error creating reminder:', _error);
84+
// });
85+
// },
86+
// style: 'default',
87+
// })),
88+
// );
89+
// }
90+
//
91+
// dismissOverlay();
92+
// },
93+
// actionType: reminder ? 'remove-reminder' : 'remind-me',
94+
// title: reminder ? 'Remove Reminder' : 'Remind Me',
95+
// icon: <Bell height={20} width={20} stroke={semantics.textSecondary} />,
96+
// type: 'standard',
97+
// });
98+
// }
9999
// actions.push({
100100
// action: async () => {
101101
// Alert.alert('Delete for me', 'Are you sure you want to delete this message for me?', [

package/src/components/ChannelList/hooks/useChannelActionItems.tsx

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { useIsDirectChat } from './useIsDirectChat';
1212

1313
import { useTheme, useTranslationContext } from '../../../contexts';
1414
import type { TranslationContextValue } from '../../../contexts/translationContext/TranslationContext';
15-
import { Archive, IconProps, Mute, BlockUser, Delete, Sound } from '../../../icons';
15+
import { IconProps, Mute, BlockUser, Delete, Sound } from '../../../icons';
1616
import { ArrowBoxLeft } from '../../../icons/leave';
1717

1818
export type ChannelActionHandler = () => Promise<void> | void;
@@ -56,18 +56,15 @@ export const buildDefaultChannelActionItems: BuildDefaultChannelActionItems = (
5656
) => {
5757
const {
5858
actions: {
59-
archive,
6059
deleteChannel,
6160
leave,
62-
unarchive,
6361
muteChannel,
6462
unmuteChannel,
6563
muteUser,
6664
unmuteUser,
6765
blockUser,
6866
unblockUser,
6967
},
70-
isArchived,
7168
isDirectChat,
7269
muteActive,
7370
t,
@@ -128,21 +125,6 @@ export const buildDefaultChannelActionItems: BuildDefaultChannelActionItems = (
128125
});
129126
}
130127

131-
actionItems.push({
132-
action: isArchived ? unarchive : archive,
133-
Icon: (props) => <ChannelActionsIcon Icon={Archive} {...props} />,
134-
id: 'archive',
135-
label: isDirectChat
136-
? isArchived
137-
? t('Unarchive Chat')
138-
: t('Archive Chat')
139-
: isArchived
140-
? t('Unarchive Group')
141-
: t('Archive Group'),
142-
placement: isDirectChat ? 'sheet' : 'both',
143-
type: 'standard',
144-
});
145-
146128
actionItems.push({
147129
action: leave,
148130
Icon: (props) => <ChannelActionsIcon Icon={ArrowBoxLeft} {...props} />,

0 commit comments

Comments
 (0)