@cometchat/chat-uikit-react-native 4.2.2 → 4.3.1

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 (227) hide show
  1. package/README.md +26 -67
  2. package/android/.gradle/7.4/checksums/checksums.lock +0 -0
  3. package/android/.gradle/7.4/fileHashes/fileHashes.lock +0 -0
  4. package/android/build.gradle +1 -1
  5. package/android/src/main/java/com/reactnativecometchatuikit/CometchatUiKitPackage.java +2 -1
  6. package/android/src/main/java/com/reactnativecometchatuikit/ReactVideoView.java +796 -0
  7. package/android/src/main/java/com/reactnativecometchatuikit/ReactVideoViewManager.java +172 -0
  8. package/android/src/main/java/com/scalablevideoview/BuildConfig.java +10 -0
  9. package/android/src/main/java/com/scalablevideoview/PivotPoint.java +13 -0
  10. package/android/src/main/java/com/scalablevideoview/ScalableType.java +34 -0
  11. package/android/src/main/java/com/scalablevideoview/ScalableVideoView.java +255 -0
  12. package/android/src/main/java/com/scalablevideoview/ScaleManager.java +188 -0
  13. package/android/src/main/java/com/scalablevideoview/Size.java +20 -0
  14. package/android/src/main/java/com/zipfile/APEZProvider.java +287 -0
  15. package/android/src/main/java/com/zipfile/APKExpansionSupport.java +81 -0
  16. package/android/src/main/java/com/zipfile/ZipResourceFile.java +428 -0
  17. package/android/src/main/res/values/attrs.xml +37 -0
  18. package/ios/FileManager.m +75 -5
  19. package/ios/Video/CCRCTVideo.h +67 -0
  20. package/ios/Video/CCRCTVideo.m +2031 -0
  21. package/ios/Video/CCRCTVideoManager.h +6 -0
  22. package/ios/Video/CCRCTVideoManager.m +133 -0
  23. package/ios/Video/CCRCTVideoPlayerViewController.h +20 -0
  24. package/ios/Video/CCRCTVideoPlayerViewController.m +43 -0
  25. package/ios/Video/CCRCTVideoPlayerViewControllerDelegate.h +7 -0
  26. package/ios/Video/UIView+FindUIViewController.h +15 -0
  27. package/ios/Video/UIView+FindUIViewController.m +21 -0
  28. package/ios/VideoCaching/RCTVideoCache.h +38 -0
  29. package/ios/VideoCaching/RCTVideoCache.m +174 -0
  30. package/ios/VideoPickerModule.h +7 -0
  31. package/ios/VideoPickerModule.mm +95 -0
  32. package/package.json +3 -4
  33. package/react-native-cometchat-ui-kit.podspec +24 -10
  34. package/src/CometChatContacts/CometChatContacts.tsx +12 -9
  35. package/src/CometChatConversations/CometChatConversations.tsx +84 -64
  36. package/src/CometChatDetails/CometChatDetails.tsx +14 -12
  37. package/src/CometChatGroupMembers/CometChatGroupMembers.tsx +8 -4
  38. package/src/CometChatGroupMembers/resources/check.png +0 -0
  39. package/src/CometChatGroupMembers/resources/index.ts +2 -0
  40. package/src/CometChatGroups/CometChatGroups.tsx +4 -4
  41. package/src/CometChatMessageComposer/CometChatMessageComposer.tsx +57 -15
  42. package/src/CometChatMessageHeader/CometChatMessageHeader.tsx +9 -2
  43. package/src/CometChatMessageInformation/CometChatMessageInformation.tsx +1 -1
  44. package/src/CometChatMessageList/CometChatMessageList.tsx +596 -181
  45. package/src/CometChatMessageList/MessageListConfiguration.ts +55 -4
  46. package/src/CometChatMessageList/resources/index.ts +5 -1
  47. package/src/CometChatMessageList/resources/leftarrowcurve.png +0 -0
  48. package/src/CometChatMessageList/resources/rightarrowcurve.png +0 -0
  49. package/src/CometChatMessages/CometChatMessages.tsx +1 -1
  50. package/src/CometChatThreadedMessages/CometChatThreadedMessages.tsx +4 -12
  51. package/src/CometChatThreadedMessages/style.ts +3 -1
  52. package/src/CometChatUsers/CometChatUsers.tsx +1 -1
  53. package/src/calls/CallUtils.ts +4 -8
  54. package/src/calls/CallingExtentionDecorator.tsx +5 -2
  55. package/src/calls/CometChatCallBubble/styles.ts +2 -1
  56. package/src/calls/CometChatCallButtons/CometChatCallButtons.tsx +14 -3
  57. package/src/calls/CometChatIncomingCall/CometChatIncomingCall.tsx +9 -9
  58. package/src/calls/CometChatOutgoingCall/CometChatOutgoingCall.tsx +80 -73
  59. package/src/extensions/CollaborativeBubble/styles.ts +2 -0
  60. package/src/extensions/SmartReplies/SmartRepliesDecorator.tsx +11 -0
  61. package/src/extensions/index.ts +0 -4
  62. package/src/index.ts +53 -8
  63. package/src/shared/CometChatUiKit/CometChatUIKit.ts +14 -2
  64. package/src/shared/constants/UIKitConstants.ts +1 -0
  65. package/src/shared/events/CometChatUIEventHandler/CometChatUIEventHandler.ts +6 -0
  66. package/src/shared/events/CometChatUIEventHandler/Listener.ts +8 -0
  67. package/src/shared/events/ListenerInitializer.ts +6 -0
  68. package/src/shared/events/messages.ts +2 -0
  69. package/src/shared/framework/MessageDataSource.tsx +29 -25
  70. package/src/shared/index.ts +49 -1
  71. package/src/shared/libs/VideoPlayer/DRMType.js +6 -0
  72. package/src/shared/libs/VideoPlayer/FilterType.js +18 -0
  73. package/src/shared/libs/VideoPlayer/TextTrackType.js +5 -0
  74. package/src/shared/libs/VideoPlayer/Video.js +519 -0
  75. package/src/shared/libs/VideoPlayer/VideoResizeMode.js +5 -0
  76. package/src/shared/libs/VideoPlayerControls/OSSupport/PlatformSupport.tsx +43 -0
  77. package/src/shared/libs/VideoPlayerControls/OSSupport/TVOSSupport.tsx +16 -0
  78. package/src/shared/libs/VideoPlayerControls/OSSupport/index.tsx +1 -0
  79. package/src/shared/libs/VideoPlayerControls/VideoPlayer.tsx +511 -0
  80. package/src/shared/libs/VideoPlayerControls/assets/img/back.png +0 -0
  81. package/src/shared/libs/VideoPlayerControls/assets/img/back@2x.png +0 -0
  82. package/src/shared/libs/VideoPlayerControls/assets/img/back@3x.png +0 -0
  83. package/src/shared/libs/VideoPlayerControls/assets/img/bottom-vignette.png +0 -0
  84. package/src/shared/libs/VideoPlayerControls/assets/img/bottom-vignette@2x.png +0 -0
  85. package/src/shared/libs/VideoPlayerControls/assets/img/bottom-vignette@3x.png +0 -0
  86. package/src/shared/libs/VideoPlayerControls/assets/img/error-icon.png +0 -0
  87. package/src/shared/libs/VideoPlayerControls/assets/img/error-icon@2x.png +0 -0
  88. package/src/shared/libs/VideoPlayerControls/assets/img/error-icon@3x.png +0 -0
  89. package/src/shared/libs/VideoPlayerControls/assets/img/expand.png +0 -0
  90. package/src/shared/libs/VideoPlayerControls/assets/img/expand@2x.png +0 -0
  91. package/src/shared/libs/VideoPlayerControls/assets/img/expand@3x.png +0 -0
  92. package/src/shared/libs/VideoPlayerControls/assets/img/forward.png +0 -0
  93. package/src/shared/libs/VideoPlayerControls/assets/img/forward@2x.png +0 -0
  94. package/src/shared/libs/VideoPlayerControls/assets/img/forward@3x.png +0 -0
  95. package/src/shared/libs/VideoPlayerControls/assets/img/loader-icon.png +0 -0
  96. package/src/shared/libs/VideoPlayerControls/assets/img/loader-icon@2x.png +0 -0
  97. package/src/shared/libs/VideoPlayerControls/assets/img/loader-icon@3x.png +0 -0
  98. package/src/shared/libs/VideoPlayerControls/assets/img/pause.png +0 -0
  99. package/src/shared/libs/VideoPlayerControls/assets/img/pause@2x.png +0 -0
  100. package/src/shared/libs/VideoPlayerControls/assets/img/pause@3x.png +0 -0
  101. package/src/shared/libs/VideoPlayerControls/assets/img/play.png +0 -0
  102. package/src/shared/libs/VideoPlayerControls/assets/img/play@2x.png +0 -0
  103. package/src/shared/libs/VideoPlayerControls/assets/img/play@3x.png +0 -0
  104. package/src/shared/libs/VideoPlayerControls/assets/img/rewind.png +0 -0
  105. package/src/shared/libs/VideoPlayerControls/assets/img/rewind@2x.png +0 -0
  106. package/src/shared/libs/VideoPlayerControls/assets/img/rewind@3x.png +0 -0
  107. package/src/shared/libs/VideoPlayerControls/assets/img/shrink.png +0 -0
  108. package/src/shared/libs/VideoPlayerControls/assets/img/shrink@2x.png +0 -0
  109. package/src/shared/libs/VideoPlayerControls/assets/img/shrink@3x.png +0 -0
  110. package/src/shared/libs/VideoPlayerControls/assets/img/top-vignette.png +0 -0
  111. package/src/shared/libs/VideoPlayerControls/assets/img/top-vignette@2x.png +0 -0
  112. package/src/shared/libs/VideoPlayerControls/assets/img/top-vignette@3x.png +0 -0
  113. package/src/shared/libs/VideoPlayerControls/assets/img/volume.png +0 -0
  114. package/src/shared/libs/VideoPlayerControls/assets/img/volume@2x.png +0 -0
  115. package/src/shared/libs/VideoPlayerControls/assets/img/volume@3x.png +0 -0
  116. package/src/shared/libs/VideoPlayerControls/components/Back/Back.tsx +28 -0
  117. package/src/shared/libs/VideoPlayerControls/components/Back/index.ts +1 -0
  118. package/src/shared/libs/VideoPlayerControls/components/BottomControls.tsx +142 -0
  119. package/src/shared/libs/VideoPlayerControls/components/Control.tsx +45 -0
  120. package/src/shared/libs/VideoPlayerControls/components/Error/Error.tsx +22 -0
  121. package/src/shared/libs/VideoPlayerControls/components/Error/index.ts +1 -0
  122. package/src/shared/libs/VideoPlayerControls/components/Error/styles.ts +21 -0
  123. package/src/shared/libs/VideoPlayerControls/components/Fullscreen.tsx +36 -0
  124. package/src/shared/libs/VideoPlayerControls/components/Loader/Loader.tsx +15 -0
  125. package/src/shared/libs/VideoPlayerControls/components/Loader/index.ts +1 -0
  126. package/src/shared/libs/VideoPlayerControls/components/Loader/styles.ts +16 -0
  127. package/src/shared/libs/VideoPlayerControls/components/NullControl.tsx +7 -0
  128. package/src/shared/libs/VideoPlayerControls/components/Overlay.tsx +23 -0
  129. package/src/shared/libs/VideoPlayerControls/components/PlayPause/PlayPause.tsx +109 -0
  130. package/src/shared/libs/VideoPlayerControls/components/PlayPause/index.ts +1 -0
  131. package/src/shared/libs/VideoPlayerControls/components/PlayPause/styles.ts +21 -0
  132. package/src/shared/libs/VideoPlayerControls/components/Seekbar/Seekbar.tsx +47 -0
  133. package/src/shared/libs/VideoPlayerControls/components/Seekbar/index.ts +1 -0
  134. package/src/shared/libs/VideoPlayerControls/components/Seekbar/styles.ts +37 -0
  135. package/src/shared/libs/VideoPlayerControls/components/Timer/Timer.tsx +28 -0
  136. package/src/shared/libs/VideoPlayerControls/components/Timer/index.ts +1 -0
  137. package/src/shared/libs/VideoPlayerControls/components/Timer/styles.ts +12 -0
  138. package/src/shared/libs/VideoPlayerControls/components/Title.tsx +35 -0
  139. package/src/shared/libs/VideoPlayerControls/components/TopControls.tsx +110 -0
  140. package/src/shared/libs/VideoPlayerControls/components/Volume/Volume.tsx +37 -0
  141. package/src/shared/libs/VideoPlayerControls/components/Volume/index.ts +1 -0
  142. package/src/shared/libs/VideoPlayerControls/components/Volume/styles.ts +31 -0
  143. package/src/shared/libs/VideoPlayerControls/components/index.ts +14 -0
  144. package/src/shared/libs/VideoPlayerControls/components/styles.ts +30 -0
  145. package/src/shared/libs/VideoPlayerControls/hooks/index.ts +3 -0
  146. package/src/shared/libs/VideoPlayerControls/hooks/useAnimations.ts +68 -0
  147. package/src/shared/libs/VideoPlayerControls/hooks/useControlTimeout.tsx +67 -0
  148. package/src/shared/libs/VideoPlayerControls/hooks/usePanResponders.tsx +96 -0
  149. package/src/shared/libs/VideoPlayerControls/index.ts +4 -0
  150. package/src/shared/libs/VideoPlayerControls/styles.ts +19 -0
  151. package/src/shared/libs/VideoPlayerControls/types.ts +290 -0
  152. package/src/shared/libs/VideoPlayerControls/utils.ts +76 -0
  153. package/src/shared/modals/CometChatMessageTemplate.ts +113 -9
  154. package/src/shared/modals/InteractiveData/InteractiveMessage/SchedulerMessage.ts +23 -21
  155. package/src/shared/resources/CometChatLocalize/resources/ar/translation.json +4 -1
  156. package/src/shared/resources/CometChatLocalize/resources/de/translation.json +4 -1
  157. package/src/shared/resources/CometChatLocalize/resources/en/translation.json +6 -3
  158. package/src/shared/resources/CometChatLocalize/resources/es/translation.json +4 -1
  159. package/src/shared/resources/CometChatLocalize/resources/fr/translation.json +4 -1
  160. package/src/shared/resources/CometChatLocalize/resources/hi/translation.json +4 -1
  161. package/src/shared/resources/CometChatLocalize/resources/lt/translation.json +4 -1
  162. package/src/shared/resources/CometChatLocalize/resources/ms/translation.json +4 -1
  163. package/src/shared/resources/CometChatLocalize/resources/pt/translation.json +4 -1
  164. package/src/shared/resources/CometChatLocalize/resources/ru/translation.json +4 -1
  165. package/src/shared/resources/CometChatLocalize/resources/sv/translation.json +4 -1
  166. package/src/shared/resources/CometChatLocalize/resources/zh/translation.json +4 -1
  167. package/src/shared/resources/CometChatLocalize/resources/zh-tw/translation.json +4 -1
  168. package/src/shared/resources/CometChatTheme/Palette.ts +79 -45
  169. package/src/shared/resources/CometChatTheme/Typography.ts +18 -0
  170. package/src/shared/utils/CommonUtils.ts +71 -0
  171. package/src/shared/utils/PermissionUtilIOS.ts +104 -0
  172. package/src/shared/views/CometChatActionSheet/ActionSheetStyle.ts +3 -1
  173. package/src/shared/views/CometChatActionSheet/CometChatActionSheet.tsx +6 -6
  174. package/src/shared/views/CometChatAudioBubble/CometChatAudioBubble.tsx +28 -5
  175. package/src/shared/views/CometChatAudioBubble/style.ts +4 -2
  176. package/src/shared/views/CometChatAvatar/AvatarStyle.ts +1 -1
  177. package/src/shared/views/CometChatBottomSheet/CometChatBottomSheet.tsx +4 -3
  178. package/src/shared/views/CometChatEmojiKeyboard/CometChatEmojiKeyboard.tsx +47 -31
  179. package/src/shared/views/CometChatEmojiKeyboard/EmojiKeyboardConfiguration.ts +5 -5
  180. package/src/shared/views/CometChatEmojiKeyboard/EmojiKeyboardStyle.ts +12 -13
  181. package/src/shared/views/CometChatFileBubble/CometChatFileBubble.tsx +52 -5
  182. package/src/shared/views/CometChatFileBubble/style.ts +4 -2
  183. package/src/shared/views/CometChatImageBubble/CometChatImageBubble.tsx +25 -2
  184. package/src/shared/views/CometChatList/CometChatList.tsx +2 -1
  185. package/src/shared/views/CometChatMessageBubble/CometChatMessageBubble.tsx +51 -2
  186. package/src/shared/views/CometChatQuickReactions/CometChatQuickReactions.tsx +76 -0
  187. package/src/shared/views/CometChatQuickReactions/QuickReactionsConfiguration.tsx +12 -0
  188. package/src/shared/views/CometChatQuickReactions/QuickReactionsStyle.tsx +35 -0
  189. package/src/shared/views/CometChatQuickReactions/index.ts +12 -0
  190. package/src/shared/views/CometChatReactions/CometChatReactions.tsx +166 -0
  191. package/src/shared/views/CometChatReactions/ReactionsConfiguration.tsx +12 -0
  192. package/src/shared/views/CometChatReactions/ReactionsStyle.tsx +43 -0
  193. package/src/shared/views/CometChatReactions/index.ts +12 -0
  194. package/src/{extensions/Reactions/CometChatMessageReactions → shared/views/CometChatReactions}/style.ts +7 -7
  195. package/src/shared/views/CometChatReactionsList/CometChatReactionsList.tsx +335 -0
  196. package/src/shared/views/CometChatReactionsList/ReactionsListConfiguration.tsx +14 -0
  197. package/src/shared/views/CometChatReactionsList/ReactionsListStyle.tsx +67 -0
  198. package/src/shared/views/CometChatReactionsList/index.ts +12 -0
  199. package/src/shared/views/CometChatReactionsList/resources/Spineer.png +0 -0
  200. package/src/shared/views/CometChatReactionsList/resources/index.ts +5 -0
  201. package/src/shared/views/CometChatReceipt/CometChatReceipt.tsx +21 -4
  202. package/src/shared/views/CometChatReceipt/MessageConfiguration.ts +12 -0
  203. package/src/shared/views/CometChatReceipt/resources/error.png +0 -0
  204. package/src/shared/views/CometChatTextBubble/CometChatTextBubble.tsx +1 -1
  205. package/src/shared/views/CometChatVideoBubble/CometChatVideoBubble.tsx +78 -12
  206. package/src/shared/views/CometChatVideoBubble/VideoBubbleStyle.ts +52 -2
  207. package/src/shared/views/CometChatVideoPlayer/CometChatVideoPlayer.tsx +134 -0
  208. package/src/shared/views/CometChatVideoPlayer/index.tsx +1 -0
  209. package/src/shared/views/index.ts +30 -0
  210. package/android/.gradle/7.4.2/checksums/checksums.lock +0 -0
  211. package/android/.gradle/7.4.2/fileChanges/last-build.bin +0 -0
  212. package/android/.gradle/7.4.2/fileHashes/fileHashes.lock +0 -0
  213. package/android/.gradle/7.4.2/gc.properties +0 -0
  214. package/android/.gradle/checksums/checksums.lock +0 -0
  215. package/android/.idea/gradle.xml +0 -13
  216. package/android/.idea/misc.xml +0 -8
  217. package/android/.idea/modules/android.iml +0 -18
  218. package/android/.idea/modules.xml +0 -8
  219. package/android/.idea/vcs.xml +0 -6
  220. package/android/local.properties +0 -8
  221. package/src/extensions/Reactions/CometChatMessageReactions/CometChatMessageReactions.tsx +0 -249
  222. package/src/extensions/Reactions/CometChatMessageReactions/index.ts +0 -3
  223. package/src/extensions/Reactions/ReactionsDecorator.tsx +0 -164
  224. package/src/extensions/Reactions/ReactionsExtension.tsx +0 -48
  225. package/src/extensions/Reactions/index.ts +0 -4
  226. /package/src/{extensions/Reactions → shared/views/CometChatQuickReactions}/resources/AddReactions.png +0 -0
  227. /package/src/{extensions/Reactions → shared/views/CometChatQuickReactions}/resources/index.ts +0 -0
