@kaleyra/video-react-native-module 1.6.0 → 2.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 (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 +11 -5
  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 +9 -7
  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
@@ -0,0 +1,71 @@
1
+ def kaleyraVideoSdkVersion = "4.2.1"
2
+
3
+ def gsonVersion = "2.9.1"
4
+ def kotlinVersionVersion = "1.9.0"
5
+ def jsonSerializationVersionVersion = "1.6.0"
6
+ def roomVersion = "2.5.2"
7
+
8
+ def junitVersion = "4.13.2"
9
+ def mockkVersion = "1.13.1"
10
+ def jsonVersion = "20230618"
11
+ def coroutinesTestVersion = "1.8.0"
12
+ def testObserverVersion = "1.6.2"
13
+
14
+ apply plugin: 'kotlin-android'
15
+ apply plugin: 'com.google.devtools.ksp'
16
+
17
+ allprojects {
18
+ repositories {
19
+ google()
20
+ mavenLocal()
21
+ mavenCentral()
22
+ maven { url 'https://maven.bandyer.com/releases' }
23
+ maven { url 'https://jitpack.io' }
24
+ }
25
+ }
26
+
27
+ android {
28
+ namespace 'com.kaleyra.video_hybrid_native_bridge'
29
+
30
+ defaultConfig {
31
+ compileSdk project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 34
32
+ minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 22
33
+ testInstrumentationRunner "com.kaleyra.video_hybrid_native_bridge.utils.RandomRunner"
34
+ }
35
+
36
+ sourceSets {
37
+ main.java.srcDirs += 'src/main/kotlin'
38
+ }
39
+
40
+ compileOptions {
41
+ sourceCompatibility JavaVersion.VERSION_1_8
42
+ targetCompatibility JavaVersion.VERSION_1_8
43
+ }
44
+
45
+ kotlinOptions {
46
+ jvmTarget = "1.8"
47
+ }
48
+
49
+ testOptions {
50
+ unitTests.returnDefaultValues = true
51
+ }
52
+ }
53
+
54
+ dependencies {
55
+ implementation(platform("com.kaleyra:video-sdk-bom:$kaleyraVideoSdkVersion"))
56
+ implementation "com.kaleyra:video-sdk"
57
+ implementation "com.kaleyra:video-extension-external-camera"
58
+
59
+ implementation "com.google.code.gson:gson:$gsonVersion"
60
+ implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlinVersionVersion"
61
+ implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:$jsonSerializationVersionVersion"
62
+ implementation "androidx.room:room-runtime:$roomVersion"
63
+ ksp "androidx.room:room-compiler:$roomVersion"
64
+
65
+ /*** Testing ***/
66
+ testImplementation "junit:junit:$junitVersion"
67
+ testImplementation "io.mockk:mockk:$mockkVersion"
68
+ testImplementation "org.json:json:$jsonVersion"
69
+ testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutinesTestVersion"
70
+ testImplementation "com.github.ologe:flow-test-observer:$testObserverVersion"
71
+ }
@@ -1,63 +1,7 @@
1
- buildscript {
2
- ext.kotlin_version = '1.6.10'
3
- repositories {
4
- google()
5
- mavenLocal()
6
- mavenCentral()
7
- maven { url 'https://maven.bandyer.com/releases' }
8
- maven { url 'https://jitpack.io' }
9
- }
10
-
11
- dependencies {
12
- classpath 'com.android.tools.build:gradle:7.1.2'
13
- classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
14
- }
15
- }
16
-
17
- allprojects {
18
- repositories {
19
- google()
20
- mavenLocal()
21
- mavenCentral()
22
- maven { url 'https://maven.bandyer.com/releases' }
23
- maven { url 'https://jitpack.io' }
24
- }
25
- }
26
-
27
- apply plugin: 'kotlin-android'
28
- apply plugin: 'kotlin-kapt'
29
-
30
- android {
31
- compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 33
32
-
33
- defaultConfig {
34
- minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 22
35
- testInstrumentationRunner "com.kaleyra.video_hybrid_native_bridge.utils.RandomRunner"
36
- }
37
-
38
- sourceSets {
39
- main.java.srcDirs += 'src/main/kotlin'
40
- }
41
-
42
- testOptions {
43
- unitTests.returnDefaultValues = true
44
- }
45
-
1
+ plugins {
2
+ id 'com.android.library' version "8.1.1"
3
+ id 'org.jetbrains.kotlin.android' version "1.9.0"
4
+ id 'com.google.devtools.ksp' version "1.9.0-1.0.13"
46
5
  }
47
6
 
48
- dependencies {
49
- implementation 'com.google.code.gson:gson:2.9.1'
50
- implementation "com.kaleyra:collaboration-suite-utils:3.0.6"
51
- implementation "com.bandyer:bandyer-android-sdk:3.10.0"
52
- implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
53
- compileOnly "org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.1"
54
- implementation "androidx.room:room-runtime:2.4.0-beta02"
55
- kapt "androidx.room:room-compiler:2.4.0-beta02"
56
-
57
- /*** Testing ***/
58
- testImplementation 'junit:junit:4.13.2'
59
- testImplementation 'io.mockk:mockk:1.13.2'
60
- testImplementation "org.json:json:20180813"
61
- testImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.4'
62
- testImplementation "com.github.ologe:flow-test-observer:1.5.1"
63
- }
7
+ apply from: "bridge.gradle"
@@ -1,5 +1,5 @@
1
1
  distributionBase=GRADLE_USER_HOME
2
2
  distributionPath=wrapper/dists
3
- distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
3
+ distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
4
4
  zipStoreBase=GRADLE_USER_HOME
5
5
  zipStorePath=wrapper/dists
@@ -1 +1,9 @@
1
+ pluginManagement {
2
+ repositories {
3
+ google()
4
+ mavenCentral()
5
+ gradlePluginPortal()
6
+ }
7
+ }
8
+
1
9
  rootProject.name = 'video_hybrid_native_bridge'
@@ -1 +1 @@
1
- <manifest package="com.kaleyra.video_hybrid_native_bridge" />
1
+ <manifest />
@@ -205,6 +205,8 @@ data class Region (
205
205
  )
206
206
 
207
207
  /**
208
+ * Video Module Tools
209
+ *
208
210
  * Define the tools to use
209
211
  */
210
212
  data class Tools (
@@ -355,53 +357,17 @@ data class Session (
355
357
  */
356
358
  data class UserDetails (
357
359
  /**
358
- * Email of the user
359
- */
360
- val email: String? = null,
361
-
362
- /**
363
- * First name of the user
364
- */
365
- val firstName: String? = null,
366
-
367
- /**
368
- * Last name of the user
369
- */
370
- val lastName: String? = null,
371
-
372
- /**
373
- * Nickname for the user
360
+ * Image url to use as placeholder for the user.
374
361
  */
375
- val nickName: String? = null,
362
+ val imageURL: String? = null,
376
363
 
377
364
  /**
378
- * Image url to use as placeholder for the user.
365
+ * The user's display name.
379
366
  */
380
- val profileImageURL: String? = null,
367
+ val name: String? = null,
381
368
 
382
369
  /**
383
370
  * User identifier
384
371
  */
385
372
  val userID: String
386
373
  )
387
-
388
- /**
389
- * This is used to display the user details in the call/chat UI
390
- */
391
- data class UserDetailsFormat (
392
- /**
393
- * Format to be used when displaying an android notification
394
- * <br/>
395
- * <br/>
396
- * <b><font color="blue">default</font>: equals to UserDetailsFormatter.default</b>
397
- */
398
- val androidNotification: String? = null,
399
-
400
- /**
401
- * Format to be used to display a user details on the call/chat UI
402
- * <br/>
403
- * <br/>
404
- * <b><font color="blue">default</font>: ${userAlias}</b>
405
- */
406
- val default: String
407
- )
@@ -3,14 +3,16 @@
3
3
 
4
4
  package com.kaleyra.video_hybrid_native_bridge
5
5
 
6
- import com.bandyer.android_sdk.client.AccessTokenProvider
7
- import com.bandyer.android_sdk.client.Completion
6
+ import kotlin.coroutines.resume
7
+ import kotlin.coroutines.suspendCoroutine
8
8
 
9
- internal class SDKAccessTokenProviderProxy(val tokenProvider: CrossPlatformAccessTokenProvider) : AccessTokenProvider {
10
- override fun provideAccessToken(userId: String, completion: Completion<String>) {
11
- tokenProvider.provideAccessToken(userId) {
12
- if (it.isSuccess) completion.success(it.getOrThrow())
13
- else completion.error(it.exceptionOrNull() ?: Throwable("connection error"))
9
+ internal class SDKAccessTokenProviderProxy(val tokenProvider: CrossPlatformAccessTokenProvider) {
10
+ suspend fun provideAccessToken(userId: String): Result<String> {
11
+ return suspendCoroutine { continuation ->
12
+ tokenProvider.provideAccessToken(userId) {
13
+ if (it.isSuccess) continuation.resume(Result.success(it.getOrThrow()))
14
+ else continuation.resume(Result.failure(it.exceptionOrNull() ?: Throwable("connection error")))
15
+ }
14
16
  }
15
17
  }
16
18
  }
@@ -16,6 +16,4 @@ interface VideoHybridBridge : CachedUserConnector, UserInterfacePresenter, Cache
16
16
  val tokenProvider: CrossPlatformAccessTokenProvider
17
17
 
18
18
  val eventsEmitter: EventsEmitter
19
- fun verifyCurrentCall(verify: Boolean)
20
- fun handlePushNotificationPayload(payload: String)
21
19
  }
@@ -3,12 +3,11 @@
3
3
 
4
4
  package com.kaleyra.video_hybrid_native_bridge
5
5
 
6
- import com.bandyer.android_sdk.client.BandyerSDK
7
- import com.bandyer.android_sdk.client.BandyerSDKInstance
6
+ import com.kaleyra.video_common_ui.KaleyraVideo
8
7
  import com.kaleyra.video_hybrid_native_bridge.configurator.CachedSDKConfigurator
9
8
  import com.kaleyra.video_hybrid_native_bridge.configurator.VideoSDKConfigurator
10
- import com.kaleyra.video_hybrid_native_bridge.connector.VideoSDKCachedUserConnector
11
9
  import com.kaleyra.video_hybrid_native_bridge.connector.CachedUserConnector
10
+ import com.kaleyra.video_hybrid_native_bridge.connector.VideoSDKCachedUserConnector
12
11
  import com.kaleyra.video_hybrid_native_bridge.events.EventsEmitter
13
12
  import com.kaleyra.video_hybrid_native_bridge.events.EventsReporter
14
13
  import com.kaleyra.video_hybrid_native_bridge.events.reporter.SDKEventsReporter
@@ -22,26 +21,23 @@ import kotlinx.coroutines.asCoroutineDispatcher
22
21
  import java.util.concurrent.Executors
23
22
 
24
23
  class VideoSDKHybridBridge(
25
- override val contextContainer: ContextContainer,
26
- override val tokenProvider: CrossPlatformAccessTokenProvider,
27
- override val eventsEmitter: EventsEmitter,
28
- private val sdk: BandyerSDKInstance = BandyerSDK.getInstance(),
29
- private val presenter: UserInterfacePresenter = SDKUserInterfacePresenter(sdk, contextContainer),
30
- private val backgroundScope: CoroutineScope = CoroutineScope(Executors.newSingleThreadExecutor().asCoroutineDispatcher()),
31
- private val eventsReporter: EventsReporter = SDKEventsReporter.create(sdk, eventsEmitter, backgroundScope),
32
- private val repository: VideoHybridBridgeRepository = VideoHybridBridgeRepository.getInstance(contextContainer.context.applicationContext),
33
- private val connector: CachedUserConnector = VideoSDKCachedUserConnector(sdk, repository, tokenProvider, eventsReporter, backgroundScope),
34
- private val userDetails: CachedUserDetails = SDKCachedUserDetails(sdk, contextContainer, repository, backgroundScope),
35
- private val createCallOptionsProxy: CreateCallOptionsProxy = CreateCallOptionsProxy(),
36
- private val configurator: CachedSDKConfigurator = VideoSDKConfigurator(sdk, createCallOptionsProxy, repository, backgroundScope),
24
+ override val contextContainer: ContextContainer,
25
+ override val tokenProvider: CrossPlatformAccessTokenProvider,
26
+ override val eventsEmitter: EventsEmitter,
27
+ private val sdk: KaleyraVideo = KaleyraVideo,
28
+ private val backgroundScope: CoroutineScope = CoroutineScope(Executors.newSingleThreadExecutor().asCoroutineDispatcher()),
29
+ private val eventsReporter: EventsReporter = SDKEventsReporter.create(sdk, eventsEmitter, backgroundScope),
30
+ private val repository: VideoHybridBridgeRepository = VideoHybridBridgeRepository.getInstance(contextContainer.context.applicationContext),
31
+ private val connector: CachedUserConnector = VideoSDKCachedUserConnector(sdk, repository, tokenProvider, eventsReporter, backgroundScope),
32
+ private val userDetails: CachedUserDetails = SDKCachedUserDetails(sdk, repository, backgroundScope),
33
+ private val configurator: CachedSDKConfigurator = VideoSDKConfigurator(sdk, repository, backgroundScope),
34
+ private val presenter: UserInterfacePresenter = SDKUserInterfacePresenter(sdk, contextContainer, configurator),
37
35
  ) : VideoHybridBridge,
38
36
  CachedUserConnector by connector,
39
37
  UserInterfacePresenter by presenter,
40
38
  CachedUserDetails by userDetails,
41
39
  CachedSDKConfigurator by configurator {
42
40
 
43
- override fun handlePushNotificationPayload(payload: String) = sdk.handleNotification(payload.replace("\\", ""))
44
-
45
41
  override fun reset() {
46
42
  configurator.reset()
47
43
  clearUserCache()
@@ -53,12 +49,6 @@ class VideoSDKHybridBridge(
53
49
  }
54
50
 
55
51
  override fun startCall(callOptions: CreateCallOptions) {
56
- createCallOptionsProxy.createCallOptions = callOptions
57
52
  presenter.startCall(callOptions)
58
53
  }
59
-
60
- override fun verifyCurrentCall(verify: Boolean) {
61
- val ongoingCall = sdk.callModule?.ongoingCall ?: return
62
- sdk.callModule?.setVerified(ongoingCall, verify)
63
- }
64
54
  }
@@ -3,9 +3,12 @@
3
3
 
4
4
  package com.kaleyra.video_hybrid_native_bridge.configurator
5
5
 
6
- import com.bandyer.android_sdk.client.BandyerSDKInstance
6
+ import com.kaleyra.video_common_ui.CallUI
7
+ import com.kaleyra.video_common_ui.ChatUI
8
+ import com.kaleyra.video_common_ui.KaleyraVideo
7
9
  import com.kaleyra.video_hybrid_native_bridge.KaleyraVideoConfiguration
8
- import com.kaleyra.video_hybrid_native_bridge.CreateCallOptionsProxy
10
+ import com.kaleyra.video_hybrid_native_bridge.extensions.toCallActions
11
+ import com.kaleyra.video_hybrid_native_bridge.extensions.toChatActions
9
12
  import com.kaleyra.video_hybrid_native_bridge.extensions.toSDK
10
13
  import com.kaleyra.video_hybrid_native_bridge.repository.ConfigurationEntity
11
14
  import com.kaleyra.video_hybrid_native_bridge.repository.VideoHybridBridgeRepository
@@ -13,8 +16,7 @@ import kotlinx.coroutines.CoroutineScope
13
16
  import kotlinx.coroutines.launch
14
17
 
15
18
  internal class VideoSDKConfigurator(
16
- private val sdk: BandyerSDKInstance,
17
- private val createCallOptionsProxy: CreateCallOptionsProxy,
19
+ private val sdk: KaleyraVideo,
18
20
  private val repository: VideoHybridBridgeRepository,
19
21
  private val scope: CoroutineScope
20
22
  ) : CachedSDKConfigurator {
@@ -24,7 +26,9 @@ internal class VideoSDKConfigurator(
24
26
  override fun configureBridge(configuration: KaleyraVideoConfiguration) {
25
27
  scope.launch {
26
28
  repository.configurationDao().insert(ConfigurationEntity(configuration))
27
- sdk.configure(configuration.toSDK(createCallOptionsProxy))
29
+ sdk.configure(configuration.toSDK())
30
+ sdk.conference.callActions = configuration.tools?.toCallActions() ?: CallUI.Action.default
31
+ sdk.conversation.chatActions = configuration.tools?.toChatActions() ?: ChatUI.Action.default
28
32
  lastConfiguration = configuration
29
33
  }
30
34
  }
@@ -33,6 +37,8 @@ internal class VideoSDKConfigurator(
33
37
  scope.launch {
34
38
  repository.clearAllTables()
35
39
  sdk.reset()
40
+ KaleyraVideo.conference.callActions = CallUI.Action.default
41
+ KaleyraVideo.conversation.chatActions = ChatUI.Action.default
36
42
  lastConfiguration = null
37
43
  }
38
44
  }
@@ -4,10 +4,10 @@
4
4
  package com.kaleyra.video_hybrid_native_bridge.connector
5
5
 
6
6
  import androidx.annotation.VisibleForTesting
7
- import com.bandyer.android_sdk.client.BandyerSDKInstance
8
- import com.bandyer.android_sdk.client.Session
7
+ import com.kaleyra.video_common_ui.KaleyraVideo
9
8
  import com.kaleyra.video_hybrid_native_bridge.CrossPlatformAccessTokenProvider
10
9
  import com.kaleyra.video_hybrid_native_bridge.SDKAccessTokenProviderProxy
10
+ import com.kaleyra.video_hybrid_native_bridge.Session
11
11
  import com.kaleyra.video_hybrid_native_bridge.events.EventsReporter
12
12
  import com.kaleyra.video_hybrid_native_bridge.repository.ConnectedUserEntity
13
13
  import com.kaleyra.video_hybrid_native_bridge.repository.VideoHybridBridgeRepository
@@ -15,7 +15,7 @@ import kotlinx.coroutines.CoroutineScope
15
15
  import kotlinx.coroutines.launch
16
16
 
17
17
  internal class VideoSDKCachedUserConnector(
18
- private val sdk: BandyerSDKInstance,
18
+ private val sdk: KaleyraVideo,
19
19
  private val repository: VideoHybridBridgeRepository,
20
20
  private val tokenProvider: CrossPlatformAccessTokenProvider,
21
21
  private val eventsReporter: EventsReporter,
@@ -31,8 +31,10 @@ internal class VideoSDKCachedUserConnector(
31
31
  scope.launch {
32
32
  repository.connectedUserDao().insert(ConnectedUserEntity(userID))
33
33
  eventsReporter.start()
34
- sdk.connect(Session(userID, accessTokenProviderProxy))
35
- lastConnectedUserId = userID
34
+ val connectedUser = kotlin.runCatching {
35
+ sdk.connect(userID) { accessTokenProviderProxy.provideAccessToken(userID) }.await()
36
+ }.getOrNull()
37
+ lastConnectedUserId = connectedUser?.userId
36
38
  }
37
39
  }
38
40
 
@@ -3,52 +3,44 @@
3
3
 
4
4
  package com.kaleyra.video_hybrid_native_bridge.events.reporter
5
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
6
+ import com.kaleyra.video.conference.Call
7
+ import com.kaleyra.video_common_ui.KaleyraVideo
12
8
  import com.kaleyra.video_hybrid_native_bridge.events.Events.CallError
13
9
  import com.kaleyra.video_hybrid_native_bridge.events.EventsEmitter
14
10
  import com.kaleyra.video_hybrid_native_bridge.events.EventsReporter
15
- import java.lang.ref.WeakReference
11
+ import kotlinx.coroutines.CoroutineScope
12
+ import kotlinx.coroutines.Job
13
+ import kotlinx.coroutines.flow.flatMapLatest
14
+ import kotlinx.coroutines.flow.launchIn
15
+ import kotlinx.coroutines.flow.map
16
+ import kotlinx.coroutines.flow.onEach
16
17
 
17
18
  class CallEventsReporter(
18
- private val sdk: BandyerSDKInstance,
19
- private val eventsEmitter: EventsEmitter
20
- ) : EventsReporter, CallObserver, CallUIObserver {
19
+ private val sdk: KaleyraVideo,
20
+ private val eventsEmitter: EventsEmitter,
21
+ private val coroutineScope: CoroutineScope
22
+ ) : EventsReporter {
21
23
 
22
24
  private val failedCalls = HashMap<String, Call>()
23
25
 
26
+ private var job: Job? = null
27
+
24
28
  override fun start() {
25
- sdk.callModule!!.addCallObserver(this)
26
- sdk.callModule!!.addCallUIObserver(this)
29
+ stop()
30
+ job = sdk.conference.call
31
+ .flatMapLatest { call -> call.state.map { call to it } }
32
+ .onEach { (call, callState) ->
33
+ if (callState is Call.State.Disconnected.Ended.Error) {
34
+ val id = call.id
35
+ if (failedCalls.containsKey(id)) return@onEach
36
+ failedCalls[id] = call
37
+ eventsEmitter.sendEvent(CallError, callState.reason)
38
+ }
39
+ }.launchIn(coroutineScope)
27
40
  }
28
41
 
29
42
  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)
43
+ job?.cancel()
44
+ job = null
39
45
  }
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
46
  }
@@ -3,41 +3,51 @@
3
3
 
4
4
  package com.kaleyra.video_hybrid_native_bridge.events.reporter
5
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
6
+ import com.kaleyra.video.conversation.Chat
7
+ import com.kaleyra.video_common_ui.KaleyraVideo
12
8
  import com.kaleyra.video_hybrid_native_bridge.events.Events.ChatError
13
9
  import com.kaleyra.video_hybrid_native_bridge.events.EventsEmitter
14
10
  import com.kaleyra.video_hybrid_native_bridge.events.EventsReporter
15
- import java.lang.ref.WeakReference
11
+ import kotlinx.coroutines.CoroutineScope
12
+ import kotlinx.coroutines.Job
13
+ import kotlinx.coroutines.flow.launchIn
14
+ import kotlinx.coroutines.flow.onCompletion
15
+ import kotlinx.coroutines.flow.onEach
16
16
 
17
17
  class ChatEventsReporter(
18
- private val sdk: BandyerSDKInstance,
19
- private val eventsEmitter: EventsEmitter
20
- ) : EventsReporter, ChatObserver, ChatUIObserver {
18
+ private val sdk: KaleyraVideo,
19
+ private val eventsEmitter: EventsEmitter,
20
+ private val coroutineScope: CoroutineScope
21
+ ) : EventsReporter {
21
22
 
22
23
  private val failedChats = HashMap<String, Chat>()
23
24
 
25
+ private val chatJobs = HashMap<String, Job>()
26
+
27
+ private var job: Job? = null
28
+
24
29
  override fun start() {
25
- sdk.chatModule?.addChatObserver(this)
26
- sdk.chatModule?.addChatUIObserver(this)
30
+ stop()
31
+ job = sdk.conversation.chats
32
+ .onEach { chats ->
33
+ chats.forEach { chat ->
34
+ chatJobs[chat.id]?.cancel()
35
+ chatJobs[chat.id] = chat.state.onEach eachState@ { state ->
36
+ if (state is Chat.State.Closed.Error) {
37
+ val id = chat.id
38
+ if (failedChats.containsKey(id)) return@eachState
39
+ failedChats[id] = chat
40
+ eventsEmitter.sendEvent(ChatError, state.reason)
41
+ }
42
+ }.launchIn(coroutineScope)
43
+ }
44
+ }
45
+ .onCompletion { chatJobs.values.forEach { it.cancel() } }
46
+ .launchIn(coroutineScope)
27
47
  }
28
48
 
29
49
  override fun stop() {
30
- sdk.chatModule?.removeChatObserver(this)
31
- sdk.chatModule?.removeChatUIObserver(this)
50
+ job?.cancel()
51
+ job = null
32
52
  }
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
53
  }
@@ -3,27 +3,26 @@
3
3
 
4
4
  package com.kaleyra.video_hybrid_native_bridge.events.reporter
5
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
6
+ import com.kaleyra.video.State
12
7
  import com.kaleyra.video_hybrid_native_bridge.events.reporter.CrossPlatformModuleStatus.Connecting
13
8
  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
9
+ import com.kaleyra.video_hybrid_native_bridge.events.reporter.CrossPlatformModuleStatus.Disconnected
10
+ import com.kaleyra.video_hybrid_native_bridge.events.reporter.CrossPlatformModuleStatus.Connected
11
+ import com.kaleyra.video_hybrid_native_bridge.events.reporter.CrossPlatformModuleStatus.Reconnecting
16
12
 
17
13
  enum class CrossPlatformModuleStatus {
18
- Ready,
14
+ Disconnected,
19
15
  Connecting,
20
- Stopped,
16
+ Connected,
17
+ Reconnecting,
21
18
  Failed
22
19
  }
23
20
 
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()
21
+ internal fun State.toCrossPlatformModuleStatus(previousState: State?): String? = when {
22
+ previousState is State.Connected && this is State.Connecting -> Reconnecting.name.lowercase()
23
+ this is State.Connecting -> Connecting.name.lowercase()
24
+ this is State.Connected -> Connected.name.lowercase()
25
+ this is State.Disconnected.Error -> Failed.name.lowercase()
26
+ this is State.Disconnected -> Disconnected.name.lowercase()
27
+ else -> null
29
28
  }