@kaleyra/video-react-native-module 1.5.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 +12 -11
  92. package/src/KaleyraVideo.ts +0 -42
  93. package/video-react-native-module.podspec +4 -4
  94. package/lib/commonjs/native-bridge/TypeScript/UserDetailsFormatValidator.js +0 -32
  95. package/lib/commonjs/native-bridge/TypeScript/types/UserDetailsFormat.js +0 -4
  96. package/lib/module/native-bridge/TypeScript/UserDetailsFormatValidator.js +0 -28
  97. package/lib/module/native-bridge/TypeScript/types/UserDetailsFormat.js +0 -3
  98. package/lib/typescript/native-bridge/TypeScript/UserDetailsFormatValidator.d.ts +0 -4
  99. package/lib/typescript/native-bridge/TypeScript/types/UserDetailsFormat.d.ts +0 -19
  100. package/native-bridge/TypeScript/UserDetailsFormatValidator.ts +0 -35
  101. package/native-bridge/TypeScript/types/UserDetailsFormat.ts +0 -23
  102. package/native-bridge/android/src/main/java/com/kaleyra/video_hybrid_native_bridge/user_details/CachedUserDetailsFormatter.kt +0 -59
  103. package/native-bridge/iOS/Source/Abstractions/BandyerSDKProtocol.swift +0 -25
  104. package/native-bridge/iOS/Source/DTOs/AudioCallOptions+Bandyer.swift +0 -14
  105. package/native-bridge/iOS/Source/DTOs/CallOptions+Bandyer.swift +0 -14
  106. package/native-bridge/iOS/Source/DTOs/CreateCallOptions+Intent.swift +0 -17
  107. package/native-bridge/iOS/Source/DTOs/KaleyraVideoConfiguration+Bandyer.swift +0 -158
  108. package/native-bridge/iOS/Source/DTOs/RecordingType+Bandyer.swift +0 -33
  109. package/native-bridge/iOS/Source/DTOs/UserDetails+Bandyer.swift +0 -18
  110. package/native-bridge/iOS/Source/DTOs/UserDetailsFormat+Decodable.swift +0 -19
  111. package/native-bridge/iOS/Source/Events/Reporters/PushTokenEventsReporter.swift +0 -34
  112. package/native-bridge/iOS/Source/User Details/Formatter/FormatterProxy.swift +0 -16
  113. package/native-bridge/iOS/Source/User Details/Formatter/UserDetailsFormatter.swift +0 -83
@@ -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, '12.0'
4
+ platform :ios, '15.0'
5
5
 
6
6
  target 'KaleyraVideoHybridNativeBridge' do
7
7
  use_frameworks!
8
8
 
9
- pod 'Bandyer', '~> 3.12.1'
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
- - Bandyer (3.12.1):
3
- - Bandyer/Core (= 3.12.1)
4
- - Bandyer/WebRTC (= 3.12.1)
5
- - Bandyer/Core (3.12.1)
6
- - Bandyer/WebRTC (3.12.1)
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
- - Bandyer (~> 3.12.1)
10
+ - KaleyraVideoSDK (~> 4.0.0)
11
11
  - SwiftHamcrest (~> 2.2)
12
12
 
13
13
  SPEC REPOS:
14
14
  trunk:
15
- - Bandyer
15
+ - KaleyraVideoSDK
16
16
  - SwiftHamcrest
17
17
 
18
18
  SPEC CHECKSUMS:
19
- Bandyer: 85a49f0c6c3e2084075991dc05a37ae3b54ca9d8
19
+ KaleyraVideoSDK: 2350e37e969a0b69bc36f0ea77c4c580b1579fa9
20
20
  SwiftHamcrest: a45dd878978049c0953259aa01c34fd7258d0340
21
21
 
22
- PODFILE CHECKSUM: eec3e41640e9473d6444b76c82ece16fcb50757e
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 Bandyer
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 setConfiguration(_ configuration: Bandyer.CallViewControllerConfiguration?)
14
- func presentCallViewController(for intent: Bandyer.Intent, completion: ((Error?) -> Void)?)
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 {}
@@ -3,7 +3,6 @@
3
3
 
4
4
  import Foundation
5
5
 
6
- @available(iOS 12.0, *)
7
6
  protocol AccessTokenRequester {
8
7
  func requestAccessToken(request: AccessTokenRequest) throws
9
8
  }
@@ -2,9 +2,8 @@
2
2
  // See LICENSE for licensing information
3
3
 
4
4
  import Foundation
5
- import Bandyer
5
+ import KaleyraVideoSDK
6
6
 