@@ -0,0 +1,12 @@
1
+ import { CometChatReactionsList, CometChatReactionsListInterface } from './CometChatReactionsList';
2
+ import { ReactionListStyle, ReactionListStyleInterface } from './ReactionsListStyle';
3
+ import { ReactionsListConfiguration, ReactionsListConfigurationInterface } from './ReactionsListConfiguration';
4
+
5
+ export {
6
+ CometChatReactionsList,
7
+ CometChatReactionsListInterface,
8
+ ReactionListStyle,
9
+ ReactionListStyleInterface,
10
+ ReactionsListConfiguration,
11
+ ReactionsListConfigurationInterface
12
+ }
@@ -0,0 +1,5 @@
1
+ import LoadingIcon from "./Spineer.png";
2
+
3
+ export {
4
+ LoadingIcon
5
+ }
@@ -1,9 +1,10 @@
1
- import React from 'react';
1
+ import React, { useContext } from 'react';
2
2
  //@ts-ignore
3
3
  import { Image } from 'react-native';
4
- import { ImageType } from '../../base';
4
+ import { CometChatContextType, ImageType } from '../../base';
5
5
  import { ICONS } from './resources';
6
6
  import styles from './style';
7
+ import { CometChatContext } from '../../CometChatContext';
7
8
 
