@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,6 @@
1
+ #import <React/RCTViewManager.h>
2
+ #import <React/RCTBridgeModule.h>
3
+
4
+ @interface CCRCTVideoManager : RCTViewManager <RCTBridgeModule>
5
+
6
+ @end
@@ -0,0 +1,133 @@
1
+ #import "CCRCTVideoManager.h"
2
+ #import "CCRCTVideo.h"
3
+ #import <React/RCTBridge.h>
4
+ #import <React/RCTUIManager.h>
5
+ #import <AVFoundation/AVFoundation.h>
6
+
7
+ @implementation CCRCTVideoManager
8
+
9
+ RCT_EXPORT_MODULE();
10
+
11
+ - (UIView *)view
12
+ {
13
+ return [[CCRCTVideo alloc] initWithEventDispatcher:self.bridge.eventDispatcher];
14
+ }
15
+
16
+ - (dispatch_queue_t)methodQueue
17
+ {
18
+ return self.bridge.uiManager.methodQueue;
19
+ }
20
+
21
+ RCT_EXPORT_VIEW_PROPERTY(src, NSDictionary);
22
+ RCT_EXPORT_VIEW_PROPERTY(drm, NSDictionary);
23
+ RCT_EXPORT_VIEW_PROPERTY(maxBitRate, float);
24
+ RCT_EXPORT_VIEW_PROPERTY(resizeMode, NSString);
25
+ RCT_EXPORT_VIEW_PROPERTY(repeat, BOOL);
26
+ RCT_EXPORT_VIEW_PROPERTY(automaticallyWaitsToMinimizeStalling, BOOL);
27
+ RCT_EXPORT_VIEW_PROPERTY(allowsExternalPlayback, BOOL);
28
+ RCT_EXPORT_VIEW_PROPERTY(textTracks, NSArray);
29
+ RCT_EXPORT_VIEW_PROPERTY(selectedTextTrack, NSDictionary);
30
+ RCT_EXPORT_VIEW_PROPERTY(selectedAudioTrack, NSDictionary);
31
+ RCT_EXPORT_VIEW_PROPERTY(paused, BOOL);
32
+ RCT_EXPORT_VIEW_PROPERTY(muted, BOOL);
33
+ RCT_EXPORT_VIEW_PROPERTY(controls, BOOL);
34
+ RCT_EXPORT_VIEW_PROPERTY(volume, float);
35
+ RCT_EXPORT_VIEW_PROPERTY(playInBackground, BOOL);
36
+ RCT_EXPORT_VIEW_PROPERTY(preventsDisplaySleepDuringVideoPlayback, BOOL);
37
+ RCT_EXPORT_VIEW_PROPERTY(preferredForwardBufferDuration, float);
38
+ RCT_EXPORT_VIEW_PROPERTY(playWhenInactive, BOOL);
39
+ RCT_EXPORT_VIEW_PROPERTY(pictureInPicture, BOOL);
40
+ RCT_EXPORT_VIEW_PROPERTY(ignoreSilentSwitch, NSString);
41
+ RCT_EXPORT_VIEW_PROPERTY(mixWithOthers, NSString);
42
+ RCT_EXPORT_VIEW_PROPERTY(rate, float);
43
+ RCT_EXPORT_VIEW_PROPERTY(seek, NSDictionary);
44
+ RCT_EXPORT_VIEW_PROPERTY(currentTime, float);
45
+ RCT_EXPORT_VIEW_PROPERTY(fullscreen, BOOL);
46
+ RCT_EXPORT_VIEW_PROPERTY(fullscreenAutorotate, BOOL);
47
+ RCT_EXPORT_VIEW_PROPERTY(fullscreenOrientation, NSString);
48
+ RCT_EXPORT_VIEW_PROPERTY(filter, NSString);
49
+ RCT_EXPORT_VIEW_PROPERTY(filterEnabled, BOOL);
50
+ RCT_EXPORT_VIEW_PROPERTY(progressUpdateInterval, float);
51
+ RCT_EXPORT_VIEW_PROPERTY(restoreUserInterfaceForPIPStopCompletionHandler, BOOL);
52
+ /* Should support: onLoadStart, onLoad, and onError to stay consistent with Image */
53
+ RCT_EXPORT_VIEW_PROPERTY(onVideoLoadStart, RCTDirectEventBlock);
54
+ RCT_EXPORT_VIEW_PROPERTY(onVideoLoad, RCTDirectEventBlock);
55
+ RCT_EXPORT_VIEW_PROPERTY(onVideoBuffer, RCTDirectEventBlock);
56
+ RCT_EXPORT_VIEW_PROPERTY(onVideoError, RCTDirectEventBlock);
57
+ RCT_EXPORT_VIEW_PROPERTY(onVideoProgress, RCTDirectEventBlock);
58
+ RCT_EXPORT_VIEW_PROPERTY(onBandwidthUpdate, RCTDirectEventBlock);
59
+ RCT_EXPORT_VIEW_PROPERTY(onVideoSeek, RCTDirectEventBlock);
60
+ RCT_EXPORT_VIEW_PROPERTY(onVideoEnd, RCTDirectEventBlock);
61
+ RCT_EXPORT_VIEW_PROPERTY(onTimedMetadata, RCTDirectEventBlock);
62
+ RCT_EXPORT_VIEW_PROPERTY(onVideoAudioBecomingNoisy, RCTDirectEventBlock);
63
+ RCT_EXPORT_VIEW_PROPERTY(onVideoFullscreenPlayerWillPresent, RCTDirectEventBlock);
64
+ RCT_EXPORT_VIEW_PROPERTY(onVideoFullscreenPlayerDidPresent, RCTDirectEventBlock);
65
+ RCT_EXPORT_VIEW_PROPERTY(onVideoFullscreenPlayerWillDismiss, RCTDirectEventBlock);
66
+ RCT_EXPORT_VIEW_PROPERTY(onVideoFullscreenPlayerDidDismiss, RCTDirectEventBlock);
67
+ RCT_EXPORT_VIEW_PROPERTY(onReadyForDisplay, RCTDirectEventBlock);
68
+ RCT_EXPORT_VIEW_PROPERTY(onPlaybackStalled, RCTDirectEventBlock);
69
+ RCT_EXPORT_VIEW_PROPERTY(onPlaybackResume, RCTDirectEventBlock);
70
+ RCT_EXPORT_VIEW_PROPERTY(onPlaybackRateChange, RCTDirectEventBlock);
71
+ RCT_EXPORT_VIEW_PROPERTY(onVideoExternalPlaybackChange, RCTDirectEventBlock);
72
+ RCT_EXPORT_VIEW_PROPERTY(onGetLicense, RCTDirectEventBlock);
73
+ RCT_REMAP_METHOD(save,
74
+ options:(NSDictionary *)options
75
+ reactTag:(nonnull NSNumber *)reactTag
76
+ resolver:(RCTPromiseResolveBlock)resolve
77
+ rejecter:(RCTPromiseRejectBlock)reject)
78
+ {
79
+ [self.bridge.uiManager prependUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, CCRCTVideo *> *viewRegistry) {
80
+ CCRCTVideo *view = viewRegistry[reactTag];
81
+ if (![view isKindOfClass:[CCRCTVideo class]]) {
82
+ RCTLogError(@"Invalid view returned from registry, expecting RCTVideo, got: %@", view);
83
+ } else {
84
+ [view save:options resolve:resolve reject:reject];
85
+ }
86
+ }];
87
+ };
88
+ RCT_REMAP_METHOD(setLicenseResult,
89
+ license:(NSString *)license
90
+ reactTag:(nonnull NSNumber *)reactTag)
91
+ {
92
+ [self.bridge.uiManager prependUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, CCRCTVideo *> *viewRegistry) {
93
+ CCRCTVideo *view = viewRegistry[reactTag];
94
+ if (![view isKindOfClass:[CCRCTVideo class]]) {
95
+ RCTLogError(@"Invalid view returned from registry, expecting RCTVideo, got: %@", view);
96
+ } else {
97
+ [view setLicenseResult:license];
98
+ }
99
+ }];
100
+ };
101
+
102
+ RCT_REMAP_METHOD(setLicenseResultError,
103
+ error:(NSString *)error
104
+ reactTag:(nonnull NSNumber *)reactTag)
105
+ {
106
+ [self.bridge.uiManager prependUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, CCRCTVideo *> *viewRegistry) {
107
+ CCRCTVideo *view = viewRegistry[reactTag];
108
+ if (![view isKindOfClass:[CCRCTVideo class]]) {
109
+ RCTLogError(@"Invalid view returned from registry, expecting RCTVideo, got: %@", view);
110
+ } else {
111
+ [view setLicenseResultError:error];
112
+ }
113
+ }];
114
+ };
115
+ RCT_EXPORT_VIEW_PROPERTY(onPictureInPictureStatusChanged, RCTDirectEventBlock);
116
+ RCT_EXPORT_VIEW_PROPERTY(onRestoreUserInterfaceForPictureInPictureStop, RCTDirectEventBlock);
117
+
118
+ - (NSDictionary *)constantsToExport
119
+ {
120
+ return @{
121
+ @"ScaleNone": AVLayerVideoGravityResizeAspect,
122
+ @"ScaleToFill": AVLayerVideoGravityResize,
123
+ @"ScaleAspectFit": AVLayerVideoGravityResizeAspect,
124
+ @"ScaleAspectFill": AVLayerVideoGravityResizeAspectFill
125
+ };
126
+ }
127
+
128
+ + (BOOL)requiresMainQueueSetup
129
+ {
130
+ return YES;
131
+ }
132
+
133
+ @end
@@ -0,0 +1,20 @@
1
+ //
2
+ // RCTVideoPlayerViewController.h
3
+ // RCTVideo
4
+ //
5
+ // Created by Stanisław Chmiela on 31.03.2016.
6
+ // Copyright © 2016 Facebook. All rights reserved.
7
+ //
8
+
9
+ #import <AVKit/AVKit.h>
10
+ #import "CCRCTVideo.h"
11
+ #import "CCRCTVideoPlayerViewControllerDelegate.h"
12
+
13
+ @interface CCRCTVideoPlayerViewController : AVPlayerViewController
14
+ @property (nonatomic, weak) id<CCRCTVideoPlayerViewControllerDelegate> rctDelegate;
15
+
16
+ // Optional paramters
17
+ @property (nonatomic, weak) NSString* preferredOrientation;
18
+ @property (nonatomic) BOOL autorotate;
19
+
20
+ @end
@@ -0,0 +1,43 @@
1
+ #import "CCRCTVideoPlayerViewController.h"
2
+
3
+ @interface CCRCTVideoPlayerViewController ()
4
+
5
+ @end
6
+
7
+ @implementation CCRCTVideoPlayerViewController
8
+
9
+ - (BOOL)shouldAutorotate {
10
+
11
+ if (self.autorotate || self.preferredOrientation.lowercaseString == nil || [self.preferredOrientation.lowercaseString isEqualToString:@"all"])
12
+ return YES;
13
+
14
+ return NO;
15
+ }
16
+
17
+ - (void)viewDidDisappear:(BOOL)animated
18
+ {
19
+ [super viewDidDisappear:animated];
20
+ [_rctDelegate videoPlayerViewControllerWillDismiss:self];
21
+ [_rctDelegate videoPlayerViewControllerDidDismiss:self];
22
+ }
23
+
24
+ #if !TARGET_OS_TV
25
+ - (UIInterfaceOrientationMask)supportedInterfaceOrientations {
26
+ return UIInterfaceOrientationMaskAll;
27
+ }
28
+
29
+ - (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
30
+ if ([self.preferredOrientation.lowercaseString isEqualToString:@"landscape"]) {
31
+ return UIInterfaceOrientationLandscapeRight;
32
+ }
33
+ else if ([self.preferredOrientation.lowercaseString isEqualToString:@"portrait"]) {
34
+ return UIInterfaceOrientationPortrait;
35
+ }
36
+ else { // default case
37
+ UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation;
38
+ return orientation;
39
+ }
40
+ }
41
+ #endif
42
+
43
+ @end
@@ -0,0 +1,7 @@
1
+ #import <Foundation/Foundation.h>
2
+ #import "AVKit/AVKit.h"
3
+
4
+ @protocol CCRCTVideoPlayerViewControllerDelegate <NSObject>
5
+ - (void)videoPlayerViewControllerWillDismiss:(AVPlayerViewController *)playerViewController;
6
+ - (void)videoPlayerViewControllerDidDismiss:(AVPlayerViewController *)playerViewController;
7
+ @end
@@ -0,0 +1,15 @@
1
+ //
2
+ // UIView+FindUIViewController.h
3
+ // RCTVideo
4
+ //
5
+ // Created by Stanisław Chmiela on 31.03.2016.
6
+ // Copyright © 2016 Facebook. All rights reserved.
7
+ //
8
+ // Source: http://stackoverflow.com/a/3732812/1123156
9
+
10
+ #import <UIKit/UIKit.h>
11
+
12
+ @interface UIView (FindUIViewController)
13
+ - (UIViewController *) firstAvailableUIViewController;
14
+ - (id) traverseResponderChainForUIViewController;
15
+ @end
@@ -0,0 +1,21 @@
1
+ // Source: http://stackoverflow.com/a/3732812/1123156
2
+
3
+ #import "UIView+FindUIViewController.h"
4
+
5
+ @implementation UIView (FindUIViewController)
6
+ - (UIViewController *) firstAvailableUIViewController {
7
+ // convenience function for casting and to "mask" the recursive function
8
+ return (UIViewController *)[self traverseResponderChainForUIViewController];
9
+ }
10
+
11
+ - (id) traverseResponderChainForUIViewController {
12
+ id nextResponder = [self nextResponder];
13
+ if ([nextResponder isKindOfClass:[UIViewController class]]) {
14
+ return nextResponder;
15
+ } else if ([nextResponder isKindOfClass:[UIView class]]) {
16
+ return [nextResponder traverseResponderChainForUIViewController];
17
+ } else {
18
+ return nil;
19
+ }
20
+ }
21
+ @end
@@ -0,0 +1,38 @@
1
+ #import <Foundation/Foundation.h>
2
+ #import <AVFoundation/AVFoundation.h>
3
+ #import <SPTPersistentCache/SPTPersistentCache.h>
4
+ #import <SPTPersistentCache/SPTPersistentCacheOptions.h>
5
+ #import <CommonCrypto/CommonDigest.h>
6
+
7
+ typedef NS_ENUM(NSUInteger, RCTVideoCacheStatus) {
8
+ RCTVideoCacheStatusMissingFileExtension,
9
+ RCTVideoCacheStatusUnsupportedFileExtension,
10
+ RCTVideoCacheStatusNotAvailable,
11
+ RCTVideoCacheStatusAvailable
12
+ };
13
+
14
+ @class SPTPersistentCache;
15
+ @class SPTPersistentCacheOptions;
16
+
17
+ @interface RCTVideoCache : NSObject
18
+ {
19
+ SPTPersistentCache *videoCache;
20
+ NSString * _Nullable cachePath;
21
+ NSString * temporaryCachePath;
22
+ NSString * _Nullable cacheIdentifier;
23
+ }
24
+
25
+ @property(nonatomic, strong) SPTPersistentCache * _Nullable videoCache;
26
+ @property(nonatomic, strong) NSString * cachePath;
27
+ @property(nonatomic, strong) NSString * cacheIdentifier;
28
+ @property(nonatomic, strong) NSString * temporaryCachePath;
29
+
30
+ + (RCTVideoCache *)sharedInstance;
31
+ - (void)storeItem:(NSData *)data forUri:(NSString *)uri withCallback:(void(^)(BOOL))handler;
32
+ - (void)getItemForUri:(NSString *)url withCallback:(void(^)(RCTVideoCacheStatus, AVAsset * _Nullable)) handler;
33
+ - (NSURL *)createUniqueTemporaryFileUrl:(NSString * _Nonnull)url withExtension:(NSString * _Nonnull) extension;
34
+ - (AVURLAsset *)getItemFromTemporaryStorage:(NSString *)key;
35
+ - (BOOL)saveDataToTemporaryStorage:(NSData *)data key:(NSString *)key;
36
+ - (void) createTemporaryPath;
37
+
38
+ @end
@@ -0,0 +1,174 @@
1
+ #import "RCTVideoCache.h"
2
+
3
+ @implementation RCTVideoCache
4
+
5
+ @synthesize videoCache;
6
+ @synthesize cachePath;
7
+ @synthesize cacheIdentifier;
8
+ @synthesize temporaryCachePath;
9
+
10
+ + (RCTVideoCache *)sharedInstance {
11
+ static RCTVideoCache *sharedInstance = nil;
12
+ static dispatch_once_t onceToken;
13
+ dispatch_once(&onceToken, ^{
14
+ sharedInstance = [[self alloc] init];
15
+ });
16
+ return sharedInstance;
17
+ }
18
+
19
+ - (id)init {
20
+ if (self = [super init]) {
21
+ self.cacheIdentifier = @"rct.video.cache";
22
+ self.temporaryCachePath = [NSTemporaryDirectory() stringByAppendingPathComponent:self.cacheIdentifier];
23
+ self.cachePath = [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES).firstObject stringByAppendingPathComponent:self.cacheIdentifier];
24
+ SPTPersistentCacheOptions *options = [SPTPersistentCacheOptions new];
25
+ options.cachePath = self.cachePath;
26
+ options.cacheIdentifier = self.cacheIdentifier;
27
+ options.defaultExpirationPeriod = 60 * 60 * 24 * 30;
28
+ options.garbageCollectionInterval = (NSUInteger)(1.5 * SPTPersistentCacheDefaultGCIntervalSec);
29
+ options.sizeConstraintBytes = 1024 * 1024 * 100;
30
+ options.useDirectorySeparation = NO;
31
+ #ifdef DEBUG
32
+ options.debugOutput = ^(NSString *string) {
33
+ NSLog(@"Video Cache: %@", string);
34
+ };
35
+ #endif
36
+ [self createTemporaryPath];
37
+ self.videoCache = [[SPTPersistentCache alloc] initWithOptions:options];
38
+ [self.videoCache scheduleGarbageCollector];
39
+ }
40
+ return self;
41
+ }
42
+
43
+ - (void) createTemporaryPath {
44
+ NSError *error = nil;
45
+ BOOL success = [[NSFileManager defaultManager] createDirectoryAtPath:self.temporaryCachePath
46
+ withIntermediateDirectories:YES
47
+ attributes:nil
48
+ error:&error];
49
+ #ifdef DEBUG
50
+ if (!success || error) {
51
+ NSLog(@"Error while! %@", error);
52
+ }
53
+ #endif
54
+ }
55
+
56
+ - (void)storeItem:(NSData *)data forUri:(NSString *)uri withCallback:(void(^)(BOOL))handler;
57
+ {
58
+ NSString *key = [self generateCacheKeyForUri:uri];
59
+ if (key == nil) {
60
+ handler(NO);
61
+ return;
62
+ }
63
+ [self saveDataToTemporaryStorage:data key:key];
64
+ [self.videoCache storeData:data forKey:key locked:NO withCallback:^(SPTPersistentCacheResponse * _Nonnull response) {
65
+ if (response.error) {
66
+ #ifdef DEBUG
67
+ NSLog(@"An error occured while saving the video into the cache: %@", [response.error localizedDescription]);
68
+ #endif
69
+ handler(NO);
70
+ return;
71
+ }
72
+ handler(YES);
73
+ } onQueue:dispatch_get_main_queue()];
74
+ return;
75
+ }
76
+
77
+ - (AVURLAsset *)getItemFromTemporaryStorage:(NSString *)key {
78
+ NSString * temporaryFilePath = [self.temporaryCachePath stringByAppendingPathComponent:key];
79
+
80
+ BOOL fileExists = [[NSFileManager defaultManager] fileExistsAtPath:temporaryFilePath];
81
+ if (!fileExists) {
82
+ return nil;
83
+ }
84
+ NSURL *assetUrl = [[NSURL alloc] initFileURLWithPath:temporaryFilePath];
85
+ AVURLAsset *asset = [AVURLAsset URLAssetWithURL:assetUrl options:nil];
86
+ return asset;
87
+ }
88
+
89
+ - (BOOL)saveDataToTemporaryStorage:(NSData *)data key:(NSString *)key {
90
+ NSString *temporaryFilePath = [self.temporaryCachePath stringByAppendingPathComponent:key];
91
+ [data writeToFile:temporaryFilePath atomically:YES];
92
+ return YES;
93
+ }
94
+
95
+ - (NSString *)generateCacheKeyForUri:(NSString *)uri {
96
+ NSString *uriWithoutQueryParams = uri;
97
+
98
+ // parse file extension
99
+ if ([uri rangeOfString:@"?"].location != NSNotFound) {
100
+ NSArray<NSString*> * components = [uri componentsSeparatedByString:@"?"];
101
+ uriWithoutQueryParams = [components objectAtIndex:0];
102
+ }
103
+
104
+ NSString * pathExtension = [uriWithoutQueryParams pathExtension];
105
+ NSArray * supportedExtensions = @[@"m4v", @"mp4", @"mov"];
106
+ if ([pathExtension isEqualToString:@""]) {
107
+ NSDictionary *userInfo = @{
108
+ NSLocalizedDescriptionKey: NSLocalizedString(@"Missing file extension.", nil),
109
+ NSLocalizedFailureReasonErrorKey: NSLocalizedString(@"Missing file extension.", nil),
110
+ NSLocalizedRecoverySuggestionErrorKey: NSLocalizedString(@"Missing file extension.", nil)
111
+ };
112
+ NSError *error = [NSError errorWithDomain:@"RCTVideoCache"
113
+ code:RCTVideoCacheStatusMissingFileExtension userInfo:userInfo];
114
+ @throw error;
115
+ } else if (![supportedExtensions containsObject:pathExtension]) {
116
+ // Notably, we don't currently support m3u8 (HLS playlists)
117
+ NSDictionary *userInfo = @{
118
+ NSLocalizedDescriptionKey: NSLocalizedString(@"Unsupported file extension.", nil),
119
+ NSLocalizedFailureReasonErrorKey: NSLocalizedString(@"Unsupported file extension.", nil),
120
+ NSLocalizedRecoverySuggestionErrorKey: NSLocalizedString(@"Unsupported file extension.", nil)
121
+ };
122
+ NSError *error = [NSError errorWithDomain:@"RCTVideoCache"
123
+ code:RCTVideoCacheStatusUnsupportedFileExtension userInfo:userInfo];
124
+ @throw error;
125
+ }
126
+ return [[self generateHashForUrl:uri] stringByAppendingPathExtension:pathExtension];
127
+ }
128
+
129
+ - (void)getItemForUri:(NSString *)uri withCallback:(void(^)(RCTVideoCacheStatus, AVAsset * _Nullable)) handler {
130
+ @try {
131
+ NSString *key = [self generateCacheKeyForUri:uri];
132
+ AVURLAsset * temporaryAsset = [self getItemFromTemporaryStorage:key];
133
+ if (temporaryAsset != nil) {
134
+ handler(RCTVideoCacheStatusAvailable, temporaryAsset);
135
+ return;
136
+ }
137
+
138
+ [self.videoCache loadDataForKey:key withCallback:^(SPTPersistentCacheResponse * _Nonnull response) {
139
+ if (response.record == nil || response.record.data == nil) {
140
+ handler(RCTVideoCacheStatusNotAvailable, nil);
141
+ return;
142
+ }
143
+ [self saveDataToTemporaryStorage:response.record.data key:key];
144
+ handler(RCTVideoCacheStatusAvailable, [self getItemFromTemporaryStorage:key]);
145
+ } onQueue:dispatch_get_main_queue()];
146
+ } @catch (NSError * err) {
147
+ switch (err.code) {
148
+ case RCTVideoCacheStatusMissingFileExtension:
149
+ handler(RCTVideoCacheStatusMissingFileExtension, nil);
150
+ return;
151
+ case RCTVideoCacheStatusUnsupportedFileExtension:
152
+ handler(RCTVideoCacheStatusUnsupportedFileExtension, nil);
153
+ return;
154
+ default:
155
+ @throw err;
156
+ }
157
+ }
158
+ }
159
+
160
+ - (NSString *)generateHashForUrl:(NSString *)string {
161
+ const char *cStr = [string UTF8String];
162
+ unsigned char result[CC_MD5_DIGEST_LENGTH];
163
+ CC_MD5( cStr, (CC_LONG)strlen(cStr), result );
164
+
165
+ return [NSString stringWithFormat:
166
+ @"%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X",
167
+ result[0], result[1], result[2], result[3],
168
+ result[4], result[5], result[6], result[7],
169
+ result[8], result[9], result[10], result[11],
170
+ result[12], result[13], result[14], result[15]
171
+ ];
172
+ }
173
+
174
+ @end
@@ -0,0 +1,7 @@
1
+ // VideoPickerModule.h
2
+
3
+ #import <React/RCTBridgeModule.h>
4
+ #import <UIKit/UIKit.h>
5
+
6
+ @interface VideoPickerModule : NSObject <RCTBridgeModule, UINavigationControllerDelegate, UIImagePickerControllerDelegate>
7
+ @end
@@ -0,0 +1,95 @@
1
+ // VideoPickerModule.m
2
+
3
+ #import "VideoPickerModule.h"
4
+ #import <React/RCTLog.h>
5
+ #import <MobileCoreServices/MobileCoreServices.h>
6
+ @interface VideoPickerModule () <UINavigationControllerDelegate, UIImagePickerControllerDelegate>
7
+
8
+ @property (nonatomic, copy) RCTResponseSenderBlock callback;
9
+
10
+ @end
11
+ @implementation VideoPickerModule
12
+
13
+ RCT_EXPORT_MODULE(VideoPickerModule);
14
+
15
+ RCT_EXPORT_METHOD(pickVideo:(RCTResponseSenderBlock)callback)
16
+ {
17
+ RCTLogInfo(@"Picking video");
18
+
19
+ dispatch_async(dispatch_get_main_queue(), ^{
20
+ UIImagePickerController *picker = [[UIImagePickerController alloc] init];
21
+ picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
22
+ picker.mediaTypes = @[(NSString*)kUTTypeMovie];
23
+ picker.delegate = self;
24
+
25
+ // Get the application's root view controller
26
+ UIViewController *rootViewController = [UIApplication sharedApplication].delegate.window.rootViewController;
27
+
28
+ // Check if the root view controller is presenting another view controller
29
+ while (rootViewController.presentedViewController) {
30
+ // If so, use it as the rootViewController to present the picker
31
+ rootViewController = rootViewController.presentedViewController;
32
+ }
33
+
34
+ // Now present the picker
35
+ [rootViewController presentViewController:picker animated:YES completion:nil];
36
+
37
+ // Store the callback for later use
38
+ self.callback = callback;
39
+ });
40
+ }
41
+
42
+ #pragma mark - UIImagePickerControllerDelegate
43
+ - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary<NSString *,id> *)info {
44
+ NSURL *videoURL = [info objectForKey:UIImagePickerControllerMediaURL];
45
+
46
+ // Remove the 'trim.' prefix and any trailing period '.' from the file name
47
+ NSString *fileName = [[videoURL lastPathComponent] stringByDeletingPathExtension];
48
+ if ([fileName hasPrefix:@"trim."]) {
49
+ fileName = [fileName substringFromIndex:5]; // Remove the 'trim.' prefix
50
+ }
51
+ NSString *fileType = [videoURL pathExtension];
52
+ NSString *tempPath = [videoURL path];
53
+
54
+ // Copy the file to the application's document directory
55
+ NSString *documentsDirectory = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject];
56
+ NSString *destinationFileName = [NSString stringWithFormat:@"%@.%@", fileName, fileType];
57
+ NSString *destinationPath = [documentsDirectory stringByAppendingPathComponent:destinationFileName];
58
+ NSURL *destinationURL = [NSURL fileURLWithPath:destinationPath];
59
+
60
+ NSError *error;
61
+ NSFileManager *fileManager = [NSFileManager defaultManager];
62
+
63
+ // Check if file exists at destination, remove it if it does
64
+ if ([fileManager fileExistsAtPath:destinationPath]) {
65
+ [fileManager removeItemAtPath:destinationPath error:&error];
66
+ if (error) {
67
+ RCTLogError(@"Error removing existing file at destination: %@", error.localizedDescription);
68
+ self.callback(@[@"Could not remove existing file at destination", [NSNull null]]);
69
+ [picker dismissViewControllerAnimated:YES completion:nil];
70
+ return;
71
+ }
72
+ }
73
+
74
+ // Copy file from temporary location to documents directory
75
+ if ([fileManager copyItemAtPath:tempPath toPath:destinationPath error:&error]) {
76
+ // Constructing file URI with "file://" prefix
77
+ NSString *fileURI = destinationURL.absoluteString;
78
+
79
+ // Pass the video info to the callback
80
+ self.callback(@[@{@"name": destinationFileName, @"type": fileType, @"uri": fileURI}]);
81
+ } else {
82
+ RCTLogError(@"Error copying temporary file to destination: %@", error.localizedDescription);
83
+ self.callback(@[error.localizedDescription, [NSNull null]]);
84
+ }
85
+
86
+ [picker dismissViewControllerAnimated:YES completion:nil];
87
+ }
88
+
89
+
90
+ - (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker
91
+ {
92
+ [picker dismissViewControllerAnimated:YES completion:nil];
93
+ }
94
+
95
+ @end
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cometchat/chat-uikit-react-native",
3
- "version": "4.2.2",
3
+ "version": "4.3.1",
4
4
  "description": "CometChat React Native UI Kit is a collection of custom UI Components designed to build text , chat and calling features in your application. The UI Kit is developed to keep developers in mind and aims to reduce development efforts significantly",
5
5
  "main": "src/index",
6
6
  "module": "src/index",
@@ -38,7 +38,7 @@
38
38
  ],
