@kaleyra/video-react-native-module 1.6.0 → 2.0.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 (113) hide show
  1. package/README.md +17 -47
  2. package/android/build.gradle +24 -32
  3. package/android/gradle.properties +3 -3
  4. package/android/settings.gradle +0 -5
  5. package/android/src/main/AndroidManifest.xml +1 -1
  6. package/android/src/main/assets/kaleyra_video_wrapper_info.txt +1 -1
  7. package/android/src/main/java/com/kaleyra/video_react_native_module/VideoNativeModule.kt +0 -9
  8. package/index.ts +0 -2
  9. package/ios/PluginInfo/_KaleyraVideoHybridVersionInfo.swift +1 -1
  10. package/ios/VideoNativeModule.m +0 -6
  11. package/ios/VideoNativeModule.swift +1 -20
  12. package/lib/commonjs/src/KaleyraVideo.js +0 -34
  13. package/lib/module/src/KaleyraVideo.js +0 -34
  14. package/lib/typescript/index.d.ts +2 -2
  15. package/lib/typescript/native-bridge/TypeScript/types/UserDetails.d.ts +3 -15
  16. package/lib/typescript/src/KaleyraVideo.d.ts +1 -16
  17. package/native-bridge/TypeScript/types/UserDetails.ts +3 -18
  18. package/native-bridge/android/bridge.gradle +71 -0
  19. package/native-bridge/android/build.gradle +5 -61
  20. package/native-bridge/android/gradle/wrapper/gradle-wrapper.properties +1 -1
  21. package/native-bridge/android/settings.gradle +8 -0
  22. package/native-bridge/android/src/main/AndroidManifest.xml +1 -1
  23. package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/DTOs.kt +6 -40
  24. package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/SDKAccessTokenProviderProxy.kt +9 -7
  25. package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/VideoHybridBridge.kt +0 -2
  26. package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/VideoSDKHybridBridge.kt +13 -23
  27. package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/configurator/VideoSDKConfigurator.kt +32 -24
  28. package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/connector/VideoSDKCachedUserConnector.kt +7 -5
  29. package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/events/reporter/CallEventsReporter.kt +27 -35
  30. package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/events/reporter/ChatEventsReporter.kt +34 -24
  31. package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/events/reporter/CrossPlatformModuleStatus.kt +14 -15
  32. package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/events/reporter/ModuleEventsReporter.kt +40 -18
  33. package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/events/reporter/SDKEventsReporter.kt +6 -6
  34. package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/extensions/CallDisplayExtension.kt +4 -3
  35. package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/extensions/CallTypeExtensions.kt +12 -0
  36. package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/extensions/ConfigurationExtension.kt +17 -23
  37. package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/extensions/EnvironmentExtension.kt +3 -3
  38. package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/extensions/RecordingTypeExtension.kt +5 -7
  39. package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/extensions/RegionExtension.kt +4 -4
  40. package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/extensions/ScreenShareToolConfigurationExtension.kt +5 -6
  41. package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/extensions/ToolsExtension.kt +49 -81
  42. package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/extensions/UserExtensions.kt +24 -17
  43. package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/notifications/KaleyraVideoNotificationService.kt +1 -2
  44. package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/repository/UserDetailsDao.kt +1 -1
  45. package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/repository/UserDetailsEntity.kt +2 -6
  46. package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/repository/VideoHybridBridgeRepository.kt +1 -1
  47. package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/ui/SDKUserInterfacePresenter.kt +22 -20
  48. package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/user_details/CachedUserDetails.kt +0 -3
  49. package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/user_details/SDKCachedUserDetails.kt +22 -30
  50. package/native-bridge/iOS/KaleyraVideoHybridNativeBridge.xcodeproj/project.pbxproj +84 -132
  51. package/native-bridge/iOS/Podfile +2 -2
  52. package/native-bridge/iOS/Podfile.lock +9 -9
  53. package/native-bridge/iOS/Source/Abstractions/CallWindowProtocol.swift +3 -6
  54. package/native-bridge/iOS/Source/Abstractions/KaleyraVideoSDKProtocol.swift +20 -0
  55. package/native-bridge/iOS/Source/AccessToken/AccessTokenRequester.swift +0 -1
  56. package/native-bridge/iOS/Source/AccessToken/TokenProvider.swift +1 -2
  57. package/native-bridge/iOS/Source/Broadcast/BroadcastConfigurationPlistReader.swift +0 -1
  58. package/native-bridge/iOS/Source/Concurrency/DispatchQueue+isMain.swift +0 -1
  59. package/native-bridge/iOS/Source/Concurrency/MainQueueDispatcher.swift +0 -1
  60. package/native-bridge/iOS/Source/Concurrency/MainQueueRelay.swift +0 -1
  61. package/native-bridge/iOS/Source/DTOs/AudioCallOptions+Equatable.swift +0 -1
  62. package/native-bridge/iOS/Source/DTOs/AudioCallOptions+KaleyraVideoSDK.swift +13 -0
  63. package/native-bridge/iOS/Source/DTOs/{AudioCallType+Bandyer.swift → AudioCallType+KaleyraVideoSDK.swift} +2 -3
  64. package/native-bridge/iOS/Source/DTOs/CallOptions+Equatable.swift +0 -1
  65. package/native-bridge/iOS/Source/DTOs/CallOptions+KaleyraVideoSDK.swift +12 -0
  66. package/native-bridge/iOS/Source/DTOs/{CallType+Bandyer.swift → CallType+KaleyraVideoSDK.swift} +2 -3
  67. package/native-bridge/iOS/Source/DTOs/CreateCallOptions+KaleyraVideoSDK.swift +12 -0
  68. package/native-bridge/iOS/Source/DTOs/DTOs.swift +3 -25
  69. package/native-bridge/iOS/Source/DTOs/{Environment+Bandyer.swift → Environment+KaleyraVideoSDK.swift} +2 -3
  70. package/native-bridge/iOS/Source/DTOs/KaleyraVideoConfiguration+KaleyraVideoSDK.swift +113 -0
  71. package/native-bridge/iOS/Source/DTOs/KaleyraVideoConfiguration+UserInterfacePresenterConfiguration.swift +0 -1
  72. package/native-bridge/iOS/Source/DTOs/RecordingType+KaleyraVideoSDK.swift +19 -0
  73. package/native-bridge/iOS/Source/DTOs/{Region+Bandyer.swift → Region+KaleyraVideoSDK.swift} +2 -3
  74. package/native-bridge/iOS/Source/DTOs/UserDetails+Decodable.swift +4 -10
  75. package/native-bridge/iOS/Source/DTOs/UserDetails+KaleyraVideoSDK.swift +15 -0
  76. package/native-bridge/iOS/Source/Events/Reporters/CallClientEventsReporter.swift +41 -16
  77. package/native-bridge/iOS/Source/Events/Reporters/ChatClientEventsReporter.swift +22 -17
  78. package/native-bridge/iOS/Source/Events/Reporters/ClientState.swift +14 -42
  79. package/native-bridge/iOS/Source/Events/Reporters/EventsReporter.swift +17 -13
  80. package/native-bridge/iOS/Source/Extensions/URL+FromString.swift +0 -2
  81. package/native-bridge/iOS/Source/NativeHybridBridge/VideoHybridNativeBridge.swift +14 -43
  82. package/native-bridge/iOS/Source/NativeHybridBridge/VideoHybridNativeBridgeError.swift +0 -1
  83. package/native-bridge/iOS/Source/UI/KaleyraVideoSDKUserInterfacePresenter.swift +68 -100
  84. package/native-bridge/iOS/Source/UI/Presenters/PresentingViewControllerViewControllerPresenter.swift +0 -1
  85. package/native-bridge/iOS/Source/UI/Presenters/ViewControllerPresenter.swift +0 -1
  86. package/native-bridge/iOS/Source/UI/Presenters/WindowViewControllerPresenter.swift +0 -1
  87. package/native-bridge/iOS/Source/UI/UserInterfacePresenter+MainQueueRelay.swift +0 -1
  88. package/native-bridge/iOS/Source/UI/UserInterfacePresenter.swift +0 -1
  89. package/native-bridge/iOS/Source/User Details/Cache/UsersDetailsCache.swift +6 -7
  90. package/native-bridge/iOS/Source/User Details/Providers/UsersDetailsProvider.swift +6 -19
  91. package/package.json +12 -11
  92. package/src/KaleyraVideo.ts +0 -42
  93. package/video-react-native-module.podspec +4 -4
  94. package/lib/commonjs/native-bridge/TypeScript/UserDetailsFormatValidator.js +0 -32
  95. package/lib/commonjs/native-bridge/TypeScript/types/UserDetailsFormat.js +0 -4
  96. package/lib/module/native-bridge/TypeScript/UserDetailsFormatValidator.js +0 -28
  97. package/lib/module/native-bridge/TypeScript/types/UserDetailsFormat.js +0 -3
  98. package/lib/typescript/native-bridge/TypeScript/UserDetailsFormatValidator.d.ts +0 -4
  99. package/lib/typescript/native-bridge/TypeScript/types/UserDetailsFormat.d.ts +0 -19
  100. package/native-bridge/TypeScript/UserDetailsFormatValidator.ts +0 -35
  101. package/native-bridge/TypeScript/types/UserDetailsFormat.ts +0 -23
  102. package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/user_details/CachedUserDetailsFormatter.kt +0 -59
  103. package/native-bridge/iOS/Source/Abstractions/BandyerSDKProtocol.swift +0 -25
  104. package/native-bridge/iOS/Source/DTOs/AudioCallOptions+Bandyer.swift +0 -14
  105. package/native-bridge/iOS/Source/DTOs/CallOptions+Bandyer.swift +0 -14
  106. package/native-bridge/iOS/Source/DTOs/CreateCallOptions+Intent.swift +0 -17
  107. package/native-bridge/iOS/Source/DTOs/KaleyraVideoConfiguration+Bandyer.swift +0 -158
  108. package/native-bridge/iOS/Source/DTOs/RecordingType+Bandyer.swift +0 -33
  109. package/native-bridge/iOS/Source/DTOs/UserDetails+Bandyer.swift +0 -18
  110. package/native-bridge/iOS/Source/DTOs/UserDetailsFormat+Decodable.swift +0 -19
  111. package/native-bridge/iOS/Source/Events/Reporters/PushTokenEventsReporter.swift +0 -34
  112. package/native-bridge/iOS/Source/User Details/Formatter/FormatterProxy.swift +0 -16
  113. package/native-bridge/iOS/Source/User Details/Formatter/UserDetailsFormatter.swift +0 -83