8
9
  /**
9
10
  *
@@ -21,12 +22,28 @@ export interface CometChatReceiptInterface {
21
22
  readIcon?: ImageType;
22
23
  errorIcon?: ImageType;
23
24
  receipt?: 'SENT' | 'DELIVERED' | 'READ' | 'ERROR' | 'WAIT';
25
+ style?: {
26
+ height?: string | number;
27
+ width?: string | number;
28
+ tintColor?: string
29
+ }
24
30
  }
25
31
 
26
32
  export const CometChatReceipt = (props: CometChatReceiptInterface) => {
27
- const { waitIcon, sentIcon, deliveredIcon, readIcon, errorIcon, receipt } =
33
+ const { waitIcon, sentIcon, deliveredIcon, readIcon, errorIcon, receipt, style } =
28
34
  props;
29
35
 
36
+ const { theme } = useContext<CometChatContextType>(CometChatContext);
37
+
38
+ const _style = {
39
+ ...style,
40
+ height: style?.height || 10,
41
+ width: style?.width || 14,
42
+ tintColor: style?.tintColor,
43
+ };
44
+
45
+ const { height, width, tintColor } = _style;
46
+
30
47
  let icon = null;
31
48
  let imageSource = null;
32
49
 
@@ -57,7 +74,7 @@ export const CometChatReceipt = (props: CometChatReceiptInterface) => {
57
74
  } else if (typeof icon === 'number') {
58
75
  imageSource = icon;
59
76
  }
60
- return <Image source={imageSource} style={styles.tickImageStyle} />;
77
+ return <Image source={imageSource} style={[styles.tickImageStyle, { tintColor: tintColor, width, height }]} />;
61
78
  }
62
79
  return null;
63
80
  };
@@ -20,6 +20,11 @@ export class ReceiptConfiguration {
20
20
  readIcon?: ImageType;
21
21
  deliveredIcon?: ImageType;
22
22
  errorIcon?: ImageType;
23
+ style?: {
24
+ height?: string | number;
25
+ width?: string | number;
26
+ tintColor?: string
27
+ }
23
28
  /**
24
29
  *
25
30
  * @param {Object} param0
@@ -36,12 +41,14 @@ export class ReceiptConfiguration {
36
41
  readIcon = greyDoubleTick,
37
42
  deliveredIcon = blueDoubleTick,
38
43
  errorIcon = errorTick,
44
+ style,
39
45
  }: ReceiptConfigurationInterface) {
40
46
  this.waitIcon = waitIcon;
41
47
  this.sentIcon = sentIcon;
42
48
  this.readIcon = readIcon;
43
49
  this.deliveredIcon = deliveredIcon;
44
50
  this.errorIcon = errorIcon;
51
+ this.style = style;
45
52
  }
46
53
  }
47
54
  export interface ReceiptConfigurationInterface {
@@ -50,4 +57,9 @@ export interface ReceiptConfigurationInterface {
50
57
  readIcon?: ImageType;
51
58
  deliveredIcon?: ImageType;
52
59
  errorIcon?: ImageType;
60
+ style?: {
61
+ height?: string | number;
62
+ width?: string | number;
63
+ tintColor?: string;
64
+ }
53
65
  }
@@ -110,7 +110,7 @@ export const CometChatTextBubble = (props: CometChatTextBubbleInterface) => {
110
110
  },
111
111
  {
112
112
  backgroundColor, borderRadius, maxHeight: height, maxWidth: width,
113
- overflow: "hidden", padding: 8,
113
+ overflow: "hidden", padding: 8, paddingBottom: 0
114
114
  },
115
115
  border,
116
116
  textContainerStyle
@@ -1,11 +1,12 @@
1
- import React, { useContext, useEffect, useState } from "react";
2
- import { View, Image, ImageBackground, NativeModules, Platform, NativeEventEmitter, EmitterSubscription } from "react-native";
1
+ import React, { useContext, useEffect, useState, useRef } from "react";
2
+ import { View, Image, ImageBackground, NativeModules, Platform, NativeEventEmitter, EmitterSubscription, ActivityIndicator, StyleSheet, ImageSourcePropType } from "react-native";
3
3
  import { CometChatContext } from "../../CometChatContext";
4
4
  import { ImageType } from "../../base/Types";
5
5
  import { VideoBubbleStyle, VideoBubbleStyleInterface } from "./VideoBubbleStyle";
6
6
  import { defaultPlayIcon } from "./resources";
7
7
  import { Style } from "./style";
8
8
  import { CometChatContextType } from "../../base/Types";
9
+ import { CometChatVideoPlayer } from "../CometChatVideoPlayer";
9
10
 
10
11
  const { VideoManager, FileManager } = NativeModules;
11
12
  const eventEmitter = new NativeEventEmitter(FileManager);
@@ -36,6 +37,23 @@ export interface CometChatVideoBubbleInterface {
36
37
  * function will receive an videoUrl as parameter.
37
38
  */
