@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
|
@@ -2,60 +2,32 @@
|
|
|
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
|
enum ClientState: String {
|
|
9
|
-
case
|
|
8
|
+
case disconnected = "disconnected"
|
|
10
9
|
case connecting = "connecting"
|
|
11
|
-
case
|
|
12
|
-
case paused = "paused"
|
|
10
|
+
case connected = "connected"
|
|
13
11
|
case reconnecting = "reconnecting"
|
|
14
12
|
case failed = "failed"
|
|
15
13
|
}
|
|
16
14
|
|
|
17
|
-
@available(iOS 12.0, *)
|
|
18
15
|
extension ClientState {
|
|
19
16
|
|
|
20
|
-
init?(
|
|
21
|
-
switch
|
|
22
|
-
case .
|
|
23
|
-
|
|
24
|
-
|
|
17
|
+
init?(state: KaleyraVideoSDK.ClientState) {
|
|
18
|
+
switch state {
|
|
19
|
+
case .disconnected(error: let error):
|
|
20
|
+
if error != nil {
|
|
21
|
+
self = .failed
|
|
22
|
+
} else {
|
|
23
|
+
self = .disconnected
|
|
24
|
+
}
|
|
25
|
+
case .connecting:
|
|
25
26
|
self = .connecting
|
|
26
|
-
case .
|
|
27
|
-
self = .
|
|
28
|
-
case .resuming:
|
|
29
|
-
self = .connecting
|
|
30
|
-
case .paused:
|
|
31
|
-
self = .paused
|
|
32
|
-
case .reconnecting:
|
|
33
|
-
self = .reconnecting
|
|
34
|
-
case .failed:
|
|
35
|
-
self = .failed
|
|
36
|
-
default:
|
|
37
|
-
return nil
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
init?(clientState: ChatClientState) {
|
|
42
|
-
switch clientState {
|
|
43
|
-
case .stopped:
|
|
44
|
-
self = .stopped
|
|
45
|
-
case .starting:
|
|
46
|
-
self = .connecting
|
|
47
|
-
case .running:
|
|
48
|
-
self = .ready
|
|
49
|
-
case .resuming:
|
|
50
|
-
self = .connecting
|
|
51
|
-
case .paused:
|
|
52
|
-
self = .paused
|
|
27
|
+
case .connected:
|
|
28
|
+
self = .connected
|
|
53
29
|
case .reconnecting:
|
|
54
30
|
self = .reconnecting
|
|
55
|
-
case .failed:
|
|
56
|
-
self = .failed
|
|
57
|
-
default:
|
|
58
|
-
return nil
|
|
59
31
|
}
|
|
60
32
|
}
|
|
61
33
|
}
|
|
@@ -2,29 +2,33 @@
|
|
|
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 SDKEventReporter {
|
|
9
8
|
|
|
9
|
+
var lastVoIPToken: String? { get }
|
|
10
|
+
|
|
10
11
|
func start()
|
|
11
12
|
func stop()
|
|
12
13
|
}
|
|
13
14
|
|
|
14
|
-
@available(iOS 12.0, *)
|
|
15
15
|
class EventsReporter: SDKEventReporter {
|
|
16
16
|
|
|
17
17
|
// MARK: - Properties
|
|
18
18
|
|
|
19
19
|
private let emitter: EventEmitter
|
|
20
|
-
private let sdk:
|
|
20
|
+
private let sdk: KaleyraVideoSDKProtocol
|
|
21
21
|
|
|
22
22
|
private(set) var callClientEventReporter: CallClientEventsReporter?
|
|
23
23
|
private(set) var chatClientEventReporter: ChatClientEventsReporter?
|
|
24
24
|
|
|
25
|
+
var lastVoIPToken: String? {
|
|
26
|
+
callClientEventReporter?.lastVoIPToken
|
|
27
|
+
}
|
|
28
|
+
|
|
25
29
|
// MARK: - Init
|
|
26
30
|
|
|
27
|
-
init(emitter: EventEmitter, sdk:
|
|
31
|
+
init(emitter: EventEmitter, sdk: KaleyraVideoSDKProtocol) {
|
|
28
32
|
self.emitter = emitter
|
|
29
33
|
self.sdk = sdk
|
|
30
34
|
}
|
|
@@ -32,21 +36,21 @@ class EventsReporter: SDKEventReporter {
|
|
|
32
36
|
// MARK: - Start Reporting Events
|
|
33
37
|
|
|
34
38
|
func start() {
|
|
35
|
-
startReportingCallClientEvents(sdk.
|
|
36
|
-
startReportingChatClientEvents(sdk.
|
|
39
|
+
startReportingCallClientEvents(sdk.conference)
|
|
40
|
+
startReportingChatClientEvents(sdk.conversation)
|
|
37
41
|
}
|
|
38
42
|
|
|
39
|
-
private func startReportingCallClientEvents(_
|
|
40
|
-
guard callClientEventReporter == nil else { return }
|
|
43
|
+
private func startReportingCallClientEvents(_ conference: Conference?) {
|
|
44
|
+
guard let conference, callClientEventReporter == nil else { return }
|
|
41
45
|
|
|
42
|
-
callClientEventReporter = .init(
|
|
46
|
+
callClientEventReporter = .init(conference: conference, emitter: emitter)
|
|
43
47
|
callClientEventReporter?.start()
|
|
44
48
|
}
|
|
45
49
|
|
|
46
|
-
private func startReportingChatClientEvents(_
|
|
47
|
-
guard chatClientEventReporter == nil else { return }
|
|
50
|
+
private func startReportingChatClientEvents(_ conversation: Conversation?) {
|
|
51
|
+
guard let conversation, chatClientEventReporter == nil else { return }
|
|
48
52
|
|
|
49
|
-
chatClientEventReporter = .init(
|
|
53
|
+
chatClientEventReporter = .init(conversation: conversation, emitter: emitter)
|
|
50
54
|
chatClientEventReporter?.start()
|
|
51
55
|
}
|
|
52
56
|
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
|
|
4
4
|
import Foundation
|
|
5
5
|
|
|
6
|
-
@available(iOS 12.0, *)
|
|
7
6
|
extension URL {
|
|
8
7
|
|
|
9
8
|
static func fromString(_ string: String) throws -> URL {
|
|
@@ -14,7 +13,6 @@ extension URL {
|
|
|
14
13
|
}
|
|
15
14
|
}
|
|
16
15
|
|
|
17
|
-
@available(iOS 12.0, *)
|
|
18
16
|
private extension String {
|
|
19
17
|
|
|
20
18
|
func unescape() -> String {
|
|
@@ -2,41 +2,35 @@
|
|
|
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
|
class VideoHybridNativeBridge {
|
|
9
8
|
|
|
10
9
|
// MARK: - Properties
|
|
11
10
|
|
|
12
|
-
private let sdk:
|
|
11
|
+
private let sdk: KaleyraVideoSDKProtocol
|
|
13
12
|
private let reporter: SDKEventReporter
|
|
14
13
|
private let emitter: EventEmitter
|
|
15
14
|
private let uiPresenter: UserInterfacePresenter
|
|
16
|
-
private let formatterProxy: FormatterProxy
|
|
17
15
|
private let usersCache: UsersDetailsCache
|
|
18
16
|
private let accessTokenProviderFactory: () -> AccessTokenProvider
|
|
19
17
|
|
|
20
|
-
private var pushTokenEventReporter: PushTokenEventsReporter?
|
|
21
|
-
|
|
22
18
|
private var isConfigured: Bool {
|
|
23
19
|
sdk.config != nil
|
|
24
20
|
}
|
|
25
21
|
|
|
26
22
|
// MARK: - Init
|
|
27
23
|
|
|
28
|
-
init(sdk:
|
|
24
|
+
init(sdk: KaleyraVideoSDKProtocol,
|
|
29
25
|
reporter: SDKEventReporter,
|
|
30
26
|
emitter: EventEmitter,
|
|
31
27
|
uiPresenter: UserInterfacePresenter,
|
|
32
|
-
formatterProxy: FormatterProxy,
|
|
33
28
|
usersCache: UsersDetailsCache,
|
|
34
29
|
accessTokenProviderFactory: @escaping () -> AccessTokenProvider) {
|
|
35
30
|
self.sdk = sdk
|
|
36
31
|
self.reporter = reporter
|
|
37
32
|
self.emitter = emitter
|
|
38
33
|
self.uiPresenter = uiPresenter
|
|
39
|
-
self.formatterProxy = formatterProxy
|
|
40
34
|
self.usersCache = usersCache
|
|
41
35
|
self.accessTokenProviderFactory = accessTokenProviderFactory
|
|
42
36
|
}
|
|
@@ -44,14 +38,12 @@ class VideoHybridNativeBridge {
|
|
|
44
38
|
convenience init(emitter: EventEmitter,
|
|
45
39
|
rootViewController: UIViewController?,
|
|
46
40
|
accessTokenProviderFactory: @escaping () -> AccessTokenProvider) {
|
|
47
|
-
let sdk =
|
|
48
|
-
let formatterProxy = FormatterProxy()
|
|
41
|
+
let sdk = KaleyraVideo.instance
|
|
49
42
|
|
|
50
43
|
self.init(sdk: sdk,
|
|
51
44
|
reporter: EventsReporter(emitter: emitter, sdk: sdk),
|
|
52
45
|
emitter: emitter,
|
|
53
|
-
uiPresenter: MainQueueRelay(KaleyraVideoSDKUserInterfacePresenter(rootViewController: rootViewController
|
|
54
|
-
formatterProxy: formatterProxy,
|
|
46
|
+
uiPresenter: MainQueueRelay(KaleyraVideoSDKUserInterfacePresenter(rootViewController: rootViewController)),
|
|
55
47
|
usersCache: .init(),
|
|
56
48
|
accessTokenProviderFactory: accessTokenProviderFactory)
|
|
57
49
|
}
|
|
@@ -59,16 +51,17 @@ class VideoHybridNativeBridge {
|
|
|
59
51
|
// MARK: - Plugin Implementation
|
|
60
52
|
|
|
61
53
|
func configureSDK(_ config: KaleyraVideoConfiguration) throws {
|
|
62
|
-
configurePushEventsReporterIfNeeded(config: config)
|
|
63
54
|
|
|
64
55
|
if config.logEnabled ?? false {
|
|
65
|
-
|
|
56
|
+
KaleyraVideo.logLevel = .all
|
|
57
|
+
|
|
66
58
|
}
|
|
67
59
|
|
|
68
|
-
let sdkConfig = try config.
|
|
60
|
+
let sdkConfig = try config.makeKaleyraVideoSDKConfig()
|
|
69
61
|
|
|
70
|
-
sdk.userDetailsProvider = UsersDetailsProvider(cache: usersCache
|
|
71
|
-
sdk.configure(sdkConfig)
|
|
62
|
+
sdk.userDetailsProvider = UsersDetailsProvider(cache: usersCache)
|
|
63
|
+
try sdk.configure(sdkConfig)
|
|
64
|
+
sdk.conference?.settings.tools = config.makeToolsConfig()
|
|
72
65
|
|
|
73
66
|
reporter.start()
|
|
74
67
|
|
|
@@ -78,23 +71,19 @@ class VideoHybridNativeBridge {
|
|
|
78
71
|
func callClientStateDescription() throws -> String {
|
|
79
72
|
try checkIsConfigured()
|
|
80
73
|
|
|
81
|
-
return sdk.
|
|
74
|
+
return sdk.conference?.state.description ?? ""
|
|
82
75
|
}
|
|
83
76
|
|
|
84
77
|
func connect(userID: String) throws {
|
|
85
78
|
try checkIsConfigured()
|
|
86
79
|
let provider = accessTokenProviderFactory()
|
|
87
|
-
sdk.connect(
|
|
80
|
+
try sdk.connect(userId: userID, provider: provider)
|
|
88
81
|
}
|
|
89
82
|
|
|
90
83
|
func getCurrentVoIPPushToken() throws -> String? {
|
|
91
84
|
try checkIsConfigured()
|
|
92
85
|
|
|
93
|
-
return
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
func setUserDetailsFormat(_ format: UserDetailsFormat) {
|
|
97
|
-
formatterProxy.formatter = UserDetailsFormatter(format: format.userDetailsFormatDefault)
|
|
86
|
+
return reporter.lastVoIPToken
|
|
98
87
|
}
|
|
99
88
|
|
|
100
89
|
func startCall(_ options: CreateCallOptions) throws {
|
|
@@ -129,26 +118,12 @@ class VideoHybridNativeBridge {
|
|
|
129
118
|
usersCache.purge()
|
|
130
119
|
}
|
|
131
120
|
|
|
132
|
-
func verifyCurrentCall(_ verify: Bool) throws {
|
|
133
|
-
try checkIsConfigured()
|
|
134
|
-
guard let call = sdk.callRegistry.calls.first else { return }
|
|
135
|
-
|
|
136
|
-
sdk.verifiedUser(verify, for: call, completion: nil)
|
|
137
|
-
}
|
|
138
|
-
|
|
139
121
|
func reset() {
|
|
140
122
|
sdk.reset()
|
|
141
123
|
}
|
|
142
124
|
|
|
143
125
|
// MARK: - Private Functions
|
|
144
126
|
|
|
145
|
-
private func configurePushEventsReporterIfNeeded(config: KaleyraVideoConfiguration) {
|
|
146
|
-
guard config.voipStrategy == .automatic else { return }
|
|
147
|
-
guard pushTokenEventReporter == nil else { return }
|
|
148
|
-
|
|
149
|
-
pushTokenEventReporter = PushTokenEventsReporter(emitter: emitter)
|
|
150
|
-
}
|
|
151
|
-
|
|
152
127
|
private func checkIsConfigured() throws {
|
|
153
128
|
guard isConfigured else {
|
|
154
129
|
throw VideoHybridNativeBridgeError.sdkNotConfiguredError()
|
|
@@ -161,10 +136,6 @@ class VideoHybridNativeBridge {
|
|
|
161
136
|
debugPrint("clearUserCache() is not supported for iOS platform.")
|
|
162
137
|
}
|
|
163
138
|
|
|
164
|
-
func handlePushNotificationPayload(_ json: String) {
|
|
165
|
-
debugPrint("handlePushNotificationPayload(_) is not supported for iOS platform - json: \(json)")
|
|
166
|
-
}
|
|
167
|
-
|
|
168
139
|
func setDisplayModeForCurrentCall(_ mode: String) {
|
|
169
140
|
debugPrint("setDisplayModeForCurrentCall(_) is not supported for iOS platform - mode: \(mode)")
|
|
170
141
|
}
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
// See LICENSE for licensing information
|
|
3
3
|
|
|
4
4
|
import Foundation
|
|
5
|
-
import
|
|
5
|
+
import Combine
|
|
6
|
+
import KaleyraVideoSDK
|
|
6
7
|
|
|
7
|
-
@available(iOS 12.0, *)
|
|
8
8
|
struct UserInterfacePresenterConfiguration: Equatable {
|
|
9
9
|
|
|
10
10
|
enum ChatAudioButtonConfiguration: Equatable {
|
|
@@ -32,48 +32,44 @@ struct UserInterfacePresenterConfiguration: Equatable {
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
@available(iOS 12.0, *)
|
|
36
35
|
class KaleyraVideoSDKUserInterfacePresenter: NSObject, UserInterfacePresenter {
|
|
37
36
|
|
|
38
37
|
// MARK: - Properties
|
|
39
38
|
|
|
40
|
-
private let sdk:
|
|
39
|
+
private let sdk: KaleyraVideoSDKProtocol
|
|
41
40
|
private let viewControllerPresenter: ViewControllerPresenter
|
|
42
41
|
private let callWindow: CallWindowProtocol
|
|
43
|
-
private let formatter: Formatter
|
|
44
42
|
|
|
45
43
|
private var configuration = UserInterfacePresenterConfiguration(showsFeedbackWhenCallEnds: false,
|
|
46
44
|
chatAudioButtonConf: .disabled,
|
|
47
45
|
chatVideoButtonConf: .disabled)
|
|
48
46
|
|
|
47
|
+
private lazy var subscriptions = Set<AnyCancellable>()
|
|
48
|
+
|
|
49
49
|
// MARK: - Init
|
|
50
50
|
|
|
51
|
-
init(sdk:
|
|
51
|
+
init(sdk: KaleyraVideoSDKProtocol,
|
|
52
52
|
viewControllerPresenter: ViewControllerPresenter,
|
|
53
|
-
callWindow: CallWindowProtocol
|
|
54
|
-
formatter: Formatter) {
|
|
53
|
+
callWindow: CallWindowProtocol) {
|
|
55
54
|
self.sdk = sdk
|
|
56
55
|
self.viewControllerPresenter = viewControllerPresenter
|
|
57
56
|
self.callWindow = callWindow
|
|
58
|
-
self.formatter = formatter
|
|
59
57
|
|
|
60
58
|
super.init()
|
|
61
|
-
|
|
62
|
-
setupCallWindow()
|
|
63
59
|
}
|
|
64
60
|
|
|
65
|
-
convenience init(rootViewController: UIViewController
|
|
66
|
-
self.init(sdk:
|
|
61
|
+
convenience init(rootViewController: UIViewController?) {
|
|
62
|
+
self.init(sdk: KaleyraVideo.instance,
|
|
67
63
|
viewControllerPresenter: KaleyraVideoSDKUserInterfacePresenter.makeViewControllerPresenter(rootViewController),
|
|
68
|
-
callWindow: KaleyraVideoSDKUserInterfacePresenter.makeCallWindow()
|
|
69
|
-
formatter: formatter)
|
|
64
|
+
callWindow: KaleyraVideoSDKUserInterfacePresenter.makeCallWindow())
|
|
70
65
|
}
|
|
71
66
|
|
|
72
67
|
private static func makeCallWindow() -> CallWindow {
|
|
73
|
-
guard let
|
|
74
|
-
return
|
|
68
|
+
guard let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene else {
|
|
69
|
+
return .init()
|
|
75
70
|
}
|
|
76
|
-
|
|
71
|
+
|
|
72
|
+
return .init(windowScene: windowScene)
|
|
77
73
|
}
|
|
78
74
|
|
|
79
75
|
private static func makeViewControllerPresenter(_ rootViewController: UIViewController?) -> ViewControllerPresenter {
|
|
@@ -86,19 +82,15 @@ class KaleyraVideoSDKUserInterfacePresenter: NSObject, UserInterfacePresenter {
|
|
|
86
82
|
|
|
87
83
|
// MARK: - Setup
|
|
88
84
|
|
|
89
|
-
private func setupCallWindow() {
|
|
90
|
-
callWindow.callDelegate = self
|
|
91
|
-
}
|
|
92
|
-
|
|
93
85
|
private func setupSDK() {
|
|
94
|
-
sdk.
|
|
86
|
+
sdk.conference?.callPublisher.compactMap({ $0 }).receive(on: RunLoop.main).sink { [weak self] call in
|
|
87
|
+
self?.present(call: call)
|
|
88
|
+
}.store(in: &subscriptions)
|
|
95
89
|
}
|
|
96
90
|
|
|
97
91
|
private func setupNotificationCoordinator() {
|
|
98
|
-
sdk.
|
|
99
|
-
sdk.
|
|
100
|
-
sdk.notificationsCoordinator?.formatter = formatter
|
|
101
|
-
sdk.notificationsCoordinator?.start()
|
|
92
|
+
sdk.conversation?.notifications.delegate = self
|
|
93
|
+
sdk.conversation?.notifications.start()
|
|
102
94
|
}
|
|
103
95
|
|
|
104
96
|
// MARK: - Configuration
|
|
@@ -113,46 +105,59 @@ class KaleyraVideoSDKUserInterfacePresenter: NSObject, UserInterfacePresenter {
|
|
|
113
105
|
// MARK: - Presenting Call UI
|
|
114
106
|
|
|
115
107
|
func presentCall(_ options: CreateCallOptions) {
|
|
116
|
-
|
|
117
|
-
handleCallIntent(intent)
|
|
108
|
+
startCall(callees: options.callees, options: options.makeCallOptions())
|
|
118
109
|
}
|
|
119
110
|
|
|
120
111
|
func presentCall(_ url: URL) {
|
|
121
|
-
|
|
122
|
-
|
|
112
|
+
sdk.conference?.join(url: url) { result in
|
|
113
|
+
do {
|
|
114
|
+
try result.get()
|
|
115
|
+
} catch {
|
|
116
|
+
debugPrint("An error occurred while starting join call \(error)")
|
|
117
|
+
}
|
|
118
|
+
}
|
|
123
119
|
}
|
|
124
120
|
|
|
125
|
-
private func
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
121
|
+
private func startCall(callees: [String], options: KaleyraVideoSDK.CallOptions) {
|
|
122
|
+
sdk.conference?.call(callees: callees,
|
|
123
|
+
options: options) { result in
|
|
124
|
+
do {
|
|
125
|
+
try result.get()
|
|
126
|
+
} catch {
|
|
127
|
+
debugPrint("An error occurred while starting call \(error)")
|
|
128
|
+
}
|
|
130
129
|
}
|
|
130
|
+
}
|
|
131
131
|
|
|
132
|
-
|
|
132
|
+
private func present(call: Call) {
|
|
133
|
+
let controller = CallViewController(call: call, configuration: makeCallViewControllerConfiguration())
|
|
134
|
+
controller.delegate = self
|
|
135
|
+
callWindow.makeKeyAndVisible()
|
|
136
|
+
callWindow.set(rootViewController: controller, animated: true, completion: nil)
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
private func makeCallViewControllerConfiguration() -> CallViewController.Configuration {
|
|
140
|
+
.init(feedback: configuration.showsFeedbackWhenCallEnds ? .init() : nil)
|
|
133
141
|
}
|
|
134
142
|
|
|
135
143
|
// MARK: - Presenting Chat UI
|
|
136
144
|
|
|
137
145
|
func presentChat(with userID: String) {
|
|
138
|
-
let intent =
|
|
146
|
+
let intent = ChatViewController.Intent.participant(id: userID)
|
|
139
147
|
handleChatIntent(intent)
|
|
140
148
|
}
|
|
141
149
|
|
|
142
|
-
private func makeChannelViewController(intent:
|
|
143
|
-
let
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
let controller = ChannelViewController()
|
|
150
|
+
private func makeChannelViewController(intent: ChatViewController.Intent) -> ChatViewController {
|
|
151
|
+
let controller = ChatViewController(intent: intent,
|
|
152
|
+
configuration: .init(audioButton: configuration.chatHasAudioButton,
|
|
153
|
+
videoButton: configuration.chatHasVideoButton))
|
|
147
154
|
controller.delegate = self
|
|
148
|
-
controller.configuration = config
|
|
149
|
-
controller.intent = intent
|
|
150
155
|
return controller
|
|
151
156
|
}
|
|
152
157
|
|
|
153
158
|
// MARK: - Intents
|
|
154
159
|
|
|
155
|
-
private func handleChatIntent(_ intent:
|
|
160
|
+
private func handleChatIntent(_ intent: ChatViewController.Intent) {
|
|
156
161
|
let channelViewController = makeChannelViewController(intent: intent)
|
|
157
162
|
|
|
158
163
|
let continueWith: (() -> Void) = { [weak self] in
|
|
@@ -165,85 +170,48 @@ class KaleyraVideoSDKUserInterfacePresenter: NSObject, UserInterfacePresenter {
|
|
|
165
170
|
continueWith()
|
|
166
171
|
}
|
|
167
172
|
}
|
|
168
|
-
|
|
169
|
-
private func handleCallIntent(_ intent: Intent) {
|
|
170
|
-
callWindow.setConfiguration(makeCallViewControllerConfiguration())
|
|
171
|
-
callWindow.presentCallViewController(for: intent) { [weak self] error in
|
|
172
|
-
guard let self = self else { return }
|
|
173
|
-
guard error != nil else { return }
|
|
174
|
-
|
|
175
|
-
self.viewControllerPresenter.displayAlert(title: "Warning", message: "Another call ongoing", dismissButtonText: "OK")
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
173
|
}
|
|
179
174
|
|
|
180
|
-
// MARK: -
|
|
175
|
+
// MARK: - CallViewControllerDelegate
|
|
181
176
|
|
|
182
|
-
|
|
183
|
-
extension KaleyraVideoSDKUserInterfacePresenter: CallWindowDelegate {
|
|
177
|
+
extension KaleyraVideoSDKUserInterfacePresenter: CallViewControllerDelegate {
|
|
184
178
|
|
|
185
|
-
func
|
|
186
|
-
callWindow.
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
func callWindow(_ window: CallWindow, openChatWith intent: OpenChatIntent) {
|
|
190
|
-
handleChatIntent(intent)
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
// MARK: - IncomingCallObserver
|
|
195
|
-
|
|
196
|
-
@available(iOS 12.0, *)
|
|
197
|
-
extension KaleyraVideoSDKUserInterfacePresenter: IncomingCallObserver {
|
|
198
|
-
|
|
199
|
-
func callClient(_ client: Bandyer.CallClient, didReceiveIncomingCall call: Bandyer.Call) {
|
|
200
|
-
handleCallIntent(HandleIncomingCallIntent(call: call))
|
|
179
|
+
func callViewControllerDidFinish(_ controller: KaleyraVideoSDK.CallViewController) {
|
|
180
|
+
callWindow.set(rootViewController: nil, animated: true) { _ in
|
|
181
|
+
self.callWindow.isHidden = true
|
|
182
|
+
}
|
|
201
183
|
}
|
|
202
184
|
}
|
|
203
185
|
|
|
204
186
|
// MARK: - InAppChatNotificationTouchListener
|
|
205
187
|
|
|
206
|
-
|
|
207
|
-
extension KaleyraVideoSDKUserInterfacePresenter: InAppChatNotificationTouchListener {
|
|
188
|
+
extension KaleyraVideoSDKUserInterfacePresenter: InAppNotificationsDelegate {
|
|
208
189
|
|
|
209
|
-
func onTouch(_ notification:
|
|
210
|
-
|
|
190
|
+
func onTouch(_ notification: ChatNotification) {
|
|
191
|
+
let intent = ChatViewController.Intent.chat(id: notification.chatId)
|
|
211
192
|
handleChatIntent(intent)
|
|
212
193
|
}
|
|
213
194
|
}
|
|
214
195
|
|
|
215
|
-
// MARK: - InAppFileShareNotificationTouchListener
|
|
216
|
-
|
|
217
|
-
@available(iOS 12.0, *)
|
|
218
|
-
extension KaleyraVideoSDKUserInterfacePresenter: InAppFileShareNotificationTouchListener {
|
|
219
|
-
|
|
220
|
-
func onTouch(_ notification: Bandyer.FileShareNotification) {
|
|
221
|
-
callWindow.presentCallViewController(for: OpenDownloadsIntent()) { _ in }
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
|
|
225
196
|
// MARK: - ChannelViewControllerDelegate
|
|
226
197
|
|
|
227
|
-
|
|
228
|
-
extension KaleyraVideoSDKUserInterfacePresenter: ChannelViewControllerDelegate {
|
|
198
|
+
extension KaleyraVideoSDKUserInterfacePresenter: ChatViewControllerDelegate {
|
|
229
199
|
|
|
230
|
-
func
|
|
200
|
+
func chatViewControllerDidFinish(_ controller: KaleyraVideoSDK.ChatViewController) {
|
|
231
201
|
viewControllerPresenter.dismiss(controller, animated: true, completion: nil)
|
|
232
202
|
}
|
|
233
203
|
|
|
234
|
-
func
|
|
204
|
+
func chatViewControllerDidTapAudioCallButton(_ controller: KaleyraVideoSDK.ChatViewController) {
|
|
235
205
|
guard case let .enabled(audioOptions) = configuration.chatAudioButtonConf else { return }
|
|
236
206
|
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
handleCallIntent(intent)
|
|
207
|
+
startCall(callees: controller.participants, options: .init(type: audioOptions.type.callType,
|
|
208
|
+
recording: audioOptions.recordingType?.callRecordingType))
|
|
240
209
|
}
|
|
241
210
|
|
|
242
|
-
func
|
|
211
|
+
func chatViewControllerDidTapVideoCallButton(_ controller: KaleyraVideoSDK.ChatViewController) {
|
|
243
212
|
guard case let .enabled(videoOptions) = configuration.chatVideoButtonConf else { return }
|
|
244
213
|
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
handleCallIntent(intent)
|
|
214
|
+
startCall(callees: controller.participants, options: .init(type: .audioVideo,
|
|
215
|
+
recording: videoOptions.recordingType?.callRecordingType))
|
|
248
216
|
}
|
|
249
217
|
}
|
|
@@ -2,27 +2,26 @@
|
|
|
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
|
class UsersDetailsCache {
|
|
9
8
|
|
|
10
|
-
private lazy var items = [String :
|
|
9
|
+
private lazy var items = [String : KaleyraVideoSDK.UserDetails]()
|
|
11
10
|
private let lock: Locking = NSRecursiveLock()
|
|
12
11
|
|
|
13
|
-
func setItem(_ item:
|
|
12
|
+
func setItem(_ item: KaleyraVideoSDK.UserDetails, forKey key: String) {
|
|
14
13
|
lock.sync {
|
|
15
14
|
items[key] = item
|
|
16
15
|
}
|
|
17
16
|
}
|
|
18
17
|
|
|
19
|
-
func setItems(_ items: [
|
|
18
|
+
func setItems(_ items: [KaleyraVideoSDK.UserDetails]) {
|
|
20
19
|
lock.sync {
|
|
21
|
-
items.forEach { setItem($0, forKey: $0.
|
|
20
|
+
items.forEach { setItem($0, forKey: $0.userId) }
|
|
22
21
|
}
|
|
23
22
|
}
|
|
24
23
|
|
|
25
|
-
func item(forKey key: String) ->
|
|
24
|
+
func item(forKey key: String) -> KaleyraVideoSDK.UserDetails? {
|
|
26
25
|
lock.sync {
|
|
27
26
|
items[key]
|
|
28
27
|
}
|