@@ -3,32 +3,54 @@
3
3
 
4
4
  package com.kaleyra.video_hybrid_native_bridge.events.reporter
5
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
6
+ import com.kaleyra.video.State
7
+ import com.kaleyra.video_common_ui.KaleyraVideo
12
8
  import com.kaleyra.video_hybrid_native_bridge.events.Events.CallModuleStatusChanged
13
9
  import com.kaleyra.video_hybrid_native_bridge.events.Events.ChatModuleStatusChanged
14
10
  import com.kaleyra.video_hybrid_native_bridge.events.EventsEmitter
15
11
  import com.kaleyra.video_hybrid_native_bridge.events.EventsReporter
12
+ import kotlinx.coroutines.CoroutineScope
13
+ import kotlinx.coroutines.Job
14
+ import kotlinx.coroutines.flow.launchIn
15
+ import kotlinx.coroutines.flow.mapNotNull
16
+ import kotlinx.coroutines.flow.onEach
16
17
 
17
18
  class ModuleEventsReporter(
18
- val sdk: BandyerSDKInstance,
19
- val eventsEmitter: EventsEmitter
20
- ) : EventsReporter, BandyerModuleObserver {
19
+ val sdk: KaleyraVideo,
20
+ val eventsEmitter: EventsEmitter,
21
+ val coroutineScope: CoroutineScope
22
+ ) : EventsReporter {
21
23
 
22
- override fun start() = sdk.addModuleObserver(this)
23
- override fun stop() = sdk.removeModuleObserver(this)
24
+ private var jobs: MutableSet<Job> = mutableSetOf()
24
25
 
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
26
+ private var previousCallState: State? = null
27
+
28
+ private var previousChatState: State? = null
29
+
30
+ override fun start() {
31
+ stop()
32
+ jobs += sdk.conference.state
33
+ .mapNotNull { state ->
34
+ state.toCrossPlatformModuleStatus(previousCallState).also {
35
+ previousCallState = state
36
+ }
37
+ }
38
+ .onEach { state -> eventsEmitter.sendEvent(CallModuleStatusChanged, state) }
39
+ .launchIn(coroutineScope)
40
+ jobs += sdk.conversation.state
41
+ .mapNotNull { state ->
42
+ state.toCrossPlatformModuleStatus(previousChatState).also {
43
+ previousChatState = state
44
+ }
45
+ }
46
+ .onEach { state -> eventsEmitter.sendEvent(ChatModuleStatusChanged, state) }
47
+ .launchIn(coroutineScope)
29
48
  }
30
49
 
31
- override fun onModuleFailed(module: BandyerModule, throwable: Throwable) = Unit
32
- override fun onModulePaused(module: BandyerModule) = Unit
33
- override fun onModuleReady(module: BandyerModule) = Unit
50
+ override fun stop() {
51
+ previousCallState = null
52
+ previousChatState = null
53
+ jobs.forEach { it.cancel() }
54
+ jobs.clear()
55
+ }
34
56
  }
