@kaleyra/video-react-native-module 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (271) hide show
  1. package/LICENSE +165 -0
  2. package/README.md +292 -0
  3. package/android/build.gradle +100 -0
  4. package/android/gradle.properties +9 -0
  5. package/android/settings.gradle +6 -0
  6. package/android/src/main/AndroidManifest.xml +1 -0
  7. package/android/src/main/assets/kaleyra_video_wrapper_info.txt +1 -0
  8. package/android/src/main/java/com/kaleyra/video_react_native_module/ReactNativeAccessTokenProvider.kt +22 -0
  9. package/android/src/main/java/com/kaleyra/video_react_native_module/ReactNativeContextContainer.kt +9 -0
  10. package/android/src/main/java/com/kaleyra/video_react_native_module/ReactNativeVideoHybridBridge.kt +30 -0
  11. package/android/src/main/java/com/kaleyra/video_react_native_module/VideoNativeEmitter.kt +45 -0
  12. package/android/src/main/java/com/kaleyra/video_react_native_module/VideoNativeModule.kt +109 -0
  13. package/android/src/main/java/com/kaleyra/video_react_native_module/VideoReactPackage.kt +20 -0
  14. package/index.ts +47 -0
  15. package/ios/PluginInfo/_KaleyraVideoHybridVersionInfo.swift +31 -0
  16. package/ios/ReactEvents/ReactNativeEventEmitter.swift +31 -0
  17. package/ios/ReactEvents/VideoNativeEmitter.m +17 -0
  18. package/ios/ReactEvents/VideoNativeEmitter.swift +42 -0
  19. package/ios/ReactNativePlugin-Bridging-Header.h +5 -0
  20. package/ios/ReactNativePlugin.xcodeproj/project.pbxproj +301 -0
  21. package/ios/VideoNativeModule.m +45 -0
  22. package/ios/VideoNativeModule.swift +154 -0
  23. package/lib/commonjs/index.js +12 -0
  24. package/lib/commonjs/native-bridge/TypeScript/Environments.js +41 -0
  25. package/lib/commonjs/native-bridge/TypeScript/Events.js +46 -0
  26. package/lib/commonjs/native-bridge/TypeScript/Regions.js +47 -0
  27. package/lib/commonjs/native-bridge/TypeScript/UserDetailsFormatValidator.js +32 -0
  28. package/lib/commonjs/native-bridge/TypeScript/errors/IllegalArgumentError.js +12 -0
  29. package/lib/commonjs/native-bridge/TypeScript/types/AccessTokenRequest.js +4 -0
  30. package/lib/commonjs/native-bridge/TypeScript/types/AccessTokenResponse.js +36 -0
  31. package/lib/commonjs/native-bridge/TypeScript/types/AudioCallOptions.js +4 -0
  32. package/lib/commonjs/native-bridge/TypeScript/types/AudioCallType.js +19 -0
  33. package/lib/commonjs/native-bridge/TypeScript/types/CallDisplayMode.js +23 -0
  34. package/lib/commonjs/native-bridge/TypeScript/types/CallKitConfiguration.js +4 -0
  35. package/lib/commonjs/native-bridge/TypeScript/types/CallOptions.js +4 -0
  36. package/lib/commonjs/native-bridge/TypeScript/types/CallType.js +23 -0
  37. package/lib/commonjs/native-bridge/TypeScript/types/ChatToolConfiguration.js +4 -0
  38. package/lib/commonjs/native-bridge/TypeScript/types/CreateCallOptions.js +4 -0
  39. package/lib/commonjs/native-bridge/TypeScript/types/Environment.js +4 -0
  40. package/lib/commonjs/native-bridge/TypeScript/types/IosConfiguration.js +4 -0
  41. package/lib/commonjs/native-bridge/TypeScript/types/KaleyraVideoConfiguration.js +4 -0
  42. package/lib/commonjs/native-bridge/TypeScript/types/RecordingType.js +23 -0
  43. package/lib/commonjs/native-bridge/TypeScript/types/Region.js +4 -0
  44. package/lib/commonjs/native-bridge/TypeScript/types/ScreenShareToolConfiguration.js +4 -0
  45. package/lib/commonjs/native-bridge/TypeScript/types/Session.js +4 -0
  46. package/lib/commonjs/native-bridge/TypeScript/types/Tools.js +4 -0
  47. package/lib/commonjs/native-bridge/TypeScript/types/UserDetails.js +4 -0
  48. package/lib/commonjs/native-bridge/TypeScript/types/UserDetailsFormat.js +4 -0
  49. package/lib/commonjs/native-bridge/TypeScript/types/VoipHandlingStrategy.js +19 -0
  50. package/lib/commonjs/src/KaleyraVideo.js +259 -0
  51. package/lib/commonjs/src/ReactNativeEventEmitter.js +40 -0
  52. package/lib/commonjs/src/events/Events.js +4 -0
  53. package/lib/module/index.js +2 -0
  54. package/lib/module/native-bridge/TypeScript/Environments.js +37 -0
  55. package/lib/module/native-bridge/TypeScript/Events.js +43 -0
  56. package/lib/module/native-bridge/TypeScript/Regions.js +43 -0
  57. package/lib/module/native-bridge/TypeScript/UserDetailsFormatValidator.js +28 -0
  58. package/lib/module/native-bridge/TypeScript/errors/IllegalArgumentError.js +8 -0
  59. package/lib/module/native-bridge/TypeScript/types/AccessTokenRequest.js +3 -0
  60. package/lib/module/native-bridge/TypeScript/types/AccessTokenResponse.js +32 -0
  61. package/lib/module/native-bridge/TypeScript/types/AudioCallOptions.js +3 -0
  62. package/lib/module/native-bridge/TypeScript/types/AudioCallType.js +16 -0
  63. package/lib/module/native-bridge/TypeScript/types/CallDisplayMode.js +20 -0
  64. package/lib/module/native-bridge/TypeScript/types/CallKitConfiguration.js +3 -0
  65. package/lib/module/native-bridge/TypeScript/types/CallOptions.js +3 -0
  66. package/lib/module/native-bridge/TypeScript/types/CallType.js +20 -0
  67. package/lib/module/native-bridge/TypeScript/types/ChatToolConfiguration.js +3 -0
  68. package/lib/module/native-bridge/TypeScript/types/CreateCallOptions.js +3 -0
  69. package/lib/module/native-bridge/TypeScript/types/Environment.js +3 -0
  70. package/lib/module/native-bridge/TypeScript/types/IosConfiguration.js +3 -0
  71. package/lib/module/native-bridge/TypeScript/types/KaleyraVideoConfiguration.js +3 -0
  72. package/lib/module/native-bridge/TypeScript/types/RecordingType.js +20 -0
  73. package/lib/module/native-bridge/TypeScript/types/Region.js +3 -0
  74. package/lib/module/native-bridge/TypeScript/types/ScreenShareToolConfiguration.js +3 -0
  75. package/lib/module/native-bridge/TypeScript/types/Session.js +3 -0
  76. package/lib/module/native-bridge/TypeScript/types/Tools.js +3 -0
  77. package/lib/module/native-bridge/TypeScript/types/UserDetails.js +3 -0
  78. package/lib/module/native-bridge/TypeScript/types/UserDetailsFormat.js +3 -0
  79. package/lib/module/native-bridge/TypeScript/types/VoipHandlingStrategy.js +16 -0
  80. package/lib/module/src/KaleyraVideo.js +249 -0
  81. package/lib/module/src/ReactNativeEventEmitter.js +36 -0
  82. package/lib/module/src/events/Events.js +3 -0
  83. package/lib/typescript/index.d.ts +2 -0
  84. package/lib/typescript/native-bridge/TypeScript/Environments.d.ts +28 -0
  85. package/lib/typescript/native-bridge/TypeScript/Events.d.ts +40 -0
  86. package/lib/typescript/native-bridge/TypeScript/Regions.d.ts +32 -0
  87. package/lib/typescript/native-bridge/TypeScript/UserDetailsFormatValidator.d.ts +4 -0
  88. package/lib/typescript/native-bridge/TypeScript/errors/IllegalArgumentError.d.ts +6 -0
  89. package/lib/typescript/native-bridge/TypeScript/types/AccessTokenRequest.d.ts +4 -0
  90. package/lib/typescript/native-bridge/TypeScript/types/AccessTokenResponse.d.ts +12 -0
  91. package/lib/typescript/native-bridge/TypeScript/types/AudioCallOptions.d.ts +11 -0
  92. package/lib/typescript/native-bridge/TypeScript/types/AudioCallType.d.ts +13 -0
  93. package/lib/typescript/native-bridge/TypeScript/types/CallDisplayMode.d.ts +17 -0
  94. package/lib/typescript/native-bridge/TypeScript/types/CallKitConfiguration.d.ts +26 -0
  95. package/lib/typescript/native-bridge/TypeScript/types/CallOptions.d.ts +13 -0
  96. package/lib/typescript/native-bridge/TypeScript/types/CallType.d.ts +17 -0
  97. package/lib/typescript/native-bridge/TypeScript/types/ChatToolConfiguration.d.ts +15 -0
  98. package/lib/typescript/native-bridge/TypeScript/types/CreateCallOptions.d.ts +15 -0
  99. package/lib/typescript/native-bridge/TypeScript/types/Environment.d.ts +9 -0
  100. package/lib/typescript/native-bridge/TypeScript/types/IosConfiguration.d.ts +23 -0
  101. package/lib/typescript/native-bridge/TypeScript/types/KaleyraVideoConfiguration.d.ts +33 -0
  102. package/lib/typescript/native-bridge/TypeScript/types/RecordingType.d.ts +17 -0
  103. package/lib/typescript/native-bridge/TypeScript/types/Region.d.ts +9 -0
  104. package/lib/typescript/native-bridge/TypeScript/types/ScreenShareToolConfiguration.d.ts +19 -0
  105. package/lib/typescript/native-bridge/TypeScript/types/Session.d.ts +16 -0
  106. package/lib/typescript/native-bridge/TypeScript/types/Tools.d.ts +42 -0
  107. package/lib/typescript/native-bridge/TypeScript/types/UserDetails.d.ts +29 -0
  108. package/lib/typescript/native-bridge/TypeScript/types/UserDetailsFormat.d.ts +19 -0
  109. package/lib/typescript/native-bridge/TypeScript/types/VoipHandlingStrategy.d.ts +13 -0
  110. package/lib/typescript/src/KaleyraVideo.d.ts +125 -0
  111. package/lib/typescript/src/ReactNativeEventEmitter.d.ts +15 -0
  112. package/lib/typescript/src/events/Events.d.ts +37 -0
  113. package/native-bridge/LICENSE +165 -0
  114. package/native-bridge/TypeScript/Environments.ts +44 -0
  115. package/native-bridge/TypeScript/Events.ts +43 -0
  116. package/native-bridge/TypeScript/Regions.ts +51 -0
  117. package/native-bridge/TypeScript/UserDetailsFormatValidator.ts +35 -0
  118. package/native-bridge/TypeScript/errors/IllegalArgumentError.ts +9 -0
  119. package/native-bridge/TypeScript/types/AccessTokenRequest.ts +7 -0
  120. package/native-bridge/TypeScript/types/AccessTokenResponse.ts +41 -0
  121. package/native-bridge/TypeScript/types/AudioCallOptions.ts +15 -0
  122. package/native-bridge/TypeScript/types/AudioCallType.ts +17 -0
  123. package/native-bridge/TypeScript/types/CallDisplayMode.ts +22 -0
  124. package/native-bridge/TypeScript/types/CallKitConfiguration.ts +32 -0
  125. package/native-bridge/TypeScript/types/CallOptions.ts +18 -0
  126. package/native-bridge/TypeScript/types/CallType.ts +22 -0
  127. package/native-bridge/TypeScript/types/ChatToolConfiguration.ts +21 -0
  128. package/native-bridge/TypeScript/types/CreateCallOptions.ts +20 -0
  129. package/native-bridge/TypeScript/types/Environment.ts +12 -0
  130. package/native-bridge/TypeScript/types/IosConfiguration.ts +29 -0
  131. package/native-bridge/TypeScript/types/KaleyraVideoConfiguration.ts +42 -0
  132. package/native-bridge/TypeScript/types/RecordingType.ts +22 -0
  133. package/native-bridge/TypeScript/types/Region.ts +12 -0
  134. package/native-bridge/TypeScript/types/ScreenShareToolConfiguration.ts +24 -0
  135. package/native-bridge/TypeScript/types/Session.ts +20 -0
  136. package/native-bridge/TypeScript/types/Tools.ts +50 -0
  137. package/native-bridge/TypeScript/types/UserDetails.ts +37 -0
  138. package/native-bridge/TypeScript/types/UserDetailsFormat.ts +23 -0
  139. package/native-bridge/TypeScript/types/VoipHandlingStrategy.ts +17 -0
  140. package/native-bridge/android/build.gradle +72 -0
  141. package/native-bridge/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  142. package/native-bridge/android/gradle/wrapper/gradle-wrapper.properties +5 -0
  143. package/native-bridge/android/gradle.properties +22 -0
  144. package/native-bridge/android/gradlew +234 -0
  145. package/native-bridge/android/gradlew.bat +89 -0
  146. package/native-bridge/android/settings.gradle +1 -0
  147. package/native-bridge/android/src/main/AndroidManifest.xml +1 -0
  148. package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/AccessTokenProvider.kt +8 -0
  149. package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/CallOptionsProxy.kt +9 -0
  150. package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/ContextContainer.kt +10 -0
  151. package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/DTOs.kt +407 -0
  152. package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/SDKAccessTokenProviderProxy.kt +16 -0
  153. package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/VideoHybridBridge.kt +21 -0
  154. package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/VideoSDKHybridBridge.kt +64 -0
  155. package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/configurator/CachedSDKConfigurator.kt +15 -0
  156. package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/configurator/VideoSDKConfigurator.kt +46 -0
  157. package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/connector/CachedUserConnector.kt +15 -0
  158. package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/connector/VideoSDKCachedUserConnector.kt +60 -0
  159. package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/events/Events.kt +29 -0
  160. package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/events/EventsEmitter.kt +8 -0
  161. package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/events/EventsReporter.kt +9 -0
  162. package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/events/reporter/CallEventsReporter.kt +54 -0
  163. package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/events/reporter/ChatEventsReporter.kt +43 -0
  164. package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/events/reporter/CrossPlatformModuleStatus.kt +29 -0
  165. package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/events/reporter/ModuleEventsReporter.kt +34 -0
  166. package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/events/reporter/SDKEventsReporter.kt +63 -0
  167. package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/extensions/CallDisplayExtension.kt +15 -0
  168. package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/extensions/ConfigurationExtension.kt +39 -0
  169. package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/extensions/EnvironmentExtension.kt +12 -0
  170. package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/extensions/RecordingTypeExtension.kt +15 -0
  171. package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/extensions/RegionExtension.kt +13 -0
  172. package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/extensions/ScreenShareToolConfigurationExtension.kt +15 -0
  173. package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/extensions/ToolsExtension.kt +95 -0
  174. package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/extensions/UserExtensions.kt +35 -0
  175. package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/notifications/KaleyraVideoNotificationReceiver.kt +139 -0
  176. package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/notifications/KaleyraVideoNotificationService.kt +85 -0
  177. package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/repository/ConfigurationEntity.kt +27 -0
  178. package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/repository/ConnectedUserEntity.kt +30 -0
  179. package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/repository/Converters.kt +25 -0
  180. package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/repository/UserDetailsDao.kt +21 -0
  181. package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/repository/UserDetailsEntity.kt +22 -0
  182. package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/repository/VideoHybridBridgeRepository.kt +39 -0
  183. package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/ui/SDKUserInterfacePresenter.kt +49 -0
  184. package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/ui/UserInterfacePresenter.kt +14 -0
  185. package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/user_details/CachedUserDetails.kt +18 -0
  186. package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/user_details/CachedUserDetailsFormatter.kt +59 -0
  187. package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/user_details/SDKCachedUserDetails.kt +74 -0
  188. package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/utils/CaseInsensitiveEnumTypeAdapterFactory.kt +48 -0
  189. package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/utils/TLSSocketFactoryCompat.kt +76 -0
  190. package/native-bridge/iOS/KaleyraVideoHybridNativeBridge.xcodeproj/project.pbxproj +1399 -0
  191. package/native-bridge/iOS/KaleyraVideoHybridNativeBridge.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  192. package/native-bridge/iOS/KaleyraVideoHybridNativeBridge.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  193. package/native-bridge/iOS/KaleyraVideoHybridNativeBridge.xcodeproj/xcshareddata/IDETemplateMacros.plist +9 -0
  194. package/native-bridge/iOS/KaleyraVideoHybridNativeBridge.xcodeproj/xcshareddata/xcschemes/KaleyraVideoHybridNativeBridge.xcscheme +79 -0
  195. package/native-bridge/iOS/KaleyraVideoHybridNativeBridge.xcworkspace/contents.xcworkspacedata +10 -0
  196. package/native-bridge/iOS/KaleyraVideoHybridNativeBridge.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  197. package/native-bridge/iOS/Podfile +28 -0
  198. package/native-bridge/iOS/Podfile.lock +20 -0
  199. package/native-bridge/iOS/Source/Abstractions/BandyerSDKProtocol.swift +24 -0
  200. package/native-bridge/iOS/Source/Abstractions/CallWindowProtocol.swift +18 -0
  201. package/native-bridge/iOS/Source/AccessToken/AccessTokenRequester.swift +9 -0
  202. package/native-bridge/iOS/Source/AccessToken/TokenProvider.swift +78 -0
  203. package/native-bridge/iOS/Source/Broadcast/BroadcastConfigurationPlistReader.swift +49 -0
  204. package/native-bridge/iOS/Source/Concurrency/DispatchQueue+isMain.swift +19 -0
  205. package/native-bridge/iOS/Source/Concurrency/Lock.swift +21 -0
  206. package/native-bridge/iOS/Source/Concurrency/MainQueueDispatcher.swift +23 -0
  207. package/native-bridge/iOS/Source/Concurrency/MainQueueRelay.swift +18 -0
  208. package/native-bridge/iOS/Source/DTOs/AccessTokenRequest+Encodable.swift +27 -0
  209. package/native-bridge/iOS/Source/DTOs/AccessTokenResponse+Decodable.swift +24 -0
  210. package/native-bridge/iOS/Source/DTOs/Array+JSON.swift +6 -0
  211. package/native-bridge/iOS/Source/DTOs/AudioCallOptions+Bandyer.swift +14 -0
  212. package/native-bridge/iOS/Source/DTOs/AudioCallOptions+Decodable.swift +18 -0
  213. package/native-bridge/iOS/Source/DTOs/AudioCallOptions+Equatable.swift +12 -0
  214. package/native-bridge/iOS/Source/DTOs/AudioCallType+Bandyer.swift +18 -0
  215. package/native-bridge/iOS/Source/DTOs/AudioCallType+Decodable.swift +25 -0
  216. package/native-bridge/iOS/Source/DTOs/CallKitConfiguration+Decodable.swift +20 -0
  217. package/native-bridge/iOS/Source/DTOs/CallOptions+Bandyer.swift +14 -0
  218. package/native-bridge/iOS/Source/DTOs/CallOptions+Decodable.swift +16 -0
  219. package/native-bridge/iOS/Source/DTOs/CallOptions+Equatable.swift +12 -0
  220. package/native-bridge/iOS/Source/DTOs/CallType+Bandyer.swift +20 -0
  221. package/native-bridge/iOS/Source/DTOs/CallType+Decodable.swift +27 -0
  222. package/native-bridge/iOS/Source/DTOs/ChatToolConfiguration+Decodable.swift +18 -0
  223. package/native-bridge/iOS/Source/DTOs/CreateCallOptions+Decodable.swift +22 -0
  224. package/native-bridge/iOS/Source/DTOs/CreateCallOptions+Equatable.swift +13 -0
  225. package/native-bridge/iOS/Source/DTOs/CreateCallOptions+Intent.swift +17 -0
  226. package/native-bridge/iOS/Source/DTOs/DTOs.swift +314 -0
  227. package/native-bridge/iOS/Source/DTOs/Environment+Bandyer.swift +20 -0
  228. package/native-bridge/iOS/Source/DTOs/Environment+Decodable.swift +16 -0
  229. package/native-bridge/iOS/Source/DTOs/IosConfiguration+Decodable.swift +18 -0
  230. package/native-bridge/iOS/Source/DTOs/JSONDecodable.swift +27 -0
  231. package/native-bridge/iOS/Source/DTOs/KaleyraVideoConfiguration+Bandyer.swift +158 -0
  232. package/native-bridge/iOS/Source/DTOs/KaleyraVideoConfiguration+Decodable.swift +28 -0
  233. package/native-bridge/iOS/Source/DTOs/KaleyraVideoConfiguration+UserInterfacePresenterConfiguration.swift +29 -0
  234. package/native-bridge/iOS/Source/DTOs/RecordingType+Bandyer.swift +33 -0
  235. package/native-bridge/iOS/Source/DTOs/RecordingType+Decodable.swift +27 -0
  236. package/native-bridge/iOS/Source/DTOs/Region+Bandyer.swift +22 -0
  237. package/native-bridge/iOS/Source/DTOs/Region+Decodable.swift +16 -0
  238. package/native-bridge/iOS/Source/DTOs/ScreenShareToolConfiguration+Decodable.swift +18 -0
  239. package/native-bridge/iOS/Source/DTOs/Tools+Decodable.swift +24 -0
  240. package/native-bridge/iOS/Source/DTOs/UserDetails+Bandyer.swift +18 -0
  241. package/native-bridge/iOS/Source/DTOs/UserDetails+Decodable.swift +28 -0
  242. package/native-bridge/iOS/Source/DTOs/UserDetailsFormat+Decodable.swift +19 -0
  243. package/native-bridge/iOS/Source/DTOs/VoipHandlingStrategy+Decodable.swift +25 -0
  244. package/native-bridge/iOS/Source/Events/Emitter/EventEmitter.swift +8 -0
  245. package/native-bridge/iOS/Source/Events/Events+CaseIterable.swift +18 -0
  246. package/native-bridge/iOS/Source/Events/Events+Description.swift +28 -0
  247. package/native-bridge/iOS/Source/Events/Events.swift +21 -0
  248. package/native-bridge/iOS/Source/Events/Reporters/CallClientEventsReporter.swift +46 -0
  249. package/native-bridge/iOS/Source/Events/Reporters/ChatClientEventsReporter.swift +46 -0
  250. package/native-bridge/iOS/Source/Events/Reporters/ClientState.swift +61 -0
  251. package/native-bridge/iOS/Source/Events/Reporters/EventsReporter.swift +69 -0
  252. package/native-bridge/iOS/Source/Events/Reporters/PushTokenEventsReporter.swift +34 -0
  253. package/native-bridge/iOS/Source/Extensions/URL+FromString.swift +26 -0
  254. package/native-bridge/iOS/Source/KaleyraVideoHybridNativeBridge.h +14 -0
  255. package/native-bridge/iOS/Source/NativeHybridBridge/VideoHybridNativeBridge.swift +173 -0
  256. package/native-bridge/iOS/Source/NativeHybridBridge/VideoHybridNativeBridgeError.swift +33 -0
  257. package/native-bridge/iOS/Source/UI/KaleyraVideoSDKUserInterfacePresenter.swift +249 -0
  258. package/native-bridge/iOS/Source/UI/Presenters/PresentingViewControllerViewControllerPresenter.swift +44 -0
  259. package/native-bridge/iOS/Source/UI/Presenters/ViewControllerPresenter.swift +17 -0
  260. package/native-bridge/iOS/Source/UI/Presenters/WindowViewControllerPresenter.swift +111 -0
  261. package/native-bridge/iOS/Source/UI/UserInterfacePresenter+MainQueueRelay.swift +30 -0
  262. package/native-bridge/iOS/Source/UI/UserInterfacePresenter.swift +14 -0
  263. package/native-bridge/iOS/Source/User Details/Cache/UsersDetailsCache.swift +36 -0
  264. package/native-bridge/iOS/Source/User Details/Formatter/FormatterProxy.swift +47 -0
  265. package/native-bridge/iOS/Source/User Details/Formatter/UserDetailsFormatter.swift +83 -0
  266. package/native-bridge/iOS/Source/User Details/Providers/UsersDetailsProvider.swift +39 -0
  267. package/package.json +147 -0
  268. package/src/KaleyraVideo.ts +343 -0
  269. package/src/ReactNativeEventEmitter.ts +51 -0
  270. package/src/events/Events.ts +46 -0
  271. package/video-react-native-module.podspec +36 -0
