@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.
- package/README.md +17 -47
- package/android/build.gradle +24 -32
- package/android/gradle.properties +3 -3
- package/android/settings.gradle +0 -5
- package/android/src/main/AndroidManifest.xml +1 -1
- package/android/src/main/assets/kaleyra_video_wrapper_info.txt +1 -1
- package/android/src/main/java/com/kaleyra/video_react_native_module/VideoNativeModule.kt +0 -9
- package/index.ts +0 -2
- package/ios/PluginInfo/_KaleyraVideoHybridVersionInfo.swift +1 -1
- package/ios/VideoNativeModule.m +0 -6
- package/ios/VideoNativeModule.swift +1 -20
- package/lib/commonjs/src/KaleyraVideo.js +0 -34
- package/lib/module/src/KaleyraVideo.js +0 -34
- package/lib/typescript/index.d.ts +2 -2
- package/lib/typescript/native-bridge/TypeScript/types/UserDetails.d.ts +3 -15
- package/lib/typescript/src/KaleyraVideo.d.ts +1 -16
- package/native-bridge/TypeScript/types/UserDetails.ts +3 -18
- package/native-bridge/android/bridge.gradle +71 -0
- package/native-bridge/android/build.gradle +5 -61
- package/native-bridge/android/gradle/wrapper/gradle-wrapper.properties +1 -1
- package/native-bridge/android/settings.gradle +8 -0
- package/native-bridge/android/src/main/AndroidManifest.xml +1 -1
- package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/DTOs.kt +6 -40
- package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/SDKAccessTokenProviderProxy.kt +9 -7
- package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/VideoHybridBridge.kt +0 -2
- package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/VideoSDKHybridBridge.kt +13 -23
- package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/configurator/VideoSDKConfigurator.kt +32 -24
- package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/connector/VideoSDKCachedUserConnector.kt +7 -5
- package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/events/reporter/CallEventsReporter.kt +27 -35
- package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/events/reporter/ChatEventsReporter.kt +34 -24
- package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/events/reporter/CrossPlatformModuleStatus.kt +14 -15
- package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/events/reporter/ModuleEventsReporter.kt +40 -18
- package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/events/reporter/SDKEventsReporter.kt +6 -6
- package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/extensions/CallDisplayExtension.kt +4 -3
- package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/extensions/CallTypeExtensions.kt +12 -0
- package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/extensions/ConfigurationExtension.kt +17 -23
- package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/extensions/EnvironmentExtension.kt +3 -3
- package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/extensions/RecordingTypeExtension.kt +5 -7
- package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/extensions/RegionExtension.kt +4 -4
- package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/extensions/ScreenShareToolConfigurationExtension.kt +5 -6
- package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/extensions/ToolsExtension.kt +49 -81
- package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/extensions/UserExtensions.kt +24 -17
- package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/notifications/KaleyraVideoNotificationService.kt +1 -2
- package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/repository/UserDetailsDao.kt +1 -1
- package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/repository/UserDetailsEntity.kt +2 -6
- package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/repository/VideoHybridBridgeRepository.kt +1 -1
- package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/ui/SDKUserInterfacePresenter.kt +22 -20
- package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/user_details/CachedUserDetails.kt +0 -3
- package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/user_details/SDKCachedUserDetails.kt +22 -30
- package/native-bridge/iOS/KaleyraVideoHybridNativeBridge.xcodeproj/project.pbxproj +84 -132
- package/native-bridge/iOS/Podfile +2 -2
- package/native-bridge/iOS/Podfile.lock +9 -9
- package/native-bridge/iOS/Source/Abstractions/CallWindowProtocol.swift +3 -6
- package/native-bridge/iOS/Source/Abstractions/KaleyraVideoSDKProtocol.swift +20 -0
- package/native-bridge/iOS/Source/AccessToken/AccessTokenRequester.swift +0 -1
- package/native-bridge/iOS/Source/AccessToken/TokenProvider.swift +1 -2
- package/native-bridge/iOS/Source/Broadcast/BroadcastConfigurationPlistReader.swift +0 -1
- package/native-bridge/iOS/Source/Concurrency/DispatchQueue+isMain.swift +0 -1
- package/native-bridge/iOS/Source/Concurrency/MainQueueDispatcher.swift +0 -1
- package/native-bridge/iOS/Source/Concurrency/MainQueueRelay.swift +0 -1
- package/native-bridge/iOS/Source/DTOs/AudioCallOptions+Equatable.swift +0 -1
- package/native-bridge/iOS/Source/DTOs/AudioCallOptions+KaleyraVideoSDK.swift +13 -0
- package/native-bridge/iOS/Source/DTOs/{AudioCallType+Bandyer.swift → AudioCallType+KaleyraVideoSDK.swift} +2 -3
- package/native-bridge/iOS/Source/DTOs/CallOptions+Equatable.swift +0 -1
- package/native-bridge/iOS/Source/DTOs/CallOptions+KaleyraVideoSDK.swift +12 -0
- package/native-bridge/iOS/Source/DTOs/{CallType+Bandyer.swift → CallType+KaleyraVideoSDK.swift} +2 -3
- package/native-bridge/iOS/Source/DTOs/CreateCallOptions+KaleyraVideoSDK.swift +12 -0
- package/native-bridge/iOS/Source/DTOs/DTOs.swift +3 -25
- package/native-bridge/iOS/Source/DTOs/{Environment+Bandyer.swift → Environment+KaleyraVideoSDK.swift} +2 -3
- package/native-bridge/iOS/Source/DTOs/KaleyraVideoConfiguration+KaleyraVideoSDK.swift +113 -0
- package/native-bridge/iOS/Source/DTOs/KaleyraVideoConfiguration+UserInterfacePresenterConfiguration.swift +0 -1
- package/native-bridge/iOS/Source/DTOs/RecordingType+KaleyraVideoSDK.swift +19 -0
- package/native-bridge/iOS/Source/DTOs/{Region+Bandyer.swift → Region+KaleyraVideoSDK.swift} +2 -3
- package/native-bridge/iOS/Source/DTOs/UserDetails+Decodable.swift +4 -10
- package/native-bridge/iOS/Source/DTOs/UserDetails+KaleyraVideoSDK.swift +15 -0
- package/native-bridge/iOS/Source/Events/Reporters/CallClientEventsReporter.swift +41 -16
- package/native-bridge/iOS/Source/Events/Reporters/ChatClientEventsReporter.swift +22 -17
- package/native-bridge/iOS/Source/Events/Reporters/ClientState.swift +14 -42
- package/native-bridge/iOS/Source/Events/Reporters/EventsReporter.swift +17 -13
- package/native-bridge/iOS/Source/Extensions/URL+FromString.swift +0 -2
- package/native-bridge/iOS/Source/NativeHybridBridge/VideoHybridNativeBridge.swift +14 -43
- package/native-bridge/iOS/Source/NativeHybridBridge/VideoHybridNativeBridgeError.swift +0 -1
- package/native-bridge/iOS/Source/UI/KaleyraVideoSDKUserInterfacePresenter.swift +68 -100
- package/native-bridge/iOS/Source/UI/Presenters/PresentingViewControllerViewControllerPresenter.swift +0 -1
- package/native-bridge/iOS/Source/UI/Presenters/ViewControllerPresenter.swift +0 -1
- package/native-bridge/iOS/Source/UI/Presenters/WindowViewControllerPresenter.swift +0 -1
- package/native-bridge/iOS/Source/UI/UserInterfacePresenter+MainQueueRelay.swift +0 -1
- package/native-bridge/iOS/Source/UI/UserInterfacePresenter.swift +0 -1
- package/native-bridge/iOS/Source/User Details/Cache/UsersDetailsCache.swift +6 -7
- package/native-bridge/iOS/Source/User Details/Providers/UsersDetailsProvider.swift +6 -19
- package/package.json +12 -11
- package/src/KaleyraVideo.ts +0 -42
- package/video-react-native-module.podspec +4 -4
- package/lib/commonjs/native-bridge/TypeScript/UserDetailsFormatValidator.js +0 -32
- package/lib/commonjs/native-bridge/TypeScript/types/UserDetailsFormat.js +0 -4
- package/lib/module/native-bridge/TypeScript/UserDetailsFormatValidator.js +0 -28
- package/lib/module/native-bridge/TypeScript/types/UserDetailsFormat.js +0 -3
- package/lib/typescript/native-bridge/TypeScript/UserDetailsFormatValidator.d.ts +0 -4
- package/lib/typescript/native-bridge/TypeScript/types/UserDetailsFormat.d.ts +0 -19
- package/native-bridge/TypeScript/UserDetailsFormatValidator.ts +0 -35
- package/native-bridge/TypeScript/types/UserDetailsFormat.ts +0 -23
- package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/user_details/CachedUserDetailsFormatter.kt +0 -59
- package/native-bridge/iOS/Source/Abstractions/BandyerSDKProtocol.swift +0 -25
- package/native-bridge/iOS/Source/DTOs/AudioCallOptions+Bandyer.swift +0 -14
- package/native-bridge/iOS/Source/DTOs/CallOptions+Bandyer.swift +0 -14
- package/native-bridge/iOS/Source/DTOs/CreateCallOptions+Intent.swift +0 -17
- package/native-bridge/iOS/Source/DTOs/KaleyraVideoConfiguration+Bandyer.swift +0 -158
- package/native-bridge/iOS/Source/DTOs/RecordingType+Bandyer.swift +0 -33
- package/native-bridge/iOS/Source/DTOs/UserDetails+Bandyer.swift +0 -18
- package/native-bridge/iOS/Source/DTOs/UserDetailsFormat+Decodable.swift +0 -19
- package/native-bridge/iOS/Source/Events/Reporters/PushTokenEventsReporter.swift +0 -34
- package/native-bridge/iOS/Source/User Details/Formatter/FormatterProxy.swift +0 -16
- 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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
-
|
|
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-
|
|
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 @@
|
|
|
1
|
-
<manifest
|
|
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
|
-
*
|
|
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
|
|
362
|
+
val imageURL: String? = null,
|
|
376
363
|
|
|
377
364
|
/**
|
|
378
|
-
*
|
|
365
|
+
* The user's display name.
|
|
379
366
|
*/
|
|
380
|
-
val
|
|
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
|
|
7
|
-
import
|
|
6
|
+
import kotlin.coroutines.resume
|
|
7
|
+
import kotlin.coroutines.suspendCoroutine
|
|
8
8
|
|
|
9
|
-
internal class SDKAccessTokenProviderProxy(val tokenProvider: CrossPlatformAccessTokenProvider)
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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.
|
|
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
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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,13 @@
|
|
|
3
3
|
|
|
4
4
|
package com.kaleyra.video_hybrid_native_bridge.configurator
|
|
5
5
|
|
|
6
|
-
import com.
|
|
6
|
+
import com.kaleyra.video_common_ui.CallUI
|
|
7
|
+
import com.kaleyra.video_common_ui.ChatUI
|
|
8
|
+
import com.kaleyra.video_common_ui.KaleyraVideo
|
|
9
|
+
import com.kaleyra.video_common_ui.PushNotificationHandlingStrategy
|
|
7
10
|
import com.kaleyra.video_hybrid_native_bridge.KaleyraVideoConfiguration
|
|
8
|
-
import com.kaleyra.video_hybrid_native_bridge.
|
|
11
|
+
import com.kaleyra.video_hybrid_native_bridge.extensions.toCallActions
|
|
12
|
+
import com.kaleyra.video_hybrid_native_bridge.extensions.toChatActions
|
|
9
13
|
import com.kaleyra.video_hybrid_native_bridge.extensions.toSDK
|
|
10
14
|
import com.kaleyra.video_hybrid_native_bridge.repository.ConfigurationEntity
|
|
11
15
|
import com.kaleyra.video_hybrid_native_bridge.repository.VideoHybridBridgeRepository
|
|
@@ -13,34 +17,38 @@ import kotlinx.coroutines.CoroutineScope
|
|
|
13
17
|
import kotlinx.coroutines.launch
|
|
14
18
|
|
|
15
19
|
internal class VideoSDKConfigurator(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
private val scope: CoroutineScope
|
|
20
|
+
private val sdk: KaleyraVideo,
|
|
21
|
+
private val repository: VideoHybridBridgeRepository,
|
|
22
|
+
private val scope: CoroutineScope
|
|
20
23
|
) : CachedSDKConfigurator {
|
|
21
24
|
|
|
22
|
-
|
|
25
|
+
override var lastConfiguration: KaleyraVideoConfiguration? = null
|
|
23
26
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
override fun configureBridge(configuration: KaleyraVideoConfiguration) {
|
|
28
|
+
scope.launch {
|
|
29
|
+
repository.configurationDao().insert(ConfigurationEntity(configuration))
|
|
30
|
+
sdk.configure(configuration.toSDK())
|
|
31
|
+
sdk.conference.callActions = configuration.tools?.toCallActions() ?: CallUI.Action.default
|
|
32
|
+
sdk.conversation.chatActions = configuration.tools?.toChatActions() ?: ChatUI.Action.default
|
|
33
|
+
lastConfiguration = configuration
|
|
34
|
+
sdk.pushNotificationHandlingStrategy = PushNotificationHandlingStrategy.Manual
|
|
30
35
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
override fun reset() {
|
|
39
|
+
scope.launch {
|
|
40
|
+
repository.clearAllTables()
|
|
41
|
+
sdk.reset()
|
|
42
|
+
KaleyraVideo.conference.callActions = CallUI.Action.default
|
|
43
|
+
KaleyraVideo.conversation.chatActions = ChatUI.Action.default
|
|
44
|
+
lastConfiguration = null
|
|
38
45
|
}
|
|
46
|
+
}
|
|
39
47
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
48
|
+
init {
|
|
49
|
+
scope.launch {
|
|
50
|
+
lastConfiguration = repository.configurationDao().configuration?.plugin
|
|
44
51
|
}
|
|
52
|
+
}
|
|
45
53
|
|
|
46
54
|
}
|
|
@@ -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.
|
|
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:
|
|
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
|
-
|
|
35
|
-
|
|
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
|
|
7
|
-
import com.
|
|
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
|
|
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:
|
|
19
|
-
private val eventsEmitter: EventsEmitter
|
|
20
|
-
|
|
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
|
-
|
|
26
|
-
sdk.
|
|
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
|
-
|
|
31
|
-
|
|
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
|
|
7
|
-
import com.
|
|
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
|
|
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:
|
|
19
|
-
private val eventsEmitter: EventsEmitter
|
|
20
|
-
|
|
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
|
-
|
|
26
|
-
sdk.
|
|
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
|
-
|
|
31
|
-
|
|
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.
|
|
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.
|
|
15
|
-
import com.kaleyra.video_hybrid_native_bridge.events.reporter.CrossPlatformModuleStatus.
|
|
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
|
-
|
|
14
|
+
Disconnected,
|
|
19
15
|
Connecting,
|
|
20
|
-
|
|
16
|
+
Connected,
|
|
17
|
+
Reconnecting,
|
|
21
18
|
Failed
|
|
22
19
|
}
|
|
23
20
|
|
|
24
|
-
internal fun
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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
|
}
|