@@ -3,7 +3,7 @@
3
3
 
4
4
  package com.kaleyra.video_hybrid_native_bridge.events.reporter
5
5
 
6
- import com.bandyer.android_sdk.client.BandyerSDKInstance
6
+ import com.kaleyra.video_common_ui.KaleyraVideo
7
7
  import com.kaleyra.video_hybrid_native_bridge.events.EventsEmitter
8
8
  import com.kaleyra.video_hybrid_native_bridge.events.EventsReporter
9
9
  import kotlinx.coroutines.CoroutineScope
@@ -21,20 +21,20 @@ class SDKEventsReporter internal constructor(
21
21
  private var instance: SDKEventsReporter? = null
22
22
 
23
23
  fun create(
24
- sdk: BandyerSDKInstance,
24
+ sdk: KaleyraVideo,
25
25
  eventsEmitter: EventsEmitter,
26
26
  scope: CoroutineScope
27
27
  ): SDKEventsReporter = instance.takeIf { it?.isRunning == true } ?: SDKEventsReporter(sdk, eventsEmitter, scope).apply { instance = this }
28
28
  }
29
29
 
30
30
  private constructor(
31
- sdk: BandyerSDKInstance,
31
+ sdk: KaleyraVideo,
32
32
  eventsEmitter: EventsEmitter,
33
33
  scope: CoroutineScope
34
34
  ) : this(
35
- ModuleEventsReporter(sdk, eventsEmitter),
36
- CallEventsReporter(sdk, eventsEmitter),
37
- ChatEventsReporter(sdk, eventsEmitter),
35
+ ModuleEventsReporter(sdk, eventsEmitter, scope),
36
+ CallEventsReporter(sdk, eventsEmitter, scope),
37
+ ChatEventsReporter(sdk, eventsEmitter, scope),
38
38
  scope
39
39
  )