7
- @available(iOS 12.0, *)
8
7
  class TokenProvider: AccessTokenProvider {
9
8
 
10
9
  // MARK: - Nested Types
@@ -3,7 +3,6 @@
3
3
 
4
4
  import Foundation
5
5
 
6
- @available(iOS 12.0, *)
7
6
  struct BroadcastConfigurationPlistReader {
8
7
 
9
8
  struct BroadcastConfig {
@@ -4,7 +4,6 @@
4
4
  import Foundation
5
5
  import Dispatch
6
6
 
7
- @available(iOS 12.0, *)
8
7
  public extension DispatchQueue {
9
8
 
10
9
  private static var mainSpecificKey: DispatchSpecificKey<Void> = {
@@ -3,7 +3,6 @@
3
3
 
4
4
  import Foundation
5
5
 
6
- @available(iOS 12.0, *)
7
6
  public enum MainQueueDispatcher {
8
7
 
9
8
  public static func perform(_ work: @escaping () -> Void) {
@@ -3,7 +3,6 @@
3
3
 
4
4
  import Foundation
5
5
 
6
- @available(iOS 12.0, *)
7
6
  final class MainQueueRelay<Decoratee> {
8
7
 
9
8
  let decoratee: Decoratee
@@ -3,7 +3,6 @@
3
3
 
4
4
  import Foundation
5
5
 
6
- @available(iOS 12.0, *)
7
6
  extension AudioCallOptions: Equatable {
8
7
 
9
8
  static func == (lhs: AudioCallOptions, rhs: AudioCallOptions) -> Bool {
@@ -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 Bandyer
5
+ import KaleyraVideoSDK
6
6
 
7
- @available(iOS 12.0, *)
8
7
  extension AudioCallType {
9
8
 
10
- var callType: Bandyer.CallType {
9
+ var callType: KaleyraVideoSDK.CallOptions.CallType {
11
10
  switch self {
12
11
  case .audio:
13
12
  return .audioOnly
@@ -3,7 +3,6 @@
3
3
 
4
4
  import Foundation
5
5
 
6
- @available(iOS 12.0, *)
7
6
  extension CallOptions: Equatable {
8
7
 
9
8
  static func == (lhs: CallOptions, rhs: CallOptions) -> Bool {
@@ -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
+ }
@@ -2,12 +2,11 @@
2
2
  // See LICENSE for licensing information
3
3
 
4
4
  import Foundation
5
- import Bandyer
5
+ import KaleyraVideoSDK
6
6
 
7
- @available(iOS 12.0, *)
8
7
  extension CallType {
9
8
 
10
- var bandyerType: Bandyer.CallType {
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 profileImageURL: String?
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 Bandyer
5
+ import KaleyraVideoSDK
6
6
 
7
- @available(iOS 12.0, *)
8
7
  extension Environment {
9
8
 
10
- var bandyerEnvironment: Bandyer.Environment? {
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
+ }
@@ -3,7 +3,6 @@
3
3
 
4
4
  import Foundation
5
5
 
6
- @available(iOS 12.0, *)
7
6
  extension KaleyraVideoConfiguration {
8
7
 
9
8
  func uiPresenterConfiguration() -> UserInterfacePresenterConfiguration {
@@ -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 Bandyer
5
+ import KaleyraVideoSDK
6
6
 
7
- @available(iOS 12.0, *)
8
7
  extension Region {
9
8
 
10
- var bandyerRegion: Bandyer.Region? {
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 firstName
11
- case lastName
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.firstName = try container.decodeIfPresent(String.self, forKey: .firstName)
21
- self.lastName = try container.decodeIfPresent(String.self, forKey: .lastName)
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 Bandyer
5
+ import Combine
6
+ import KaleyraVideoSDK
6
7
 
7
- @available(iOS 12.0, *)
8
- class CallClientEventsReporter: NSObject, CallClientObserver {
8
+ class CallClientEventsReporter: NSObject {
9
9
 
10
- private let client: CallClient
10
+ private(set) var lastVoIPToken: String?
11
+ private let conference: Conference
11
12
  private let emitter: EventEmitter
12
- private(set) var isRunning = false
13
+ private var cancellables = Set<AnyCancellable>()
13
14
 
14
- init(client: CallClient, emitter: EventEmitter) {
15
- self.client = client
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
- isRunning = true
24
- client.add(observer: self, queue: .main)
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
- client.remove(observer: self)
31
- isRunning = false
40
+ cancellables.removeAll()
32
41
  }
33
42
 
34
43
  // MARK: - Call client observer
35
44
 
36
- func callClientDidChangeState(_ client: CallClient, oldState: CallClientState, newState: CallClientState) {
37
- guard let clientState = ClientState(clientState: newState) else { return }
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 callClient(_ client: CallClient, didFailWithError error: Error) {
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
- emitter.sendEvent(Events.callModuleStatusChanged, args: ClientState.failed.rawValue)
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 Bandyer
5
+ import Combine
6
+ import KaleyraVideoSDK
6
7
 
7
- @available(iOS 12.0, *)
8
- class ChatClientEventsReporter: NSObject, ChatClientObserver {
8
+ class ChatClientEventsReporter: NSObject {
9
9
 
10
- private let client: ChatClient
10
+ private let conversation: Conversation
11
11
  private let emitter: EventEmitter
12
- private(set) var isRunning = false
12
+ private var stateCancellable: AnyCancellable?
13
13
 
14
- init(client: ChatClient, emitter: EventEmitter) {
15
- self.client = client
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
- isRunning = true
24
- client.add(observer: self, queue: .main)
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
- client.remove(observer: self)
31
- isRunning = false
35
+ stateCancellable = nil
32
36
  }
33
37
 
34
- // MARK: - Chat client observer
38
+ // MARK: - Events Notification
35
39
 
36
- func chatClientDidChangeState(_ client: ChatClient, oldState: ChatClientState, newState: ChatClientState) {
37
- guard let clientState = ClientState(clientState: newState) else { return }
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 chatClient(_ client: ChatClient, didFailWithError error: Error) {
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
  }