@cometchat/chat-uikit-react-native 5.4.1 → 5.5.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 (80) hide show
  1. package/android/.gradle/7.4/checksums/checksums.lock +0 -0
  2. package/android/.gradle/7.4/fileChanges/last-build.bin +0 -0
  3. package/android/.gradle/7.4/fileHashes/fileHashes.lock +0 -0
  4. package/android/.gradle/7.4/gc.properties +0 -0
  5. package/android/.gradle/vcs-1/gc.properties +0 -0
  6. package/android/src/main/java/com/reactnativecometchatuikit/CometChatClipboardModule.kt +34 -0
  7. package/android/src/main/java/com/reactnativecometchatuikit/RichTextEditorView.kt +542 -5
  8. package/android/src/main/java/com/reactnativecometchatuikit/RichTextEditorViewManager.kt +20 -1
  9. package/ios/CometChatClipboardModule.m +5 -0
  10. package/ios/CometChatClipboardModule.swift +22 -0
  11. package/ios/RichTextEditorView.swift +593 -31
  12. package/ios/RichTextEditorViewManager.m +2 -0
  13. package/ios/RichTextEditorViewManager.swift +16 -0
  14. package/package.json +1 -1
  15. package/src/CometChatCompactMessageComposer/CometChatCompactMessageComposer.tsx +245 -55
  16. package/src/CometChatCompactMessageComposer/index.ts +2 -0
  17. package/src/CometChatConversations/CometChatConversations.tsx +291 -14
  18. package/src/CometChatMessageHeader/CometChatMessageHeader.tsx +181 -12
  19. package/src/CometChatMessageList/CometChatMessageList.tsx +568 -15
  20. package/src/CometChatMessageList/MANUAL_TEST_CASES.md +154 -0
  21. package/src/CometChatMessageList/components/MessageModals.tsx +30 -0
  22. package/src/CometChatMessageList/components/MessageOptionsSheet.tsx +14 -1
  23. package/src/CometChatMessageList/components/MessageQuickActions.tsx +162 -0
  24. package/src/CometChatPinnedMessages/CometChatPinnedMessages.tsx +940 -0
  25. package/src/CometChatPinnedMessages/index.ts +5 -0
  26. package/src/CometChatPinnedMessages/style.ts +216 -0
  27. package/src/CometChatRichTextEditor/RichTextEditorViewNativeComponent.ts +5 -0
  28. package/src/CometChatRichTextEditor/index.tsx +27 -1
  29. package/src/CometChatRichTextEditor/types.ts +19 -1
  30. package/src/CometChatSavedMessages/CometChatSavedMessages.tsx +634 -0
  31. package/src/CometChatSavedMessages/index.ts +5 -0
  32. package/src/CometChatSavedMessages/style.ts +159 -0
  33. package/src/CometChatSearch/CometChatSearch.tsx +47 -340
  34. package/src/CometChatThreadHeader/CometChatThreadHeader.tsx +22 -2
  35. package/src/index.ts +60 -0
  36. package/src/shared/CometChatUiKit/CometChatUIKit.ts +16 -0
  37. package/src/shared/base/Types.ts +5 -0
  38. package/src/shared/constants/UIKitConstants.ts +13 -0
  39. package/src/shared/events/CometChatUIEventHandler/CometChatUIEventHandler.ts +34 -0
  40. package/src/shared/events/CometChatUIEventHandler/Listener.ts +37 -0
  41. package/src/shared/events/ListenerInitializer.ts +20 -1
  42. package/src/shared/events/messages.ts +18 -0
  43. package/src/shared/formatters/CometChatRichTextFormatter/index.tsx +92 -6
  44. package/src/shared/formatters/index.ts +14 -0
  45. package/src/shared/formatters/richTextWireFormat.ts +165 -0
  46. package/src/shared/framework/MessageDataSource.tsx +296 -3
  47. package/src/shared/icons/components/thread-follow.tsx +13 -0
  48. package/src/shared/icons/components/thread-unfollow.tsx +13 -0
  49. package/src/shared/icons/components/unsave.tsx +13 -0
  50. package/src/shared/icons/icon-mapping.tsx +6 -0
  51. package/src/shared/index.ts +37 -0
  52. package/src/shared/resources/CometChatLocalizeNew/resources/en/translation.json +54 -0
  53. package/src/shared/utils/MarkdownUtils.ts +25 -4
  54. package/src/shared/utils/MessageUtils.tsx +80 -5
  55. package/src/shared/utils/PinConversationHelper.ts +245 -0
  56. package/src/shared/utils/PinSaveFeatureGates.ts +178 -0
  57. package/src/shared/utils/PinSaveHelper.ts +549 -0
  58. package/src/shared/utils/SavedMessagesHelper.ts +231 -0
  59. package/src/shared/utils/ThreadSubscriptionHelper.ts +427 -0
  60. package/src/shared/utils/conversationUtils.ts +8 -1
  61. package/src/shared/utils/stripRichText.ts +7 -0
  62. package/src/shared/views/ClipboardPasteHandler/ClipboardPasteHandler.ts +21 -0
  63. package/src/shared/views/ClipboardPasteHandler/NativeCometChatClipboardModule.ts +6 -0
  64. package/src/shared/views/CometChatActionSheet/CometChatActionSheet.tsx +4 -0
  65. package/src/shared/views/CometChatAvatar/CometChatAvatar.tsx +17 -5
  66. package/src/shared/views/CometChatBottomSheet/CometChatBottomSheet.tsx +1 -0
  67. package/src/shared/views/CometChatConfirmDialog/CometChatConfirmDialog.tsx +2 -0
  68. package/src/shared/views/CometChatConversationStarter/CometChatConversationStarter.tsx +91 -20
  69. package/src/shared/views/CometChatList/CometChatList.tsx +6 -1
  70. package/src/shared/views/CometChatListItem/CometChatListItem.tsx +4 -0
  71. package/src/shared/views/CometChatRetryButton/CometChatRetryButton.tsx +1 -0
  72. package/src/shared/views/CometChatSuggestionList/CometChatSuggestionList.tsx +4 -0
  73. package/src/shared/views/ErrorEmptyView/ErrorEmptyView.tsx +4 -1
  74. package/src/theme/default/default.ts +6 -0
  75. package/src/theme/type.ts +4 -0
  76. package/src/CometChatMessageList/PERFORMANCE_ARCHITECTURE.md +0 -478
  77. package/src/CometChatMessageList/SEARCH_NAV_PERF_PLAN.md +0 -613
  78. package/src/CometChatMessageList/SEARCH_NAV_SLOWNESS_FINDINGS_AND_FIX.md +0 -313
  79. package/src/shared/CometChatUiKit/CometChatUIKit.changes.md +0 -76
  80. package/src/shared/CometChatUiKit/checkAuthSettings-review.md +0 -211