40
40
 
@@ -3,13 +3,14 @@
3
3
 
4
4
  package com.kaleyra.video_hybrid_native_bridge.extensions
5
5
 
6
+ import com.kaleyra.video_common_ui.CallUI
6
7
  import com.kaleyra.video_hybrid_native_bridge.CallDisplayMode
7
8
  import com.kaleyra.video_hybrid_native_bridge.CallDisplayMode.Background
8
9
  import com.kaleyra.video_hybrid_native_bridge.CallDisplayMode.Foreground
9
10
  import com.kaleyra.video_hybrid_native_bridge.CallDisplayMode.ForegroundPictureInPicture
10
11
 
11
12
  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
13
+ Background -> CallUI.DisplayMode.Background
14
+ Foreground -> CallUI.DisplayMode.Foreground
15
+ ForegroundPictureInPicture -> CallUI.DisplayMode.PictureInPicture
15
16
  }
@@ -0,0 +1,12 @@
1
+ package com.kaleyra.video_hybrid_native_bridge.extensions
2
+
3
+ import com.kaleyra.video.conference.Call
4
+ import com.kaleyra.video_hybrid_native_bridge.CallType
5
+
6
+ internal fun CallType.toSDK(): Call.PreferredType {
7
+ return when(this) {
8
+ CallType.Audio -> Call.PreferredType.audioOnly()
9
+ CallType.AudioUpgradable -> Call.PreferredType.audioUpgradable()
10
+ CallType.AudioVideo -> Call.PreferredType.audioVideo()
11
+ }
12
+ }
@@ -3,12 +3,11 @@
3
3
 
