@cometchat/chat-uikit-react-native 5.5.4 → 5.7.0

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.
Files changed (215) hide show
  1. package/android/src/main/java/com/reactnativecometchatuikit/CometChatKeyboardModule.kt +101 -0
  2. package/android/src/main/java/com/reactnativecometchatuikit/CometchatUiKitPackage.java +1 -0
  3. package/android/src/main/java/com/reactnativecometchatuikit/FileManager.java +78 -3
  4. package/android/src/main/java/com/reactnativecometchatuikit/KeyboardDirectionWatcher.kt +64 -0
  5. package/android/src/main/java/com/reactnativecometchatuikit/KeyboardLanguageDirection.kt +44 -0
  6. package/android/src/main/java/com/reactnativecometchatuikit/RichTextEditorView.kt +287 -49
  7. package/android/src/main/java/com/reactnativecometchatuikit/SafeFileName.java +78 -0
  8. package/ios/CCLocalFileGuard.h +19 -0
  9. package/ios/CCLocalFileGuard.m +34 -0
  10. package/ios/CometChatKeyboardModule.m +9 -0
  11. package/ios/CometChatKeyboardModule.swift +71 -0
  12. package/ios/FileManager.m +70 -6
  13. package/ios/KeyboardLanguageDirection.swift +24 -0
  14. package/ios/RichTextEditorView.swift +253 -51
  15. package/ios/RichTextEditorViewManager.m +1 -0
  16. package/ios/VideoManager.m +1 -1
  17. package/package.json +18 -3
  18. package/src/CometChatAIAssistantChatHistory/CometChatAIAssistantChatHistory.tsx +41 -57
  19. package/src/CometChatAIAssistantChatHistory/Skeleton.tsx +4 -1
  20. package/src/CometChatAIAssistantChatHistory/style.ts +5 -2
  21. package/src/CometChatCompactMessageComposer/CometChatCompactMessageComposer.tsx +145 -63
  22. package/src/CometChatCompactMessageComposer/styles.ts +7 -7
  23. package/src/CometChatConversations/CometChatConversations.tsx +276 -147
  24. package/src/CometChatConversations/Skeleton.tsx +4 -1
  25. package/src/CometChatConversations/style.ts +1 -1
  26. package/src/CometChatGroupMembers/CometChatGroupMembers.tsx +39 -18
  27. package/src/CometChatGroupMembers/Skeleton.tsx +4 -1
  28. package/src/CometChatGroupMembers/style.ts +6 -4
  29. package/src/CometChatGroups/CometChatGroups.tsx +74 -58
  30. package/src/CometChatGroups/GroupsStyle.ts +1 -1
  31. package/src/CometChatGroups/Skeleton.tsx +4 -1
  32. package/src/CometChatMessageComposer/CometChatMessageComposer.tsx +190 -96
  33. package/src/CometChatMessageComposer/styles.tsx +1 -1
  34. package/src/CometChatMessageHeader/CometChatMessageHeader.tsx +28 -15
  35. package/src/CometChatMessageHeader/listners.ts +76 -56
  36. package/src/CometChatMessageInformation/CometChatMessageInformation.tsx +8 -1
  37. package/src/CometChatMessageInformation/Skeleton.tsx +4 -1
  38. package/src/CometChatMessageList/CometChatMessageList.tsx +1465 -313
  39. package/src/CometChatMessageList/SwipeToReplyView.tsx +61 -0
  40. package/src/CometChatMessageList/style.ts +32 -32
  41. package/src/CometChatMessageList/swipeToReply.ts +25 -0
  42. package/src/CometChatNotificationFeed/CometChatNotificationFeed.tsx +81 -10
  43. package/src/CometChatNotificationFeed/style.ts +1 -1
  44. package/src/CometChatNotificationFeed/utils.ts +17 -18
  45. package/src/CometChatPinnedMessages/CometChatPinnedMessages.tsx +82 -3
  46. package/src/CometChatPinnedMessages/style.ts +5 -5
  47. package/src/CometChatRichTextEditor/RichTextEditorViewNativeComponent.ts +2 -0
  48. package/src/CometChatRichTextEditor/index.tsx +3 -0
  49. package/src/CometChatSavedMessages/CometChatSavedMessages.tsx +83 -15
  50. package/src/CometChatSavedMessages/style.ts +3 -3
  51. package/src/CometChatSearch/CometChatSearch.tsx +391 -136
  52. package/src/CometChatSearch/Skeleton.tsx +4 -1
  53. package/src/CometChatSearch/searchLabels.ts +26 -0
  54. package/src/CometChatSearch/style.ts +7 -7
  55. package/src/CometChatThreadHeader/CometChatThreadHeader.tsx +34 -8
  56. package/src/CometChatThreadHeader/Header.tsx +2 -2
  57. package/src/CometChatUsers/CometChatUsers.tsx +10 -1
  58. package/src/CometChatUsers/Skeleton.tsx +4 -1
  59. package/src/CometChatUsers/style.ts +1 -1
  60. package/src/calls/CometChatCallButtons/CometChatCallButtons.tsx +27 -1
  61. package/src/calls/CometChatCallLogs/CometChatCallLogs.tsx +16 -4
  62. package/src/calls/CometChatCallLogs/Skeleton.tsx +4 -1
  63. package/src/calls/CometChatIncomingCall/CometChatIncomingCall.tsx +11 -3
  64. package/src/calls/CometChatOutgoingCall/CometChatOutgoingCall.tsx +10 -2
  65. package/src/extensions/CollaborativeBubble/style.ts +4 -4
  66. package/src/extensions/CollaborativeDocument/CollaborativeDocumentExtensionDecorator.tsx +1 -1
  67. package/src/extensions/CollaborativeWhiteboard/CollaborativeWhiteboardExtensionDecorator.tsx +1 -1
  68. package/src/extensions/LinkPreview/LinkPreviewBubble.tsx +11 -6
  69. package/src/extensions/LinkPreview/style.ts +6 -6
  70. package/src/extensions/Polls/Header.tsx +1 -1
  71. package/src/extensions/Polls/Polls.tsx +25 -12
  72. package/src/extensions/Polls/PollsBubble.tsx +10 -6
  73. package/src/extensions/Polls/style.ts +4 -4
  74. package/src/extensions/Stickers/CometChatStickerKeyboard/CometChatStickerKeyboard.tsx +2 -2
  75. package/src/extensions/Stickers/CometChatStickerKeyboard/Skeleton.tsx +1 -1
  76. package/src/extensions/Stickers/CometChatStickerKeyboard/style.ts +1 -1
  77. package/src/extensions/Stickers/StickersExtensionDecorator.tsx +4 -2
  78. package/src/index.ts +11 -1
  79. package/src/shared/CometChatUiKit/CometChatUIKit.ts +102 -2
  80. package/src/shared/CometChatUiKit/UIKitSettings.ts +28 -0
  81. package/src/shared/events/CometChatUIEventHandler/Listener.ts +10 -0
  82. package/src/shared/events/index.ts +4 -0
  83. package/src/shared/events/offline.ts +28 -0
  84. package/src/shared/formatters/CometChatMentionsFormatter/CometChatMentionsFormatter.tsx +18 -13
  85. package/src/shared/formatters/CometChatRichTextFormatter/index.tsx +15 -7
  86. package/src/shared/formatters/CometChatTextFormatter.ts +11 -0
  87. package/src/shared/formatters/CometChatUrlsFormatter/index.tsx +7 -4
  88. package/src/shared/framework/MessageDataSource.tsx +51 -108
  89. package/src/shared/helper/LocalizedDateHelper.ts +64 -4
  90. package/src/shared/helper/helperFunctions.ts +71 -4
  91. package/src/shared/helper/keyboardDirection.ts +54 -0
  92. package/src/shared/helper/layoutDirection.ts +205 -0
  93. package/src/shared/helper/pluralRules.ts +67 -0
  94. package/src/shared/helper/textDirection.ts +118 -0
  95. package/src/shared/icons/Icon.tsx +37 -2
  96. package/src/shared/icons/components/format-list-numbered-rtl.tsx +15 -0
  97. package/src/shared/index.ts +2 -0
  98. package/src/shared/offline/OfflineHub.ts +651 -0
  99. package/src/shared/offline/OfflineMediaBubble.tsx +49 -0
  100. package/src/shared/offline/OfflineViews.tsx +222 -0
  101. package/src/shared/offline/conversationPins.ts +137 -0
  102. package/src/shared/offline/conversations.ts +325 -0
  103. package/src/shared/offline/frameProbe.ts +24 -0
  104. package/src/shared/offline/gate.ts +94 -0
  105. package/src/shared/offline/groupActions.ts +81 -0
  106. package/src/shared/offline/identity.ts +162 -0
  107. package/src/shared/offline/index.ts +76 -0
  108. package/src/shared/offline/media.ts +247 -0
  109. package/src/shared/offline/notices.ts +84 -0
  110. package/src/shared/offline/reconcile.ts +296 -0
  111. package/src/shared/offline/searchOutcome.ts +62 -0
  112. package/src/shared/offline/send.ts +430 -0
  113. package/src/shared/offline/stateContract.ts +85 -0
  114. package/src/shared/offline/threadReplies.ts +125 -0
  115. package/src/shared/offline/twoPhase.ts +372 -0
  116. package/src/shared/offline/unsentActions.ts +168 -0
  117. package/src/shared/offline/useOfflineMediaUri.ts +87 -0
  118. package/src/shared/offline/useOfflineReconnect.ts +25 -0
  119. package/src/shared/offline/useOfflineSessionEnded.ts +22 -0
  120. package/src/shared/offline/useOfflineUploadTray.ts +76 -0
  121. package/src/shared/offline/usePresenceHidden.ts +33 -0
  122. package/src/shared/resources/CometChatLocalizeNew/CometChatLocalizationHelper.ts +2 -0
  123. package/src/shared/resources/CometChatLocalizeNew/resources/ar/translation.json +720 -0
  124. package/src/shared/resources/CometChatLocalizeNew/resources/de/translation.json +74 -3
  125. package/src/shared/resources/CometChatLocalizeNew/resources/en/translation.json +75 -4
  126. package/src/shared/resources/CometChatLocalizeNew/resources/es/translation.json +74 -3
  127. package/src/shared/resources/CometChatLocalizeNew/resources/fr/translation.json +75 -4
  128. package/src/shared/resources/CometChatLocalizeNew/resources/hi/translation.json +74 -3
  129. package/src/shared/resources/CometChatLocalizeNew/resources/hu/translation.json +74 -3
  130. package/src/shared/resources/CometChatLocalizeNew/resources/it/translation.json +74 -3
  131. package/src/shared/resources/CometChatLocalizeNew/resources/ja/translation.json +74 -3
  132. package/src/shared/resources/CometChatLocalizeNew/resources/ko/translation.json +74 -3
  133. package/src/shared/resources/CometChatLocalizeNew/resources/lt/translation.json +82 -3
  134. package/src/shared/resources/CometChatLocalizeNew/resources/ms/translation.json +74 -3
  135. package/src/shared/resources/CometChatLocalizeNew/resources/nl/translation.json +74 -3
  136. package/src/shared/resources/CometChatLocalizeNew/resources/pt/translation.json +74 -3
  137. package/src/shared/resources/CometChatLocalizeNew/resources/ru/translation.json +90 -3
  138. package/src/shared/resources/CometChatLocalizeNew/resources/sv/translation.json +74 -3
  139. package/src/shared/resources/CometChatLocalizeNew/resources/tr/translation.json +74 -3
  140. package/src/shared/resources/CometChatLocalizeNew/resources/zh/translation.json +74 -3
  141. package/src/shared/resources/CometChatLocalizeNew/resources/zh-tw/translation.json +74 -3
  142. package/src/shared/services/UploadQueueService.ts +106 -1
  143. package/src/shared/utils/CometChatMessagePreview/CometChatMessagePreview.tsx +13 -12
  144. package/src/shared/utils/CometChatMessagePreview/style.ts +1 -1
  145. package/src/shared/utils/MessageReceiptUtils.ts +8 -0
  146. package/src/shared/utils/MessageUtils.tsx +14 -14
  147. package/src/shared/utils/PermissionUtil.ts +16 -5
  148. package/src/shared/utils/SavedMessagesHelper.ts +18 -1
  149. package/src/shared/utils/attachmentLimits.ts +3 -2
  150. package/src/shared/utils/catchUpCursor.ts +36 -0
  151. package/src/shared/utils/conversationUtils.ts +3 -5
  152. package/src/shared/utils/failedMessageRetry.ts +73 -0
  153. package/src/shared/utils/fileIconFontSize.ts +10 -0
  154. package/src/shared/utils/fileSizeLabel.ts +16 -0
  155. package/src/shared/utils/groupActionText.ts +75 -0
  156. package/src/shared/utils/messageIdentity.ts +38 -0
  157. package/src/shared/views/CometChatAIAssistantMessageBubble/CometChatAIAssistantMessageBubble.tsx +12 -8
  158. package/src/shared/views/CometChatAttachmentPreview/CometChatAttachmentPreview.style.ts +1 -1
  159. package/src/shared/views/CometChatAttachmentPreview/CometChatAttachmentPreviewItem.tsx +5 -3
  160. package/src/shared/views/CometChatAttachmentPreview/CometChatAttachmentTile.tsx +22 -17
  161. package/src/shared/views/CometChatAttachmentViewer/CometChatAttachmentViewer.tsx +45 -12
  162. package/src/shared/views/CometChatAudioBubble/CometChatAudioBubble.tsx +16 -10
  163. package/src/shared/views/CometChatAudiosBubble/CometChatAudiosBubble.tsx +20 -8
  164. package/src/shared/views/CometChatBadge/CometChatBadge.tsx +8 -4
  165. package/src/shared/views/CometChatBottomSheet/CometChatBottomSheet.tsx +6 -2
  166. package/src/shared/views/CometChatComposerErrorBanner.tsx +3 -1
  167. package/src/shared/views/CometChatConfirmDialog/CometChatConfirmDialog.tsx +8 -3
  168. package/src/shared/views/CometChatConversationStarter/CometChatConversationStarter.tsx +2 -2
  169. package/src/shared/views/CometChatEmojiKeyboard/CometChatEmojiKeyboard.tsx +5 -3
  170. package/src/shared/views/CometChatEmojiKeyboard/emojis.ts +8 -8
  171. package/src/shared/views/CometChatEmojiKeyboard/style.ts +2 -2
  172. package/src/shared/views/CometChatFileBubble/CometChatFileBubble.tsx +13 -27
  173. package/src/shared/views/CometChatFilesBubble/CometChatFilesBubble.tsx +65 -15
  174. package/src/shared/views/CometChatImageViewerModal/ImageViewerModal.tsx +7 -3
  175. package/src/shared/views/CometChatImagesBubble/CometChatImagesBubble.tsx +56 -25
  176. package/src/shared/views/CometChatInlineAudioRecorder/CometChatInlineAudioRecorder.tsx +41 -21
  177. package/src/shared/views/CometChatInlineAudioRecorder/useAudioRecorder.ts +7 -3
  178. package/src/shared/views/CometChatLinkConfirmPopup/CometChatLinkConfirmPopup.tsx +7 -3
  179. package/src/shared/views/CometChatList/CometChatList.tsx +478 -21
  180. package/src/shared/views/CometChatList/Header.tsx +5 -2
  181. package/src/shared/views/CometChatList/sectionLetter.ts +44 -0
  182. package/src/shared/views/CometChatList/styles.ts +7 -7
  183. package/src/shared/views/CometChatListItem/CometChatListItem.tsx +6 -4
  184. package/src/shared/views/CometChatMediaRecorder/CometChatAudioPlayer.tsx +16 -10
  185. package/src/shared/views/CometChatMediaRecorder/Timer.tsx +5 -1
  186. package/src/shared/views/CometChatMediaViewer/CometChatMediaViewer.tsx +43 -16
  187. package/src/shared/views/CometChatMessageBubble/CometChatMessageBubble.tsx +24 -4
  188. package/src/shared/views/CometChatMessageInput/CometChatMessageInput.tsx +19 -2
  189. package/src/shared/views/CometChatNewMessageIndicator/CometChatNewMessageIndicator.tsx +3 -2
  190. package/src/shared/views/CometChatReactionList/CometChatReactionList.tsx +59 -12
  191. package/src/shared/views/CometChatReactionList/ReactionListStyle.tsx +2 -2
  192. package/src/shared/views/CometChatReactionList/Skeleton.tsx +4 -1
  193. package/src/shared/views/CometChatReactions/CometChatReactions.tsx +6 -2
  194. package/src/shared/views/CometChatReportDialog/CometChatReportDialog.tsx +7 -3
  195. package/src/shared/views/CometChatReportDialog/style.ts +1 -1
  196. package/src/shared/views/CometChatSmartReplies/CometChatSmartReplies.tsx +1 -1
  197. package/src/shared/views/CometChatStatusIndicator/CometChatStatusIndicator.tsx +4 -0
  198. package/src/shared/views/CometChatStreamMessageBubble/CometChatStreamMessageBubble.tsx +20 -13
  199. package/src/shared/views/CometChatSuggestionList/CometChatSuggestionList.tsx +3 -2
  200. package/src/shared/views/CometChatSuggestionList/Skeleton.tsx +1 -1
  201. package/src/shared/views/CometChatTextBubble/CometChatTextBubble.tsx +29 -3
  202. package/src/shared/views/CometChatTooltipMenu/CometChatTooltipMenu.tsx +20 -30
  203. package/src/shared/views/CometChatTooltipMenu/tooltipPosition.ts +43 -0
  204. package/src/shared/views/CometChatVideoBubble/style.ts +2 -2
  205. package/src/shared/views/CometChatVideoPlayer/CometChatVideoPlayer.tsx +4 -1
  206. package/src/shared/views/CometChatVideosBubble/CometChatVideosBubble.tsx +58 -24
  207. package/src/shared/views/CometChatVoiceNoteBubble/CometChatVoiceNoteBubble.tsx +24 -12
  208. package/src/shared/views/SenderLabel.tsx +41 -0
  209. package/src/theme/default/default.ts +1 -1
  210. package/src/theme/type.ts +17 -0
  211. package/android/.gradle/7.4/checksums/checksums.lock +0 -0
  212. package/android/.gradle/7.4/fileChanges/last-build.bin +0 -0
  213. package/android/.gradle/7.4/fileHashes/fileHashes.lock +0 -0
  214. package/android/.gradle/7.4/gc.properties +0 -0
  215. package/android/.gradle/vcs-1/gc.properties +0 -0