@@ -48,6 +48,8 @@ class RichTextEditorViewManager : SimpleViewManager<LinearLayout>() {
48
48
  const val COMMAND_SET_MENTION_RANGES = "setMentionRanges"
49
49
  const val COMMAND_REMOVE_LINK = "removeLink"
50
50
  const val COMMAND_UPDATE_LINK = "updateLink"
51
+ const val COMMAND_APPLY_INLINE_STYLE = "applyInlineStyle"
52
+ const val COMMAND_REMOVE_INLINE_STYLE = "removeInlineStyle"
51
53
 
52
54
  private const val TAG_EDITOR = "editor"
53
55
  }
@@ -123,7 +125,9 @@ class RichTextEditorViewManager : SimpleViewManager<LinearLayout>() {
123
125
  COMMAND_SET_CONTENT to 29,
124
126
  COMMAND_SET_MENTION_RANGES to 30,
125
127
  COMMAND_REMOVE_LINK to 31,
126
- COMMAND_UPDATE_LINK to 32
128
+ COMMAND_UPDATE_LINK to 32,
129
+ COMMAND_APPLY_INLINE_STYLE to 33,
130
+ COMMAND_REMOVE_INLINE_STYLE to 34
127
131
  )
128
132
  }
129
133
 
@@ -199,6 +203,11 @@ class RichTextEditorViewManager : SimpleViewManager<LinearLayout>() {
199
203
  if (styleName == "link" && style.hasKey("url")) {
200
204
  styleMap["url"] = style.getString("url") ?: ""
201
205
  }
206
+ // Preserve colour for textColor styles — without this the
207
+ // edit round-trip loses the colour and renders plain.
208
+ if (styleName == "textColor" && style.hasKey("color")) {
209
+ styleMap["color"] = style.getString("color") ?: ""
210
+ }
202
211
  stylesList.add(styleMap)
203
212
  }