4
4
  package com.kaleyra.video_hybrid_native_bridge.extensions
5
5
 
6
- import com.bandyer.android_sdk.client.BandyerSDKConfiguration
6
+ import com.kaleyra.video.configuration.Configuration
7
7
  import com.kaleyra.video_hybrid_native_bridge.KaleyraVideoConfiguration
8
- import com.kaleyra.video_hybrid_native_bridge.CreateCallOptionsProxy
9
8
  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
9
+ import com.kaleyra.video_utils.logging.BaseLogger
10
+ import com.kaleyra.video_utils.logging.androidPrioryLogger
12
11
  import okhttp3.OkHttpClient
13
12
  import java.security.cert.X509Certificate
14
13
  import javax.net.ssl.X509TrustManager
@@ -17,23 +16,18 @@ import javax.net.ssl.X509TrustManager
17
16
  *
18
17
  * @author kristiyan
19
18
  */
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()
19
+ internal fun KaleyraVideoConfiguration.toSDK() =
20
+ Configuration(
21
+ appId = appID,
22
+ environment = environment.toSDK(),
23
+ region = region.toSDK(),
24
+ httpStack = trustedHttpClient(),
25
+ logger = if (logEnabled == true) androidPrioryLogger(BaseLogger.VERBOSE, -1) else null
26
+ )
32
27
 
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()
28
+ private fun trustedHttpClient() =
29
+ OkHttpClient.Builder().sslSocketFactory(TLSSocketFactoryCompat(), object : X509TrustManager {
30
+ override fun getAcceptedIssuers(): Array<X509Certificate> = arrayOf()
31
+ override fun checkClientTrusted(certs: Array<X509Certificate>, authType: String) = Unit
32
+ override fun checkServerTrusted(certs: Array<X509Certificate>, authType: String) = Unit
33
+ }).build()
@@ -6,7 +6,7 @@ package com.kaleyra.video_hybrid_native_bridge.extensions
6
6
  import com.kaleyra.video_hybrid_native_bridge.Environment
7
7
 
8
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)
9
+ "sandbox" -> com.kaleyra.video.configuration.Environment.Sandbox
10
+ "production" -> com.kaleyra.video.configuration.Environment.Production
11
+ else -> com.kaleyra.video.configuration.Environment.create(name)
12
12
  }
@@ -3,13 +3,11 @@
3
3
 
4
4
  package com.kaleyra.video_hybrid_native_bridge.extensions
5
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
6
+ import com.kaleyra.video.conference.Call
9
7
  import com.kaleyra.video_hybrid_native_bridge.RecordingType
10
8
 
11
- internal fun RecordingType?.toSDK(): CallRecordingType = when (this) {
12
- RecordingType.Manual -> MANUAL
13
- RecordingType.Automatic -> AUTOMATIC
14
- else -> CallRecordingType.NONE
9
+ internal fun RecordingType?.toSDK() = when (this) {
10
+ RecordingType.Manual -> Call.Recording.manual()
11
+ RecordingType.Automatic -> Call.Recording.automatic()
12
+ else -> Call.Recording.disabled()
15
13
  }
@@ -6,8 +6,8 @@ package com.kaleyra.video_hybrid_native_bridge.extensions
6
6
  import com.kaleyra.video_hybrid_native_bridge.Region
7
7
 
8
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)
9
+ "europe" -> com.kaleyra.video.configuration.Region.Europe
10
+ "india" -> com.kaleyra.video.configuration.Region.India
11
+ "us" -> com.kaleyra.video.configuration.Region.US
12
+ else -> com.kaleyra.video.configuration.Region.create(name)
13
13
  }
@@ -3,13 +3,12 @@
3
3
 
4
4
  package com.kaleyra.video_hybrid_native_bridge.extensions
5
5
 
6
- import com.bandyer.android_sdk.tool_configuration.screen_share.CustomScreenShareConfiguration
7
- import com.bandyer.android_sdk.tool_configuration.screen_share.ScreenShareOptionSet
6
+ import com.kaleyra.video_common_ui.CallUI
8
7
  import com.kaleyra.video_hybrid_native_bridge.ScreenShareToolConfiguration