@@ -0,0 +1,61 @@
1
+ import React, { useCallback, useState } from "react";
2
+ import { Animated } from "react-native";
3
+ import {
4
+ PanGestureHandler,
5
+ PanGestureHandlerGestureEvent,
6
+ PanGestureHandlerStateChangeEvent,
7
+ State,
8
+ } from "react-native-gesture-handler";
9
+ import { useKitRTL } from "../shared/helper/layoutDirection";
10
+ import { shouldReply, swipeOffset } from "./swipeToReply";
11
+
12
+ type Props = {
13
+ /** Emits the reply. Called only when a released drag qualifies (swipeToReply.ts). */
14
+ onReply: () => void;
15
+ /** Checked on release — e.g. an outgoing message still under moderation can't be replied to. */
16
+ canReply: () => boolean;
17
+ children: React.ReactNode;
18
+ };
19
+
20
+ /**
21
+ * ENG-41315: a message bubble that slides toward the end side to reply — right in LTR, left in RTL.
22
+ * Its own component so only swipeable rows pay for the gesture state, and its hooks never sit
23
+ * behind the message list's template checks.
24
+ */
25
+ export const SwipeToReplyView = ({ onReply, canReply, children }: Props) => {
26
+ // useState initialiser: one Animated.Value per row, not a new one discarded every render.
27
+ const [offset] = useState(() => new Animated.Value(0));
28
+ const isRTL = useKitRTL();
29
+
30
+ const onGestureEvent = useCallback(
31
+ (event: PanGestureHandlerGestureEvent) => {
32
+ offset.setValue(swipeOffset(event.nativeEvent.translationX, isRTL));
33
+ },
34
+ [offset, isRTL]
35
+ );
36
+
37
+ const onHandlerStateChange = useCallback(
38
+ (event: PanGestureHandlerStateChangeEvent) => {
39
+ const { state, translationX, velocityX } = event.nativeEvent;
40
+ // Cancelled or failed (the list's scroll took over, the app went to the background) must
41
+ // spring back too, or the bubble stays shifted sideways.
42
+ if (state !== State.END && state !== State.CANCELLED && state !== State.FAILED) return;
43
+ Animated.spring(offset, { toValue: 0, useNativeDriver: true }).start();
44
+ if (state === State.END && canReply() && shouldReply(translationX, velocityX, isRTL)) {
45
+ onReply();
46
+ }
47
+ },
48
+ [offset, isRTL, canReply, onReply]
49
+ );
50
+
51
+ return (
52
+ <PanGestureHandler
53
+ onGestureEvent={onGestureEvent}
54
+ onHandlerStateChange={onHandlerStateChange}
55
+ activeOffsetX={[-10, 10]}
56
+ failOffsetY={[-50, 50]}
57
+ >
58
+ <Animated.View style={{ transform: [{ translateX: offset }] }}>{children}</Animated.View>
59
+ </PanGestureHandler>
60
+ );
61
+ };
@@ -105,7 +105,7 @@ export const getMessageListStylesLight = (
105
105
  flexDirection: "column",
106
106
  alignItems: "center",
107
107
  backgroundColor: color.background1,
108
- right: 10,
108
+ end: 10,
109
109
  bottom: 2,
110
110
  gap: spacing.padding.p1,
111
111
  borderRadius: spacing.radius.max,
@@ -211,7 +211,7 @@ export const getMessageListStylesLight = (
211
211
  containerStyle: {
212
212
  paddingTop: spacing.padding.p2,
213
213
  paddingBottom: spacing.padding.p2,
214
- paddingLeft: spacing.padding.p1,
214
+ paddingStart: spacing.padding.p1,
215
215
  },
216
216
  textStyle: {
217
217
  color: color.receiveBubbleTimestamp,
@@ -257,9 +257,9 @@ export const getMessageListStylesLight = (
257
257
  // Figma: padding 4px top/right/left, 0 bottom — leaves a thin bubble-color
258
258
  // frame around the media; the timestamp row sits flush under the grid.
259
259
  paddingTop: spacing.padding.p1,
260
- paddingRight: spacing.padding.p1,
260
+ paddingEnd: spacing.padding.p1,
261
261
  paddingBottom: spacing.padding.p0,
262
- paddingLeft: spacing.padding.p1,
262
+ paddingStart: spacing.padding.p1,
263
263
  borderRadius: spacing.radius.r3,
264
264
  alignSelf: "flex-start",
265
265
  },
@@ -272,7 +272,7 @@ export const getMessageListStylesLight = (
272
272
  dateReceiptContainerStyle: {
273
273
  // Figma: 2px gap between the media grid and the timestamp row.
274
274
  paddingTop: spacing.padding.p0_5,
275
- paddingRight: spacing.padding.p1,
275
+ paddingEnd: spacing.padding.p1,
276
276
  paddingBottom: spacing.padding.p1,
277
277
  },
278
278
  },
@@ -348,9 +348,9 @@ export const getMessageListStylesLight = (
348
348
  borderRadius: spacing.radius.r5,
349
349
  backgroundColor: color.primary,
350
350
  paddingTop: 1,
351
- paddingRight: spacing.padding.p1,
351
+ paddingEnd: spacing.padding.p1,
352
352
  paddingBottom: 3,
353
- paddingLeft: spacing.padding.p1,
353
+ paddingStart: spacing.padding.p1,
354
354
  },
355
355
  textStyle: {
356
356
  ...typography.caption2.regular,
@@ -403,10 +403,10 @@ export const getMessageListStylesLight = (
403
403
  containerStyle: {
404
404
  backgroundColor: "#F9EAEF",
405
405
  paddingVertical: 6,
406
- borderBottomLeftRadius: 8,
407
- borderBottomRightRadius: 8,
408
- borderTopLeftRadius: 0,
409
- borderTopRightRadius: 0,
406
+ borderBottomStartRadius: 8,
407
+ borderBottomEndRadius: 8,
408
+ borderTopStartRadius: 0,
409
+ borderTopEndRadius: 0,
410
410
  flexDirection: "row",
411
411
  alignItems: "center",
412
412
  },
@@ -496,9 +496,9 @@ export const getMessageListStylesLight = (
496
496
  // Figma: padding 4px top/right/left, 0 bottom — leaves a thin bubble-color
497
497
  // frame around the media; the timestamp row sits flush under the grid.
498
498
  paddingTop: spacing.padding.p1,
499
- paddingRight: spacing.padding.p1,
499
+ paddingEnd: spacing.padding.p1,
500
500
  paddingBottom: spacing.padding.p0,
501
- paddingLeft: spacing.padding.p1,
501
+ paddingStart: spacing.padding.p1,
502
502
  borderRadius: spacing.radius.r3,
503
503
  overflow: "hidden",
504
504
  },
@@ -512,7 +512,7 @@ export const getMessageListStylesLight = (
512
512
  dateReceiptContainerStyle: {
513
513
  // Figma: 2px gap between the media grid and the timestamp row.
514
514
  paddingTop: spacing.padding.p0_5,
515
- paddingRight: spacing.padding.p1,
515
+ paddingEnd: spacing.padding.p1,
516
516
  paddingBottom: spacing.padding.p1,
517
517
  },
518
518
  },
@@ -552,9 +552,9 @@ export const getMessageListStylesLight = (
552
552
  borderRadius: spacing.radius.r5,
553
553
  backgroundColor: color.primary,
554
554
  paddingTop: 1,
555
- paddingRight: spacing.padding.p1,
555
+ paddingEnd: spacing.padding.p1,
556
556
  paddingBottom: 3,
557
- paddingLeft: spacing.padding.p1,
557
+ paddingStart: spacing.padding.p1,
558
558
  },
559
559
  textStyle: {
560
560
  ...typography.caption2.regular,
@@ -621,7 +621,7 @@ export const getMessageListStylesDark = (
621
621
  flexDirection: "column",
622
622
  alignItems: "center",
623
623
  backgroundColor: color.background3,
624
- right: 10,
624
+ end: 10,
625
625
  bottom: 2,
626
626
  gap: spacing.padding.p1,
627
627
  borderRadius: spacing.radius.max,
@@ -729,7 +729,7 @@ export const getMessageListStylesDark = (
729
729
  containerStyle: {
730
730
  paddingTop: spacing.padding.p2,
731
731
  paddingBottom: spacing.padding.p2,
732
- paddingLeft: spacing.padding.p1,
732
+ paddingStart: spacing.padding.p1,
733
733
  },
734
734
  textStyle: {
735
735
  color: color.receiveBubbleTimestamp,
@@ -775,9 +775,9 @@ export const getMessageListStylesDark = (
775
775
  // Figma: padding 4px top/right/left, 0 bottom — leaves a thin bubble-color
776
776
  // frame around the media; the timestamp row sits flush under the grid.
777
777
  paddingTop: spacing.padding.p1,
778
- paddingRight: spacing.padding.p1,
778
+ paddingEnd: spacing.padding.p1,
779
779
  paddingBottom: spacing.padding.p0,
780
- paddingLeft: spacing.padding.p1,
780
+ paddingStart: spacing.padding.p1,
781
781
  borderRadius: spacing.radius.r3,
782
782
  alignSelf: "flex-start",
783
783
  },
@@ -790,7 +790,7 @@ export const getMessageListStylesDark = (
790
790
  dateReceiptContainerStyle: {
791
791
  // Figma: 2px gap between the media grid and the timestamp row.
792
792
  paddingTop: spacing.padding.p0_5,
793
- paddingRight: spacing.padding.p1,
793
+ paddingEnd: spacing.padding.p1,
794
794
  paddingBottom: spacing.padding.p1,
795
795
  },
796
796
  },
@@ -875,9 +875,9 @@ export const getMessageListStylesDark = (
875
875
  borderRadius: spacing.radius.r5,
876
876
  backgroundColor: color.primary,
877
877
  paddingTop: 1,
878
- paddingRight: spacing.padding.p1,
878
+ paddingEnd: spacing.padding.p1,
879
879
  paddingBottom: 3,
880
- paddingLeft: spacing.padding.p1,
880
+ paddingStart: spacing.padding.p1,
881
881
  },
882
882
  textStyle: {
883
883
  ...typography.caption2.regular,
@@ -921,10 +921,10 @@ export const getMessageListStylesDark = (
921
921
  containerStyle: {
922
922
  backgroundColor: "#3A0C05",
923
923
  paddingVertical: 6,
924
- borderBottomLeftRadius: 8,
925
- borderBottomRightRadius: 8,
926
- borderTopLeftRadius: 0,
927
- borderTopRightRadius: 0,
924
+ borderBottomStartRadius: 8,
925
+ borderBottomEndRadius: 8,
926
+ borderTopStartRadius: 0,
927
+ borderTopEndRadius: 0,
928
928
  flexDirection: "row",
929
929
  alignItems: "center",
930
930
  overflow: 'hidden',
@@ -1015,9 +1015,9 @@ export const getMessageListStylesDark = (
1015
1015
  // Figma: padding 4px top/right/left, 0 bottom — leaves a thin bubble-color
1016
1016
  // frame around the media; the timestamp row sits flush under the grid.
1017
1017
  paddingTop: spacing.padding.p1,
1018
- paddingRight: spacing.padding.p1,
1018
+ paddingEnd: spacing.padding.p1,
1019
1019
  paddingBottom: spacing.padding.p0,
1020
- paddingLeft: spacing.padding.p1,
1020
+ paddingStart: spacing.padding.p1,
1021
1021
  borderRadius: spacing.radius.r3,
1022
1022
  overflow: "hidden",
1023
1023
  },
@@ -1031,7 +1031,7 @@ export const getMessageListStylesDark = (
1031
1031
  dateReceiptContainerStyle: {
1032
1032
  // Figma: 2px gap between the media grid and the timestamp row.
1033
1033
  paddingTop: spacing.padding.p0_5,
1034
- paddingRight: spacing.padding.p1,
1034
+ paddingEnd: spacing.padding.p1,
1035
1035
  paddingBottom: spacing.padding.p1,
1036
1036
  },
1037
1037
  },
@@ -1080,9 +1080,9 @@ export const getMessageListStylesDark = (
1080
1080
  borderRadius: spacing.radius.r5,
1081
1081
  backgroundColor: color.primary,
1082
1082
  paddingTop: 1,
1083
- paddingRight: spacing.padding.p1,
1083
+ paddingEnd: spacing.padding.p1,
1084
1084
  paddingBottom: 3,
1085
- paddingLeft: spacing.padding.p1,
1085
+ paddingStart: spacing.padding.p1,
1086
1086
  },
1087
1087
  textStyle: {
1088
1088
  ...typography.caption2.regular,
@@ -0,0 +1,25 @@
1
+ // ENG-41315: swipe-to-reply goes toward the end side — right in LTR, left in RTL. Gesture
2
+ // translation/velocity and translateX are physical; these helpers work in "toward the end" terms.
3
+
4
+ export const SWIPE_REPLY_THRESHOLD = 80;
5
+ export const SWIPE_MAX_DISTANCE = 120;
6
+ export const SWIPE_FLICK_VELOCITY = 500;
7
+
8
+ /** Physical translateX for the bubble while dragging; 0 when dragged toward the start side. */
9
+ export function swipeOffset(translationX: number, isRTL: boolean): number {
10
+ const sign = isRTL ? -1 : 1;
11
+ const towardEnd = translationX * sign;
12
+ return towardEnd <= 0 ? 0 : Math.min(towardEnd, SWIPE_MAX_DISTANCE) * sign;
13
+ }
14
+
15
+ /**
16
+ * Whether a released drag replies: far enough toward the end, or flicked toward the end. The flick
17
+ * only counts when the drag itself went toward the end — a drag back toward the start followed
18
+ * by a quick end-ward flick on release doesn't reply.
19
+ */
20
+ export function shouldReply(translationX: number, velocityX: number, isRTL: boolean): boolean {
21
+ const sign = isRTL ? -1 : 1;
22
+ const towardEnd = translationX * sign;
23
+ if (towardEnd <= 0) return false;
24
+ return towardEnd > SWIPE_REPLY_THRESHOLD || velocityX * sign > SWIPE_FLICK_VELOCITY;
25
+ }
@@ -38,6 +38,15 @@ import { Skeleton } from "./Skeleton";
38
38
  import Header from "../shared/views/CometChatList/Header";
39
39
  import { ErrorEmptyView } from "../shared/views/ErrorEmptyView/ErrorEmptyView";
40
40
  import NotificationEmptyIcon from "../shared/icons/components/notification-empty";
41
+ import { LayoutDirectionContext, directionStyle, useComponentLayoutDirection } from "../shared/helper/layoutDirection";
42
+ import { readListPage } from "../shared/offline/twoPhase";
43
+ import { useOfflineSessionEnded } from "../shared/offline/useOfflineSessionEnded";
44
+ import { useOfflineReconnect } from "../shared/offline/useOfflineReconnect";
45
+ import { isOfflineOn, sdkConnected } from "../shared/offline/gate";
46
+ import { isNotConnectedError } from "../shared/offline/reconcile";
47
+ import { ConnectStateView } from "../shared/offline/OfflineViews";
48
+ import { OFFLINE_STRING_KEYS } from "../shared/offline/notices";
49
+ import { CONTRACT_IDS } from "../shared/offline/stateContract";
41
50
 
42
51
  // ───────────────────────────────────────────────────────────────
43
52
  // Module-level constants (hoisted — no GC churn)
@@ -69,6 +78,8 @@ interface CardAction {
69
78
  * Props interface for CometChatNotificationFeed.
70
79
  */
71
80
  export interface CometChatNotificationFeedInterface {
81
+ /** Lays this component out `"ltr"` or `"rtl"`, overriding the kit's global `layoutDirection`. Not set = inherit. */
82
+ layoutDirection?: "ltr" | "rtl";
72
83
  // ─── Content Configuration ───────────────────────────────────
73
84
  /** Feed title. Default: "Notifications" */
74
85
  title?: string;
@@ -136,6 +147,8 @@ export const CometChatNotificationFeed = (props: CometChatNotificationFeedInterf
136
147
  cardThemeMode = "auto",
137
148
  cardThemeOverride,
138
149
  } = props;
150
+ // ENG-41333: own setting → enclosing component → global; drives the root and the context.
151
+ const direction = useComponentLayoutDirection(props.layoutDirection);
139
152
 
140
153
  // ─── Theme & Styles ──────────────────────────────────────────
141
154
  const theme = useTheme();
@@ -148,6 +161,16 @@ export const CometChatNotificationFeed = (props: CometChatNotificationFeedInterf
148
161
  // ─── State ───────────────────────────────────────────────────
149
162
  const [screenState, setScreenState] = useState<ScreenState>("loading");
150
163
  const [feedItems, setFeedItems] = useState<NotificationFeedItem[]>([]);
164
+ // Offline ON: nothing of the old session stays on screen (UIK-LIFE-01).
165
+ useOfflineSessionEnded(() => {
166
+ setFeedItems([]);
167
+ setScreenState("empty");
168
+ });
169
+ // Offline ON (D84): the device was not connected and has nothing saved: "Connect to load
170
+ // notifications" shows (the app's own ErrorView instead, if it passed one) and the feed loads
171
+ // again once, by itself, when the connection is back. Any other error is not loaded again.
172
+ const [offlineMiss, setOfflineMiss] = useState(false);
173
+ const reloadOnConnectRef = useRef(false);
151
174
  const [categories, setCategories] = useState<NotificationCategory[]>([]);
152
175
  const [activeCategory, setActiveCategory] = useState<string | null>(null);
153
176
  const [totalUnreadCount, setTotalUnreadCount] = useState<number>(0);
@@ -243,8 +266,22 @@ export const CometChatNotificationFeed = (props: CometChatNotificationFeedInterf
243
266
  feedRequestRef.current = builder;
244
267
 
245
268
  try {
246
- const items = await builder.fetchNext();
247
-
269
+ // Offline ON: two-phase; offline past the cache the device's feed shows (U6).
270
+ const page = await readListPage<any>(builder, "next");
271
+ const items = page.rows;
272
+ if (page.offline && items.length === 0) {
273
+ // Nothing on the device and not connected: the offline state and onError once (D84 rule 3),
274
+ // not an empty feed; it loads again once on reconnect.
275
+ reloadOnConnectRef.current = true;
276
+ setOfflineMiss(true);
277
+ setScreenState("error");
278
+ onError?.(page.error as CometChat.CometChatException);
279
+ return;
280
+ }
281
+ reloadOnConnectRef.current = false;
282
+ setOfflineMiss(false);
283
+ // The device's rows are shown and the server read could not be reached: the rows stay and
284
+ // nothing is reported (D84 rule 2).
248
285
  if (!items || items.length === 0) {
249
286
  setScreenState("empty");
250
287
  setFeedItems([]);
@@ -273,6 +310,8 @@ export const CometChatNotificationFeed = (props: CometChatNotificationFeedInterf
273
310
  }
274
311
  }
275
312
  } catch (err: any) {
313
+ reloadOnConnectRef.current = false;
314
+ setOfflineMiss(false);
276
315
  setScreenState("error");
277
316
  onError?.(err);
278
317
  } finally {
@@ -290,13 +329,20 @@ export const CometChatNotificationFeed = (props: CometChatNotificationFeedInterf
290
329
  setIsLoadingMore(true);
291
330
  setLoadMoreError(false);
292
331
  try {
293
- const items = await feedRequestRef.current.fetchNext();
294
-
295
- if (!items || items.length === 0) {
332
+ const page = await readListPage<any>(feedRequestRef.current, "next");
333
+ const items = page.rows;
334
+ if (page.offline && items.length === 0) {
335
+ // A cached page never ends the feed (BEH-READ-09b): "load more" errors, retry reads on.
336
+ setLoadMoreError(true);
337
+ } else if (!items || items.length === 0) {
296
338
  setHasMorePages(false);
297
339
  hasMorePagesRef.current = false;
298
340
  } else {
299
- setFeedItems((prev) => [...prev, ...items]);
341
+ // Reading past the last page can repeat items (SDK known issue): dedupe by id.
342
+ setFeedItems((prev) => {
343
+ const seen = new Set(prev.map((i: any) => String(i?.id ?? i?.getId?.() ?? "")));
344
+ return [...prev, ...items.filter((i: any) => !seen.has(String(i?.id ?? i?.getId?.() ?? "")))];
345
+ });
300
346
  markItemsAsDelivered(items);
301
347
  }
302
348
  } catch (err: any) {
@@ -327,7 +373,8 @@ export const CometChatNotificationFeed = (props: CometChatNotificationFeedInterf
327
373
  markItemsAsDelivered(items);
328
374
  }
329
375
  } catch (err: any) {
330
- onError?.(err);
376
+ // D84 rule 2: not connected over the rows on screen is not an error. A real one is reported (rule 5).
377
+ if (!(isOfflineOn() && (isNotConnectedError(err) || sdkConnected() === false))) onError?.(err);
331
378
  } finally {
332
379
  setIsRefreshing(false);
333
380
  }
@@ -469,6 +516,13 @@ export const CometChatNotificationFeed = (props: CometChatNotificationFeedInterf
469
516
  fetchInitialItems();
470
517
  }, [activeCategory]);
471
518
 
519
+ // D84 rule 8: the one load again of the offline state.
520
+ useOfflineReconnect(() => {
521
+ if (!reloadOnConnectRef.current) return;
522
+ reloadOnConnectRef.current = false;
523
+ void fetchInitialItems();
524
+ });
525
+
472
526
  // ─── Lifecycle: WebSocket Listener ───────────────────────────
473
527
  useEffect(() => {
474
528
  const listenerId = listenerIdRef.current;
@@ -542,7 +596,7 @@ export const CometChatNotificationFeed = (props: CometChatNotificationFeedInterf
542
596
  containerStyle={mergedStyles.headerContainerStyle}
543
597
  titleStyle={mergedStyles.titleStyle}
544
598
  backButtonIconStyle={mergedStyles.backButtonIconStyle}
545
- backButtonIconContainerStyle={{ paddingRight: theme.spacing.spacing.s2 }}
599
+ backButtonIconContainerStyle={{ paddingEnd: theme.spacing.spacing.s2 }}
546
600
  hideSearch={true}
547
601
  />
548
602
  );
@@ -553,7 +607,7 @@ export const CometChatNotificationFeed = (props: CometChatNotificationFeedInterf
553
607
  if (!showFilterChips) return null;
554
608
 
555
609
  const allChips = [
556
- { id: ALL_CATEGORY_ID, label: "All", filterKey: null as string | null },
610
+ { id: ALL_CATEGORY_ID, label: t("ALL"), filterKey: null as string | null },
557
611
  ...categories.map((cat: any, index: number) => ({
558
612
  id: `chip_${index}_${cat.label ?? cat.id}`,
559
613
  label: cat?.label || "",
@@ -751,6 +805,21 @@ export const CometChatNotificationFeed = (props: CometChatNotificationFeedInterf
751
805
  </View>
752
806
  );
753
807
  }
808
+ if (offlineMiss) {
809
+ // D84 rule 3: offline with nothing saved: the offline state, no Retry.
810
+ return (
811
+ <View style={mergedStyles.containerStyle}>
812
+ {renderHeader()}
813
+ <ConnectStateView
814
+ testID={CONTRACT_IDS.emptyConnectToLoad}
815
+ title={t(OFFLINE_STRING_KEYS.connectToLoadNotifications)}
816
+ containerStyle={mergedStyles.errorStateStyle?.containerStyle}
817
+ titleStyle={mergedStyles.errorStateStyle?.titleStyle}
818
+ subtitleStyle={mergedStyles.errorStateStyle?.subTitleStyle}
819
+ />
820
+ </View>
821
+ );
822
+ }
754
823
  return (
755
824
  <View style={mergedStyles.containerStyle}>
756
825
  {renderHeader()}
@@ -774,7 +843,8 @@ export const CometChatNotificationFeed = (props: CometChatNotificationFeedInterf
774
843
 
775
844
  // ─── Render: Loaded State ────────────────────────────────────
776
845
  return (
777
- <View style={mergedStyles.containerStyle}>
846
+ <LayoutDirectionContext.Provider value={direction}>
847
+ <View style={[mergedStyles.containerStyle, directionStyle(direction)]}>
778
848
  {renderHeader()}
779
849
  {renderFilterChips()}
780
850
  {isFetchingItems ? (
@@ -807,5 +877,6 @@ export const CometChatNotificationFeed = (props: CometChatNotificationFeedInterf
807
877
  />
808
878
  )}
809
879
  </View>
880
+ </LayoutDirectionContext.Provider>
810
881
  );
811
882
  };
@@ -257,7 +257,7 @@ export const getNotificationFeedStyleLight = (
257
257
  borderRadius: spacing.radius.max,
258
258
  position: "absolute",
259
259
  top: spacing.spacing.s3,
260
- left: spacing.spacing.s2,
260
+ start: spacing.spacing.s2,
261
261
  },
262
262
  unreadIndicatorColor: color.primary,
263
263
 
@@ -8,22 +8,19 @@
8
8
  * Total count invariant: no items lost or duplicated.
9
9
  */
10
10
 
11
+ import { getCometChatTranslation, getCurrentLanguage } from "../shared/resources/CometChatLocalizeNew/LocalizationManager";
12
+ import { LocalizedDateHelper, localizeDigits } from "../shared/helper/LocalizedDateHelper";
13
+
11
14
  /** Represents a single timestamp group (section) for SectionList */
12
15
  export interface TimestampGroup<T> {
13
16
  title: string;
14
17
  data: T[];
15
18
  }
16
19
 
17
- /** Day names for "this week" grouping */
18
- const DAY_NAMES = [
19
- "Sunday",
20
- "Monday",
21
- "Tuesday",
22
- "Wednesday",
23
- "Thursday",
24
- "Friday",
25
- "Saturday",
26
- ] as const;
20
+ const t = getCometChatTranslation();
21
+
22
+ /** The kit language as a date-formatting locale (e.g. "ar" → Arabic day and month names). */
23
+ const dateLocale = () => LocalizedDateHelper.getFullLocaleForDateFormatting(getCurrentLanguage());
27
24
 
28
25
  /**
29
26
  * Returns the start of a given day (midnight) for comparison purposes.
@@ -50,21 +47,23 @@ const getGroupLabel = (sentAt: number, now: Date): string => {
50
47
  const diffDays = Math.floor(diffMs / (24 * 60 * 60 * 1000));
51
48
 
52
49
  if (diffDays === 0) {
53
- return "Today";
50
+ return t("TODAY");
54
51
  }
55
52
  if (diffDays === 1) {
56
- return "Yesterday";
53
+ return t("YESTERDAY");
57
54
  }
58
55
  // Within this week (2-6 days ago) — show day name
59
56
  if (diffDays >= 2 && diffDays <= 6) {
60
- return DAY_NAMES[itemDate.getDay()];
57
+ return itemDate.toLocaleDateString(dateLocale(), { weekday: "long" });
61
58
  }
62
59
  // Older — show localized date
63
- return itemDate.toLocaleDateString(undefined, {
64
- month: "short",
65
- day: "numeric",
66
- year: "numeric",
67
- });
60
+ return localizeDigits(
61
+ itemDate.toLocaleDateString(dateLocale(), {
62
+ month: "short",
63
+ day: "numeric",
64
+ year: "numeric",
65
+ })
66
+ );
68
67
  };
69
68
 
70
69
  /**