204
213
  }
@@ -221,6 +230,16 @@ class RichTextEditorViewManager : SimpleViewManager<LinearLayout>() {
221
230
  view.setMentionRanges(ranges)
222
231
  }
223
232
  }
233
+ COMMAND_APPLY_INLINE_STYLE -> {
234
+ val key = args?.getString(0) ?: return
235
+ // ARGB int from RN's processColor()
236
+ val color = args?.getInt(1) ?: return
237
+ view.applyInlineStyle(key, color)
238
+ }
239
+ COMMAND_REMOVE_INLINE_STYLE -> {
240
+ val key = args?.getString(0) ?: return
241
+ view.removeInlineStyle(key)
242
+ }
224
243
  COMMAND_REMOVE_LINK -> {
225
244
  val location = args?.getInt(0) ?: return
226
245
  val length = args?.getInt(1) ?: return
@@ -2,6 +2,11 @@
2
2
 
3
3
  @interface RCT_EXTERN_MODULE(CometChatClipboardModule, NSObject)
4
4
 
5
+ RCT_EXTERN_METHOD(setRichText:(nonnull NSString *)plain
6
+ wire:(nonnull NSString *)wire
7
+ resolve:(RCTPromiseResolveBlock)resolve
8
+ reject:(RCTPromiseRejectBlock)reject)
9
+
5
10
  RCT_EXTERN_METHOD(hasImageInClipboard:(RCTPromiseResolveBlock)resolve
6
11
  reject:(RCTPromiseRejectBlock)reject)
7
12
 
@@ -1,9 +1,31 @@
1
1
  import Foundation
2
2
  import UIKit
3
3
 
4
+ /// Private pasteboard type carrying the rich-text wire format alongside the plain text.
5
+ /// Other apps only ever see `public.utf8-plain-text`, so `<color=…>` markup can never leak
6
+ /// out of CometChat — only our own editor reads this type back.
7
+ let CometChatRichTextPasteboardType = "com.cometchat.uikit.richtext"
8
+
4
9
  @objc(CometChatClipboardModule)
5
10
  class CometChatClipboardModule: NSObject {
6
11
 
12
+ /// Copies `plain` to the system pasteboard for everyone, and `wire` under a private type
13
+ /// so our composer can restore inline colour when the paste lands back in CometChat.
14
+ @objc func setRichText(
15
+ _ plain: NSString,
16
+ wire: NSString,
17
+ resolve: @escaping RCTPromiseResolveBlock,
18
+ reject: @escaping RCTPromiseRejectBlock
19
+ ) {
20
+ var item: [String: Any] = ["public.utf8-plain-text": plain as String]
21
+ // Only carry the private type when it actually differs — nothing to restore otherwise.
22
+ if (wire as String) != (plain as String) {
23
+ item[CometChatRichTextPasteboardType] = wire as String
24
+ }
25
+ UIPasteboard.general.items = [item]
26
+ resolve(true)
27
+ }
28
+
7
29
  @objc func hasImageInClipboard(
8
30
  _ resolve: @escaping RCTPromiseResolveBlock,
9
31
  reject: @escaping RCTPromiseRejectBlock