9
8
 
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)
9
+ internal fun ScreenShareToolConfiguration?.toSDK(): CallUI.Action.ScreenShare? = when {
10
+ this?.inApp == true && this.wholeDevice == true -> CallUI.Action.ScreenShare.UserChoice
11
+ this?.inApp == true -> CallUI.Action.ScreenShare.App
12
+ this?.wholeDevice == true -> CallUI.Action.ScreenShare.WholeDevice
14
13
  else -> null
15
14
  }
@@ -3,93 +3,61 @@
3
3
 
4
4
  package com.kaleyra.video_hybrid_native_bridge.extensions
5
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
6
+ import com.kaleyra.video.conference.Call
7
+ import com.kaleyra.video_common_ui.CallUI
8
+ import com.kaleyra.video_common_ui.ChatUI
9
+ import com.kaleyra.video_common_ui.ChatUI.Action.CreateCall
16
10
  import com.kaleyra.video_hybrid_native_bridge.AudioCallType.Audio
17
11
  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
12
  import com.kaleyra.video_hybrid_native_bridge.Tools
21
13
 
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
14
+ internal fun Tools.toCallActions(): Set<CallUI.Action> {
15
+ val callActions = CallUI.Action.default.toMutableSet()
16
+ if (this.whiteboard == true) {
17
+ callActions.add(CallUI.Action.OpenWhiteboard.Full)
18
+ }
19
+ if (this.fileShare == true) {
20
+ callActions.add(CallUI.Action.FileShare)
21
+ }
27
22
 
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
- )
23
+ screenShare.toSDK()?.let {
24
+ callActions.add(it)
25
+ }
53
26
 
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
- ))
27
+ return callActions
66
28
  }
67
29
 
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)
30
+ internal fun Tools.toChatActions(): Set<ChatUI.Action> {
31
+ chat ?: return emptySet()
32
+ val chatActions = mutableSetOf<ChatUI.Action>()
33
+ when (chat.audioCallOption?.type) {
34
+ Audio -> {
35
+ chatActions.add(
36
+ CreateCall(
37
+ preferredType = Call.PreferredType.audioOnly(),
38
+ recordingType = chat.audioCallOption.recordingType.toSDK()
39
+ )
40
+ )
41
+ }
42
+
43
+ AudioUpgradable -> {
44
+ chatActions.add(
45
+ CreateCall(
46
+ preferredType = Call.PreferredType.audioUpgradable(),
47
+ recordingType = chat.audioCallOption.recordingType.toSDK()
48
+ )
49
+ )
50
+ }
51
+
52
+ else -> Unit
53
+ }
54
+ if (chat.videoCallOption != null) {
55
+ chatActions.add(
56
+ CreateCall(
57
+ preferredType = Call.PreferredType.audioVideo(),
58
+ recordingType = chat.videoCallOption.recordingType.toSDK()
59
+ )
60
+ )
61
+ }
62
+ return chatActions
72
63
  }
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
- )
@@ -3,7 +3,8 @@
3
3
 
4
4
  package com.kaleyra.video_hybrid_native_bridge.extensions
5
5
 
6
- import com.bandyer.android_sdk.utils.provider.UserDetails
6
+ import android.net.Uri
7
+ import com.kaleyra.video_common_ui.model.UserDetails
7
8
  import com.kaleyra.video_hybrid_native_bridge.repository.UserDetailsEntity
8
9
 
9
10
  /**
@@ -11,25 +12,31 @@ import com.kaleyra.video_hybrid_native_bridge.repository.UserDetailsEntity
11
12
  * @author kristiyan
12
13
  */
13
14
  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) }
15
+ return UserDetails(
16
+ userId = userID,
17
+ name = name ?: userID,
18
+ image = imageUrl?.let { Uri.parse(it) } ?: Uri.EMPTY
19
+ )
20
+ }
19
21
 
20
- email?.let { builder.withEmail(it) }
22
+ internal fun com.kaleyra.video_hybrid_native_bridge.UserDetails.toSDK(): UserDetails {
23
+ return UserDetails(
24
+ userId = userID,
25
+ name = name ?: userID,
26
+ image = imageURL?.let { Uri.parse(it) } ?: Uri.EMPTY
27
+ )
28
+ }
21
29
 
