@developer_tribe/react-native-comnyx 0.15.0 → 0.16.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 (210) hide show
  1. package/Comnyx.podspec +10 -2
  2. package/README.md +50 -0
  3. package/android/build.gradle +1 -0
  4. package/android/consumer-rules.pro +23 -0
  5. package/android/generated/java/com/comnyx/NativeComnyxSpec.java +46 -0
  6. package/android/generated/jni/RNComnyxSpec-generated.cpp +23 -1
  7. package/android/generated/jni/RNComnyxSpec.h +7 -0
  8. package/android/generated/jni/react/renderer/components/RNComnyxSpec/RNComnyxSpecJSI-generated.cpp +21 -0
  9. package/android/generated/jni/react/renderer/components/RNComnyxSpec/RNComnyxSpecJSI.h +70 -0
  10. package/android/src/main/AndroidManifest.xml +11 -1
  11. package/android/src/main/AndroidManifestNew.xml +11 -1
  12. package/android/src/main/java/com/comnyx/ComnyxMediaPickerModule.kt +91 -51
  13. package/android/src/main/java/com/comnyx/ComnyxModule.kt +7 -0
  14. package/android/src/main/java/com/comnyx/src/messaging/firebase/FirebaseMessagingService.kt +4 -6
  15. package/android/src/main/res/xml/comnyx_file_paths.xml +12 -0
  16. package/ios/APNService.swift +9 -9
  17. package/ios/Comnyx.swift +17 -8
  18. package/ios/ComnyxMediaPicker.swift +47 -26
  19. package/ios/ComnyxMessaging.swift +2 -0
  20. package/ios/PrivacyInfo.xcprivacy +32 -0
  21. package/ios/comnyx_post_install.rb +25 -0
  22. package/ios/generated/RCTAppDependencyProvider.h +25 -0
  23. package/ios/generated/RCTAppDependencyProvider.mm +55 -0
  24. package/ios/generated/RCTModulesConformingToProtocolsProvider.h +18 -0
  25. package/ios/generated/RCTModulesConformingToProtocolsProvider.mm +33 -0
  26. package/ios/generated/RCTThirdPartyComponentsProvider.h +16 -0
  27. package/ios/generated/RCTThirdPartyComponentsProvider.mm +23 -0
  28. package/ios/generated/RNComnyxSpec/RNComnyxSpec-generated.mm +53 -0
  29. package/ios/generated/RNComnyxSpec/RNComnyxSpec.h +67 -0
  30. package/ios/generated/RNComnyxSpecJSI-generated.cpp +38 -0
  31. package/ios/generated/RNComnyxSpecJSI.h +89 -0
  32. package/ios/generated/ReactAppDependencyProvider.podspec +34 -0
  33. package/lib/commonjs/NativeComnyxMediaPicker.js +19 -0
  34. package/lib/commonjs/NativeComnyxMediaPicker.js.map +1 -1
  35. package/lib/commonjs/api/conversations.js +6 -6
  36. package/lib/commonjs/api/conversations.js.map +1 -1
  37. package/lib/commonjs/api/customers.js +3 -2
  38. package/lib/commonjs/api/customers.js.map +1 -1
  39. package/lib/commonjs/api/media.js +20 -6
  40. package/lib/commonjs/api/media.js.map +1 -1
  41. package/lib/commonjs/api/messages.js +3 -2
  42. package/lib/commonjs/api/messages.js.map +1 -1
  43. package/lib/commonjs/components/ChatList.js +132 -90
  44. package/lib/commonjs/components/ChatList.js.map +1 -1
  45. package/lib/commonjs/components/ComnyxErrorBoundary.js +92 -0
  46. package/lib/commonjs/components/ComnyxErrorBoundary.js.map +1 -0
  47. package/lib/commonjs/components/CustomerForm.js +7 -3
  48. package/lib/commonjs/components/CustomerForm.js.map +1 -1
  49. package/lib/commonjs/components/InitFailed.js +77 -21
  50. package/lib/commonjs/components/InitFailed.js.map +1 -1
  51. package/lib/commonjs/components/MediaMessageItem.js +37 -10
  52. package/lib/commonjs/components/MediaMessageItem.js.map +1 -1
  53. package/lib/commonjs/components/MediaViewerModal.js +16 -3
  54. package/lib/commonjs/components/MediaViewerModal.js.map +1 -1
  55. package/lib/commonjs/components/MessageInput.js +83 -15
  56. package/lib/commonjs/components/MessageInput.js.map +1 -1
  57. package/lib/commonjs/components/MessageItem.js +1 -1
  58. package/lib/commonjs/components/MessageItem.js.map +1 -1
  59. package/lib/commonjs/hooks/usePolling.js +30 -21
  60. package/lib/commonjs/hooks/usePolling.js.map +1 -1
  61. package/lib/commonjs/hooks/useThemeColors.js +12 -1
  62. package/lib/commonjs/hooks/useThemeColors.js.map +1 -1
  63. package/lib/commonjs/index.js +6 -0
  64. package/lib/commonjs/index.js.map +1 -1
  65. package/lib/commonjs/notifications/initializeNotifications.js +19 -16
  66. package/lib/commonjs/notifications/initializeNotifications.js.map +1 -1
  67. package/lib/commonjs/register/Accumulator.js +19 -6
  68. package/lib/commonjs/register/Accumulator.js.map +1 -1
  69. package/lib/commonjs/register/collectData.js +1 -1
  70. package/lib/commonjs/register/collectData.js.map +1 -1
  71. package/lib/commonjs/register/login.js +5 -0
  72. package/lib/commonjs/register/login.js.map +1 -1
  73. package/lib/commonjs/store/store.js +6 -0
  74. package/lib/commonjs/store/store.js.map +1 -1
  75. package/lib/commonjs/support/ComnyxSupport.js +77 -16
  76. package/lib/commonjs/support/ComnyxSupport.js.map +1 -1
  77. package/lib/commonjs/support/SupportConfigContext.js +66 -0
  78. package/lib/commonjs/support/SupportConfigContext.js.map +1 -0
  79. package/lib/commonjs/support/index.js +7 -0
  80. package/lib/commonjs/support/index.js.map +1 -1
  81. package/lib/commonjs/types/Theme.js +30 -2
  82. package/lib/commonjs/types/Theme.js.map +1 -1
  83. package/lib/commonjs/version.js +1 -1
  84. package/lib/module/NativeComnyxMediaPicker.js +18 -0
  85. package/lib/module/NativeComnyxMediaPicker.js.map +1 -1
  86. package/lib/module/api/conversations.js +6 -6
  87. package/lib/module/api/conversations.js.map +1 -1
  88. package/lib/module/api/customers.js +3 -2
  89. package/lib/module/api/customers.js.map +1 -1
  90. package/lib/module/api/media.js +21 -6
  91. package/lib/module/api/media.js.map +1 -1
  92. package/lib/module/api/messages.js +3 -2
  93. package/lib/module/api/messages.js.map +1 -1
  94. package/lib/module/components/ChatList.js +133 -91
  95. package/lib/module/components/ChatList.js.map +1 -1
  96. package/lib/module/components/ComnyxErrorBoundary.js +87 -0
  97. package/lib/module/components/ComnyxErrorBoundary.js.map +1 -0
  98. package/lib/module/components/CustomerForm.js +7 -3
  99. package/lib/module/components/CustomerForm.js.map +1 -1
  100. package/lib/module/components/InitFailed.js +79 -23
  101. package/lib/module/components/InitFailed.js.map +1 -1
  102. package/lib/module/components/MediaMessageItem.js +37 -11
  103. package/lib/module/components/MediaMessageItem.js.map +1 -1
  104. package/lib/module/components/MediaViewerModal.js +15 -3
  105. package/lib/module/components/MediaViewerModal.js.map +1 -1
  106. package/lib/module/components/MessageInput.js +84 -16
  107. package/lib/module/components/MessageInput.js.map +1 -1
  108. package/lib/module/components/MessageItem.js +1 -1
  109. package/lib/module/components/MessageItem.js.map +1 -1
  110. package/lib/module/hooks/usePolling.js +30 -21
  111. package/lib/module/hooks/usePolling.js.map +1 -1
  112. package/lib/module/hooks/useThemeColors.js +13 -2
  113. package/lib/module/hooks/useThemeColors.js.map +1 -1
  114. package/lib/module/index.js +1 -0
  115. package/lib/module/index.js.map +1 -1
  116. package/lib/module/notifications/initializeNotifications.js +19 -16
  117. package/lib/module/notifications/initializeNotifications.js.map +1 -1
  118. package/lib/module/register/Accumulator.js +19 -6
  119. package/lib/module/register/Accumulator.js.map +1 -1
  120. package/lib/module/register/collectData.js +1 -1
  121. package/lib/module/register/collectData.js.map +1 -1
  122. package/lib/module/register/login.js +5 -0
  123. package/lib/module/register/login.js.map +1 -1
  124. package/lib/module/store/store.js +6 -0
  125. package/lib/module/store/store.js.map +1 -1
  126. package/lib/module/support/ComnyxSupport.js +79 -18
  127. package/lib/module/support/ComnyxSupport.js.map +1 -1
  128. package/lib/module/support/SupportConfigContext.js +59 -0
  129. package/lib/module/support/SupportConfigContext.js.map +1 -0
  130. package/lib/module/support/index.js +1 -0
  131. package/lib/module/support/index.js.map +1 -1
  132. package/lib/module/types/Theme.js +30 -2
  133. package/lib/module/types/Theme.js.map +1 -1
  134. package/lib/module/version.js +1 -1
  135. package/lib/typescript/src/NativeComnyxMediaPicker.d.ts +9 -0
  136. package/lib/typescript/src/NativeComnyxMediaPicker.d.ts.map +1 -1
  137. package/lib/typescript/src/api/conversations.d.ts +2 -2
  138. package/lib/typescript/src/api/conversations.d.ts.map +1 -1
  139. package/lib/typescript/src/api/customers.d.ts +1 -1
  140. package/lib/typescript/src/api/customers.d.ts.map +1 -1
  141. package/lib/typescript/src/api/media.d.ts +3 -3
  142. package/lib/typescript/src/api/media.d.ts.map +1 -1
  143. package/lib/typescript/src/api/messages.d.ts +1 -1
  144. package/lib/typescript/src/api/messages.d.ts.map +1 -1
  145. package/lib/typescript/src/components/ChatList.d.ts.map +1 -1
  146. package/lib/typescript/src/components/ComnyxErrorBoundary.d.ts +18 -0
  147. package/lib/typescript/src/components/ComnyxErrorBoundary.d.ts.map +1 -0
  148. package/lib/typescript/src/components/CustomerForm.d.ts.map +1 -1
  149. package/lib/typescript/src/components/InitFailed.d.ts +5 -2
  150. package/lib/typescript/src/components/InitFailed.d.ts.map +1 -1
  151. package/lib/typescript/src/components/MediaMessageItem.d.ts.map +1 -1
  152. package/lib/typescript/src/components/MediaViewerModal.d.ts.map +1 -1
  153. package/lib/typescript/src/components/MessageInput.d.ts.map +1 -1
  154. package/lib/typescript/src/components/MessageItem.d.ts.map +1 -1
  155. package/lib/typescript/src/hooks/usePolling.d.ts.map +1 -1
  156. package/lib/typescript/src/hooks/useThemeColors.d.ts.map +1 -1
  157. package/lib/typescript/src/index.d.ts +3 -0
  158. package/lib/typescript/src/index.d.ts.map +1 -1
  159. package/lib/typescript/src/notifications/initializeNotifications.d.ts.map +1 -1
  160. package/lib/typescript/src/register/Accumulator.d.ts.map +1 -1
  161. package/lib/typescript/src/register/collectData.d.ts +4 -1
  162. package/lib/typescript/src/register/collectData.d.ts.map +1 -1
  163. package/lib/typescript/src/register/login.d.ts.map +1 -1
  164. package/lib/typescript/src/store/store.d.ts +6 -2
  165. package/lib/typescript/src/store/store.d.ts.map +1 -1
  166. package/lib/typescript/src/support/ComnyxSupport.d.ts +80 -3
  167. package/lib/typescript/src/support/ComnyxSupport.d.ts.map +1 -1
  168. package/lib/typescript/src/support/SupportConfigContext.d.ts +98 -0
  169. package/lib/typescript/src/support/SupportConfigContext.d.ts.map +1 -0
  170. package/lib/typescript/src/support/index.d.ts +2 -0
  171. package/lib/typescript/src/support/index.d.ts.map +1 -1
  172. package/lib/typescript/src/types/Conversation.d.ts +2 -2
  173. package/lib/typescript/src/types/Conversation.d.ts.map +1 -1
  174. package/lib/typescript/src/types/Customer.d.ts +1 -1
  175. package/lib/typescript/src/types/Customer.d.ts.map +1 -1
  176. package/lib/typescript/src/types/MessageResponse.d.ts +7 -4
  177. package/lib/typescript/src/types/MessageResponse.d.ts.map +1 -1
  178. package/lib/typescript/src/types/Theme.d.ts +26 -0
  179. package/lib/typescript/src/types/Theme.d.ts.map +1 -1
  180. package/lib/typescript/src/version.d.ts +1 -1
  181. package/package.json +19 -30
  182. package/src/NativeComnyxMediaPicker.ts +18 -0
  183. package/src/api/conversations.ts +6 -4
  184. package/src/api/customers.ts +3 -1
  185. package/src/api/media.ts +32 -10
  186. package/src/api/messages.ts +3 -1
  187. package/src/components/ChatList.tsx +147 -99
  188. package/src/components/ComnyxErrorBoundary.tsx +91 -0
  189. package/src/components/CustomerForm.tsx +7 -3
  190. package/src/components/InitFailed.tsx +80 -16
  191. package/src/components/MediaMessageItem.tsx +48 -11
  192. package/src/components/MediaViewerModal.tsx +21 -8
  193. package/src/components/MessageInput.tsx +108 -17
  194. package/src/components/MessageItem.tsx +12 -13
  195. package/src/hooks/usePolling.ts +26 -11
  196. package/src/hooks/useThemeColors.ts +11 -2
  197. package/src/index.ts +16 -0
  198. package/src/notifications/initializeNotifications.ts +22 -20
  199. package/src/register/Accumulator.ts +26 -9
  200. package/src/register/collectData.ts +10 -2
  201. package/src/register/login.ts +5 -0
  202. package/src/store/store.ts +11 -3
  203. package/src/support/ComnyxSupport.tsx +172 -23
  204. package/src/support/SupportConfigContext.tsx +157 -0
  205. package/src/support/index.ts +11 -0
  206. package/src/types/Conversation.ts +2 -2
  207. package/src/types/Customer.ts +1 -2
  208. package/src/types/MessageResponse.ts +4 -4
  209. package/src/types/Theme.ts +38 -0
  210. package/src/version.ts +1 -1
