@droppii-org/chat-mobile 0.2.27 → 0.2.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/module/components/ThreadCard/MuteThread.js +86 -0
- package/lib/module/components/ThreadCard/MuteThread.js.map +1 -0
- package/lib/module/components/ThreadCard/ThreadCard.js +93 -73
- package/lib/module/components/ThreadCard/ThreadCard.js.map +1 -1
- package/lib/module/components/messages/revokedMessage/index.js +22 -0
- package/lib/module/components/messages/revokedMessage/index.js.map +1 -0
- package/lib/module/config/uploadLimits.js +1 -1
- package/lib/module/core/useChatListener.js +6 -1
- package/lib/module/core/useChatListener.js.map +1 -1
- package/lib/module/hooks/message/useSendMessage.js +15 -2
- package/lib/module/hooks/message/useSendMessage.js.map +1 -1
- package/lib/module/hooks/useMuteConversation.js +34 -0
- package/lib/module/hooks/useMuteConversation.js.map +1 -0
- package/lib/module/screens/chat-detail/constants.js +1 -1
- package/lib/module/screens/chat-detail/constants.js.map +1 -1
- package/lib/module/screens/chat-detail/legend/LegendChatMessage.js +3 -1
- package/lib/module/screens/chat-detail/legend/LegendChatMessage.js.map +1 -1
- package/lib/module/screens/chat-detail/messageToolbox/MessageToolboxItem.js +36 -0
- package/lib/module/screens/chat-detail/messageToolbox/MessageToolboxItem.js.map +1 -0
- package/lib/module/screens/chat-detail/messageToolbox/MessageToolboxMenu.js +29 -56
- package/lib/module/screens/chat-detail/messageToolbox/MessageToolboxMenu.js.map +1 -1
- package/lib/module/screens/chat-detail/messageToolbox/MessageToolboxOverlay.js +27 -7
- package/lib/module/screens/chat-detail/messageToolbox/MessageToolboxOverlay.js.map +1 -1
- package/lib/module/screens/chat-detail/messageToolbox/messageToolbox.utils.js +22 -11
- package/lib/module/screens/chat-detail/messageToolbox/messageToolbox.utils.js.map +1 -1
- package/lib/module/store/message.js +9 -0
- package/lib/module/store/message.js.map +1 -1
- package/lib/module/translation/resources/i18n.js +10 -0
- package/lib/module/translation/resources/i18n.js.map +1 -1
- package/lib/module/utils/conversation.js +1 -1
- package/lib/module/utils/conversation.js.map +1 -1
- package/lib/module/utils/device.js +1 -1
- package/lib/module/utils/device.js.map +1 -1
- package/lib/module/utils/messageUtils.js +9 -14
- package/lib/module/utils/messageUtils.js.map +1 -1
- package/lib/typescript/src/components/ThreadCard/MuteThread.d.ts +10 -0
- package/lib/typescript/src/components/ThreadCard/MuteThread.d.ts.map +1 -0
- package/lib/typescript/src/components/ThreadCard/ThreadCard.d.ts.map +1 -1
- package/lib/typescript/src/components/messages/revokedMessage/index.d.ts +3 -0
- package/lib/typescript/src/components/messages/revokedMessage/index.d.ts.map +1 -0
- package/lib/typescript/src/core/useChatListener.d.ts.map +1 -1
- package/lib/typescript/src/hooks/message/useSendMessage.d.ts +1 -0
- package/lib/typescript/src/hooks/message/useSendMessage.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useMuteConversation.d.ts +6 -0
- package/lib/typescript/src/hooks/useMuteConversation.d.ts.map +1 -0
- package/lib/typescript/src/screens/chat-detail/legend/LegendChatMessage.d.ts.map +1 -1
- package/lib/typescript/src/screens/chat-detail/messageToolbox/MessageToolboxItem.d.ts +10 -0
- package/lib/typescript/src/screens/chat-detail/messageToolbox/MessageToolboxItem.d.ts.map +1 -0
- package/lib/typescript/src/screens/chat-detail/messageToolbox/MessageToolboxMenu.d.ts +3 -1
- package/lib/typescript/src/screens/chat-detail/messageToolbox/MessageToolboxMenu.d.ts.map +1 -1
- package/lib/typescript/src/screens/chat-detail/messageToolbox/MessageToolboxOverlay.d.ts.map +1 -1
- package/lib/typescript/src/screens/chat-detail/messageToolbox/messageToolbox.utils.d.ts +3 -9
- package/lib/typescript/src/screens/chat-detail/messageToolbox/messageToolbox.utils.d.ts.map +1 -1
- package/lib/typescript/src/store/message.d.ts +1 -0
- package/lib/typescript/src/store/message.d.ts.map +1 -1
- package/lib/typescript/src/translation/resources/i18n.d.ts.map +1 -1
- package/lib/typescript/src/types/chat.d.ts +1 -1
- package/lib/typescript/src/types/chat.d.ts.map +1 -1
- package/lib/typescript/src/utils/messageUtils.d.ts +1 -0
- package/lib/typescript/src/utils/messageUtils.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/ThreadCard/MuteThread.tsx +100 -0
- package/src/components/ThreadCard/ThreadCard.tsx +104 -71
- package/src/components/messages/revokedMessage/index.tsx +23 -0
- package/src/config/uploadLimits.ts +1 -1
- package/src/core/useChatListener.ts +8 -1
- package/src/hooks/message/useSendMessage.ts +18 -1
- package/src/hooks/useMuteConversation.ts +44 -0
- package/src/screens/chat-detail/constants.ts +1 -1
- package/src/screens/chat-detail/legend/LegendChatMessage.tsx +2 -0
- package/src/screens/chat-detail/messageToolbox/MessageToolboxItem.tsx +38 -0
- package/src/screens/chat-detail/messageToolbox/MessageToolboxMenu.tsx +35 -62
- package/src/screens/chat-detail/messageToolbox/MessageToolboxOverlay.tsx +47 -10
- package/src/screens/chat-detail/messageToolbox/messageToolbox.utils.ts +31 -14
- package/src/store/message.ts +17 -1
- package/src/translation/resources/i18n.ts +11 -0
- package/src/types/chat.ts +3 -1
- package/src/utils/conversation.ts +1 -1
- package/src/utils/device.ts +1 -1
- package/src/utils/messageUtils.ts +18 -13
|
@@ -10,6 +10,7 @@ export declare const useSendMessage: () => {
|
|
|
10
10
|
flow?: IRunConversationFlowPayload;
|
|
11
11
|
}) => Promise<void>;
|
|
12
12
|
retryMessage: (message: MessageItem) => Promise<void>;
|
|
13
|
+
revokeMessage: (message: MessageItem) => Promise<void>;
|
|
13
14
|
};
|
|
14
15
|
export declare const createTextMessage: (text: string) => Promise<any>;
|
|
15
16
|
export declare const createUrlTextMessage: (text: string, urls: string[]) => Promise<any>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSendMessage.d.ts","sourceRoot":"","sources":["../../../../../src/hooks/message/useSendMessage.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEtD,OAAO,KAAK,EAAE,WAAW,EAAe,MAAM,+BAA+B,CAAC;AAS9E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,mBAAmB,CAAC;AAerE,eAAO,MAAM,cAAc;4DAwCpB;QACD,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,KAAK,CAAC,EAAE,cAAc,EAAE,CAAC;QACzB,WAAW,CAAC,EAAE,YAAY,CAAC;QAC3B,IAAI,CAAC,EAAE,2BAA2B,CAAC;KACpC;4BAiDe,WAAW;
|
|
1
|
+
{"version":3,"file":"useSendMessage.d.ts","sourceRoot":"","sources":["../../../../../src/hooks/message/useSendMessage.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEtD,OAAO,KAAK,EAAE,WAAW,EAAe,MAAM,+BAA+B,CAAC;AAS9E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,mBAAmB,CAAC;AAerE,eAAO,MAAM,cAAc;4DAwCpB;QACD,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,KAAK,CAAC,EAAE,cAAc,EAAE,CAAC;QACzB,WAAW,CAAC,EAAE,YAAY,CAAC;QAC3B,IAAI,CAAC,EAAE,2BAA2B,CAAC;KACpC;4BAiDe,WAAW;6BA6CqB,WAAW;CAqB9D,CAAC;AAyBF,eAAO,MAAM,iBAAiB,GAAU,MAAM,MAAM,iBAanD,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAU,MAAM,MAAM,EAAE,MAAM,MAAM,EAAE,iBActE,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ConversationItem } from '@droppii/openim-rn-client-sdk';
|
|
2
|
+
export declare function useMuteConversation(): {
|
|
3
|
+
muteConversation: (conversation?: ConversationItem) => Promise<void>;
|
|
4
|
+
unmuteConversation: (conversation?: ConversationItem) => Promise<void>;
|
|
5
|
+
};
|
|
6
|
+
//# sourceMappingURL=useMuteConversation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMuteConversation.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useMuteConversation.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAGtE,wBAAgB,mBAAmB;sCAET,gBAAgB;wCAiBhB,gBAAgB;EAiBzC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LegendChatMessage.d.ts","sourceRoot":"","sources":["../../../../../../src/screens/chat-detail/legend/LegendChatMessage.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAoC,SAAS,EAAE,MAAM,OAAO,CAAC;AAEzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAGjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"LegendChatMessage.d.ts","sourceRoot":"","sources":["../../../../../../src/screens/chat-detail/legend/LegendChatMessage.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAoC,SAAS,EAAE,MAAM,OAAO,CAAC;AAEzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAGjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAiB/D,UAAU,sBAAsB;IAC9B,OAAO,EAAE,YAAY,CAAC;IACtB,UAAU,EAAE,OAAO,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE,KAAK,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5D,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,IAAI,CAAC;IACzC,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB,wBAAwB,CAAC,EAAE,CAAC,CAAC,EAAE,YAAY,KAAK,SAAS,CAAC;CAC3D;AAyBD,eAAO,MAAM,iBAAiB,0JAUzB,sBAAsB,iCAsC1B,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
interface MessageToolboxItemProps {
|
|
2
|
+
icon: string;
|
|
3
|
+
color: string;
|
|
4
|
+
label: string;
|
|
5
|
+
visible?: boolean;
|
|
6
|
+
onPress?: () => void;
|
|
7
|
+
}
|
|
8
|
+
export declare const MessageToolboxItem: import("react").MemoExoticComponent<({ icon, color, label, visible, onPress }: MessageToolboxItemProps) => import("react").JSX.Element>;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=MessageToolboxItem.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MessageToolboxItem.d.ts","sourceRoot":"","sources":["../../../../../../src/screens/chat-detail/messageToolbox/MessageToolboxItem.tsx"],"names":[],"mappings":"AAGA,UAAU,uBAAuB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,eAAO,MAAM,kBAAkB,iFACc,uBAAuB,iCAuBnE,CAAC"}
|
|
@@ -2,10 +2,12 @@ interface MessageToolboxMenuProps {
|
|
|
2
2
|
showCopyMessage?: boolean;
|
|
3
3
|
showCopyMessageLink?: boolean;
|
|
4
4
|
showRetryMessage?: boolean;
|
|
5
|
+
showRevokeMessage?: boolean;
|
|
5
6
|
onCopyMessage: () => void;
|
|
6
7
|
onCopyMessageLink: () => void;
|
|
7
8
|
onRetryMessage: () => void;
|
|
9
|
+
onRevokeMessage: () => void;
|
|
8
10
|
}
|
|
9
|
-
export declare const MessageToolboxMenu: import("react").MemoExoticComponent<({ showCopyMessage, showCopyMessageLink, showRetryMessage, onCopyMessage, onCopyMessageLink, onRetryMessage, }: MessageToolboxMenuProps) => import("react").JSX.Element>;
|
|
11
|
+
export declare const MessageToolboxMenu: import("react").MemoExoticComponent<({ showCopyMessage, showCopyMessageLink, showRetryMessage, showRevokeMessage, onCopyMessage, onCopyMessageLink, onRetryMessage, onRevokeMessage, }: MessageToolboxMenuProps) => import("react").JSX.Element>;
|
|
10
12
|
export {};
|
|
11
13
|
//# sourceMappingURL=MessageToolboxMenu.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessageToolboxMenu.d.ts","sourceRoot":"","sources":["../../../../../../src/screens/chat-detail/messageToolbox/MessageToolboxMenu.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MessageToolboxMenu.d.ts","sourceRoot":"","sources":["../../../../../../src/screens/chat-detail/messageToolbox/MessageToolboxMenu.tsx"],"names":[],"mappings":"AAMA,UAAU,uBAAuB;IAC/B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,iBAAiB,EAAE,MAAM,IAAI,CAAC;IAC9B,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,eAAe,EAAE,MAAM,IAAI,CAAC;CAC7B;AAED,eAAO,MAAM,kBAAkB,0LAU1B,uBAAuB,iCAqC3B,CAAC"}
|
package/lib/typescript/src/screens/chat-detail/messageToolbox/MessageToolboxOverlay.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessageToolboxOverlay.d.ts","sourceRoot":"","sources":["../../../../../../src/screens/chat-detail/messageToolbox/MessageToolboxOverlay.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MessageToolboxOverlay.d.ts","sourceRoot":"","sources":["../../../../../../src/screens/chat-detail/messageToolbox/MessageToolboxOverlay.tsx"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,EAAgB,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,UAAU,0BAA0B;IAClC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,wBAAwB,CAAC,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,SAAS,CAAC;CAC9D;AAED,eAAO,MAAM,qBAAqB,0HA6HhC,CAAC"}
|
|
@@ -1,18 +1,12 @@
|
|
|
1
1
|
import type { DMessageItem } from '../../../types/chat';
|
|
2
|
-
export declare const isMessageRecalled: (message: DMessageItem) => boolean;
|
|
3
|
-
export declare const isMessageSucceeded: (message: DMessageItem) => boolean;
|
|
4
|
-
export declare const isEligibleForToolbox: (message: DMessageItem) => boolean;
|
|
5
|
-
export declare const isCopyMessageSupported: (message: DMessageItem) => boolean;
|
|
6
|
-
export declare const isCopyMessageLinkSupported: (message: DMessageItem) => boolean;
|
|
7
|
-
export declare const isRetrySupported: (message: DMessageItem) => boolean;
|
|
8
2
|
export declare const getCopyableMessageText: (message: DMessageItem) => string;
|
|
9
|
-
export declare const
|
|
3
|
+
export declare const getMessageToolboxItems: (message?: DMessageItem, currentUserId?: string) => {
|
|
10
4
|
showCopyMessage?: undefined;
|
|
11
|
-
showCopyMessageLink?: undefined;
|
|
12
5
|
showRetryMessage?: undefined;
|
|
6
|
+
showRevokeMessage?: undefined;
|
|
13
7
|
} | {
|
|
14
8
|
showCopyMessage: boolean;
|
|
15
|
-
showCopyMessageLink: boolean;
|
|
16
9
|
showRetryMessage: boolean;
|
|
10
|
+
showRevokeMessage: boolean;
|
|
17
11
|
};
|
|
18
12
|
//# sourceMappingURL=messageToolbox.utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messageToolbox.utils.d.ts","sourceRoot":"","sources":["../../../../../../src/screens/chat-detail/messageToolbox/messageToolbox.utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"messageToolbox.utils.d.ts","sourceRoot":"","sources":["../../../../../../src/screens/chat-detail/messageToolbox/messageToolbox.utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AA6CxD,eAAO,MAAM,sBAAsB,GAAI,SAAS,YAAY,KAAG,MAK9D,CAAC;AAEF,eAAO,MAAM,sBAAsB,GACjC,UAAU,YAAY,EACtB,gBAAgB,MAAM;;;;;;;;CAiBvB,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { MessageStore } from '../types/chat';
|
|
2
2
|
export declare const useMessageStore: import("zustand").UseBoundStore<import("zustand").StoreApi<MessageStore>>;
|
|
3
|
+
export declare const markMessageRevoked: (clientMsgID: string) => void;
|
|
3
4
|
//# sourceMappingURL=message.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../../../src/store/message.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../../../src/store/message.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAgB,YAAY,EAAE,MAAM,eAAe,CAAC;AAGhE,eAAO,MAAM,eAAe,2EAsCzB,CAAC;AAEJ,eAAO,MAAM,kBAAkB,GAAI,aAAa,MAAM,SAarD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../../../../../src/translation/resources/i18n.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../../../../../src/translation/resources/i18n.ts"],"names":[],"mappings":";;;AAwDA,wBAEE"}
|
|
@@ -108,7 +108,7 @@ export interface MessageStore {
|
|
|
108
108
|
hasMoreNewer: boolean;
|
|
109
109
|
setMessages: (messages: DMessageItem[], hasMore: boolean) => void;
|
|
110
110
|
pushNewMessage: (message: MessageItem) => void;
|
|
111
|
-
updateOneMessage: (message: MessageItem) => void;
|
|
111
|
+
updateOneMessage: (message: Partial<MessageItem> & Pick<MessageItem, 'clientMsgID'>) => void;
|
|
112
112
|
deleteOneMessage: (clientMsgID: string) => void;
|
|
113
113
|
reset: () => void;
|
|
114
114
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../../../src/types/chat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAC/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,KAAK,EACV,iBAAiB,EACjB,qBAAqB,EACrB,2BAA2B,EAC5B,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,QAAQ,CAAC;AAErD,eAAO,MAAM,aAAa;;;;CAIhB,CAAC;AAEX,KAAK,KAAK,GAAG,CACX,KAAK,EAAE,MAAM,EACb,MAAM,CAAC,EAAE,GAAG,EACZ,QAAQ,CAAC,EAAE,GAAG,MAAM,OAAO,aAAa,EAAE,KACvC,IAAI,CAAC;AAEV,MAAM,WAAW,aAAa;IAC5B,KAAK,CAAC,EAAE;QAAE,IAAI,EAAE,C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AE,MAAM,IAAI,CAAC;IACpC,iBAAiB,EAAE,OAAO,CAAC;IAC3B,sBAAsB,EAAE,CAAC,IAAI,CAAC,EAAE,qBAAqB,KAAK,IAAI,CAAC;CAChE;AAED,MAAM,WAAW,uBAAwB,SAAQ,iBAAiB;CAAG;AAErE,MAAM,WAAW,mBAAmB;IAClC,eAAe,EAAE,oBAAoB,CAAC;IACtC,WAAW,CAAC,EAAE;QACZ,IAAI,EAAE,cAAc,CAAC;QACrB,IAAI,EAAE;YACJ,OAAO,EAAE,MAAM,CAAC;YAChB,KAAK,EAAE,MAAM,CAAC;SACf,CAAC;KACH,CAAC;IACF,YAAY,EAAE,aAAa,CAAC;CAC7B"}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { type ConversationItem } from '@droppii/openim-rn-client-sdk';
|
|
5
5
|
import type { DMessageItem } from '../types/chat';
|
|
6
|
+
export declare const isMessageRevoked: (message: DMessageItem) => boolean;
|
|
6
7
|
export declare const extractTextContent: (message: DMessageItem) => string;
|
|
7
8
|
export declare const getMessagePreview: (message: DMessageItem) => string;
|
|
8
9
|
export declare const getLastMessageText: (message: DMessageItem | undefined, currentUserId?: string, conversation?: ConversationItem) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messageUtils.d.ts","sourceRoot":"","sources":["../../../../src/utils/messageUtils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAGL,KAAK,gBAAgB,EACtB,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"messageUtils.d.ts","sourceRoot":"","sources":["../../../../src/utils/messageUtils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAGL,KAAK,gBAAgB,EACtB,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAKlD,eAAO,MAAM,gBAAgB,GAAI,SAAS,YAAY,KAAG,OACN,CAAC;AAEpD,eAAO,MAAM,kBAAkB,GAAI,SAAS,YAAY,KAAG,MAQ1D,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,SAAS,YAAY,KAAG,MAiFzD,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAC7B,SAAS,YAAY,GAAG,SAAS,EACjC,gBAAgB,MAAM,EACtB,eAAe,gBAAgB,KAC9B,MAmBF,CAAC"}
|
package/package.json
CHANGED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { memo, useCallback } from 'react';
|
|
2
|
+
import type { SwipeableMethods } from 'react-native-gesture-handler/ReanimatedSwipeable';
|
|
3
|
+
import { KContainer, KImage, KLabel, KColors } from '@droppii/libs';
|
|
4
|
+
import { useMuteConversation } from '../../hooks/useMuteConversation';
|
|
5
|
+
import { trans } from '../../translation';
|
|
6
|
+
import { UIUtils } from '../../utils/UIUtils';
|
|
7
|
+
import { type ConversationItem } from '@droppii/openim-rn-client-sdk';
|
|
8
|
+
|
|
9
|
+
interface MuteThreadProps {
|
|
10
|
+
isMuted: boolean;
|
|
11
|
+
conversation?: ConversationItem;
|
|
12
|
+
swipeableMethods: SwipeableMethods;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const MuteThread = memo(
|
|
16
|
+
({ isMuted, conversation, swipeableMethods }: MuteThreadProps) => {
|
|
17
|
+
const { muteConversation, unmuteConversation } = useMuteConversation();
|
|
18
|
+
|
|
19
|
+
const handleMutePress = useCallback(() => {
|
|
20
|
+
UIUtils.alert.open({
|
|
21
|
+
title: trans('chat:mute_confirm_title'),
|
|
22
|
+
message: trans('chat:mute_confirm_desc'),
|
|
23
|
+
primaryIndex: 0,
|
|
24
|
+
buttons: [
|
|
25
|
+
{
|
|
26
|
+
label: trans('chat:mute_confirm_primary'),
|
|
27
|
+
kind: 'danger',
|
|
28
|
+
onPress: async () => {
|
|
29
|
+
try {
|
|
30
|
+
await muteConversation(conversation);
|
|
31
|
+
UIUtils.toast.open({
|
|
32
|
+
title: trans('chat:mute_toast_success'),
|
|
33
|
+
theme: 'success',
|
|
34
|
+
});
|
|
35
|
+
} catch {
|
|
36
|
+
UIUtils.toast.open({
|
|
37
|
+
title: trans('chat:generic_error'),
|
|
38
|
+
theme: 'error',
|
|
39
|
+
});
|
|
40
|
+
} finally {
|
|
41
|
+
swipeableMethods.close();
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
label: trans('chat:mute_confirm_secondary'),
|
|
47
|
+
kind: 'gray',
|
|
48
|
+
onPress: () => swipeableMethods.close(),
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
});
|
|
52
|
+
}, [swipeableMethods, conversation, muteConversation]);
|
|
53
|
+
|
|
54
|
+
const handleUnmutePress = useCallback(async () => {
|
|
55
|
+
try {
|
|
56
|
+
await unmuteConversation(conversation);
|
|
57
|
+
UIUtils.toast.open({
|
|
58
|
+
title: trans('chat:unmute_toast_success'),
|
|
59
|
+
theme: 'success',
|
|
60
|
+
});
|
|
61
|
+
} catch {
|
|
62
|
+
UIUtils.toast.open({
|
|
63
|
+
title: trans('chat:generic_error'),
|
|
64
|
+
theme: 'error',
|
|
65
|
+
});
|
|
66
|
+
} finally {
|
|
67
|
+
swipeableMethods.close();
|
|
68
|
+
}
|
|
69
|
+
}, [swipeableMethods, conversation, unmuteConversation]);
|
|
70
|
+
|
|
71
|
+
return (
|
|
72
|
+
<KContainer.Touchable
|
|
73
|
+
width={76}
|
|
74
|
+
alignItems="center"
|
|
75
|
+
justifyContent="center"
|
|
76
|
+
background={
|
|
77
|
+
isMuted ? KColors.palette.gray.w400 : KColors.palette.danger.w400
|
|
78
|
+
}
|
|
79
|
+
onPress={isMuted ? handleUnmutePress : handleMutePress}
|
|
80
|
+
>
|
|
81
|
+
<KImage.VectorIcons
|
|
82
|
+
name={isMuted ? 'bell-o' : 'bell-off-o'}
|
|
83
|
+
provider="DroppiiNew"
|
|
84
|
+
size={20}
|
|
85
|
+
color={KColors.white}
|
|
86
|
+
/>
|
|
87
|
+
<KLabel.Text
|
|
88
|
+
typo="Text2XsMedium"
|
|
89
|
+
color={KColors.white}
|
|
90
|
+
marginT="0.25rem"
|
|
91
|
+
textAlign="center"
|
|
92
|
+
>
|
|
93
|
+
{isMuted ? trans('chat:unmute_action') : trans('chat:mute_action')}
|
|
94
|
+
</KLabel.Text>
|
|
95
|
+
</KContainer.Touchable>
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
MuteThread.displayName = 'MuteThread';
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { memo, useCallback, useMemo } from 'react';
|
|
2
2
|
import { type GestureResponderEvent } from 'react-native';
|
|
3
|
+
import ReanimatedSwipeable from 'react-native-gesture-handler/ReanimatedSwipeable';
|
|
4
|
+
import type { SwipeableMethods } from 'react-native-gesture-handler/ReanimatedSwipeable';
|
|
3
5
|
import { KContainer, KImage, KLabel, KColors } from '@droppii/libs';
|
|
4
6
|
import { AvatarSection } from './AvatarSection';
|
|
5
7
|
import { NamePrefixIcon } from './NamePrefixIcon';
|
|
@@ -7,7 +9,11 @@ import { UnreadBadge } from './UnreadBadge';
|
|
|
7
9
|
import { formatTimestamp } from '../../utils/dateTimeUtils';
|
|
8
10
|
import { getLastMessageText } from '../../utils/messageUtils';
|
|
9
11
|
import { useConversation, useUserStore } from '../../store';
|
|
10
|
-
import
|
|
12
|
+
import {
|
|
13
|
+
MessageReceiveOptType,
|
|
14
|
+
type MessageItem,
|
|
15
|
+
} from '@droppii/openim-rn-client-sdk';
|
|
16
|
+
import { MuteThread } from './MuteThread';
|
|
11
17
|
|
|
12
18
|
interface ThreadCardProps {
|
|
13
19
|
item: string;
|
|
@@ -15,18 +21,19 @@ interface ThreadCardProps {
|
|
|
15
21
|
}
|
|
16
22
|
|
|
17
23
|
const ThreadCard = memo(({ item, onPress }: ThreadCardProps) => {
|
|
18
|
-
const
|
|
24
|
+
const conversation = useConversation(item);
|
|
19
25
|
|
|
20
26
|
const {
|
|
21
27
|
peerType,
|
|
22
28
|
showName,
|
|
23
29
|
faceURL,
|
|
24
30
|
unreadCount = 0,
|
|
25
|
-
recvMsgOpt,
|
|
31
|
+
recvMsgOpt = MessageReceiveOptType.Normal,
|
|
26
32
|
isPinned,
|
|
33
|
+
isNotInGroup,
|
|
27
34
|
latestMsgSendTime,
|
|
28
35
|
latestMsg,
|
|
29
|
-
} =
|
|
36
|
+
} = conversation || {};
|
|
30
37
|
|
|
31
38
|
const latestMsgData: MessageItem = useMemo(() => {
|
|
32
39
|
let result = null;
|
|
@@ -40,7 +47,7 @@ const ThreadCard = memo(({ item, onPress }: ThreadCardProps) => {
|
|
|
40
47
|
|
|
41
48
|
const fullName = showName ?? '';
|
|
42
49
|
const hasUnread = unreadCount > 0;
|
|
43
|
-
const isMuted =
|
|
50
|
+
const isMuted = recvMsgOpt !== MessageReceiveOptType.Normal;
|
|
44
51
|
const timestamp = formatTimestamp(
|
|
45
52
|
latestMsgSendTime ?? latestMsgData?.sendTime ?? null
|
|
46
53
|
);
|
|
@@ -48,7 +55,7 @@ const ThreadCard = memo(({ item, onPress }: ThreadCardProps) => {
|
|
|
48
55
|
const lastMessageText = getLastMessageText(
|
|
49
56
|
latestMsgData,
|
|
50
57
|
currentUserId,
|
|
51
|
-
|
|
58
|
+
conversation
|
|
52
59
|
);
|
|
53
60
|
|
|
54
61
|
const handlePress = useCallback(
|
|
@@ -58,79 +65,105 @@ const ThreadCard = memo(({ item, onPress }: ThreadCardProps) => {
|
|
|
58
65
|
[item, onPress]
|
|
59
66
|
);
|
|
60
67
|
|
|
68
|
+
const renderRightActions = useCallback(
|
|
69
|
+
(
|
|
70
|
+
_progress: unknown,
|
|
71
|
+
_translation: unknown,
|
|
72
|
+
swipeableMethods: SwipeableMethods
|
|
73
|
+
) => (
|
|
74
|
+
<>
|
|
75
|
+
<KContainer.VisibleView visible={!isNotInGroup}>
|
|
76
|
+
<MuteThread
|
|
77
|
+
conversation={conversation}
|
|
78
|
+
isMuted={isMuted}
|
|
79
|
+
swipeableMethods={swipeableMethods}
|
|
80
|
+
/>
|
|
81
|
+
</KContainer.VisibleView>
|
|
82
|
+
</>
|
|
83
|
+
),
|
|
84
|
+
[isMuted, conversation, isNotInGroup]
|
|
85
|
+
);
|
|
86
|
+
|
|
61
87
|
return (
|
|
62
|
-
<
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
paddingV="0.75rem"
|
|
67
|
-
onPress={handlePress}
|
|
68
|
-
activeOpacity={0.7}
|
|
88
|
+
<ReanimatedSwipeable
|
|
89
|
+
friction={2}
|
|
90
|
+
rightThreshold={40}
|
|
91
|
+
renderRightActions={renderRightActions}
|
|
69
92
|
>
|
|
70
|
-
<
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
93
|
+
<KContainer.Touchable
|
|
94
|
+
row
|
|
95
|
+
alignItems="center"
|
|
96
|
+
paddingH="0.75rem"
|
|
97
|
+
paddingV="0.75rem"
|
|
98
|
+
onPress={handlePress}
|
|
99
|
+
activeOpacity={1}
|
|
100
|
+
background={KColors.white}
|
|
101
|
+
>
|
|
102
|
+
<AvatarSection
|
|
103
|
+
avatar={faceURL ?? null}
|
|
104
|
+
fullName={fullName}
|
|
105
|
+
peerType={peerType}
|
|
106
|
+
/>
|
|
75
107
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
<KLabel.Text
|
|
82
|
-
typo={hasUnread ? 'TextMdBold' : 'TextMdNormal'}
|
|
83
|
-
numberOfLines={1}
|
|
84
|
-
color={KColors.black}
|
|
85
|
-
flex
|
|
86
|
-
>
|
|
87
|
-
{fullName}
|
|
88
|
-
</KLabel.Text>
|
|
89
|
-
<KContainer.VisibleView visible={isMuted}>
|
|
90
|
-
<KContainer.View marginL="0.25rem">
|
|
91
|
-
<KImage.VectorIcons
|
|
92
|
-
name="bell-off"
|
|
93
|
-
provider="MaterialCommunityIcons"
|
|
94
|
-
size={16}
|
|
95
|
-
color={KColors.palette.gray.w500}
|
|
96
|
-
/>
|
|
97
|
-
</KContainer.View>
|
|
98
|
-
</KContainer.VisibleView>
|
|
99
|
-
<KContainer.VisibleView visible={Boolean(timestamp)}>
|
|
108
|
+
{/* Chat-Content */}
|
|
109
|
+
<KContainer.View flex marginL="0.5rem" paddingB={2}>
|
|
110
|
+
{/* Row-Title */}
|
|
111
|
+
<KContainer.View row alignItems="center">
|
|
112
|
+
<NamePrefixIcon peerType={peerType} />
|
|
100
113
|
<KLabel.Text
|
|
101
|
-
typo=
|
|
102
|
-
|
|
103
|
-
|
|
114
|
+
typo={hasUnread ? 'TextMdBold' : 'TextMdNormal'}
|
|
115
|
+
numberOfLines={1}
|
|
116
|
+
color={KColors.black}
|
|
117
|
+
flex
|
|
104
118
|
>
|
|
105
|
-
{
|
|
119
|
+
{fullName}
|
|
106
120
|
</KLabel.Text>
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
<KContainer.VisibleView visible={Boolean(isPinned)}>
|
|
121
|
-
<KContainer.View marginL="0.5rem">
|
|
122
|
-
<KImage.VectorIcons
|
|
123
|
-
name="pin-outline"
|
|
124
|
-
provider="MaterialCommunityIcons"
|
|
125
|
-
size={14}
|
|
121
|
+
<KContainer.VisibleView visible={isMuted}>
|
|
122
|
+
<KContainer.View marginL="0.25rem">
|
|
123
|
+
<KImage.VectorIcons
|
|
124
|
+
name="bell-off"
|
|
125
|
+
provider="MaterialCommunityIcons"
|
|
126
|
+
size={16}
|
|
127
|
+
color={KColors.palette.gray.w500}
|
|
128
|
+
/>
|
|
129
|
+
</KContainer.View>
|
|
130
|
+
</KContainer.VisibleView>
|
|
131
|
+
<KContainer.VisibleView visible={Boolean(timestamp)}>
|
|
132
|
+
<KLabel.Text
|
|
133
|
+
typo="TextXsNormal"
|
|
126
134
|
color={KColors.palette.gray.w400}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
135
|
+
marginL="0.25rem"
|
|
136
|
+
>
|
|
137
|
+
{timestamp}
|
|
138
|
+
</KLabel.Text>
|
|
139
|
+
</KContainer.VisibleView>
|
|
140
|
+
</KContainer.View>
|
|
141
|
+
|
|
142
|
+
{/* In-Text */}
|
|
143
|
+
<KContainer.View row alignItems="center">
|
|
144
|
+
<KLabel.Text
|
|
145
|
+
typo={hasUnread ? 'TextNmMedium' : 'TextNmNormal'}
|
|
146
|
+
color={hasUnread ? KColors.black : KColors.gray.normal}
|
|
147
|
+
numberOfLines={1}
|
|
148
|
+
flex
|
|
149
|
+
>
|
|
150
|
+
{lastMessageText}
|
|
151
|
+
</KLabel.Text>
|
|
152
|
+
<KContainer.VisibleView visible={Boolean(isPinned)}>
|
|
153
|
+
<KContainer.View marginL="0.5rem">
|
|
154
|
+
<KImage.VectorIcons
|
|
155
|
+
name="pin-outline"
|
|
156
|
+
provider="MaterialCommunityIcons"
|
|
157
|
+
size={14}
|
|
158
|
+
color={KColors.palette.gray.w400}
|
|
159
|
+
/>
|
|
160
|
+
</KContainer.View>
|
|
161
|
+
</KContainer.VisibleView>
|
|
162
|
+
<UnreadBadge count={unreadCount} />
|
|
163
|
+
</KContainer.View>
|
|
131
164
|
</KContainer.View>
|
|
132
|
-
</KContainer.
|
|
133
|
-
</
|
|
165
|
+
</KContainer.Touchable>
|
|
166
|
+
</ReanimatedSwipeable>
|
|
134
167
|
);
|
|
135
168
|
});
|
|
136
169
|
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { memo } from 'react';
|
|
2
|
+
import { KContainer, KLabel } from '@droppii/libs';
|
|
3
|
+
import { trans } from '../../../translation';
|
|
4
|
+
import { CHAT_BUBBLE_COLORS } from '../../../screens/chat-detail/constants';
|
|
5
|
+
import { messageStyles } from '../styles';
|
|
6
|
+
import type { BaseLegendMessageProps } from '../types';
|
|
7
|
+
|
|
8
|
+
export const RevokedMessage = memo(({ isOutgoing }: BaseLegendMessageProps) => {
|
|
9
|
+
return (
|
|
10
|
+
<KContainer.View
|
|
11
|
+
style={[
|
|
12
|
+
messageStyles.bubble,
|
|
13
|
+
isOutgoing ? messageStyles.bubbleSent : messageStyles.bubbleReceived,
|
|
14
|
+
]}
|
|
15
|
+
>
|
|
16
|
+
<KLabel.Text typo="TextMdNormal" color={CHAT_BUBBLE_COLORS.timestamp}>
|
|
17
|
+
{trans('msg_type_revoke')}
|
|
18
|
+
</KLabel.Text>
|
|
19
|
+
</KContainer.View>
|
|
20
|
+
);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
RevokedMessage.displayName = 'RevokedMessage';
|
|
@@ -3,10 +3,11 @@ import OpenIMSDK, {
|
|
|
3
3
|
type ConversationItem,
|
|
4
4
|
type GroupMemberItem,
|
|
5
5
|
type MessageItem,
|
|
6
|
+
type RevokedInfo,
|
|
6
7
|
} from '@droppii/openim-rn-client-sdk';
|
|
7
8
|
import { useCallback, useEffect } from 'react';
|
|
8
9
|
import { useConversationStore } from '../store/conversation';
|
|
9
|
-
import { useMessageStore } from '../store/message';
|
|
10
|
+
import { markMessageRevoked, useMessageStore } from '../store/message';
|
|
10
11
|
|
|
11
12
|
export const useChatListener = () => {
|
|
12
13
|
const updateOneMessage = useMessageStore((state) => state.updateOneMessage);
|
|
@@ -56,6 +57,10 @@ export const useChatListener = () => {
|
|
|
56
57
|
});
|
|
57
58
|
}, []);
|
|
58
59
|
|
|
60
|
+
const onMessageRevoked = useCallback((revokedInfo: RevokedInfo) => {
|
|
61
|
+
markMessageRevoked(revokedInfo.clientMsgID);
|
|
62
|
+
}, []);
|
|
63
|
+
|
|
59
64
|
useEffect(() => {
|
|
60
65
|
// Conversation
|
|
61
66
|
OpenIMSDK.on(OpenIMEvent.OnConversationChanged, onConversationChanged);
|
|
@@ -67,6 +72,7 @@ export const useChatListener = () => {
|
|
|
67
72
|
|
|
68
73
|
// Message status
|
|
69
74
|
OpenIMSDK.on(OpenIMEvent.SendMessageProgress, onSendMessageProgress);
|
|
75
|
+
OpenIMSDK.on(OpenIMEvent.OnNewRecvMessageRevoked, onMessageRevoked);
|
|
70
76
|
|
|
71
77
|
return () => {
|
|
72
78
|
// Conversation
|
|
@@ -79,6 +85,7 @@ export const useChatListener = () => {
|
|
|
79
85
|
|
|
80
86
|
// Message status
|
|
81
87
|
OpenIMSDK.off(OpenIMEvent.SendMessageProgress, onSendMessageProgress);
|
|
88
|
+
OpenIMSDK.off(OpenIMEvent.OnNewRecvMessageRevoked, onMessageRevoked);
|
|
82
89
|
};
|
|
83
90
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
84
91
|
}, []);
|
|
@@ -8,7 +8,7 @@ import OpenIMSDK from '@droppii/openim-rn-client-sdk';
|
|
|
8
8
|
import type { IMessageItemEx } from '../../types/chat';
|
|
9
9
|
import { useChatContext } from '../../context';
|
|
10
10
|
import { generateContentBasedOnMessageType } from '../../utils/conversation';
|
|
11
|
-
import { useMessageStore } from '../../store/message';
|
|
11
|
+
import { markMessageRevoked, useMessageStore } from '../../store/message';
|
|
12
12
|
|
|
13
13
|
import type { IUrlMetadata } from '../../types/common';
|
|
14
14
|
import type { IRunConversationFlowPayload } from '../../types/flows';
|
|
@@ -165,9 +165,26 @@ export const useSendMessage = () => {
|
|
|
165
165
|
[pushNewMessage, updateOneMessage, deleteOneMessage]
|
|
166
166
|
);
|
|
167
167
|
|
|
168
|
+
const revokeMessage = useCallback(async (message: MessageItem) => {
|
|
169
|
+
const conversationID = useConversationStore
|
|
170
|
+
.getState()
|
|
171
|
+
.getCurrentConversation()?.conversationID;
|
|
172
|
+
if (!conversationID) throw new Error('No active conversation');
|
|
173
|
+
|
|
174
|
+
await OpenIMSDK.revokeMessage({
|
|
175
|
+
conversationID,
|
|
176
|
+
clientMsgID: message.clientMsgID,
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
// TODO: Handle revoked quoted message
|
|
180
|
+
|
|
181
|
+
markMessageRevoked(message.clientMsgID);
|
|
182
|
+
}, []);
|
|
183
|
+
|
|
168
184
|
return {
|
|
169
185
|
sendMessage,
|
|
170
186
|
retryMessage,
|
|
187
|
+
revokeMessage,
|
|
171
188
|
};
|
|
172
189
|
};
|
|
173
190
|
|