@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,54 @@
1
+ // Copyright © 2018-2023 Kaleyra S.p.a. All Rights Reserved.
2
+ // See LICENSE for licensing information
3
+
4
+ package com.kaleyra.video_hybrid_native_bridge.events.reporter
5
+
6
+ import androidx.appcompat.app.AppCompatActivity
7
+ import com.bandyer.android_sdk.call.CallException
8
+ import com.bandyer.android_sdk.call.CallObserver
9
+ import com.bandyer.android_sdk.call.CallUIObserver
10
+ import com.bandyer.android_sdk.client.BandyerSDKInstance
11
+ import com.bandyer.android_sdk.intent.call.Call
12
+ import com.kaleyra.video_hybrid_native_bridge.events.Events.CallError
13
+ import com.kaleyra.video_hybrid_native_bridge.events.EventsEmitter
14
+ import com.kaleyra.video_hybrid_native_bridge.events.EventsReporter
15
+ import java.lang.ref.WeakReference
16
+
17
+ class CallEventsReporter(
18
+ private val sdk: BandyerSDKInstance,
19
+ private val eventsEmitter: EventsEmitter
20
+ ) : EventsReporter, CallObserver, CallUIObserver {
21
+
22
+ private val failedCalls = HashMap<String, Call>()
23
+
24
+ override fun start() {
25
+ sdk.callModule!!.addCallObserver(this)
26
+ sdk.callModule!!.addCallUIObserver(this)
27
+ }
28
+
29
+ override fun stop() {
30
+ sdk.callModule!!.removeCallObserver(this)
31
+ sdk.callModule!!.removeCallUIObserver(this)
32
+ }
33
+
34
+ override fun onCallEndedWithError(call: Call, callException: CallException) {
35
+ val id = call.callInfo.callId
36
+ if (failedCalls.containsKey(id)) return
37
+ failedCalls[id] = call
38
+ eventsEmitter.sendEvent(CallError, callException.localizedMessage)
39
+ }
40
+
41
+ override fun onActivityError(call: Call, activity: WeakReference<AppCompatActivity>, error: CallException) {
42
+ val id = call.callInfo.callId
43
+ if (failedCalls.containsKey(id)) return
44
+ failedCalls[id] = call
45
+ eventsEmitter.sendEvent(CallError, error.localizedMessage)
46
+ }
47
+
48
+ override fun onCallCreated(call: Call) = Unit
49
+ override fun onCallEnded(call: Call) = Unit
50
+ override fun onCallStarted(call: Call) = Unit
51
+
52
+ override fun onActivityDestroyed(call: Call, activity: WeakReference<AppCompatActivity>) = Unit
53
+ override fun onActivityStarted(call: Call, activity: WeakReference<AppCompatActivity>) = Unit
54
+ }
@@ -0,0 +1,43 @@
1
+ // Copyright © 2018-2023 Kaleyra S.p.a. All Rights Reserved.
2
+ // See LICENSE for licensing information
3
+
4
+ package com.kaleyra.video_hybrid_native_bridge.events.reporter
5
+
6
+ import androidx.appcompat.app.AppCompatActivity
7
+ import com.bandyer.android_sdk.chat.ChatException
8
+ import com.bandyer.android_sdk.chat.ChatObserver
9
+ import com.bandyer.android_sdk.chat.ChatUIObserver
10
+ import com.bandyer.android_sdk.client.BandyerSDKInstance
11
+ import com.bandyer.android_sdk.intent.chat.Chat
12
+ import com.kaleyra.video_hybrid_native_bridge.events.Events.ChatError
13
+ import com.kaleyra.video_hybrid_native_bridge.events.EventsEmitter
14
+ import com.kaleyra.video_hybrid_native_bridge.events.EventsReporter
15
+ import java.lang.ref.WeakReference
16
+
17
+ class ChatEventsReporter(
18
+ private val sdk: BandyerSDKInstance,
19
+ private val eventsEmitter: EventsEmitter
20
+ ) : EventsReporter, ChatObserver, ChatUIObserver {
21
+
22
+ private val failedChats = HashMap<String, Chat>()
23
+
24
+ override fun start() {
25
+ sdk.chatModule?.addChatObserver(this)
26
+ sdk.chatModule?.addChatUIObserver(this)
27
+ }
28
+
29
+ override fun stop() {
30
+ sdk.chatModule?.removeChatObserver(this)
31
+ sdk.chatModule?.removeChatUIObserver(this)
32
+ }
33
+
34
+ override fun onActivityError(chat: Chat, activity: WeakReference<AppCompatActivity>, error: ChatException) {
35
+ val id = chat.chatInfo.chatId
36
+ if (failedChats.containsKey(id)) return
37
+ failedChats[id] = chat
38
+ eventsEmitter.sendEvent(ChatError, error.localizedMessage)
39
+ }
40
+
41
+ override fun onActivityStarted(chat: Chat, activity: WeakReference<AppCompatActivity>) = Unit
42
+ override fun onActivityDestroyed(chat: Chat, activity: WeakReference<AppCompatActivity>) = Unit
43
+ }
@@ -0,0 +1,29 @@
1
+ // Copyright © 2018-2023 Kaleyra S.p.a. All Rights Reserved.
2
+ // See LICENSE for licensing information
3
+
4
+ package com.kaleyra.video_hybrid_native_bridge.events.reporter
5
+
6
+ import com.bandyer.android_sdk.module.BandyerModuleStatus
7
+ import com.bandyer.android_sdk.module.BandyerModuleStatus.CONNECTED
8
+ import com.bandyer.android_sdk.module.BandyerModuleStatus.CONNECTING
9
+ import com.bandyer.android_sdk.module.BandyerModuleStatus.DISCONNECTED
10
+ import com.bandyer.android_sdk.module.BandyerModuleStatus.FAILED
11
+ import com.bandyer.android_sdk.module.BandyerModuleStatus.READY
12
+ import com.kaleyra.video_hybrid_native_bridge.events.reporter.CrossPlatformModuleStatus.Connecting
13
+ import com.kaleyra.video_hybrid_native_bridge.events.reporter.CrossPlatformModuleStatus.Failed
14
+ import com.kaleyra.video_hybrid_native_bridge.events.reporter.CrossPlatformModuleStatus.Ready
15
+ import com.kaleyra.video_hybrid_native_bridge.events.reporter.CrossPlatformModuleStatus.Stopped
16
+
17
+ enum class CrossPlatformModuleStatus {
18
+ Ready,
19
+ Connecting,
20
+ Stopped,
21
+ Failed
22
+ }
23
+
24
+ internal fun BandyerModuleStatus.toCrossPlatformModuleStatus(): String = when (this) {
25
+ CONNECTING -> Connecting.name.lowercase()
26
+ CONNECTED, READY -> Ready.name.lowercase()
27
+ DISCONNECTED -> Stopped.name.lowercase()
28
+ FAILED -> Failed.name.lowercase()
29
+ }
@@ -0,0 +1,34 @@
1
+ // Copyright © 2018-2023 Kaleyra S.p.a. All Rights Reserved.
2
+ // See LICENSE for licensing information
3
+
4
+ package com.kaleyra.video_hybrid_native_bridge.events.reporter
5
+
6
+ import com.bandyer.android_sdk.call.CallModule
7
+ import com.bandyer.android_sdk.chat.ChatModule
8
+ import com.bandyer.android_sdk.client.BandyerSDKInstance
9
+ import com.bandyer.android_sdk.module.BandyerModule
10
+ import com.bandyer.android_sdk.module.BandyerModuleObserver
11
+ import com.bandyer.android_sdk.module.BandyerModuleStatus
12
+ import com.kaleyra.video_hybrid_native_bridge.events.Events.CallModuleStatusChanged
13
+ import com.kaleyra.video_hybrid_native_bridge.events.Events.ChatModuleStatusChanged
14
+ import com.kaleyra.video_hybrid_native_bridge.events.EventsEmitter
15
+ import com.kaleyra.video_hybrid_native_bridge.events.EventsReporter
16
+
17
+ class ModuleEventsReporter(
18
+ val sdk: BandyerSDKInstance,
19
+ val eventsEmitter: EventsEmitter
20
+ ) : EventsReporter, BandyerModuleObserver {
21
+
22
+ override fun start() = sdk.addModuleObserver(this)
23
+ override fun stop() = sdk.removeModuleObserver(this)
24
+
25
+ override fun onModuleStatusChanged(module: BandyerModule, moduleStatus: BandyerModuleStatus) = when (module) {
26
+ is CallModule -> eventsEmitter.sendEvent(CallModuleStatusChanged, moduleStatus.toCrossPlatformModuleStatus())
27
+ is ChatModule -> eventsEmitter.sendEvent(ChatModuleStatusChanged, moduleStatus.toCrossPlatformModuleStatus())
28
+ else -> Unit
29
+ }
30
+
31
+ override fun onModuleFailed(module: BandyerModule, throwable: Throwable) = Unit
32
+ override fun onModulePaused(module: BandyerModule) = Unit
33
+ override fun onModuleReady(module: BandyerModule) = Unit
34
+ }
@@ -0,0 +1,63 @@
1
+ // Copyright © 2018-2023 Kaleyra S.p.a. All Rights Reserved.
2
+ // See LICENSE for licensing information
3
+
4
+ package com.kaleyra.video_hybrid_native_bridge.events.reporter
5
+
6
+ import com.bandyer.android_sdk.client.BandyerSDKInstance
7
+ import com.kaleyra.video_hybrid_native_bridge.events.EventsEmitter
8
+ import com.kaleyra.video_hybrid_native_bridge.events.EventsReporter
9
+ import kotlinx.coroutines.CoroutineScope
10
+ import kotlinx.coroutines.launch
11
+
12
+ class SDKEventsReporter internal constructor(
13
+ private val moduleEventsReporter: ModuleEventsReporter,
14
+ private val callEventsReporter: CallEventsReporter,
15
+ private val chatEventsReporter: ChatEventsReporter,
16
+ private val scope: CoroutineScope
17
+ ) : EventsReporter {
18
+
19
+ companion object {
20
+
21
+ private var instance: SDKEventsReporter? = null
22
+
23
+ fun create(
24
+ sdk: BandyerSDKInstance,
25
+ eventsEmitter: EventsEmitter,
26
+ scope: CoroutineScope
27
+ ): SDKEventsReporter = instance.takeIf { it?.isRunning == true } ?: SDKEventsReporter(sdk, eventsEmitter, scope).apply { instance = this }
28
+ }
29
+
30
+ private constructor(
31
+ sdk: BandyerSDKInstance,
32
+ eventsEmitter: EventsEmitter,
33
+ scope: CoroutineScope
34
+ ) : this(
35
+ ModuleEventsReporter(sdk, eventsEmitter),
36
+ CallEventsReporter(sdk, eventsEmitter),
37
+ ChatEventsReporter(sdk, eventsEmitter),
38
+ scope
39
+ )
40
+
41
+ private var isRunning = false
42
+
43
+ override fun start() {
44
+ scope.launch {
45
+ if (isRunning) return@launch
46
+ isRunning = true
47
+ moduleEventsReporter.start()
48
+ callEventsReporter.start()
49
+ chatEventsReporter.start()
50
+ }
51
+ }
52
+
53
+ override fun stop() {
54
+ scope.launch {
55
+ if (!isRunning) return@launch
56
+ isRunning = false
57
+ moduleEventsReporter.stop()
58
+ callEventsReporter.stop()
59
+ chatEventsReporter.stop()
60
+ }
61
+ }
62
+
63
+ }
@@ -0,0 +1,15 @@
1
+ // Copyright © 2018-2023 Kaleyra S.p.a. All Rights Reserved.
2
+ // See LICENSE for licensing information
3
+
4
+ package com.kaleyra.video_hybrid_native_bridge.extensions
5
+
6
+ import com.kaleyra.video_hybrid_native_bridge.CallDisplayMode
7
+ import com.kaleyra.video_hybrid_native_bridge.CallDisplayMode.Background
8
+ import com.kaleyra.video_hybrid_native_bridge.CallDisplayMode.Foreground
9
+ import com.kaleyra.video_hybrid_native_bridge.CallDisplayMode.ForegroundPictureInPicture
10
+
11
+ internal fun CallDisplayMode.toSDK() = when (this) {
12
+ Background -> com.bandyer.android_sdk.intent.call.CallDisplayMode.BACKGROUND
13
+ Foreground -> com.bandyer.android_sdk.intent.call.CallDisplayMode.FOREGROUND
14
+ ForegroundPictureInPicture -> com.bandyer.android_sdk.intent.call.CallDisplayMode.FOREGROUND_PICTURE_IN_PICTURE
15
+ }
@@ -0,0 +1,39 @@
1
+ // Copyright © 2018-2023 Kaleyra S.p.a. All Rights Reserved.
2
+ // See LICENSE for licensing information
3
+
4
+ package com.kaleyra.video_hybrid_native_bridge.extensions
5
+
6
+ import com.bandyer.android_sdk.client.BandyerSDKConfiguration
7
+ import com.kaleyra.video_hybrid_native_bridge.KaleyraVideoConfiguration
8
+ import com.kaleyra.video_hybrid_native_bridge.CreateCallOptionsProxy
9
+ import com.kaleyra.video_hybrid_native_bridge.utils.TLSSocketFactoryCompat
10
+ import com.kaleyra.collaboration_suite_utils.logging.BaseLogger
11
+ import com.kaleyra.collaboration_suite_utils.logging.androidPrioryLogger
12
+ import okhttp3.OkHttpClient
13
+ import java.security.cert.X509Certificate
14
+ import javax.net.ssl.X509TrustManager
15
+
16
+ /**
17
+ *
18
+ * @author kristiyan
19
+ */
20
+ internal fun KaleyraVideoConfiguration.toSDK(createCallOptionsProxy: CreateCallOptionsProxy) = BandyerSDKConfiguration.Builder(appID, environment.toSDK(), region.toSDK()).apply {
21
+ tools {
22
+ tools ?: return@tools
23
+ val chatToolsConfiguration = tools.toChatConfiguration()
24
+ val callToolsConfiguration = tools.toCallConfiguration(chatToolsConfiguration, createCallOptionsProxy)
25
+ withCall { callConfiguration = callToolsConfiguration }
26
+ chatToolsConfiguration ?: return@tools
27
+ withChat { chatConfiguration = chatToolsConfiguration }
28
+ }
29
+ if (logEnabled == true) enableLogger()
30
+ httpStack(trustedHttpClient())
31
+ }.build()
32
+
33
+ private fun BandyerSDKConfiguration.Builder.enableLogger() = logger(androidPrioryLogger(BaseLogger.VERBOSE, -1))
34
+
35
+ private fun trustedHttpClient() = OkHttpClient.Builder().sslSocketFactory(TLSSocketFactoryCompat(), object : X509TrustManager {
36
+ override fun getAcceptedIssuers(): Array<X509Certificate> = arrayOf()
37
+ override fun checkClientTrusted(certs: Array<X509Certificate>, authType: String) = Unit
38
+ override fun checkServerTrusted(certs: Array<X509Certificate>, authType: String) = Unit
39
+ }).build()
@@ -0,0 +1,12 @@
1
+ // Copyright © 2018-2023 Kaleyra S.p.a. All Rights Reserved.
2
+ // See LICENSE for licensing information
3
+
4
+ package com.kaleyra.video_hybrid_native_bridge.extensions
5
+
6
+ import com.kaleyra.video_hybrid_native_bridge.Environment
7
+
8
+ internal fun Environment.toSDK() = when (name.lowercase()) {
9
+ "sandbox" -> com.kaleyra.collaboration_suite_networking.Environment.Sandbox
10
+ "production" -> com.kaleyra.collaboration_suite_networking.Environment.Production
11
+ else -> com.kaleyra.collaboration_suite_networking.Environment.create(name)
12
+ }
@@ -0,0 +1,15 @@
1
+ // Copyright © 2018-2023 Kaleyra S.p.a. All Rights Reserved.
2
+ // See LICENSE for licensing information
3
+
4
+ package com.kaleyra.video_hybrid_native_bridge.extensions
5
+
6
+ import com.bandyer.android_sdk.intent.call.CallRecordingType
7
+ import com.bandyer.android_sdk.intent.call.CallRecordingType.AUTOMATIC
8
+ import com.bandyer.android_sdk.intent.call.CallRecordingType.MANUAL
9
+ import com.kaleyra.video_hybrid_native_bridge.RecordingType
10
+
11
+ internal fun RecordingType?.toSDK(): CallRecordingType = when (this) {
12
+ RecordingType.Manual -> MANUAL
13
+ RecordingType.Automatic -> AUTOMATIC
14
+ else -> CallRecordingType.NONE
15
+ }
@@ -0,0 +1,13 @@
1
+ // Copyright © 2018-2023 Kaleyra S.p.a. All Rights Reserved.
2
+ // See LICENSE for licensing information
3
+
4
+ package com.kaleyra.video_hybrid_native_bridge.extensions
5
+
6
+ import com.kaleyra.video_hybrid_native_bridge.Region
7
+
8
+ internal fun Region.toSDK() = when (name.lowercase()) {
9
+ "europe" -> com.kaleyra.collaboration_suite_networking.Region.Eu
10
+ "india" -> com.kaleyra.collaboration_suite_networking.Region.In
11
+ "us" -> com.kaleyra.collaboration_suite_networking.Region.Us
12
+ else -> com.kaleyra.collaboration_suite_networking.Region.create(name)
13
+ }
@@ -0,0 +1,15 @@
1
+ // Copyright © 2018-2023 Kaleyra S.p.a. All Rights Reserved.
2
+ // See LICENSE for licensing information
3
+
4
+ package com.kaleyra.video_hybrid_native_bridge.extensions
5
+
6
+ import com.bandyer.android_sdk.tool_configuration.screen_share.CustomScreenShareConfiguration
7
+ import com.bandyer.android_sdk.tool_configuration.screen_share.ScreenShareOptionSet
8
+ import com.kaleyra.video_hybrid_native_bridge.ScreenShareToolConfiguration
9
+
10
+ internal fun ScreenShareToolConfiguration?.toSDK(): ScreenShareOptionSet? = when {
11
+ this?.inApp == true && this.wholeDevice == true -> CustomScreenShareConfiguration.Options(ScreenShareOptionSet.USER_SELECTION)
12
+ this?.inApp == true -> CustomScreenShareConfiguration.Options(ScreenShareOptionSet.APP_ONLY)
13
+ this?.wholeDevice == true -> CustomScreenShareConfiguration.Options(ScreenShareOptionSet.WHOLE_DEVICE)
14
+ else -> null
15
+ }
@@ -0,0 +1,95 @@
1
+ // Copyright © 2018-2023 Kaleyra S.p.a. All Rights Reserved.
2
+ // See LICENSE for licensing information
3
+
4
+ package com.kaleyra.video_hybrid_native_bridge.extensions
5
+
6
+ import com.bandyer.android_sdk.intent.call.CallOptions
7
+ import com.bandyer.android_sdk.tool_configuration.call.CustomCallConfiguration
8
+ import com.bandyer.android_sdk.tool_configuration.chat.CustomChatConfiguration
9
+ import com.bandyer.android_sdk.tool_configuration.chat.CustomChatConfiguration.CustomCapabilitySet
10
+ import com.bandyer.android_sdk.tool_configuration.file_share.CustomFileShareConfiguration
11
+ import com.bandyer.android_sdk.tool_configuration.file_share.FileShareConfiguration
12
+ import com.bandyer.android_sdk.tool_configuration.screen_share.CustomScreenShareConfiguration
13
+ import com.bandyer.android_sdk.tool_configuration.screen_share.ScreenShareConfiguration
14
+ import com.bandyer.android_sdk.tool_configuration.whiteboard.CustomWhiteboardConfiguration
15
+ import com.bandyer.android_sdk.tool_configuration.whiteboard.WhiteboardConfiguration
16
+ import com.kaleyra.video_hybrid_native_bridge.AudioCallType.Audio
17
+ import com.kaleyra.video_hybrid_native_bridge.AudioCallType.AudioUpgradable
18
+ import com.kaleyra.video_hybrid_native_bridge.CreateCallOptionsProxy
19
+ import com.kaleyra.video_hybrid_native_bridge.RecordingType
20
+ import com.kaleyra.video_hybrid_native_bridge.Tools
21
+
22
+ internal fun Tools.toCallConfiguration(chatConfiguration: CustomChatConfiguration?, createCallOptionsProxy: CreateCallOptionsProxy): CustomCallConfiguration {
23
+ val fileShareConfiguration = CustomFileShareConfiguration().takeIf { fileShare == true }
24
+ val screenShareConfiguration = screenShare(this)
25
+ val whiteboardConfiguration = CustomWhiteboardConfiguration().takeIf { whiteboard == true }
26
+ val feedback = feedback == true
27
+
28
+ return CustomCallConfiguration(
29
+ capabilitySet = CustomCallConfiguration.CustomCapabilitySet(
30
+ chatConfiguration,
31
+ fileShareConfiguration,
32
+ screenShareConfiguration,
33
+ whiteboardConfiguration
34
+ ),
35
+ optionSet = callOptions(feedback, createCallOptionsProxy.createCallOptions.recordingType)
36
+ )
37
+ }
38
+
39
+ internal fun Tools.toChatConfiguration(): CustomChatConfiguration? {
40
+ this.chat ?: return null
41
+ val fileShareConfiguration = CustomFileShareConfiguration().takeIf { fileShare == true }
42
+ val screenShareConfiguration = screenShare(this)
43
+ val whiteboardConfiguration = CustomWhiteboardConfiguration().takeIf { whiteboard == true }
44
+ val feedback = feedback == true
45
+
46
+ val audioChatCallConfiguration = chatCallConfiguration(
47
+ fileShareConfiguration,
48
+ screenShareConfiguration,
49
+ whiteboardConfiguration,
50
+ feedback,
51
+ chat.audioCallOption?.recordingType
52
+ )
53
+
54
+ val audioVideoChatCallConfiguration = chatCallConfiguration(
55
+ fileShareConfiguration,
56
+ screenShareConfiguration,
57
+ whiteboardConfiguration,
58
+ feedback,
59
+ chat.videoCallOption?.recordingType
60
+ )
61
+ return CustomChatConfiguration(CustomCapabilitySet(
62
+ audioCallConfiguration = audioChatCallConfiguration.takeIf { chat.audioCallOption?.type == Audio },
63
+ audioUpgradableCallConfiguration = audioChatCallConfiguration.takeIf { chat.audioCallOption?.type == AudioUpgradable },
64
+ audioVideoCallConfiguration = audioVideoChatCallConfiguration.takeIf { chat.videoCallOption != null }
65
+ ))
66
+ }
67
+
68
+ private fun screenShare(tools: Tools): CustomScreenShareConfiguration? {
69
+ tools.screenShare ?: return null
70
+ val optionSet = tools.screenShare.toSDK() ?: return CustomScreenShareConfiguration()
71
+ return CustomScreenShareConfiguration(optionSet = optionSet)
72
+ }
73
+
74
+ private fun callOptions(feedback: Boolean, recordingType: RecordingType?) = CallOptions(feedbackEnabled = feedback, callRecordingType = recordingType.toSDK())
75
+
76
+ private fun chatCallCapabilitySet(
77
+ fileShareConfiguration: FileShareConfiguration?,
78
+ screenShareConfiguration: ScreenShareConfiguration?,
79
+ whiteboardConfiguration: WhiteboardConfiguration?
80
+ ) = CustomCapabilitySet.CustomCallConfiguration.CustomCapabilitySet(
81
+ fileShareConfiguration,
82
+ screenShareConfiguration,
83
+ whiteboardConfiguration
84
+ )
85
+
86
+ private fun chatCallConfiguration(
87
+ fileShareConfiguration: CustomFileShareConfiguration?,
88
+ screenShareConfiguration: CustomScreenShareConfiguration?,
89
+ whiteboardConfiguration: CustomWhiteboardConfiguration?,
90
+ feedback: Boolean,
91
+ recordingType: RecordingType?
92
+ ) = CustomCapabilitySet.CustomCallConfiguration(
93
+ capabilitySet = chatCallCapabilitySet(fileShareConfiguration, screenShareConfiguration, whiteboardConfiguration),
94
+ optionSet = callOptions(feedback, recordingType)
95
+ )
@@ -0,0 +1,35 @@
1
+ // Copyright © 2018-2023 Kaleyra S.p.a. All Rights Reserved.
2
+ // See LICENSE for licensing information
3
+
4
+ package com.kaleyra.video_hybrid_native_bridge.extensions
5
+
6
+ import com.bandyer.android_sdk.utils.provider.UserDetails
7
+ import com.kaleyra.video_hybrid_native_bridge.repository.UserDetailsEntity
8
+
9
+ /**
10
+ *
11
+ * @author kristiyan
12
+ */
13
+ internal fun UserDetailsEntity.toSDK(): UserDetails {
14
+ return UserDetails.Builder(userAlias).also { builder ->
15
+
16
+ firstName?.let { builder.withFirstName(it) }
17
+ lastName?.let { builder.withLastName(it) }
18
+ nickName?.let { builder.withNickName(it) }
19
+
20
+ email?.let { builder.withEmail(it) }
21
+
22
+ imageUrl?.let { builder.withImageUrl(it) }
23
+ }.build()
24
+ }
25
+
26
+ internal fun UserDetailsEntity.toUserDetails(): com.kaleyra.video_hybrid_native_bridge.UserDetails = com.kaleyra.video_hybrid_native_bridge.UserDetails(
27
+ email = this.email,
28
+ userID = this.userAlias,
29
+ firstName = this.firstName,
30
+ lastName = this.lastName,
31
+ nickName = this.nickName,
32
+ profileImageURL = this.imageUrl
33
+ )
34
+
35
+ internal fun UserDetails.toUserDetailsEntity(): UserDetailsEntity = UserDetailsEntity(userAlias, firstName, lastName, nickName, email, imageUrl)
@@ -0,0 +1,139 @@
1
+ // Copyright © 2018-2023 Kaleyra S.p.a. All Rights Reserved.
2
+ // See LICENSE for licensing information
3
+
4
+ package com.kaleyra.video_hybrid_native_bridge.notifications
5
+
6
+ import android.app.Activity
7
+ import android.content.BroadcastReceiver
8
+ import android.content.ComponentName
9
+ import android.content.Context
10
+ import android.content.Intent
11
+ import android.content.pm.PackageManager
12
+ import android.os.Bundle
13
+ import android.util.Log
14
+ //import com.bandyer.flutter_plugin.exceptions.PluginNotificationKeyNotFound
15
+ //import com.bandyer.flutter_plugin.exceptions.NotificationPayloadDataPathNotDefined
16
+ //import com.bandyer.flutter_plugin.extensions.asJSONObject
17
+ import org.json.JSONObject
18
+
19
+ /**
20
+ * @author kristiyan
21
+ */
22
+ class KaleyraVideoNotificationReceiver : BroadcastReceiver() {
23
+
24
+ companion object {
25
+ private val GCM_RECEIVE_ACTION = "com.google.android.c2dm.intent.RECEIVE"
26
+ private val GCM_TYPE = "gcm"
27
+ private val MESSAGE_TYPE_EXTRA_KEY = "message_type"
28
+ }
29
+
30
+ override fun onReceive(context: Context, intent: Intent) {
31
+ val bundle = intent.extras
32
+ // check if is from gcm/fcm, else return because it is not a notification
33
+ if (bundle == null || "google.com/iid" == bundle.getString("from")) return
34
+ if (!isGcmMessage(intent)) {
35
+ if (isOrderedBroadcast) resultCode = Activity.RESULT_OK
36
+ return
37
+ }
38
+
39
+ // check if a bandyer notification service was defined in the manifest
40
+ val serviceIntent = Intent().setAction("com.bandyer.NotificationEvent").setPackage(context.packageName)
41
+ val resolveInfo = context.packageManager.queryIntentServices(serviceIntent, PackageManager.GET_RESOLVED_FILTER)
42
+ if (resolveInfo.size < 1) return
43
+
44
+ val bandyerPayloadPath: String
45
+ try {
46
+ bandyerPayloadPath = resolveInfo[0].filter.getDataPath(0).path
47
+ } catch (e: Throwable) {
48
+ throw Throwable("You have not defined data path in your intent-filter!! Bandyer requires it to know where to find the payload!")
49
+ }
50
+
51
+ val payload = getBandyerPayload(intent, bandyerPayloadPath)
52
+ // if bandyer can handle payload proceed
53
+ if (payload == null) {
54
+ resultCode = Activity.RESULT_OK
55
+ return
56
+ }
57
+
58
+ val component = ComponentName(context, resolveInfo[0].serviceInfo.name)
59
+
60
+ serviceIntent.component = component
61
+ serviceIntent.putExtra("payload", payload)
62
+
63
+ KaleyraVideoNotificationService.enqueueWork(context, component, serviceIntent)
64
+
65
+ if (isOrderedBroadcast) abortBroadcast()
66
+ resultCode = Activity.RESULT_OK
67
+ }
68
+
69
+ private fun getBandyerPayload(intent: Intent, bandyerPayloadPath: String): String? {
70
+ try {
71
+ val keyPath = bandyerPayloadPath.split("\\.".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()
72
+ val payload = intent.extras!!.asJSONObject()
73
+ if (!payload.toString().isBandyerNotification()) return null
74
+ if (!payload.has(keyPath[0]))
75
+ throw PluginNotificationKeyNotFound("\nRequired jsonObject:" + keyPath[0] + " is not contained in " + payload.keys().asString())
76
+ var bandyerData = payload.getString(keyPath[0])
77
+ for (i in 1 until keyPath.size) {
78
+ val data = JSONObject(bandyerData)
79
+ if (!data.has(keyPath[i]))
80
+ throw PluginNotificationKeyNotFound("\nRequired jsonObject:" + keyPath[i] + " is not contained in " + payload.keys().asString())
81
+ bandyerData = JSONObject(bandyerData).getString(keyPath[i])
82
+ }
83
+ return bandyerData
84
+ } catch (e: Throwable) {
85
+ if (e is PluginNotificationKeyNotFound) {
86
+ Log.w(
87
+ "BandyerNotReceiver", "Failed to handle notification!!!" + e.message +
88
+ "\nThis notification will not be handled by Bandyer!" +
89
+ "\nBandyer payload not found in the following path: " + bandyerPayloadPath
90
+ )
91
+ } else
92
+ Log.w(
93
+ "BandyerNotReceiver", "Failed to handle notification!!!" +
94
+ "\nThis notification will not be handled by Bandyer!" +
95
+ e.localizedMessage!!
96
+ )
97
+ }
98
+ return null
99
+ }
100
+
101
+ private fun Iterator<String>.asString(): String {
102
+ val value = StringBuilder()
103
+ value.append("<")
104
+ while (hasNext()) {
105
+ value.append(next())
106
+ if (hasNext()) value.append(",")
107
+ }
108
+ value.append(">")
109
+ return value.toString()
110
+ }
111
+
112
+ private fun String.isBandyerNotification(): Boolean = contains("on_call_incoming") || contains("on_message_sent");
113
+
114
+ private fun isGcmMessage(intent: Intent): Boolean {
115
+ if (GCM_RECEIVE_ACTION == intent.action) {
116
+ val messageType = intent.getStringExtra(MESSAGE_TYPE_EXTRA_KEY)
117
+ return messageType == null || GCM_TYPE == messageType
118
+ }
119
+ return false
120
+ }
121
+
122
+ private fun Bundle.asJSONObject(): JSONObject {
123
+ val json = JSONObject()
124
+ val keys = keySet()
125
+
126
+ for (key in keys) {
127
+ try {
128
+ json.put(key, get(key))
129
+ } catch (e: Throwable) {
130
+ e.printStackTrace()
131
+ }
132
+ }
133
+ return json
134
+ }
135
+
136
+ class PluginNotificationKeyNotFound(override val message: String?): Throwable(message)
137
+
138
+ }
139
+