38
39
  onPress?: Function
40
+ /**
41
+ * custom player play icon
42
+ */
43
+ playerPlayIcon?: ImageSourcePropType
44
+ /**
45
+ * custom player pause icon
46
+ */
47
+ playerPauseIcon?: ImageSourcePropType
48
+ /**
49
+ * custom player back icon
50
+ */
51
+ playerBackIcon?: ImageSourcePropType
52
+ /**
53
+ * custom player volume icon
54
+ */
55
+ playerVolumeIcon?: ImageSourcePropType
56
+
39
57
  }
40
58
 
41
59
  export const CometChatVideoBubble = (props: CometChatVideoBubbleInterface) => {
@@ -46,10 +64,16 @@ export const CometChatVideoBubble = (props: CometChatVideoBubbleInterface) => {
46
64
  style,
47
65
  playIcon,
48
66
  onPress,
67
+ playerPlayIcon,
68
+ playerPauseIcon,
69
+ playerBackIcon,
70
+ playerVolumeIcon,
49
71
  } = props;
50
72
 
51
73
  const { theme } = useContext<CometChatContextType>(CometChatContext);
52
74
  const [isOpening, setOpening] = useState(false);
75
+ const [isLoading, setIsLoading] = useState(false);
76
+ const [isVideoPlayerVisible, setIsVideoPlayerVisible] = useState(false);
53
77
 
54
78
  const _style = new VideoBubbleStyle({
55
79
  backgroundColor: theme?.palette.getBackgroundColor(),
@@ -83,11 +107,8 @@ export const CometChatVideoBubble = (props: CometChatVideoBubbleInterface) => {
83
107
  }
84
108
 
85
109
  if (!videoUrl) return;
86
-
87
- Platform.OS == 'ios' ?
88
- FileManager.openFile(videoUrl, getFileName(videoUrl), (s) => { }) :
89
- VideoManager.openVideo(videoUrl, (s) => { });
90
-
110
+ setIsLoading(true)
111
+ setIsVideoPlayerVisible(true)
91
112
  }
92
113
 
93
114
  useEffect(() => {
@@ -105,11 +126,56 @@ export const CometChatVideoBubble = (props: CometChatVideoBubbleInterface) => {
105
126
  }
106
127
  }, []);
107
128
 
129
+ const pressTime = useRef(0);
130
+
131
+ const handleTouchStart = () => {
132
+ pressTime.current = Date.now();
133
+ };
134
+
135
+ const handleTouchEnd = () => {
136
+ // if (pressTime.current === null) return;
137
+ const endTime = Date.now();
138
+ const pressDuration = endTime - pressTime.current;
139
+ if (pressDuration < 500) {
140
+ playVideo();
141
+ }
142
+ };
143
+
144
+ const onTouchMove = () => {
145
+ // pressTime.current = null
146
+ }
147
+
108
148
  return (
109
- <ImageBackground source={thumbnailUrl || placeholderImage} resizeMode={"contain"} style={{ backgroundColor, ...border, borderRadius, height, width }}>
110
- <View onTouchEnd={playVideo} style={[Style.playIconPosition, { backgroundColor: playIconBackgroundColor, borderRadius }]}>
111
- <Image source={playIcon || defaultPlayIcon} style={{ tintColor: playIconTint }} />
112
- </View>
113
- </ImageBackground>
149
+ <>
150
+ <CometChatVideoPlayer
151
+ videoUri={videoUrl}
152
+ isVisible={isVideoPlayerVisible}
153
+ onClose={() => {
154
+ setIsLoading(false)
155
+ setIsVideoPlayerVisible(false)
156
+ }}
157
+ onLoad={() => setIsLoading(false)}
158
+ loadingIconColor={style.playerLoadingIconColor}
159
+ playIcon={playerPlayIcon}
160
+ playIconColor={style.playerPlayIconColor}
161
+ pauseIcon={playerPauseIcon}
162
+ pauseIconColor={style.playerPauseIconColor}
163
+ backIcon={playerBackIcon}
164
+ backIconColor={style.playerBackIconColor}
165
+ volumeIcon={playerVolumeIcon}
166
+ volumeIconColor={style.playerVolumeIconColor}
167
+ />
168
+ <ImageBackground source={thumbnailUrl || placeholderImage} resizeMode={"contain"} style={{ backgroundColor, ...border, borderRadius, height, width }}>
169
+ <View
170
+ onTouchStart={handleTouchStart}
171
+ onTouchEnd={handleTouchEnd}
172
+ // onTouchMove={onTouchMove}
173
+ style={[Style.playIconPosition, { backgroundColor: playIconBackgroundColor, borderRadius }]}>
174
+ {isLoading ? <ActivityIndicator size={"small"} color={playIconTint} />
175
+ : <Image source={playIcon || defaultPlayIcon} style={{ tintColor: playIconTint }} />
176
+ }
177
+ </View>
178
+ </ImageBackground>
179
+ </>
114
180
  )
115
181
  }
@@ -9,12 +9,52 @@ export interface VideoBubbleStyleInterface extends BaseStyleInterface {
9
9
  * play icon background color
10
10
  */
11
11
  playIconBackgroundColor?: string
12
+ /**
13
+ * player loading icon color
14
+ */
15
+ playerLoadingIconColor?: string
16
+ /**
17
+ * player play icon color
18
+ */
19
+ playerPlayIconColor?: string
20
+ /**
21
+ * player pause icon color
22
+ */
23
+ playerPauseIconColor?: string
24
+ /**
25
+ * player back icon color
26
+ */
27
+ playerBackIconColor?: string
28
+ /**
29
+ * player volume icon color
30
+ */
31
+ playerVolumeIconColor?: string
12
32
  }
13
33
 
14
34
  export class VideoBubbleStyle extends BaseStyle {
15
35
  playIconTint: string
16
36
  playIconBackgroundColor: string
17
-
37
+ /**
38
+ * player loading icon color
39
+ */
40
+ playerLoadingIconColor?: string
41
+ /**
42
+ * player play icon color
43
+ */
44
+ playerPlayIconColor?: string
45
+ /**
46
+ * player pause icon color
47
+ */
48
+ playerPauseIconColor?: string
49
+ /**
50
+ * player back icon color
51
+ */
52
+ playerBackIconColor?: string
53
+ /**
54
+ * player volume icon color
55
+ */
56
+ playerVolumeIconColor?: string
57
+
18
58
  constructor({
19
59
  height = 24,
20
60
  width = 24,
@@ -22,7 +62,12 @@ export class VideoBubbleStyle extends BaseStyle {
22
62
  border = new BorderStyle({}),
23
63
  borderRadius = 0,
24
64
  playIconBackgroundColor = "rgba(20,20,20,0.4)",
25
- playIconTint = "white"
65
+ playIconTint = "white",
66
+ playerLoadingIconColor = "white",
67
+ playerPlayIconColor = "white",
68
+ playerPauseIconColor = "white",
69
+ playerBackIconColor = "white",
70
+ playerVolumeIconColor = "white",
26
71
  }: VideoBubbleStyleInterface) {
27
72
  super({
28
73
  height,
@@ -33,5 +78,10 @@ export class VideoBubbleStyle extends BaseStyle {
33
78
  });
34
79
  this.playIconTint = playIconTint;
35
80
  this.playIconBackgroundColor = playIconBackgroundColor;
81
+ this.playerLoadingIconColor = playerLoadingIconColor
82
+ this.playerPlayIconColor = playerPlayIconColor
83
+ this.playerPauseIconColor = playerPauseIconColor
84
+ this.playerBackIconColor = playerBackIconColor
85
+ this.playerVolumeIconColor = playerVolumeIconColor
36
86
  }
37
87
  }
@@ -0,0 +1,134 @@
1
+ import React, { useEffect, useState } from "react";
2
+ import {
3
+ Modal,
4
+ StyleSheet,
5
+ View,
6
+ SafeAreaView,
7
+ Platform,
8
+ ImageSourcePropType,
9
+ } from "react-native";
10
+ import Video from "../../libs/VideoPlayerControls/index";
11
+
12
+ interface CometChatVideoPlayer {
13
+ videoUri: string
14
+ isVisible: boolean
15
+ onClose: Function
16
+ onLoad: Function
17
+ loadingIconColor?: string;
18
+ playIcon?: ImageSourcePropType
19
+ playIconColor?: string
20
+ pauseIcon?: ImageSourcePropType
21
+ pauseIconColor?: string
22
+ backIcon?: ImageSourcePropType
23
+ backIconColor?: string
24
+ volumeIcon?: ImageSourcePropType
25
+ volumeIconColor?: string
26
+ }
27
+
28
+ export const CometChatVideoPlayer = (props:CometChatVideoPlayer) => {
29
+ const {
30
+ videoUri,
31
+ isVisible,
32
+ onClose,
33
+ onLoad,
34
+ loadingIconColor,
35
+ playIcon,
36
+ playIconColor,
37
+ pauseIcon,
38
+ pauseIconColor,
39
+ backIcon,
40
+ backIconColor,
41
+ volumeIcon,
42
+ volumeIconColor,
43
+ } = props
44
+ const [isPaused, setPaused] = useState(false);
45
+
46
+ const handleLoadStart = () => {
47
+ setPaused(false);
48
+ };
49
+
50
+ const handleLoad = () => {
51
+ onLoad()
52
+ };
53
+
54
+ const handleClose = () => {
55
+ setPaused(true);
56
+ onClose();
57
+ };
58
+
59
+ useEffect(() => {
60
+ setPaused(!isVisible);
61
+ }, [isVisible]);
62
+
63
+ return (
64
+ <Modal
65
+ animationType="slide"
66
+ transparent={false}
67
+ visible={isVisible}
68
+ onRequestClose={handleClose}
69
+ >
70
+ <SafeAreaView style={styles.safeArea}>
71
+ <View style={styles.container}>
72
+ <Video
73
+ disableFullscreen
74
+ disableSeekButtons
75
+ source={{ uri: videoUri }}
76
+ muted={false}
77
+ resizeMode="contain"
78
+ paused={isPaused}
79
+ onLoadStart={handleLoadStart}
80
+ onLoad={handleLoad}
81
+ onError={(e) => {
82
+ console.warn("Video Error: ", e.error);
83
+ handleClose();
84
+ }}
85
+ onBack={handleClose}
86
+ loadingIconColor={loadingIconColor}
87
+ playIcon={playIcon}
88
+ playIconColor={playIconColor}
89
+ pauseIcon={pauseIcon}
90
+ pauseIconColor={pauseIconColor}
91
+ backIcon={backIcon}
92
+ backIconColor={backIconColor}
93
+ volumeIcon={volumeIcon}
94
+ volumeIconColor={volumeIconColor}
95
+ />
96
+ </View>
97
+ </SafeAreaView>
98
+ </Modal>
99
+ );
100
+ };
101
+
102
+ const styles = StyleSheet.create({
103
+ safeArea: { flex: 1 },
104
+ container: {
105
+ flex: 1,
106
+ justifyContent: "center",
107
+ backgroundColor: "black",
108
+ },
109
+ fullscreenVideo: {
110
+ position: "absolute",
111
+ top: 0,
112
+ left: 0,
113
+ bottom: 0,
114
+ right: 0,
115
+ elevation: 10,
116
+ },
117
+ closeButton: {
118
+ position: "absolute",
119
+ marginTop: Platform.OS === "ios" ? 40 : 20,
120
+ right: 20,
121
+ backgroundColor: "black",
122
+ padding: 10,
123
+ borderRadius: 5,
124
+ zIndex: 20,
125
+ },
126
+ text: {
127
+ color: "white",
128
+ fontWeight: "bold",
129
+ },
130
+ loadingIndicator: {
131
+ position: "absolute",
132
+ alignSelf: "center",
133
+ },
134
+ });
@@ -0,0 +1 @@
1
+ export { CometChatVideoPlayer } from "./CometChatVideoPlayer";
@@ -88,6 +88,12 @@ import { CometChatFormBubble, CometChatFormBubbleInterface } from './CometChatFo
88
88
  import { CometChatCardBubble, CometChatCardBubbleInterface } from './CometChatCardBubble'
89
89
  import { CometChatSchedulerBubble, CometChatSchedulerBubbleInterface } from './CometChatSchedulerBubble'
90
90
 
91
+ import { CometChatReactions, CometChatReactionsInterface, ReactionsConfiguration, ReactionsConfigurationInterface, ReactionsStyle, ReactionsStyleInterface } from './CometChatReactions';
92
+ import { CometChatReactionsList, CometChatReactionsListInterface, ReactionListStyle, ReactionListStyleInterface, ReactionsListConfiguration, ReactionsListConfigurationInterface } from './CometChatReactionsList';
93
+ import { CometChatQuickReactions, CometChatQuickReactionsInterface, QuickReactionsConfiguration, QuickReactionsConfigurationInterface, QuickReactionsStyle, QuickReactionsStyleInterface } from './CometChatQuickReactions';
94
+
95
+ import { CometChatEmojiKeyboard, EmojiKeyboardConfiguration, EmojiKeyboardStyle } from './CometChatEmojiKeyboard';
96
+
91
97
  export {
92
98
  CometChatMessageInputStyleInterface,
93
99
  CometChatMessageInputInterface,
@@ -167,6 +173,30 @@ export {
167
173
  CometChatFormBubbleInterface,
168
174
  CometChatCardBubble,
169
175
  CometChatCardBubbleInterface,
176
+
177
+ CometChatReactions,
178
+ CometChatReactionsInterface,
179
+ ReactionsConfiguration,
180
+ ReactionsConfigurationInterface,
181
+ ReactionsStyle,
182
+ ReactionsStyleInterface,
183
+ CometChatReactionsList,
184
+ CometChatReactionsListInterface,
185
+ ReactionListStyle,
186
+ ReactionListStyleInterface,
187
+ ReactionsListConfiguration,
188
+ ReactionsListConfigurationInterface,
189
+ CometChatQuickReactions,
190
+ CometChatQuickReactionsInterface,
191
+ QuickReactionsConfiguration,
192
+ QuickReactionsConfigurationInterface,
193
+ QuickReactionsStyle,
194
+ QuickReactionsStyleInterface,
195
+
196
+ CometChatEmojiKeyboard,
197
+ EmojiKeyboardConfiguration,
198
+ EmojiKeyboardStyle,
199
+
170
200
  CometChatSchedulerBubble,
171
201
  CometChatSchedulerBubbleInterface
172
202
  };
File without changes
@@ -1,13 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="GradleMigrationSettings" migrationVersion="1" />
4
- <component name="GradleSettings">
5
- <option name="linkedExternalProjectsSettings">
6
- <GradleProjectSettings>
7
- <option name="testRunner" value="GRADLE" />
8
- <option name="distributionType" value="DEFAULT_WRAPPED" />
9
- <option name="externalProjectPath" value="$PROJECT_DIR$" />
10
- </GradleProjectSettings>
11
- </option>
12
- </component>
13
- </project>
@@ -1,8 +0,0 @@
1
- <project version="4">
2
- <component name="ProjectRootManager" version="2" project-jdk-name="Android Studio default JDK" project-jdk-type="JavaSDK">
3
- <output url="file://$PROJECT_DIR$/build/classes" />
4
- </component>
5
- <component name="ProjectType">
6
- <option name="id" value="Android" />
7
- </component>
8
- </project>
@@ -1,18 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <module external.linked.project.id=":" external.linked.project.path="$MODULE_DIR$/../.." external.root.project.path="$MODULE_DIR$/../.." external.system.id="GRADLE" type="JAVA_MODULE" version="4">
3
- <component name="FacetManager">
4
- <facet type="android-gradle" name="Android-Gradle">
5
- <configuration>
6
- <option name="GRADLE_PROJECT_PATH" value=":" />
7
- <option name="LAST_SUCCESSFUL_SYNC_AGP_VERSION" />
8
- <option name="LAST_KNOWN_AGP_VERSION" />
9
- </configuration>
10
- </facet>
11
- </component>
12
- <component name="NewModuleRootManager" inherit-compiler-output="true">
13
- <exclude-output />
14
- <content url="file://$MODULE_DIR$/../.." />
15
- <orderEntry type="inheritedJdk" />
16
- <orderEntry type="sourceFolder" forTests="false" />
17
- </component>
18
- </module>
@@ -1,8 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="ProjectModuleManager">
4
- <modules>
5
- <module fileurl="file://$PROJECT_DIR$/.idea/modules/android.iml" filepath="$PROJECT_DIR$/.idea/modules/android.iml" />
6
- </modules>
7
- </component>
8
- </project>
@@ -1,6 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="VcsDirectoryMappings">
4
- <mapping directory="$PROJECT_DIR$/.." vcs="Git" />
5
- </component>
6
- </project>
@@ -1,8 +0,0 @@
1
- ## This file must *NOT* be checked into Version Control Systems,
2
- # as it contains information specific to your local configuration.
3
- #
4
- # Location of the SDK. This is only used by Gradle.
5
- # For customization when using a Version Control System, please read the
6
- # header note.
7
- #Sun May 28 18:33:26 IST 2023
8
- sdk.dir=/Users/ritikkaushik/Library/Android/sdk