22
- imageUrl?.let { builder.withImageUrl(it) }
23
- }.build()
30
+ internal fun com.kaleyra.video_hybrid_native_bridge.UserDetails.toDatabaseEntity(): UserDetailsEntity {
31
+ return UserDetailsEntity(
32
+ userID = userID,
33
+ name = name,
34
+ imageUrl = imageURL
35
+ )
24
36
  }
25
37
 
26
38
  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
39
+ userID = this.userID,
40
+ name = this.name,
41
+ imageURL = this.imageUrl
33
42
  )
34
-
35
- internal fun UserDetails.toUserDetailsEntity(): UserDetailsEntity = UserDetailsEntity(userAlias, firstName, lastName, nickName, email, imageUrl)
@@ -8,9 +8,9 @@ import android.content.Context
8
8
  import android.content.Intent
9
9
  import android.util.Log
10
10
  import androidx.core.app.JobIntentService
11
- import com.kaleyra.video_hybrid_native_bridge.VideoSDKHybridBridge
12
11
  import com.kaleyra.video_hybrid_native_bridge.ContextContainer
13
12
  import com.kaleyra.video_hybrid_native_bridge.CrossPlatformAccessTokenProvider
13
+ import com.kaleyra.video_hybrid_native_bridge.VideoSDKHybridBridge
14
14
  import com.kaleyra.video_hybrid_native_bridge.events.Events
15
15
  import com.kaleyra.video_hybrid_native_bridge.events.EventsEmitter
16
16
  import com.kaleyra.video_hybrid_native_bridge.events.EventsReporter
@@ -59,7 +59,6 @@ class KaleyraVideoNotificationService : JobIntentService() {
59
59
  plugin.addUsersDetails(plugin.cachedUserDetails.toTypedArray())
60
60
  plugin.configureBridge(savedConfiguration)
61
61
  plugin.connect(savedUsed)
62
- plugin.handlePushNotificationPayload(webHookPayload)
63
62
  }