@@ -0,0 +1,343 @@
1
+ // Copyright © 2018-2023 Kaleyra S.p.a. All Rights Reserved.
2
+ // See LICENSE for licensing information
3
+
4
+ import { NativeModules, Platform } from 'react-native';
5
+ import type { KaleyraVideoConfiguration } from '../native-bridge/TypeScript/types/KaleyraVideoConfiguration';
6
+ import type { CreateCallOptions } from '../native-bridge/TypeScript/types/CreateCallOptions';
7
+ import type { UserDetails } from '../native-bridge/TypeScript/types/UserDetails';
8
+ import type { UserDetailsFormat } from '../native-bridge/TypeScript/types/UserDetailsFormat';
9
+ import { UserDetailsFormatValidator } from '../native-bridge/TypeScript/UserDetailsFormatValidator';
10
+ import { CallType } from '../native-bridge/TypeScript/types/CallType';
11
+ import { IllegalArgumentError } from '../native-bridge/TypeScript/errors/IllegalArgumentError';
12
+ import { Environments } from '../native-bridge/TypeScript/Environments';
13
+ import { CallDisplayMode } from '../native-bridge/TypeScript/types/CallDisplayMode';
14
+ import { Regions } from '../native-bridge/TypeScript/Regions';
15
+ import type { Session } from '../native-bridge/TypeScript/types/Session';
16
+ import { RecordingType } from '../native-bridge/TypeScript/types/RecordingType';
17
+ import { AudioCallType } from '../native-bridge/TypeScript/types/AudioCallType';
18
+ import { VoipHandlingStrategy } from '../native-bridge/TypeScript/types/VoipHandlingStrategy';
19
+ import { AccessTokenResponse } from '../native-bridge/TypeScript/types/AccessTokenResponse';
20
+ import { Events as HybridEvents } from '../native-bridge/TypeScript/Events';
21
+ import { ReactNativeEventEmitter } from './ReactNativeEventEmitter';
22
+ import type { Events } from './events/Events';
23
+ import { Tools } from '../native-bridge/TypeScript/types/Tools';
24
+ import { IosConfiguration } from '../native-bridge/TypeScript/types/IosConfiguration';
25
+ import { CallKitConfiguration } from '../native-bridge/TypeScript/types/CallKitConfiguration';
26
+ import { ScreenShareToolConfiguration } from '../native-bridge/TypeScript/types/ScreenShareToolConfiguration';
27
+ import { ChatToolConfiguration } from '../native-bridge/TypeScript/types/ChatToolConfiguration';
28
+ import { AudioCallOptions } from '../native-bridge/TypeScript/types/AudioCallOptions';
29
+ import { CallOptions } from '../native-bridge/TypeScript/types/CallOptions';
30
+
31
+ const LINKING_ERROR =
32
+ `The package 'video-react-native-module' doesn't seem to be linked. Make sure: \n\n` +
33
+ Platform.select({ ios: '- You have run \'pod install\'\n', default: '' }) +
34
+ '- You rebuilt the app after installing the package\n' +
35
+ '- You are not using Expo Go\n';
36
+
37
+ const VideoNativeModuleBridge = NativeModules.VideoNativeModule
38
+ ? NativeModules.VideoNativeModule
39
+ : new Proxy(
40
+ {},
41
+ {
42
+ get() {
43
+ throw new Error(LINKING_ERROR);
44
+ },
45
+ },
46
+ );
47
+
48
+ const VideoNativeEmitter = NativeModules.VideoNativeEmitter
49
+ ? NativeModules.VideoNativeEmitter
50
+ : new Proxy(
51
+ {},
52
+ {
53
+ get() {
54
+ throw new Error(LINKING_ERROR);
55
+ },
56
+ },
57
+ );
58
+
59
+ /**
60
+ * KaleyraVideo
61
+ */
62
+ class KaleyraVideo {
63
+ /**
64
+ * <b>To create an instance of the Kaleyra Video invoke the [[configure]] method</b>
65
+ */
66
+ static instance: KaleyraVideo;
67
+
68
+ private readonly eventEmitter: ReactNativeEventEmitter;
69
+
70
+ events: Events;
71
+
72
+ constructor(eventEmitter: ReactNativeEventEmitter) {
73
+ this.eventEmitter = eventEmitter;
74
+ this.events = eventEmitter;
75
+ }
76
+
77
+ /**
78
+ * Call this method when device is ready to configure the module
79
+ * @param configuration
80
+ * @throws IllegalArgumentError
81
+ */
82
+ static configure(configuration: KaleyraVideoConfiguration): KaleyraVideo {
83
+ if (configuration.appID === '') {
84
+ throw new IllegalArgumentError('Expected a not empty appId!');
85
+ }
86
+
87
+ if (this.instance) {
88
+ console.warn('KaleyraVideo was already setup.');
89
+ return this.instance;
90
+ }
91
+
92
+ VideoNativeModuleBridge.configure(JSON.stringify(configuration));
93
+ this.instance = new KaleyraVideo(
94
+ new ReactNativeEventEmitter(VideoNativeEmitter),
95
+ );
96
+
97
+ return this.instance;
98
+ }
99
+
100
+ /**
101
+ * @ignore
102
+ * @private
103
+ */
104
+ private static _isAndroid() {
105
+ return Platform.OS === 'android';
106
+ }
107
+
108
+ /**
109
+ * @ignore
110
+ * @private
111
+ */
112
+ private static _isIOS() {
113
+ return Platform.OS === 'ios';
114
+ }
115
+
116
+ /**
117
+ * Connect the plugin
118
+ * @param session session to connect with
119
+ * @throws IllegalArgumentError
120
+ */
121
+ connect(session: Session) {
122
+ if (session.userID === '') {
123
+ throw new IllegalArgumentError('Expected a not empty userId!');
124
+ }
125
+ this.eventEmitter.on(HybridEvents.accessTokenRequest, (data) => {
126
+ const accessTokenRequest = JSON.parse(data);
127
+ session.accessTokenProvider(accessTokenRequest.userID).then(
128
+ (token) => {
129
+ const response = AccessTokenResponse.success(
130
+ accessTokenRequest.requestID,
131
+ token,
132
+ );
133
+ VideoNativeModuleBridge.setAccessTokenResponse(
134
+ JSON.stringify(response),
135
+ );
136
+ },
137
+ (err: string) => {
138
+ const response = AccessTokenResponse.failed(
139
+ accessTokenRequest.requestID,
140
+ err,
141
+ );
142
+ VideoNativeModuleBridge.setAccessTokenResponse(
143
+ JSON.stringify(response),
144
+ );
145
+ },
146
+ );
147
+ });
148
+ VideoNativeModuleBridge.connect(session.userID);
149
+ }
150
+
151
+ /**
152
+ * Stop the plugin
153
+ */
154
+ disconnect() {
155
+ VideoNativeModuleBridge.disconnect();
156
+ this.eventEmitter.clear();
157
+ }
158
+
159
+ /**
160
+ * This method allows you to reset the configuration.
161
+ */
162
+ reset() {
163
+ if (KaleyraVideo._isAndroid()) {
164
+ VideoNativeModuleBridge.reset();
165
+ } else {
166
+ console.warn('Not yet supported on ', Platform.OS, ' platform.');
167
+ }
168
+ }
169
+
170
+ /**
171
+ * Get the current state of the plugin
172
+ * @return the state as a promise
173
+ */
174
+ // state() {
175
+ // return new Promise((resolve, reject) => {
176
+ // cordova.exec(resolve, reject, 'BandyerPlugin', 'state', []);
177
+ // });
178
+ // }
179
+
180
+ /**
181
+ * Start Call with the callee defined
182
+ * @param callOptions
183
+ * @throws IllegalArgumentError
184
+ */
185
+ startCall(callOptions: CreateCallOptions) {
186
+ if (callOptions.callees.length === 0) {
187
+ throw new IllegalArgumentError('No userIds were provided!');
188
+ }
189
+ if (
190
+ callOptions.callees.filter((str) => str.trim().length <= 0).length > 0
191
+ ) {
192
+ throw new IllegalArgumentError('Some empty userIds were provided');
193
+ }
194
+
195
+ VideoNativeModuleBridge.startCall(JSON.stringify(callOptions));
196
+ }
197
+
198
+ /**
199
+ * Verify the user for the current call
200
+ * @param verify true if the user is verified, false otherwise
201
+ * @throws IllegalArgumentError
202
+ */
203
+ verifyCurrentCall(verify: boolean) {
204
+ if (KaleyraVideo._isAndroid()) {
205
+ VideoNativeModuleBridge.verifyCurrentCall(verify);
206
+ } else {
207
+ console.warn('Not yet supported on ', Platform.OS, ' platform.');
208
+ }
209
+ }
210
+
211
+ /**
212
+ * Set the UI display mode for the current call
213
+ * @param mode FOREGROUND, FOREGROUND_PICTURE_IN_PICTURE, BACKGROUND
214
+ * @throws IllegalArgumentError
215
+ */
216
+ setDisplayModeForCurrentCall(mode: CallDisplayMode) {
217
+ if (KaleyraVideo._isAndroid()) {
218
+ VideoNativeModuleBridge.setDisplayModeForCurrentCall(
219
+ JSON.stringify(mode),
220
+ );
221
+ } else {
222
+ console.warn('Not supported by ', Platform.OS, ' platform.');
223
+ }
224
+ }
225
+
226
+ /**
227
+ * Start Call from url
228
+ * @param url received
229
+ * @throws IllegalArgumentError
230
+ */
231
+ startCallFrom(url: string) {
232
+ if (url === '' || url === 'undefined') {
233
+ throw new IllegalArgumentError('Invalid url!');
234
+ }
235
+ VideoNativeModuleBridge.startCallUrl(JSON.stringify(url));
236
+ }
237
+
238
+ // noinspection JSMethodCanBeStatic
239
+ /**
240
+ * Call this method to provide the details for each user to be used to set up the UI
241
+ * @param userDetails array of user details
242
+ * @throws IllegalArgumentError
243
+ */
244
+ addUsersDetails(userDetails: UserDetails[]) {
245
+ if (userDetails.length === 0) {
246
+ throw new IllegalArgumentError('No userDetails were provided!');
247
+ }
248
+
249
+ VideoNativeModuleBridge.addUsersDetails(JSON.stringify(userDetails));
250
+ }
251
+
252
+ setUserDetailsFormat(format: UserDetailsFormat) {
253
+ const validator = new UserDetailsFormatValidator();
254
+ validator.validate(format.default);
255
+ if (format.androidNotification !== undefined) {
256
+ validator.validate(format.androidNotification);
257
+ }
258
+
259
+ VideoNativeModuleBridge.setUserDetailsFormat(JSON.stringify(format));
260
+ }
261
+
262
+ /**
263
+ * Call this method to remove all the user details previously provided.
264
+ */
265
+ removeUsersDetails() {
266
+ VideoNativeModuleBridge.removeUsersDetails();
267
+ }
268
+
269
+ /**
270
+ * Call this method to handle a notification!
271
+ *
272
+ * @param payload notification data payload as String
273
+ * @throws IllegalArgumentError
274
+ */
275
+ handlePushNotificationPayload(payload: string) {
276
+ if (payload === '' || payload === 'undefined') {
277
+ throw new IllegalArgumentError('Expected a not empty payload!');
278
+ }
279
+
280
+ VideoNativeModuleBridge.handlePushNotificationPayload(
281
+ JSON.stringify(payload),
282
+ );
283
+ }
284
+
285
+ /**
286
+ * Open chat
287
+ * @param userID user you want to chat with
288
+ * @throws IllegalArgumentError
289
+ */
290
+ startChat(userID: string) {
291
+ if (userID === '') {
292
+ throw new IllegalArgumentError('Expected a not empty userId!');
293
+ }
294
+
295
+ VideoNativeModuleBridge.startChat(userID);
296
+ }
297
+
298
+ /**
299
+ * This method allows you to clear all user cached data, such as chat messages and generic information.
300
+ */
301
+ clearUserCache() {
302
+ if (KaleyraVideo._isAndroid()) {
303
+ VideoNativeModuleBridge.clearUserCache();
304
+ } else {
305
+ console.warn('Not yet supported on ', Platform.OS, ' platform.');
306
+ }
307
+ }
308
+
309
+ /**
310
+ * This method returns the current voip push token
311
+ * @return promise of voipPushToken or undefined if has not been generated yet.
312
+ */
313
+ getCurrentVoIPPushToken(): Promise<string> {
314
+ if (!KaleyraVideo._isIOS()) {
315
+ return Promise.reject('Token has not been generated yet.');
316
+ }
317
+ return VideoNativeModuleBridge.getCurrentVoIPPushToken();
318
+ }
319
+ }
320
+
321
+ export {
322
+ KaleyraVideo,
323
+ KaleyraVideoConfiguration,
324
+ CreateCallOptions,
325
+ Tools,
326
+ ScreenShareToolConfiguration,
327
+ ChatToolConfiguration,
328
+ AudioCallOptions,
329
+ AudioCallType,
330
+ CallOptions,
331
+ RecordingType,
332
+ IosConfiguration,
333
+ CallKitConfiguration,
334
+ VoipHandlingStrategy,
335
+ CallType,
336
+ Regions,
337
+ UserDetails,
338
+ UserDetailsFormat,
339
+ CallDisplayMode,
340
+ Session,
341
+ Environments,
342
+ Events,
343
+ };
@@ -0,0 +1,51 @@
1
+ /* eslint-disable @typescript-eslint/no-empty-function,@typescript-eslint/no-unused-vars,@typescript-eslint/no-explicit-any */
2
+ // Copyright © 2018-2023 Kaleyra S.p.a. All Rights Reserved.
3
+ // See LICENSE for licensing information
4
+
5
+ import { NativeEventEmitter, NativeModule } from 'react-native';
6
+ import type { Events } from './events/Events';
7
+ import { Events as HybridEvents } from '../native-bridge/TypeScript/Events';
8
+
9
+ export class ReactNativeEventEmitter
10
+ extends NativeEventEmitter
11
+ implements Events
12
+ {
13
+ constructor(nativeModule: NativeModule) {
14
+ super(nativeModule);
15
+
16
+ this.on(HybridEvents.setupError, (args) => this.onSetupError(args));
17
+ this.on(HybridEvents.callError, (args) => this.onCallError(args));
18
+ this.on(HybridEvents.chatError, (args) => this.onChatError(args));
19
+ this.on(HybridEvents.iOSVoipPushTokenInvalidated, () =>
20
+ this.oniOSVoipPushTokenInvalidated()
21
+ );
22
+ this.on(HybridEvents.iOSVoipPushTokenUpdated, (args) =>
23
+ this.oniOSVoipPushTokenUpdated(args)
24
+ );
25
+ this.on(HybridEvents.callModuleStatusChanged, (args) => {
26
+ this.onCallModuleStatusChanged(args);
27
+ });
28
+ this.on(HybridEvents.chatModuleStatusChanged, (args) =>
29
+ this.onChatModuleStatusChanged(args)
30
+ );
31
+ }
32
+
33
+ onSetupError = (_: string) => {};
34
+ onCallModuleStatusChanged = (_: string) => {};
35
+ onCallError = (_: string) => {};
36
+ oniOSVoipPushTokenUpdated = (_: string) => {};
37
+ onChatError = (_: string) => {};
38
+ onChatModuleStatusChanged = (_: string) => {};
39
+ oniOSVoipPushTokenInvalidated = () => {};
40
+
41
+ on(event: HybridEvents, listener: (...args: any[]) => any) {
42
+ if (this.listenerCount(event) > 0) this.removeAllListeners(event);
43
+ this.addListener(event, listener);
44
+ }
45
+
46
+ clear() {
47
+ for (const event in HybridEvents) {
48
+ this.removeAllListeners(event);
49
+ }
50
+ }
51
+ }
@@ -0,0 +1,46 @@
1
+ // Copyright © 2018-2023 Kaleyra S.p.a. All Rights Reserved.
2
+ // See LICENSE for licensing information
3
+
4
+ /**
5
+ * This enum defines all the events that may be handled
6
+ * <br/>
7
+ * <br/>
8
+ * You can listen to these events via [[KaleyraVideo.on]]
9
+ */
10
+ export interface Events {
11
+ /**
12
+ * @see [[SetupErrorEvent]]
13
+ */
14
+ onSetupError: ((reason: string) => void) | null;
15
+
16
+ /**
17
+ * @see [[CallStatusChangedEvent]]
18
+ */
19
+ onCallModuleStatusChanged: ((status: string) => void) | null;
20
+
21
+ /**
22
+ * Register to this event via [[KaleyraVideo.on]]
23
+ * @param callback with the reason as parameter
24
+ */
25
+ onCallError: ((reason: string) => void) | null;
26
+
27
+ /**
28
+ * @see [[ChatErrorEvent]]
29
+ */
30
+ onChatError: ((reason: string) => void) | null;
31
+
32
+ /**
33
+ * @see [[ChatStatusChangedEvent]]
34
+ */
35
+ onChatModuleStatusChanged: ((status: string) => void) | null;
36
+
37
+ /**
38
+ * @see [[VoipPushTokenEvents]]
39
+ */
40
+ oniOSVoipPushTokenUpdated: ((token: string) => void) | null;
41
+
42
+ /**
43
+ * @see [[VoipPushTokenEvents]]
44
+ */
45
+ oniOSVoipPushTokenInvalidated: (() => void) | null;
46
+ }
@@ -0,0 +1,36 @@
1
+ require "json"
2
+
3
+ package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4
+ folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
5
+
6
+ Pod::Spec.new do |s|
7
+ s.name = "video-react-native-module"
8
+ s.version = package["version"]
9
+ s.summary = package["description"]
10
+ s.homepage = package["homepage"]
11
+ s.license = package["license"]
12
+ s.authors = package["author"]
13
+
14
+ s.platforms = { :ios => "10.0" }
15
+ s.source = { :git => "git@github.com:KaleyraVideo/VideoReactNativeModule.git", :tag => "#{s.version}" }
16
+
17
+ s.source_files = "ios/**/*.{h,m,mm,swift}", "native-bridge/iOS/Source/**/*.swift"
18
+
19
+ s.dependency "React-Core"
20
+ s.dependency "Bandyer", "~> 3.6.3"
21
+
22
+ # Don't install the dependencies when we run `pod install` in the old architecture.
23
+ if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
24
+ s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
25
+ s.pod_target_xcconfig = {
26
+ "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
27
+ "OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
28
+ "CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
29
+ }
30
+ s.dependency "React-Codegen"
31
+ s.dependency "RCT-Folly"
32
+ s.dependency "RCTRequired"
33
+ s.dependency "RCTTypeSafety"
34
+ s.dependency "ReactCommon/turbomodule/core"
35
+ end
36
+ end