package/ios/Comnyx.swift CHANGED
@@ -19,7 +19,8 @@ public class Comnyx: RCTEventEmitter {
19
19
  override init() {
20
20
  super.init()
21
21
  resetBadge()
22
- self.comnyxMessaging = ComnyxMessaging(onNotificationReceived: { notification in
22
+ self.comnyxMessaging = ComnyxMessaging(onNotificationReceived: { [weak self] notification in
23
+ guard let self = self else { return }
23
24
  let notificationData: [String: Any] = [
24
25
  "title": notification.request.content.title,
25
26
  "body": notification.request.content.body,
@@ -42,7 +43,8 @@ public class Comnyx: RCTEventEmitter {
42
43
  ]
43
44
  ]
44
45
  self.sendEvent(withName: "NOTIFICATION_RECEIVED", body: ["notification": notificationData])
45
- }, onNotificationClicked: { response in
46
+ }, onNotificationClicked: { [weak self] response in
47
+ guard let self = self else { return }
46
48
  let responseData: [String: Any] = [
47
49
  "title": response.notification.request.content.title,
48
50
  "body": response.notification.request.content.body,
@@ -139,8 +141,12 @@ public class Comnyx: RCTEventEmitter {
139
141
  let logLevel = options["logLevel"] as? String ?? "warn"
140
142
  NSLog("Comnyx Log Level: \(logLevel) passed from JavaScript. It will be supported in the future.")
141
143
 
142
- self.comnyxMessaging!.initialize(onInitialized: { initialized in
144
+ guard let messaging = self.comnyxMessaging else {
145
+ reject("ERROR_NOT_READY", "Comnyx messaging layer is not initialized", nil)
146
+ return
147
+ }
143
148
 
149
+ messaging.initialize(onInitialized: { initialized in
144
150
  var countryCode = "US"
145
151
  var language = "en"
146
152
  if #available(iOS 16, *) {
@@ -158,7 +164,8 @@ public class Comnyx: RCTEventEmitter {
158
164
  "timezone": timezone,
159
165
  "language": language,
160
166
  ])
161
- }, onApnTokenReceived: { type, token in
167
+ }, onApnTokenReceived: { [weak self] type, token in
168
+ guard let self = self else { return }
162
169
  if(type == "failed"){
163
170
  self.sendEvent(withName: "TOKEN_FAILED", body: ["type": type, "token": nil])
164
171
  }else{
@@ -195,9 +202,10 @@ public class Comnyx: RCTEventEmitter {
195
202
  @objc
196
203
  public static func registerDeviceToken(_ deviceToken: Data) {
197
204
  let token = deviceToken.map { String(format: "%02.2hhx", $0) }.joined()
198
- print("Device Token: \(token)")
205
+ #if DEBUG
206
+ print("[Comnyx] Device Token: \(token)")
207
+ #endif
199
208
 
200
- // Post notification for RCT modules to handle
201
209
  NotificationCenter.default.post(
202
210
  name: NSNotification.Name("RCTRemoteNotificationRegistered"),
203
211
  object: self,
@@ -207,8 +215,9 @@ public class Comnyx: RCTEventEmitter {
207
215
 
208
216
  @objc
209
217
  public static func registerDeviceTokenFailed(_ error: Error) {
210
- print("Device Token Failed: \(error)")
211
- // Post notification for RCT modules to handle
218
+ #if DEBUG
219
+ print("[Comnyx] Device Token Failed: \(error)")
220
+ #endif
212
221
  NotificationCenter.default.post(
213
222
  name: NSNotification.Name("RCTRemoteNotificationRegistrationFailed"),
214
223
  object: self,
@@ -5,6 +5,13 @@ import AVFoundation
5
5
  import AVKit
6
6
  import React
7
7
 
8
+ @inline(__always)
9
+ private func comnyxMediaLog(_ message: @autoclosure () -> String) {
10
+ #if DEBUG
11
+ print(message())
12
+ #endif
13
+ }
14
+
8
15
  @objc(ComnyxMediaPicker)
9
16
  class ComnyxMediaPicker: NSObject, RCTBridgeModule {
10
17
 
@@ -303,7 +310,7 @@ extension ComnyxMediaPicker: PHPickerViewControllerDelegate {
303
310
  provider.loadFileRepresentation(forTypeIdentifier: "public.image") { [weak self] url, error in
304
311
  defer { group.leave() }
305
312
  guard let self = self, let sourceURL = url, error == nil else {
306
- print("[ComnyxMediaPicker] Image load failed: \(error?.localizedDescription ?? "no url")")
313
+ comnyxMediaLog("[ComnyxMediaPicker] Image load failed: \(error?.localizedDescription ?? "no url")")
307
314
  return
308
315
  }
309
316
 
@@ -323,12 +330,12 @@ extension ComnyxMediaPicker: PHPickerViewControllerDelegate {
323
330
  "fileSize": finalData.count,
324
331
  "mimeType": finalMimeType,
325
332
  ]
326
- print("[ComnyxMediaPicker] Image asset ready: \(asset)")
333
+ comnyxMediaLog("[ComnyxMediaPicker] Image asset ready: \(asset)")
327
334
  lock.lock()
328
335
  allAssets.add(asset)
329
336
  lock.unlock()
330
337
  } catch {
331
- print("[ComnyxMediaPicker] Image processing error: \(error)")
338
+ comnyxMediaLog("[ComnyxMediaPicker] Image processing error: \(error)")
332
339
  }
333
340
  }
334
341
  continue
@@ -340,7 +347,7 @@ extension ComnyxMediaPicker: PHPickerViewControllerDelegate {
340
347
  provider.loadFileRepresentation(forTypeIdentifier: "public.movie") { [weak self] url, error in
341
348
  defer { group.leave() }
342
349
  guard let self = self, let sourceURL = url, error == nil else {
343
- print("[ComnyxMediaPicker] Video load failed: \(error?.localizedDescription ?? "no url")")
350
+ comnyxMediaLog("[ComnyxMediaPicker] Video load failed: \(error?.localizedDescription ?? "no url")")
344
351
  return
345
352
  }
346
353
 
@@ -365,12 +372,12 @@ extension ComnyxMediaPicker: PHPickerViewControllerDelegate {
365
372
  if let thumb = thumbnailUri {
366
373
  asset["thumbnailUri"] = thumb
367
374
  }
368
- print("[ComnyxMediaPicker] Video asset ready: \(asset)")
375
+ comnyxMediaLog("[ComnyxMediaPicker] Video asset ready: \(asset)")
369
376
  lock.lock()
370
377
  allAssets.add(asset)
371
378
  lock.unlock()
372
379
  } catch {
373
- print("[ComnyxMediaPicker] Video processing error: \(error)")
380
+ comnyxMediaLog("[ComnyxMediaPicker] Video processing error: \(error)")
374
381
  }
375
382
  }
376
383
  continue
@@ -378,12 +385,12 @@ extension ComnyxMediaPicker: PHPickerViewControllerDelegate {
378
385
  }
379
386
 
380
387
  group.notify(queue: .main) { [weak self] in
381
- print("[ComnyxMediaPicker] All assets processed. Count: \(allAssets.count)")
388
+ comnyxMediaLog("[ComnyxMediaPicker] All assets processed. Count: \(allAssets.count)")
382
389
  if allAssets.count == 0 {
383
390
  self?.resolveBlock?(nil)
384
391
  } else {
385
392
  let result = allAssets.map { $0 }
386
- print("[ComnyxMediaPicker] Resolving with \(result.count) assets")
393
+ comnyxMediaLog("[ComnyxMediaPicker] Resolving with \(result.count) assets")
387
394
  self?.resolveBlock?(result)
388
395
  }
389
396
  self?.resolveBlock = nil
@@ -399,26 +406,40 @@ extension ComnyxMediaPicker: UIImagePickerControllerDelegate, UINavigationContro
399
406
  picker.dismiss(animated: true)
400
407
 
401
408
  if let imageURL = info[.imageURL] as? URL {
402
- do {
403
- let data = try Data(contentsOf: imageURL)
404
- let (finalURL, finalData, finalMimeType) = compressImageIfNeeded(imageURL: imageURL, originalData: data)
405
- resolveWithAsset(url: finalURL, type: "image", mimeType: finalMimeType, fileSize: finalData.count)
406
- } catch {
407
- rejectBlock?("FILE_ERROR", error.localizedDescription, error)
408
- resolveBlock = nil
409
- rejectBlock = nil
409
+ DispatchQueue.global(qos: .userInitiated).async { [weak self] in
410
+ guard let self = self else { return }
411
+ do {
412
+ let data = try Data(contentsOf: imageURL)
413
+ let (finalURL, finalData, finalMimeType) = self.compressImageIfNeeded(imageURL: imageURL, originalData: data)
414
+ DispatchQueue.main.async {
415
+ self.resolveWithAsset(url: finalURL, type: "image", mimeType: finalMimeType, fileSize: finalData.count)
416
+ }
417
+ } catch {
418
+ DispatchQueue.main.async {
419
+ self.rejectBlock?("FILE_ERROR", error.localizedDescription, error)
420
+ self.resolveBlock = nil
421
+ self.rejectBlock = nil
422
+ }
423
+ }
410
424
  }
411
425
  } else if let videoURL = info[.mediaURL] as? URL {
412
- do {
413
- let attrs = try FileManager.default.attributesOfItem(atPath: videoURL.path)
414
- let fileSize = attrs[.size] as? Int ?? 0
415
- let mime = mimeType(for: videoURL)
416
- let thumbnailUri = generateVideoThumbnail(for: videoURL)
417
- resolveWithAsset(url: videoURL, type: "video", mimeType: mime, fileSize: fileSize, thumbnailUri: thumbnailUri)
418
- } catch {
419
- rejectBlock?("FILE_ERROR", error.localizedDescription, error)
420
- resolveBlock = nil
421
- rejectBlock = nil
426
+ DispatchQueue.global(qos: .userInitiated).async { [weak self] in
427
+ guard let self = self else { return }
428
+ do {
429
+ let attrs = try FileManager.default.attributesOfItem(atPath: videoURL.path)
430
+ let fileSize = attrs[.size] as? Int ?? 0
431
+ let mime = self.mimeType(for: videoURL)
432
+ let thumbnailUri = self.generateVideoThumbnail(for: videoURL)
433
+ DispatchQueue.main.async {
434
+ self.resolveWithAsset(url: videoURL, type: "video", mimeType: mime, fileSize: fileSize, thumbnailUri: thumbnailUri)
435
+ }
436
+ } catch {
437
+ DispatchQueue.main.async {
438
+ self.rejectBlock?("FILE_ERROR", error.localizedDescription, error)
439
+ self.resolveBlock = nil
440
+ self.rejectBlock = nil
441
+ }
442
+ }
422
443
  }
423
444
  } else {
424
445
  resolveBlock?(nil)
@@ -35,7 +35,9 @@ class ComnyxMessaging: NSObject, UNUserNotificationCenterDelegate {
35
35
  self.completeInitialize()
36
36
  onInitialized(true)
37
37
  }else{
38
+ #if DEBUG
38
39
  print("[Comnyx] permission not granted")
40
+ #endif
39
41
  onInitialized(false)
40
42
  }
41
43
  })
@@ -0,0 +1,32 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>NSPrivacyTracking</key>
6
+ <false/>
7
+ <key>NSPrivacyTrackingDomains</key>
8
+ <array/>
9
+ <key>NSPrivacyCollectedDataTypes</key>
10
+ <array/>
11
+ <key>NSPrivacyAccessedAPITypes</key>
12
+ <array>
13
+ <dict>
14
+ <key>NSPrivacyAccessedAPIType</key>
15
+ <string>NSPrivacyAccessedAPICategoryUserDefaults</string>
16
+ <key>NSPrivacyAccessedAPITypeReasons</key>
17
+ <array>
18
+ <string>CA92.1</string>
19
+ </array>
20
+ </dict>
21
+ <dict>
22
+ <key>NSPrivacyAccessedAPIType</key>
23
+ <string>NSPrivacyAccessedAPICategoryFileTimestamp</string>
24
+ <key>NSPrivacyAccessedAPITypeReasons</key>
25
+ <array>
26
+ <string>C617.1</string>
27
+ <string>3B52.1</string>
28
+ </array>
29
+ </dict>
30
+ </array>
31
+ </dict>
32
+ </plist>
@@ -0,0 +1,25 @@
1
+ # Comnyx iOS post-install helpers.
2
+ #
3
+ # Usage in a host app's Podfile:
4
+ #
5
+ # require_relative '../node_modules/@developer_tribe/react-native-comnyx/ios/comnyx_post_install'
6
+ #
7
+ # post_install do |installer|
8
+ # comnyx_post_install(installer)
9
+ # react_native_post_install(installer, config[:reactNativePath], :mac_catalyst_enabled => false)
10
+ # end
11
+ #
12
+ # What this does:
13
+ # React Native 0.85 ships React-Core as a prebuilt XCFramework whose umbrella
14
+ # header re-imports non-modular React-Core headers. Xcode 26 Clang explicit
15
+ # modules rejects that, failing the pod build. Enabling
16
+ # CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES on every pod target
17
+ # lets the umbrella compile. Safe on older RN versions (no-op there).
18
+
19
+ def comnyx_post_install(installer)
20
+ installer.pods_project.targets.each do |target|
21
+ target.build_configurations.each do |config|
22
+ config.build_settings['CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES'] = 'YES'
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,25 @@
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+
9
+ #import <Foundation/Foundation.h>
10
+
11
+ #if __has_include(<React-RCTAppDelegate/RCTDependencyProvider.h>)
12
+ #import <React-RCTAppDelegate/RCTDependencyProvider.h>
13
+ #elif __has_include(<React_RCTAppDelegate/RCTDependencyProvider.h>)
14
+ #import <React_RCTAppDelegate/RCTDependencyProvider.h>
15
+ #else
16
+ #import "RCTDependencyProvider.h"
17
+ #endif
18
+
19
+ NS_ASSUME_NONNULL_BEGIN
20
+
21
+ @interface RCTAppDependencyProvider : NSObject <RCTDependencyProvider>
22
+
23
+ @end
24
+
25
+ NS_ASSUME_NONNULL_END
@@ -0,0 +1,55 @@
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ #import "RCTAppDependencyProvider.h"
9
+ #import <ReactCodegen/RCTModulesConformingToProtocolsProvider.h>
10
+ #import <ReactCodegen/RCTThirdPartyComponentsProvider.h>
11
+
12
+ @implementation RCTAppDependencyProvider {
13
+ NSArray<NSString *> * _URLRequestHandlerClassNames;
14
+ NSArray<NSString *> * _imageDataDecoderClassNames;
15
+ NSArray<NSString *> * _imageURLLoaderClassNames;
16
+ NSDictionary<NSString *,Class<RCTComponentViewProtocol>> * _thirdPartyFabricComponents;
17
+ }
18
+
19
+ - (nonnull NSArray<NSString *> *)URLRequestHandlerClassNames {
20
+ static dispatch_once_t requestUrlToken;
21
+ dispatch_once(&requestUrlToken, ^{
22
+ self->_URLRequestHandlerClassNames = RCTModulesConformingToProtocolsProvider.URLRequestHandlerClassNames;
23
+ });
24
+
25
+ return _URLRequestHandlerClassNames;
26
+ }
27
+
28
+ - (nonnull NSArray<NSString *> *)imageDataDecoderClassNames {
29
+ static dispatch_once_t dataDecoderToken;
30
+ dispatch_once(&dataDecoderToken, ^{
31
+ _imageDataDecoderClassNames = RCTModulesConformingToProtocolsProvider.imageDataDecoderClassNames;
32
+ });
33
+
34
+ return _imageDataDecoderClassNames;
35
+ }
36
+
37
+ - (nonnull NSArray<NSString *> *)imageURLLoaderClassNames {
38
+ static dispatch_once_t urlLoaderToken;
39
+ dispatch_once(&urlLoaderToken, ^{
40
+ _imageURLLoaderClassNames = RCTModulesConformingToProtocolsProvider.imageURLLoaderClassNames;
41
+ });
42
+
43
+ return _imageURLLoaderClassNames;
44
+ }
45
+
46
+ - (nonnull NSDictionary<NSString *,Class<RCTComponentViewProtocol>> *)thirdPartyFabricComponents {
47
+ static dispatch_once_t nativeComponentsToken;
48
+ dispatch_once(&nativeComponentsToken, ^{
49
+ _thirdPartyFabricComponents = RCTThirdPartyComponentsProvider.thirdPartyFabricComponents;
50
+ });
51
+
52
+ return _thirdPartyFabricComponents;
53
+ }
54
+
55
+ @end
@@ -0,0 +1,18 @@
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ #import <Foundation/Foundation.h>
9
+
10
+ @interface RCTModulesConformingToProtocolsProvider: NSObject
11
+
12
+ +(NSArray<NSString *> *)imageURLLoaderClassNames;
13
+
14
+ +(NSArray<NSString *> *)imageDataDecoderClassNames;
15
+
16
+ +(NSArray<NSString *> *)URLRequestHandlerClassNames;
17
+
18
+ @end
@@ -0,0 +1,33 @@
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ #import "RCTModulesConformingToProtocolsProvider.h"
9
+
10
+ @implementation RCTModulesConformingToProtocolsProvider
11
+
12
+ +(NSArray<NSString *> *)imageURLLoaderClassNames
13
+ {
14
+ return @[
15
+
16
+ ];
17
+ }
18
+
19
+ +(NSArray<NSString *> *)imageDataDecoderClassNames
20
+ {
21
+ return @[
22
+
23
+ ];
24
+ }
25
+
26
+ +(NSArray<NSString *> *)URLRequestHandlerClassNames
27
+ {
28
+ return @[
29
+
30
+ ];
31
+ }
32
+
33
+ @end
@@ -0,0 +1,16 @@
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ #import <Foundation/Foundation.h>
9
+
10
+ @protocol RCTComponentViewProtocol;
11
+
12
+ @interface RCTThirdPartyComponentsProvider: NSObject
13
+
14
+ + (NSDictionary<NSString *, Class<RCTComponentViewProtocol>> *)thirdPartyFabricComponents;
15
+
16
+ @end
@@ -0,0 +1,23 @@
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+
9
+ #import <Foundation/Foundation.h>
10
+
11
+ #import "RCTThirdPartyComponentsProvider.h"
12
+ #import <React/RCTComponentViewProtocol.h>
13
+
14
+ @implementation RCTThirdPartyComponentsProvider
15
+
16
+ + (NSDictionary<NSString *, Class<RCTComponentViewProtocol>> *)thirdPartyFabricComponents
17
+ {
18
+ return @{
19
+
20
+ };
21
+ }
22
+
23
+ @end
@@ -0,0 +1,53 @@
1
+ /**
2
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
3
+ *
4
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
5
+ * once the code is regenerated.
6
+ *
7
+ * @generated by codegen project: GenerateModuleObjCpp
8
+ *
9
+ * We create an umbrella header (and corresponding implementation) here since
10
+ * Cxx compilation in BUCK has a limitation: source-code producing genrule()s
11
+ * must have a single output. More files => more genrule()s => slower builds.
12
+ */
13
+
14
+ #import "RNComnyxSpec.h"
15
+
16
+
17
+ @implementation NativeComnyxSpecBase
18
+
19
+
20
+ - (void)setEventEmitterCallback:(EventEmitterCallbackWrapper *)eventEmitterCallbackWrapper
21
+ {
22
+ _eventEmitterCallback = std::move(eventEmitterCallbackWrapper->_eventEmitterCallback);
23
+ }
24
+ @end
25
+
26
+
27
+ namespace facebook::react {
28
+
29
+ static facebook::jsi::Value __hostFunction_NativeComnyxSpecJSI_initialize(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
30
+ return static_cast<ObjCTurboModule&>(turboModule).invokeObjCMethod(rt, PromiseKind, "initialize", @selector(initialize:reject:), args, count);
31
+ }
32
+
33
+ static facebook::jsi::Value __hostFunction_NativeComnyxSpecJSI_checkOptIn(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
34
+ return static_cast<ObjCTurboModule&>(turboModule).invokeObjCMethod(rt, PromiseKind, "checkOptIn", @selector(checkOptIn:reject:), args, count);
35
+ }
36
+
37
+ static facebook::jsi::Value __hostFunction_NativeComnyxSpecJSI_optIn(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
38
+ return static_cast<ObjCTurboModule&>(turboModule).invokeObjCMethod(rt, PromiseKind, "optIn", @selector(optIn:reject:), args, count);
39
+ }
40
+
41
+ NativeComnyxSpecJSI::NativeComnyxSpecJSI(const ObjCTurboModule::InitParams &params)
42
+ : ObjCTurboModule(params) {
43
+
44
+ methodMap_["initialize"] = MethodMetadata {0, __hostFunction_NativeComnyxSpecJSI_initialize};
45
+
46
+
47
+ methodMap_["checkOptIn"] = MethodMetadata {0, __hostFunction_NativeComnyxSpecJSI_checkOptIn};
48
+
49
+
50
+ methodMap_["optIn"] = MethodMetadata {0, __hostFunction_NativeComnyxSpecJSI_optIn};
51
+
52
+ }
53
+ } // namespace facebook::react
@@ -0,0 +1,67 @@
1
+ /**
2
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
3
+ *
4
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
5
+ * once the code is regenerated.
6
+ *
7
+ * @generated by codegen project: GenerateModuleObjCpp
8
+ *
9
+ * We create an umbrella header (and corresponding implementation) here since
10
+ * Cxx compilation in BUCK has a limitation: source-code producing genrule()s
11
+ * must have a single output. More files => more genrule()s => slower builds.
12
+ */
13
+
14
+ #ifndef __cplusplus
15
+ #error This file must be compiled as Obj-C++. If you are importing it, you must change your file extension to .mm.
16
+ #endif
17
+
18
+ // Avoid multiple includes of RNComnyxSpec symbols
19
+ #ifndef RNComnyxSpec_H
20
+ #define RNComnyxSpec_H
21
+
22
+ #import <Foundation/Foundation.h>
23
+ #import <RCTRequired/RCTRequired.h>
24
+ #import <RCTTypeSafety/RCTConvertHelpers.h>
25
+ #import <RCTTypeSafety/RCTTypedModuleConstants.h>
26
+ #import <React/RCTBridgeModule.h>
27
+ #import <React/RCTCxxConvert.h>
28
+ #import <React/RCTManagedPointer.h>
29
+ #import <ReactCommon/RCTTurboModule.h>
30
+ #import <optional>
31
+ #import <vector>
32
+
33
+
34
+ NS_ASSUME_NONNULL_BEGIN
35
+
36
+ @protocol NativeComnyxSpec <RCTBridgeModule, RCTTurboModule>
37
+
38
+ - (void)initialize:(RCTPromiseResolveBlock)resolve
39
+ reject:(RCTPromiseRejectBlock)reject;
40
+ - (void)checkOptIn:(RCTPromiseResolveBlock)resolve
41
+ reject:(RCTPromiseRejectBlock)reject;
42
+ - (void)optIn:(RCTPromiseResolveBlock)resolve
43
+ reject:(RCTPromiseRejectBlock)reject;
44
+
45
+ @end
46
+
47
+ @interface NativeComnyxSpecBase : NSObject {
48
+ @protected
49
+ facebook::react::EventEmitterCallback _eventEmitterCallback;
50
+ }
51
+ - (void)setEventEmitterCallback:(EventEmitterCallbackWrapper *)eventEmitterCallbackWrapper;
52
+
53
+
54
+ @end
55
+
56
+ namespace facebook::react {
57
+ /**
58
+ * ObjC++ class for module 'NativeComnyx'
59
+ */
60
+ class JSI_EXPORT NativeComnyxSpecJSI : public ObjCTurboModule {
61
+ public:
62
+ NativeComnyxSpecJSI(const ObjCTurboModule::InitParams &params);
63
+ };
64
+ } // namespace facebook::react
65
+
66
+ NS_ASSUME_NONNULL_END
67
+ #endif // RNComnyxSpec_H
@@ -0,0 +1,38 @@
1
+ /**
2
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
3
+ *
4
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
5
+ * once the code is regenerated.
6
+ *
7
+ * @generated by codegen project: GenerateModuleCpp.js
8
+ */
9
+
10
+ #include "RNComnyxSpecJSI.h"
11
+
12
+ namespace facebook::react {
13
+
14
+ static jsi::Value __hostFunction_NativeComnyxCxxSpecJSI_initialize(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
15
+ return static_cast<NativeComnyxCxxSpecJSI *>(&turboModule)->initialize(
16
+ rt
17
+ );
18
+ }
19
+ static jsi::Value __hostFunction_NativeComnyxCxxSpecJSI_checkOptIn(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
20
+ return static_cast<NativeComnyxCxxSpecJSI *>(&turboModule)->checkOptIn(
21
+ rt
22
+ );
23
+ }
24
+ static jsi::Value __hostFunction_NativeComnyxCxxSpecJSI_optIn(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
25
+ return static_cast<NativeComnyxCxxSpecJSI *>(&turboModule)->optIn(
26
+ rt
27
+ );
28
+ }
29
+
30
+ NativeComnyxCxxSpecJSI::NativeComnyxCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker)
31
+ : TurboModule("Comnyx", jsInvoker) {
32
+ methodMap_["initialize"] = MethodMetadata {0, __hostFunction_NativeComnyxCxxSpecJSI_initialize};
33
+ methodMap_["checkOptIn"] = MethodMetadata {0, __hostFunction_NativeComnyxCxxSpecJSI_checkOptIn};
34
+ methodMap_["optIn"] = MethodMetadata {0, __hostFunction_NativeComnyxCxxSpecJSI_optIn};
35
+ }
36
+
37
+
38
+ } // namespace facebook::react