@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.
- 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 +11 -5
- 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 +9 -7
- 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
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# Copyright © 2018-2023 Kaleyra S.p.a. All Rights Reserved.
|
|
2
2
|
# See LICENSE for licensing information
|
|
3
3
|
|
|
4
|
-
platform :ios, '
|
|
4
|
+
platform :ios, '15.0'
|
|
5
5
|
|
|
6
6
|
target 'KaleyraVideoHybridNativeBridge' do
|
|
7
7
|
use_frameworks!
|
|
8
8
|
|
|
9
|
-
pod '
|
|
9
|
+
pod 'KaleyraVideoSDK', '~> 4.0.0'
|
|
10
10
|
|
|
11
11
|
target 'KaleyraVideoHybridNativeBridgeTests' do
|
|
12
12
|
use_frameworks!
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
PODS:
|
|
2
|
-
-
|
|
3
|
-
-
|
|
4
|
-
-
|
|
5
|
-
-
|
|
6
|
-
-
|
|
2
|
+
- KaleyraVideoSDK (4.0.0):
|
|
3
|
+
- KaleyraVideoSDK/Core (= 4.0.0)
|
|
4
|
+
- KaleyraVideoSDK/WebRTC (= 4.0.0)
|
|
5
|
+
- KaleyraVideoSDK/Core (4.0.0)
|
|
6
|
+
- KaleyraVideoSDK/WebRTC (4.0.0)
|
|
7
7
|
- SwiftHamcrest (2.2.4)
|
|
8
8
|
|
|
9
9
|
DEPENDENCIES:
|
|
10
|
-
-
|
|
10
|
+
- KaleyraVideoSDK (~> 4.0.0)
|
|
11
11
|
- SwiftHamcrest (~> 2.2)
|
|
12
12
|
|
|
13
13
|
SPEC REPOS:
|
|
14
14
|
trunk:
|
|
15
|
-
-
|
|
15
|
+
- KaleyraVideoSDK
|
|
16
16
|
- SwiftHamcrest
|
|
17
17
|
|
|
18
18
|
SPEC CHECKSUMS:
|
|
19
|
-
|
|
19
|
+
KaleyraVideoSDK: 2350e37e969a0b69bc36f0ea77c4c580b1579fa9
|
|
20
20
|
SwiftHamcrest: a45dd878978049c0953259aa01c34fd7258d0340
|
|
21
21
|
|
|
22
|
-
PODFILE CHECKSUM:
|
|
22
|
+
PODFILE CHECKSUM: b048d01ca8b52521a6098cef14d564781e2b7242
|
|
23
23
|
|
|
24
24
|
COCOAPODS: 1.15.2
|
|
@@ -2,17 +2,14 @@
|
|
|
2
2
|
// See LICENSE for licensing information
|
|
3
3
|
|
|
4
4
|
import Foundation
|
|
5
|
-
import
|
|
5
|
+
import KaleyraVideoSDK
|
|
6
6
|
|
|
7
|
-
@available(iOS 12.0, *)
|
|
8
7
|
protocol CallWindowProtocol: AnyObject {
|
|
9
8
|
|
|
10
9
|
var isHidden: Bool { get set }
|
|
11
|
-
var callDelegate: Bandyer.CallWindowDelegate? { get set }
|
|
12
10
|
|
|
13
|
-
func
|
|
14
|
-
func
|
|
11
|
+
func makeKeyAndVisible()
|
|
12
|
+
func set(rootViewController controller: UIViewController?, animated: Bool, completion: ((Bool) -> Void)?)
|
|
15
13
|
}
|
|
16
14
|
|
|
17
|
-
@available(iOS 12.0, *)
|
|
18
15
|
extension CallWindow: CallWindowProtocol {}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// Copyright © 2018-2023 Kaleyra S.p.a. All Rights Reserved.
|
|
2
|
+
// See LICENSE for licensing information
|
|
3
|
+
|
|
4
|
+
import Foundation
|
|
5
|
+
import KaleyraVideoSDK
|
|
6
|
+
|
|
7
|
+
protocol KaleyraVideoSDKProtocol: AnyObject {
|
|
8
|
+
|
|
9
|
+
var config: KaleyraVideoSDK.Config? { get }
|
|
10
|
+
var userDetailsProvider: KaleyraVideoSDK.UserDetailsProvider? { get set }
|
|
11
|
+
var conversation: KaleyraVideoSDK.Conversation? { get }
|
|
12
|
+
var conference: KaleyraVideoSDK.Conference? { get }
|
|
13
|
+
|
|
14
|
+
func configure(_ config: KaleyraVideoSDK.Config) throws
|
|
15
|
+
func connect(userId: String, provider: AccessTokenProvider) throws
|
|
16
|
+
func disconnect()
|
|
17
|
+
func reset()
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
extension KaleyraVideo: KaleyraVideoSDKProtocol {}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Copyright © 2018-2023 Kaleyra S.p.a. All Rights Reserved.
|
|
2
|
+
// See LICENSE for licensing information
|
|
3
|
+
|
|
4
|
+
import Foundation
|
|
5
|
+
import KaleyraVideoSDK
|
|
6
|
+
|
|
7
|
+
extension AudioCallOptions {
|
|
8
|
+
|
|
9
|
+
var callOptions: KaleyraVideoSDK.CallOptions {
|
|
10
|
+
.init(type: type.callType,
|
|
11
|
+
recording: recordingType?.callRecordingType)
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -2,12 +2,11 @@
|
|
|
2
2
|
// See LICENSE for licensing information
|
|
3
3
|
|
|
4
4
|
import Foundation
|
|
5
|
-
import
|
|
5
|
+
import KaleyraVideoSDK
|
|
6
6
|
|
|
7
|
-
@available(iOS 12.0, *)
|
|
8
7
|
extension AudioCallType {
|
|
9
8
|
|
|
10
|
-
var callType:
|
|
9
|
+
var callType: KaleyraVideoSDK.CallOptions.CallType {
|
|
11
10
|
switch self {
|
|
12
11
|
case .audio:
|
|
13
12
|
return .audioOnly
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Copyright © 2018-2023 Kaleyra S.p.a. All Rights Reserved.
|
|
2
|
+
// See LICENSE for licensing information
|
|
3
|
+
|
|
4
|
+
import Foundation
|
|
5
|
+
import KaleyraVideoSDK
|
|
6
|
+
|
|
7
|
+
extension CallOptions {
|
|
8
|
+
|
|
9
|
+
var callOptions: KaleyraVideoSDK.CallOptions {
|
|
10
|
+
.init(type: .audioVideo, recording: recordingType?.callRecordingType)
|
|
11
|
+
}
|
|
12
|
+
}
|
package/native-bridge/iOS/Source/DTOs/{CallType+Bandyer.swift → CallType+KaleyraVideoSDK.swift}
RENAMED
|
@@ -2,12 +2,11 @@
|
|
|
2
2
|
// See LICENSE for licensing information
|
|
3
3
|
|
|
4
4
|
import Foundation
|
|
5
|
-
import
|
|
5
|
+
import KaleyraVideoSDK
|
|
6
6
|
|
|
7
|
-
@available(iOS 12.0, *)
|
|
8
7
|
extension CallType {
|
|
9
8
|
|
|
10
|
-
var bandyerType:
|
|
9
|
+
var bandyerType: KaleyraVideoSDK.CallOptions.CallType {
|
|
11
10
|
switch self {
|
|
12
11
|
case .audio:
|
|
13
12
|
return .audioOnly
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Copyright © 2018-2023 Kaleyra S.p.a. All Rights Reserved.
|
|
2
|
+
// See LICENSE for licensing information
|
|
3
|
+
|
|
4
|
+
import Foundation
|
|
5
|
+
import KaleyraVideoSDK
|
|
6
|
+
|
|
7
|
+
extension CreateCallOptions {
|
|
8
|
+
|
|
9
|
+
func makeCallOptions() -> KaleyraVideoSDK.CallOptions {
|
|
10
|
+
.init(type: callType.bandyerType, recording: recordingType?.callRecordingType)
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -21,7 +21,6 @@
|
|
|
21
21
|
// let kaleyraVideoConfiguration = try KaleyraVideoConfiguration(json)
|
|
22
22
|
// let session = try Session(json)
|
|
23
23
|
// let userDetails = try UserDetails(json)
|
|
24
|
-
// let userDetailsFormat = try UserDetailsFormat(json)
|
|
25
24
|
|
|
26
25
|
import Foundation
|
|
27
26
|
|
|
@@ -284,31 +283,10 @@ struct Session {
|
|
|
284
283
|
/// This is used to define the user details in the call/chat UI
|
|
285
284
|
// MARK: - UserDetails
|
|
286
285
|
struct UserDetails {
|
|
287
|
-
/// Email of the user
|
|
288
|
-
let email: String?
|
|
289
|
-
/// First name of the user
|
|
290
|
-
let firstName: String?
|
|
291
|
-
/// Last name of the user
|
|
292
|
-
let lastName: String?
|
|
293
|
-
/// Nickname for the user
|
|
294
|
-
let nickName: String?
|
|
295
286
|
/// Image url to use as placeholder for the user.
|
|
296
|
-
let
|
|
287
|
+
let imageURL: String?
|
|
288
|
+
/// The user's display name.
|
|
289
|
+
let name: String?
|
|
297
290
|
/// User identifier
|
|
298
291
|
let userID: String
|
|
299
292
|
}
|
|
300
|
-
|
|
301
|
-
/// This is used to display the user details in the call/chat UI
|
|
302
|
-
// MARK: - UserDetailsFormat
|
|
303
|
-
struct UserDetailsFormat {
|
|
304
|
-
/// Format to be used when displaying an android notification
|
|
305
|
-
/// <br/>
|
|
306
|
-
/// <br/>
|
|
307
|
-
/// <b><font color="blue">default</font>: equals to UserDetailsFormatter.default</b>
|
|
308
|
-
let androidNotification: String?
|
|
309
|
-
/// Format to be used to display a user details on the call/chat UI
|
|
310
|
-
/// <br/>
|
|
311
|
-
/// <br/>
|
|
312
|
-
/// <b><font color="blue">default</font>: ${userAlias}</b>
|
|
313
|
-
let userDetailsFormatDefault: String
|
|
314
|
-
}
|
|
@@ -2,12 +2,11 @@
|
|
|
2
2
|
// See LICENSE for licensing information
|
|
3
3
|
|
|
4
4
|
import Foundation
|
|
5
|
-
import
|
|
5
|
+
import KaleyraVideoSDK
|
|
6
6
|
|
|
7
|
-
@available(iOS 12.0, *)
|
|
8
7
|
extension Environment {
|
|
9
8
|
|
|
10
|
-
var
|
|
9
|
+
var kaleyraEnvironment: KaleyraVideoSDK.Environment? {
|
|
11
10
|
switch name.lowercased() {
|
|
12
11
|
case "production":
|
|
13
12
|
return .production
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
// Copyright © 2018-2023 Kaleyra S.p.a. All Rights Reserved.
|
|
2
|
+
// See LICENSE for licensing information
|
|
3
|
+
|
|
4
|
+
import Foundation
|
|
5
|
+
import UIKit
|
|
6
|
+
import KaleyraVideoSDK
|
|
7
|
+
import PushKit
|
|
8
|
+
|
|
9
|
+
extension KaleyraVideoConfiguration {
|
|
10
|
+
|
|
11
|
+
private enum ConfigurationError: Error {
|
|
12
|
+
case unsupportedEnvironment
|
|
13
|
+
case unsupportedRegion
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
var isCallkitEnabled: Bool {
|
|
17
|
+
iosConfig?.callkit?.enabled ?? true
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
var voipStrategy: VoipHandlingStrategy {
|
|
21
|
+
iosConfig?.voipHandlingStrategy ?? .automatic
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
func makeKaleyraVideoSDKConfig() throws -> KaleyraVideoSDK.Config {
|
|
25
|
+
guard let kaleyraEnv = environment.kaleyraEnvironment else {
|
|
26
|
+
throw ConfigurationError.unsupportedEnvironment
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
guard let kaleyraRegion = region.kaleyraRegion else {
|
|
30
|
+
throw ConfigurationError.unsupportedRegion
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
var config = KaleyraVideoSDK.Config(appID: appID, region: kaleyraRegion, environment: kaleyraEnv)
|
|
34
|
+
config.callKit = iosConfig?.makeCallKitConfiguration() ?? .enabled(.default)
|
|
35
|
+
config.voip = iosConfig?.makeVoIPConfiguration() ?? .manual
|
|
36
|
+
return config
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
func makeToolsConfig() -> KaleyraVideoSDK.ConferenceSettings.Tools {
|
|
40
|
+
var config = KaleyraVideoSDK.ConferenceSettings.Tools.default
|
|
41
|
+
config.chat = tools?.makeChatConfiguration() ?? .disabled
|
|
42
|
+
config.broadcastScreenSharing = tools?.makeBroadcastScreenSharingConfiguration() ?? .disabled
|
|
43
|
+
config.inAppScreenSharing = tools?.makeInAppScreenSharingConfiguration() ?? .disabled
|
|
44
|
+
config.fileshare = tools?.makeFileShareConfiguration() ?? .disabled
|
|
45
|
+
config.whiteboard = tools?.makeWhiteboardConfiguration() ?? .disabled
|
|
46
|
+
return config
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
private extension IosConfiguration {
|
|
51
|
+
|
|
52
|
+
func makeCallKitConfiguration() -> KaleyraVideoSDK.Config.CallKitIntegration {
|
|
53
|
+
|
|
54
|
+
guard let callkitConfig = callkit else {
|
|
55
|
+
return .enabled(.default)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if callkitConfig.enabled ?? true {
|
|
59
|
+
let image: UIImage? = if let iconName = callkitConfig.appIconName {
|
|
60
|
+
UIImage(named: iconName)
|
|
61
|
+
} else {
|
|
62
|
+
nil
|
|
63
|
+
}
|
|
64
|
+
return .enabled(.init(icon: image, ringtoneSound: callkitConfig.ringtoneSoundName))
|
|
65
|
+
} else {
|
|
66
|
+
return .disabled
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
func makeVoIPConfiguration() -> KaleyraVideoSDK.Config.VoIP {
|
|
71
|
+
if voipHandlingStrategy == nil || voipHandlingStrategy == .automatic {
|
|
72
|
+
return .automatic(listenForNotificationsInForeground: false)
|
|
73
|
+
} else {
|
|
74
|
+
return .manual
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
private extension Tools {
|
|
80
|
+
|
|
81
|
+
func makeChatConfiguration() -> KaleyraVideoSDK.ConferenceSettings.Tools.Chat {
|
|
82
|
+
guard chat != nil else { return .disabled }
|
|
83
|
+
return .enabled
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
func makeBroadcastScreenSharingConfiguration() -> KaleyraVideoSDK.ConferenceSettings.Tools.BroadcastScreenSharing {
|
|
87
|
+
guard let screenShare,
|
|
88
|
+
screenShare.wholeDevice ?? false,
|
|
89
|
+
let configURL = Bundle.main.url(forResource: "KaleyraVideoConfig", withExtension: "plist") else { return .disabled }
|
|
90
|
+
|
|
91
|
+
let reader = BroadcastConfigurationPlistReader()
|
|
92
|
+
guard let broadcastConfig = try? reader.read(fileURL: configURL),
|
|
93
|
+
let appGroupIdentifier = try? AppGroupIdentifier(broadcastConfig.appGroupID) else { return .disabled }
|
|
94
|
+
|
|
95
|
+
return .enabled(appGroupIdentifier: appGroupIdentifier, extensionBundleIdentifier: broadcastConfig.extensionBundleID)
|
|
96
|
+
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
func makeInAppScreenSharingConfiguration() -> KaleyraVideoSDK.ConferenceSettings.Tools.InAppScreenSharing {
|
|
100
|
+
guard let screenShare, screenShare.inApp ?? false else { return .disabled }
|
|
101
|
+
return .enabled
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
func makeFileShareConfiguration() -> KaleyraVideoSDK.ConferenceSettings.Tools.Fileshare {
|
|
105
|
+
guard fileShare ?? false else { return .disabled }
|
|
106
|
+
return .enabled
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
func makeWhiteboardConfiguration() -> KaleyraVideoSDK.ConferenceSettings.Tools.Whiteboard {
|
|
110
|
+
guard whiteboard ?? false else { return .disabled }
|
|
111
|
+
return .enabled
|
|
112
|
+
}
|
|
113
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// Copyright © 2018-2023 Kaleyra S.p.a. All Rights Reserved.
|
|
2
|
+
// See LICENSE for licensing information
|
|
3
|
+
|
|
4
|
+
import Foundation
|
|
5
|
+
import KaleyraVideoSDK
|
|
6
|
+
|
|
7
|
+
extension RecordingType {
|
|
8
|
+
|
|
9
|
+
var callRecordingType: KaleyraVideoSDK.CallOptions.RecordingType? {
|
|
10
|
+
switch self {
|
|
11
|
+
case .automatic:
|
|
12
|
+
return .automatic
|
|
13
|
+
case .manual:
|
|
14
|
+
return .manual
|
|
15
|
+
case .none:
|
|
16
|
+
return nil
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -2,12 +2,11 @@
|
|
|
2
2
|
// See LICENSE for licensing information
|
|
3
3
|
|
|
4
4
|
import Foundation
|
|
5
|
-
import
|
|
5
|
+
import KaleyraVideoSDK
|
|
6
6
|
|
|
7
|
-
@available(iOS 12.0, *)
|
|
8
7
|
extension Region {
|
|
9
8
|
|
|
10
|
-
var
|
|
9
|
+
var kaleyraRegion: KaleyraVideoSDK.Region? {
|
|
11
10
|
switch name.lowercased() {
|
|
12
11
|
case "europe", "eu":
|
|
13
12
|
return .europe
|
|
@@ -7,21 +7,15 @@ extension UserDetails: Decodable {
|
|
|
7
7
|
|
|
8
8
|
private enum CodingKeys: String, CodingKey {
|
|
9
9
|
case userID
|
|
10
|
-
case
|
|
11
|
-
case
|
|
12
|
-
case email
|
|
13
|
-
case nickName
|
|
14
|
-
case profileImageURL
|
|
10
|
+
case name
|
|
11
|
+
case imageUrl
|
|
15
12
|
}
|
|
16
13
|
|
|
17
14
|
init(from decoder: Decoder) throws {
|
|
18
15
|
let container = try decoder.container(keyedBy: CodingKeys.self)
|
|
19
16
|
self.userID = try container.decode(String.self, forKey: .userID)
|
|
20
|
-
self.
|
|
21
|
-
self.
|
|
22
|
-
self.email = try container.decodeIfPresent(String.self, forKey: .email)
|
|
23
|
-
self.nickName = try container.decodeIfPresent(String.self, forKey: .nickName)
|
|
24
|
-
self.profileImageURL = try container.decodeIfPresent(String.self, forKey: .profileImageURL)
|
|
17
|
+
self.name = try container.decodeIfPresent(String.self, forKey: .name)
|
|
18
|
+
self.imageURL = try container.decodeIfPresent(String.self, forKey: .imageUrl)
|
|
25
19
|
}
|
|
26
20
|
}
|
|
27
21
|
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Copyright © 2018-2023 Kaleyra S.p.a. All Rights Reserved.
|
|
2
|
+
// See LICENSE for licensing information
|
|
3
|
+
|
|
4
|
+
import Foundation
|
|
5
|
+
import KaleyraVideoSDK
|
|
6
|
+
|
|
7
|
+
extension UserDetails {
|
|
8
|
+
|
|
9
|
+
var bandyerDetails: KaleyraVideoSDK.UserDetails {
|
|
10
|
+
.init(userId: userID,
|
|
11
|
+
name: name,
|
|
12
|
+
image: URL(string: imageURL ?? ""),
|
|
13
|
+
handle: .init(type: .generic, value: name ?? userID))
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -2,45 +2,70 @@
|
|
|
2
2
|
// See LICENSE for licensing information
|
|
3
3
|
|
|
4
4
|
import Foundation
|
|
5
|
-
import
|
|
5
|
+
import Combine
|
|
6
|
+
import KaleyraVideoSDK
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
class CallClientEventsReporter: NSObject, CallClientObserver {
|
|
8
|
+
class CallClientEventsReporter: NSObject {
|
|
9
9
|
|
|
10
|
-
private
|
|
10
|
+
private(set) var lastVoIPToken: String?
|
|
11
|
+
private let conference: Conference
|
|
11
12
|
private let emitter: EventEmitter
|
|
12
|
-
private
|
|
13
|
+
private var cancellables = Set<AnyCancellable>()
|
|
13
14
|
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
var isRunning: Bool {
|
|
16
|
+
!cancellables.isEmpty
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
init(conference: Conference, emitter: EventEmitter) {
|
|
20
|
+
self.conference = conference
|
|
16
21
|
self.emitter = emitter
|
|
17
22
|
super.init()
|
|
18
23
|
}
|
|
19
24
|
|
|
20
|
-
func start() {
|
|
25
|
+
func start<S: Scheduler>(scheduler: S = DispatchQueue.main) {
|
|
21
26
|
guard !isRunning else { return }
|
|
22
27
|
|
|
23
|
-
|
|
24
|
-
|
|
28
|
+
conference.statePublisher.dropFirst().receive(on: scheduler).sink { [weak self] _ in
|
|
29
|
+
self?.notifyNewClientState()
|
|
30
|
+
}.store(in: &cancellables)
|
|
31
|
+
|
|
32
|
+
conference.voipCredentialsPublisher.receive(on: scheduler).sink { [weak self] credentials in
|
|
33
|
+
self?.notifyNewCredentials(credentials)
|
|
34
|
+
}.store(in: &cancellables)
|
|
25
35
|
}
|
|
26
36
|
|
|
27
37
|
func stop() {
|
|
28
38
|
guard isRunning else { return }
|
|
29
39
|
|
|
30
|
-
|
|
31
|
-
isRunning = false
|
|
40
|
+
cancellables.removeAll()
|
|
32
41
|
}
|
|
33
42
|
|
|
34
43
|
// MARK: - Call client observer
|
|
35
44
|
|
|
36
|
-
func
|
|
37
|
-
|
|
45
|
+
private func notifyNewClientState() {
|
|
46
|
+
notifyErrorIfNeeded()
|
|
38
47
|
|
|
48
|
+
guard let clientState = ClientState(state: conference.state) else { return }
|
|
39
49
|
emitter.sendEvent(Events.callModuleStatusChanged, args: clientState.rawValue)
|
|
40
50
|
}
|
|
41
51
|
|
|
42
|
-
func
|
|
52
|
+
private func notifyErrorIfNeeded() {
|
|
53
|
+
guard case KaleyraVideoSDK.ClientState.disconnected(error: let error) = conference.state, let error else { return }
|
|
43
54
|
emitter.sendEvent(Events.callError, args: error.localizedDescription)
|
|
44
|
-
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// MARK: - VoIP Credentials
|
|
58
|
+
|
|
59
|
+
private func notifyNewCredentials(_ credentials: VoIPCredentials?) {
|
|
60
|
+
guard let credentials else {
|
|
61
|
+
guard lastVoIPToken != nil else { return }
|
|
62
|
+
|
|
63
|
+
emitter.sendEvent(.iOSVoipPushTokenInvalidated, args: nil)
|
|
64
|
+
lastVoIPToken = nil
|
|
65
|
+
return
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
emitter.sendEvent(.iOSVoipPushTokenUpdated, args: credentials.tokenAsString)
|
|
69
|
+
lastVoIPToken = credentials.tokenAsString
|
|
45
70
|
}
|
|
46
71
|
}
|
|
@@ -2,45 +2,50 @@
|
|
|
2
2
|
// See LICENSE for licensing information
|
|
3
3
|
|
|
4
4
|
import Foundation
|
|
5
|
-
import
|
|
5
|
+
import Combine
|
|
6
|
+
import KaleyraVideoSDK
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
class ChatClientEventsReporter: NSObject, ChatClientObserver {
|
|
8
|
+
class ChatClientEventsReporter: NSObject {
|
|
9
9
|
|
|
10
|
-
private let
|
|
10
|
+
private let conversation: Conversation
|
|
11
11
|
private let emitter: EventEmitter
|
|
12
|
-
private
|
|
12
|
+
private var stateCancellable: AnyCancellable?
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
var isRunning: Bool {
|
|
15
|
+
stateCancellable != nil
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
init(conversation: Conversation, emitter: EventEmitter) {
|
|
19
|
+
self.conversation = conversation
|
|
16
20
|
self.emitter = emitter
|
|
17
21
|
super.init()
|
|
18
22
|
}
|
|
19
23
|
|
|
20
|
-
func start() {
|
|
24
|
+
func start<S: Scheduler>(scheduler: S = DispatchQueue.main) {
|
|
21
25
|
guard !isRunning else { return }
|
|
22
26
|
|
|
23
|
-
|
|
24
|
-
|
|
27
|
+
stateCancellable = conversation.statePublisher.dropFirst().receive(on: scheduler).sink { [weak self] _ in
|
|
28
|
+
self?.notifyNewClientState()
|
|
29
|
+
}
|
|
25
30
|
}
|
|
26
31
|
|
|
27
32
|
func stop() {
|
|
28
33
|
guard isRunning else { return }
|
|
29
34
|
|
|
30
|
-
|
|
31
|
-
isRunning = false
|
|
35
|
+
stateCancellable = nil
|
|
32
36
|
}
|
|
33
37
|
|
|
34
|
-
// MARK: -
|
|
38
|
+
// MARK: - Events Notification
|
|
35
39
|
|
|
36
|
-
func
|
|
37
|
-
|
|
40
|
+
private func notifyNewClientState() {
|
|
41
|
+
notifyErrorIfNeeded()
|
|
38
42
|
|
|
43
|
+
guard let clientState = ClientState(state: conversation.state) else { return }
|
|
39
44
|
emitter.sendEvent(Events.chatModuleStatusChanged, args: clientState.rawValue)
|
|
40
45
|
}
|
|
41
46
|
|
|
42
|
-
func
|
|
47
|
+
private func notifyErrorIfNeeded() {
|
|
48
|
+
guard case KaleyraVideoSDK.ClientState.disconnected(error: let error) = conversation.state, let error else { return }
|
|
43
49
|
emitter.sendEvent(Events.chatError, args: error.localizedDescription)
|
|
44
|
-
emitter.sendEvent(Events.chatModuleStatusChanged, args: ClientState.failed.rawValue)
|
|
45
50
|
}
|
|
46
51
|
}
|