39
39
  "repository": "https://github.com/cometchat-pro/cometchat-pro-react-native-ui-kit",
40
40
  "author": "Inscripts",
41
- "license": "SEE LICENSE IN LICENSE.md",
41
+ "license": "https://www.cometchat.com/legal-terms-of-service",
42
42
  "bugs": {
43
43
  "url": "https://github.com/cometchat-pro/cometchat-pro-react-native-ui-kit/issues"
44
44
  },
@@ -70,8 +70,7 @@
70
70
  "@types/react": "17.0.21"
71
71
  },
72
72
  "dependencies": {
73
- "@react-native-async-storage/async-storage": "^1.17.10",
74
- "@react-native-community/clipboard": "^1.5.1"
73
+ "@react-native-clipboard/clipboard": "^1.13.2"
75
74
  },
76
75
  "peerDependencies": {
77
76
  "react": "*",
@@ -1,31 +1,45 @@
1
1
  require "json"
2
2
 
3
3
  package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4
+
4
5
  folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
5
6
 
6
7
  Pod::Spec.new do |s|
7
8
  s.name = "react-native-cometchat-ui-kit"
8
9
  s.version = package["version"]
9
- s.summary = package["description"]
10
+ s.summary = package["description"][0...140] # Shorten summary to max 140 characters
10
11
  s.homepage = package["homepage"]
11
12
  s.license = package["license"]
12
- s.authors = package["author"]
13
+ s.authors = package["author"].is_a?(Hash) ? [package["author"]] : package["author"]
13
14
 
14
15
  s.platforms = { :ios => "11.0" }
15
16
  s.source = { :git => "https://github.com/cometchat-pro/cometchat-pro-react-native-ui-kit.git", :tag => "#{s.version}" }
16
17
 
17
18
  s.source_files = "ios/**/*.{h,m,mm}"
18
19
 
20
+ s.static_framework = true # Set static_framework for the main spec if needed
19
21
  s.dependency "React-Core"
20
22
 
21
- # Don't install the dependencies when we run `pod install` in the old architecture.
22
- if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
23
- s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
24
- s.pod_target_xcconfig = {
25
- "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
26
- "CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
27
- }
23
+ s.subspec "Video" do |ss|
24
+ ss.source_files = "ios/Video/*.{h,m}"
25
+ end
26
+
27
+ s.subspec "VideoCaching" do |ss|
28
+ ss.dependency "react-native-cometchat-ui-kit/Video"
29
+ ss.dependency "SPTPersistentCache", "~> 1.1.0"
30
+ ss.dependency "DVAssetLoaderDelegate", "~> 0.3.1"
28
31
 
32
+ ss.source_files = "ios/VideoCaching/**/*.{h,m}"
33
+ end
34
+
35
+ # Conditional compiler flags and dependencies for the new architecture
36
+ if ENV['RCT_NEW_ARCH_ENABLED'] == '1'
37
+ s.compiler_flags = "#{folly_compiler_flags} -DRCT_NEW_ARCH_ENABLED=1"
38
+ s.pod_target_xcconfig = {
39
+ "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/Header/Public/**\"",
40
+ "CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
41
+ }
42
+
29
43
  s.dependency "React-Codegen"
30
44
  s.dependency "RCT-Folly"
31
45
  s.dependency "RCTRequired"
@@ -33,4 +47,4 @@ Pod::Spec.new do |s|
33
47
  s.dependency "ReactCommon/turbomodule/core"
34
48
  s.dependency "RCTSlider"
35
49
  end
36
- end
50
+ end