64
63
  } catch (exception: Throwable) {
65
64
  Log.e("KaleyraNotService", "" + exception.message)
@@ -10,7 +10,7 @@ interface UserDetailsDao {
10
10
  @get:Query("SELECT * FROM userdetailsentity")
11
11
  val all: List<UserDetailsEntity>
12
12
 
13
- @Query("SELECT * FROM userdetailsentity WHERE userAlias = :userAlias LIMIT 1")
13
+ @Query("SELECT * FROM userdetailsentity WHERE userID = :userAlias LIMIT 1")
14
14
  fun getUserDetailsEntity(userAlias: String): UserDetailsEntity?
15
15
 
16
16
  @Insert(onConflict = OnConflictStrategy.REPLACE)
@@ -6,17 +6,13 @@ package com.kaleyra.video_hybrid_native_bridge.repository
6
6
  import androidx.room.Entity
7
7
  import androidx.room.PrimaryKey
8
8
 
9
-
10
9
  /**
11
10
  * @suppress
12
11
  * @author kristiyan
13
12
  */
14
13
  @Entity
15
14
  data class UserDetailsEntity(
16
- @PrimaryKey val userAlias: String,
17
- var firstName: String? = null,
18
- var lastName: String? = null,
19
- var nickName: String? = null,
20
- var email: String? = null,
15
+ @PrimaryKey val userID: String,
16
+ var name: String? = null,
21
17
  var imageUrl: String? = null
22
18
  )
@@ -14,7 +14,7 @@ import androidx.room.TypeConverters
14
14
  *
15
15
  * @author kristiyan
16
16
  */
17
- @Database(entities = [UserDetailsEntity::class, ConfigurationEntity::class, ConnectedUserEntity::class], version = 2, exportSchema = false)
17
+ @Database(entities = [UserDetailsEntity::class, ConfigurationEntity::class, ConnectedUserEntity::class], version = 3, exportSchema = false)
18
18
  @TypeConverters(Converters::class)
19
19
  abstract class VideoHybridBridgeRepository : RoomDatabase() {
20
20
 
@@ -3,47 +3,49 @@
3
3
 
4
4
  package com.kaleyra.video_hybrid_native_bridge.ui
5
5
 
6
- import com.bandyer.android_sdk.client.BandyerSDKInstance
7
- import com.bandyer.android_sdk.intent.BandyerIntent
6
+ import com.kaleyra.video_common_ui.KaleyraVideo
8
7
  import com.kaleyra.video_hybrid_native_bridge.CallDisplayMode
9
- import com.kaleyra.video_hybrid_native_bridge.CallType.Audio
10
- import com.kaleyra.video_hybrid_native_bridge.CallType.AudioUpgradable
11
- import com.kaleyra.video_hybrid_native_bridge.CallType.AudioVideo
12
8
  import com.kaleyra.video_hybrid_native_bridge.ContextContainer
13
9
  import com.kaleyra.video_hybrid_native_bridge.CreateCallOptions
10
+ import com.kaleyra.video_hybrid_native_bridge.configurator.CachedSDKConfigurator
14
11
  import com.kaleyra.video_hybrid_native_bridge.extensions.toSDK
12
+ import com.kaleyra.video.State
15
13
 
16
14
  internal class SDKUserInterfacePresenter(
17
- private val sdk: BandyerSDKInstance,
18
- private val contextContainer: ContextContainer
15
+ private val sdk: KaleyraVideo,
16
+ private val contextContainer: ContextContainer,
17
+ private val configurator: CachedSDKConfigurator
19
18
  ) : UserInterfacePresenter {
20
19
 
21
20
  private val context
22
21
  get() = contextContainer.context
23
22
 
24
23
  override fun startCall(callOptions: CreateCallOptions) {
25
- val bandyerCallIntent = BandyerIntent.Builder().let {
26
- when (callOptions.callType) {
27
- Audio -> it.startWithAudioCall(context)
28
- AudioUpgradable -> it.startWithAudioUpgradableCall(context)
29
- AudioVideo -> it.startWithAudioVideoCall(context)
30
- }.with(ArrayList(callOptions.callees)).build()
24
+ sdk.conference.call(
25
+ userIDs = callOptions.callees,
26
+ options = {
27
+ recordingType = callOptions.recordingType.toSDK()
28
+ preferredType = callOptions.callType.toSDK()
29
+ }
30
+ ).onSuccess {
31
+ val withFeedback = configurator.lastConfiguration?.tools?.feedback == true
32
+ it.withFeedback = withFeedback
31
33
  }
32
- context.startActivity(bandyerCallIntent)
33
34
  }
34
35
 
35
36
  override fun startCallUrl(url: String) {
36
- val bandyerCallIntent = BandyerIntent.Builder().startFromJoinCallUrl(context, url).build()
37
- context.startActivity(bandyerCallIntent)
37
+ if (sdk.state.value == State.Disconnected) {
38
+ sdk.connect(url)
39
+ }
40
+ sdk.conference.joinUrl(url)
38
41
  }
39
42
 
40
43
  override fun startChat(userId: String) {
41
- val bandyerCallIntent = BandyerIntent.Builder().startWithChat(context).with(userId).build()
42
- context.startActivity(bandyerCallIntent)
44
+ sdk.conversation.chat(context, userId)
43
45
  }
44
46
 
45
47
  override fun setDisplayModeForCurrentCall(mode: CallDisplayMode) {
46
- val ongoingCall = sdk.callModule?.ongoingCall ?: return
47
- sdk.callModule?.setDisplayMode(ongoingCall, mode.toSDK())
48
+ val ongoingCall = sdk.conference.call.replayCache.firstOrNull() ?: return
49
+ ongoingCall.setDisplayMode(mode.toSDK())
48
50
  }
49
51
  }
@@ -4,14 +4,11 @@
4
4
  package com.kaleyra.video_hybrid_native_bridge.user_details
5
5
 
6
6
  import com.kaleyra.video_hybrid_native_bridge.UserDetails
7
- import com.kaleyra.video_hybrid_native_bridge.UserDetailsFormat
8
7
 
9
8
  interface CachedUserDetails {
10
9
 
11
10
  val cachedUserDetails: androidx.collection.ArraySet<UserDetails>
12
11
 
13
- fun setUserDetailsFormat(format: UserDetailsFormat)
14
-
15
12
  fun addUsersDetails(userDetails: Array<UserDetails>)
16
13
 
17
14
  fun removeUserDetails()