@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
|
@@ -3,37 +3,24 @@
|
|
|
3
3
|
|
|
4
4
|
import Foundation
|
|
5
5
|
import CallKit
|
|
6
|
-
import
|
|
6
|
+
import KaleyraVideoSDK
|
|
7
7
|
|
|
8
|
-
@available(iOS 12.0, *)
|
|
9
8
|
class UsersDetailsProvider: NSObject, UserDetailsProvider {
|
|
10
9
|
|
|
11
10
|
private let cache: UsersDetailsCache
|
|
12
|
-
private let formatter: Formatter
|
|
13
11
|
|
|
14
|
-
init(cache: UsersDetailsCache
|
|
12
|
+
init(cache: UsersDetailsCache) {
|
|
15
13
|
self.cache = cache
|
|
16
|
-
self.formatter = formatter
|
|
17
14
|
super.init()
|
|
18
15
|
}
|
|
19
16
|
|
|
20
|
-
func provideDetails(_ userIds: [String], completion: @escaping ([
|
|
21
|
-
completion(detailsFor(userIds: userIds))
|
|
17
|
+
func provideDetails(_ userIds: [String], completion: @escaping (Result<[KaleyraVideoSDK.UserDetails], any Error>) -> Void) {
|
|
18
|
+
completion(.success(detailsFor(userIds: userIds)))
|
|
22
19
|
}
|
|
23
20
|
|
|
24
|
-
func
|
|
25
|
-
completion(handleFor(userIds: userIds))
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
private func detailsFor(userIds: [String]) -> [Bandyer.UserDetails] {
|
|
21
|
+
private func detailsFor(userIds: [String]) -> [KaleyraVideoSDK.UserDetails] {
|
|
29
22
|
userIds.map { id in
|
|
30
|
-
cache.item(forKey: id) ?? .init(
|
|
23
|
+
cache.item(forKey: id) ?? .init(userId: id)
|
|
31
24
|
}
|
|
32
25
|
}
|
|
33
|
-
|
|
34
|
-
private func handleFor(userIds: [String]) -> CXHandle {
|
|
35
|
-
guard !userIds.isEmpty else { return .init(type: .generic, value: "") }
|
|
36
|
-
let details = detailsFor(userIds: userIds)
|
|
37
|
-
return .init(type: .generic, value: formatter.string(for: details) ?? userIds.joined(separator: ", ") )
|
|
38
|
-
}
|
|
39
26
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kaleyra/video-react-native-module",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Kaleyra Video module for react native.",
|
|
6
6
|
"main": "lib/commonjs/index.js",
|
|
@@ -69,8 +69,10 @@
|
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
71
|
"@commitlint/config-conventional": "^17.0.2",
|
|
72
|
+
"@eslint/eslintrc": "^3.2.0",
|
|
73
|
+
"@eslint/js": "^9.15.0",
|
|
72
74
|
"@evilmartians/lefthook": "^1.2.2",
|
|
73
|
-
"@react-native
|
|
75
|
+
"@react-native/eslint-config": "^0.76.3",
|
|
74
76
|
"@release-it/conventional-changelog": "^5.0.0",
|
|
75
77
|
"@types/jest": "^28.1.2",
|
|
76
78
|
"@types/react": "~18.2.79",
|
|
@@ -79,15 +81,15 @@
|
|
|
79
81
|
"@typescript-eslint/parser": "^5.60.0",
|
|
80
82
|
"commitlint": "^17.0.2",
|
|
81
83
|
"del-cli": "^5.0.0",
|
|
82
|
-
"eslint": "^
|
|
84
|
+
"eslint": "^9.15.0",
|
|
83
85
|
"eslint-config-prettier": "^8.5.0",
|
|
84
86
|
"eslint-plugin-prettier": "^4.0.0",
|
|
85
|
-
"jest": "^
|
|
87
|
+
"jest": "^29.2.1",
|
|
86
88
|
"pod-install": "^0.1.0",
|
|
87
|
-
"prettier": "^
|
|
89
|
+
"prettier": "^3.3.3",
|
|
88
90
|
"quicktype": "^16.0.43",
|
|
89
|
-
"react": "18.
|
|
90
|
-
"react-native": "0.
|
|
91
|
+
"react": "18.3.1",
|
|
92
|
+
"react-native": "^0.74.6",
|
|
91
93
|
"typedoc": "^0.24.4",
|
|
92
94
|
"typescript": "^4.9.5"
|
|
93
95
|
},
|
package/src/KaleyraVideo.ts
CHANGED
|
@@ -5,8 +5,6 @@ import { NativeModules, Platform } from 'react-native';
|
|
|
5
5
|
import type { KaleyraVideoConfiguration } from '../native-bridge/TypeScript/types/KaleyraVideoConfiguration';
|
|
6
6
|
import type { CreateCallOptions } from '../native-bridge/TypeScript/types/CreateCallOptions';
|
|
7
7
|
import type { UserDetails } from '../native-bridge/TypeScript/types/UserDetails';
|
|
8
|
-
import type { UserDetailsFormat } from '../native-bridge/TypeScript/types/UserDetailsFormat';
|
|
9
|
-
import { UserDetailsFormatValidator } from '../native-bridge/TypeScript/UserDetailsFormatValidator';
|
|
10
8
|
import { CallType } from '../native-bridge/TypeScript/types/CallType';
|
|
11
9
|
import { IllegalArgumentError } from '../native-bridge/TypeScript/errors/IllegalArgumentError';
|
|
12
10
|
import { Environments } from '../native-bridge/TypeScript/Environments';
|
|
@@ -195,19 +193,6 @@ class KaleyraVideo {
|
|
|
195
193
|
VideoNativeModuleBridge.startCall(JSON.stringify(callOptions));
|
|
196
194
|
}
|
|
197
195
|
|
|
198
|
-
/**
|
|
199
|
-
* Verify the user for the current call
|
|
200
|
-
* @param verify true if the user is verified, false otherwise
|
|
201
|
-
* @throws IllegalArgumentError
|
|
202
|
-
*/
|
|
203
|
-
verifyCurrentCall(verify: boolean) {
|
|
204
|
-
if (KaleyraVideo._isAndroid()) {
|
|
205
|
-
VideoNativeModuleBridge.verifyCurrentCall(verify);
|
|
206
|
-
} else {
|
|
207
|
-
console.warn('Not yet supported on ', Platform.OS, ' platform.');
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
|
|
211
196
|
/**
|
|
212
197
|
* Set the UI display mode for the current call
|
|
213
198
|
* @param mode FOREGROUND, FOREGROUND_PICTURE_IN_PICTURE, BACKGROUND
|
|
@@ -249,16 +234,6 @@ class KaleyraVideo {
|
|
|
249
234
|
VideoNativeModuleBridge.addUsersDetails(JSON.stringify(userDetails));
|
|
250
235
|
}
|
|
251
236
|
|
|
252
|
-
setUserDetailsFormat(format: UserDetailsFormat) {
|
|
253
|
-
const validator = new UserDetailsFormatValidator();
|
|
254
|
-
validator.validate(format.default);
|
|
255
|
-
if (format.androidNotification !== undefined) {
|
|
256
|
-
validator.validate(format.androidNotification);
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
VideoNativeModuleBridge.setUserDetailsFormat(JSON.stringify(format));
|
|
260
|
-
}
|
|
261
|
-
|
|
262
237
|
/**
|
|
263
238
|
* Call this method to remove all the user details previously provided.
|
|
264
239
|
*/
|
|
@@ -266,22 +241,6 @@ class KaleyraVideo {
|
|
|
266
241
|
VideoNativeModuleBridge.removeUsersDetails();
|
|
267
242
|
}
|
|
268
243
|
|
|
269
|
-
/**
|
|
270
|
-
* Call this method to handle a notification!
|
|
271
|
-
*
|
|
272
|
-
* @param payload notification data payload as String
|
|
273
|
-
* @throws IllegalArgumentError
|
|
274
|
-
*/
|
|
275
|
-
handlePushNotificationPayload(payload: string) {
|
|
276
|
-
if (payload === '' || payload === 'undefined') {
|
|
277
|
-
throw new IllegalArgumentError('Expected a not empty payload!');
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
VideoNativeModuleBridge.handlePushNotificationPayload(
|
|
281
|
-
JSON.stringify(payload),
|
|
282
|
-
);
|
|
283
|
-
}
|
|
284
|
-
|
|
285
244
|
/**
|
|
286
245
|
* Open chat
|
|
287
246
|
* @param userID user you want to chat with
|
|
@@ -335,7 +294,6 @@ export {
|
|
|
335
294
|
CallType,
|
|
336
295
|
Regions,
|
|
337
296
|
UserDetails,
|
|
338
|
-
UserDetailsFormat,
|
|
339
297
|
CallDisplayMode,
|
|
340
298
|
Session,
|
|
341
299
|
Environments,
|
|
@@ -11,7 +11,7 @@ Pod::Spec.new do |s|
|
|
|
11
11
|
s.license = package["license"]
|
|
12
12
|
s.authors = package["author"]
|
|
13
13
|
|
|
14
|
-
s.platforms = { :ios => "
|
|
14
|
+
s.platforms = { :ios => "15.0" }
|
|
15
15
|
s.source = { :git => "git@github.com:KaleyraVideo/VideoReactNativeModule.git", :tag => "#{s.version}" }
|
|
16
16
|
|
|
17
17
|
s.source_files = "ios/**/*.{h,m,mm,swift}", "native-bridge/iOS/Source/**/*.swift"
|
|
@@ -19,12 +19,12 @@ Pod::Spec.new do |s|
|
|
|
19
19
|
s.dependency "React-Core"
|
|
20
20
|
|
|
21
21
|
podfile = Pod::Podfile.from_file(Pathname.new('native-bridge/iOS/Podfile'))
|
|
22
|
-
pod = podfile.dependencies.select { |pod| pod.name == "
|
|
22
|
+
pod = podfile.dependencies.select { |pod| pod.name == "KaleyraVideoSDK" }
|
|
23
23
|
|
|
24
24
|
if defined?($KaleyraNoWebRTC)
|
|
25
|
-
s.dependency "
|
|
25
|
+
s.dependency "KaleyraVideoSDK/Core", pod[0].requirement.to_s
|
|
26
26
|
else
|
|
27
|
-
s.dependency "
|
|
27
|
+
s.dependency "KaleyraVideoSDK", pod[0].requirement.to_s
|
|
28
28
|
end
|
|
29
29
|
|
|
30
30
|
# Don't install the dependencies when we run `pod install` in the old architecture.
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Copyright © 2018-2023 Kaleyra S.p.a. All Rights Reserved.
|
|
3
|
-
// See LICENSE for licensing information
|
|
4
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.UserDetailsFormatValidator = void 0;
|
|
6
|
-
const IllegalArgumentError_1 = require("./errors/IllegalArgumentError");
|
|
7
|
-
class UserDetailsFormatValidator {
|
|
8
|
-
validate(format) {
|
|
9
|
-
const keywords = this.findKeywords(format);
|
|
10
|
-
if (keywords.length === 0) {
|
|
11
|
-
throw new IllegalArgumentError_1.IllegalArgumentError("Could not find any keyword, at least one keyword in the format ${keyword} must be provided");
|
|
12
|
-
}
|
|
13
|
-
const allowedKeywords = ["userID", "nickName", "firstName", "lastName", "email", "profileImageUrl"];
|
|
14
|
-
keywords.forEach((keyword) => {
|
|
15
|
-
if (allowedKeywords.indexOf(keyword) === -1) {
|
|
16
|
-
throw new IllegalArgumentError_1.IllegalArgumentError("Declared keyword=${" + keyword + "} is not allowed. The allowedKeywords allowed are: " + allowedKeywords);
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
findKeywords(format) {
|
|
21
|
-
const regex = /\${([\w]+)}/g;
|
|
22
|
-
let match;
|
|
23
|
-
const matches = [];
|
|
24
|
-
while ((match = regex.exec(format)) !== null) {
|
|
25
|
-
if (match[1] && match[1] !== null) {
|
|
26
|
-
matches.push(match[1]);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
return matches;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
exports.UserDetailsFormatValidator = UserDetailsFormatValidator;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
// Copyright © 2018-2023 Kaleyra S.p.a. All Rights Reserved.
|
|
2
|
-
// See LICENSE for licensing information
|
|
3
|
-
import { IllegalArgumentError } from "./errors/IllegalArgumentError";
|
|
4
|
-
export class UserDetailsFormatValidator {
|
|
5
|
-
validate(format) {
|
|
6
|
-
const keywords = this.findKeywords(format);
|
|
7
|
-
if (keywords.length === 0) {
|
|
8
|
-
throw new IllegalArgumentError("Could not find any keyword, at least one keyword in the format ${keyword} must be provided");
|
|
9
|
-
}
|
|
10
|
-
const allowedKeywords = ["userID", "nickName", "firstName", "lastName", "email", "profileImageUrl"];
|
|
11
|
-
keywords.forEach((keyword) => {
|
|
12
|
-
if (allowedKeywords.indexOf(keyword) === -1) {
|
|
13
|
-
throw new IllegalArgumentError("Declared keyword=${" + keyword + "} is not allowed. The allowedKeywords allowed are: " + allowedKeywords);
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
findKeywords(format) {
|
|
18
|
-
const regex = /\${([\w]+)}/g;
|
|
19
|
-
let match;
|
|
20
|
-
const matches = [];
|
|
21
|
-
while ((match = regex.exec(format)) !== null) {
|
|
22
|
-
if (match[1] && match[1] !== null) {
|
|
23
|
-
matches.push(match[1]);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
return matches;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This is used to display the user details in the call/chat UI
|
|
3
|
-
*/
|
|
4
|
-
export interface UserDetailsFormat {
|
|
5
|
-
/**
|
|
6
|
-
* Format to be used to display a user details on the call/chat UI
|
|
7
|
-
* <br/>
|
|
8
|
-
* <br/>
|
|
9
|
-
* <b><font color="blue">default</font>: ${userAlias}</b>
|
|
10
|
-
*/
|
|
11
|
-
default: string;
|
|
12
|
-
/**
|
|
13
|
-
* Format to be used when displaying an android notification
|
|
14
|
-
* <br/>
|
|
15
|
-
* <br/>
|
|
16
|
-
* <b><font color="blue">default</font>: equals to UserDetailsFormatter.default</b>
|
|
17
|
-
*/
|
|
18
|
-
androidNotification?: string;
|
|
19
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
// Copyright © 2018-2023 Kaleyra S.p.a. All Rights Reserved.
|
|
2
|
-
// See LICENSE for licensing information
|
|
3
|
-
|
|
4
|
-
import { IllegalArgumentError } from "./errors/IllegalArgumentError";
|
|
5
|
-
|
|
6
|
-
export class UserDetailsFormatValidator {
|
|
7
|
-
|
|
8
|
-
validate(format: string) {
|
|
9
|
-
const keywords = this.findKeywords(format);
|
|
10
|
-
|
|
11
|
-
if (keywords.length === 0) {
|
|
12
|
-
throw new IllegalArgumentError("Could not find any keyword, at least one keyword in the format ${keyword} must be provided");
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const allowedKeywords = ["userID", "nickName", "firstName", "lastName", "email", "profileImageUrl"];
|
|
16
|
-
|
|
17
|
-
keywords.forEach((keyword) => {
|
|
18
|
-
if (allowedKeywords.indexOf(keyword) === -1) {
|
|
19
|
-
throw new IllegalArgumentError("Declared keyword=${" + keyword + "} is not allowed. The allowedKeywords allowed are: " + allowedKeywords);
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
private findKeywords(format: string): string[] {
|
|
25
|
-
const regex = /\${([\w]+)}/g;
|
|
26
|
-
let match;
|
|
27
|
-
const matches: string[] = [];
|
|
28
|
-
while ((match = regex.exec(format)) !== null) {
|
|
29
|
-
if (match[1] && match[1] !== null) {
|
|
30
|
-
matches.push(match[1]);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
return matches;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
// Copyright © 2018-2023 Kaleyra S.p.a. All Rights Reserved.
|
|
2
|
-
// See LICENSE for licensing information
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* This is used to display the user details in the call/chat UI
|
|
6
|
-
*/
|
|
7
|
-
export interface UserDetailsFormat {
|
|
8
|
-
/**
|
|
9
|
-
* Format to be used to display a user details on the call/chat UI
|
|
10
|
-
* <br/>
|
|
11
|
-
* <br/>
|
|
12
|
-
* <b><font color="blue">default</font>: ${userAlias}</b>
|
|
13
|
-
*/
|
|
14
|
-
default: string;
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Format to be used when displaying an android notification
|
|
18
|
-
* <br/>
|
|
19
|
-
* <br/>
|
|
20
|
-
* <b><font color="blue">default</font>: equals to UserDetailsFormatter.default</b>
|
|
21
|
-
*/
|
|
22
|
-
androidNotification?: string;
|
|
23
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
// Copyright © 2018-2023 Kaleyra S.p.a. All Rights Reserved.
|
|
2
|
-
// See LICENSE for licensing information
|
|
3
|
-
|
|
4
|
-
package com.kaleyra.video_hybrid_native_bridge.user_details
|
|
5
|
-
|
|
6
|
-
import android.annotation.SuppressLint
|
|
7
|
-
import android.content.Context
|
|
8
|
-
import com.bandyer.android_sdk.notification.FormatContext
|
|
9
|
-
import com.bandyer.android_sdk.utils.provider.UserDetails
|
|
10
|
-
import com.bandyer.android_sdk.utils.provider.UserDetailsFormatter
|
|
11
|
-
import com.kaleyra.video_hybrid_native_bridge.UserDetailsFormat
|
|
12
|
-
import com.google.gson.Gson
|
|
13
|
-
import java.util.regex.Pattern
|
|
14
|
-
import kotlin.reflect.full.declaredMemberProperties
|
|
15
|
-
|
|
16
|
-
internal class CachedUserDetailsFormatter private constructor() : UserDetailsFormatter {
|
|
17
|
-
|
|
18
|
-
private lateinit var context: Context
|
|
19
|
-
private lateinit var userDetailsFormat: UserDetailsFormat
|
|
20
|
-
|
|
21
|
-
private val preferences by lazy { context.getSharedPreferences(KALEYRA_VIDEO_CACHED_USER_DETAILS_FORMATTER_PREFS, Context.MODE_PRIVATE) }
|
|
22
|
-
private val gson by lazy { Gson() }
|
|
23
|
-
|
|
24
|
-
constructor(context: Context) : this() {
|
|
25
|
-
this.context = context
|
|
26
|
-
userDetailsFormat = gson.fromJson(preferences.getString(KALEYRA_VIDEO_CACHED_USER_DETAILS_FORMAT, ""), UserDetailsFormat::class.java)
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
@SuppressLint("ApplySharedPref")
|
|
30
|
-
constructor(context: Context, userDetailsFormat: UserDetailsFormat) : this() {
|
|
31
|
-
this.context = context
|
|
32
|
-
this.userDetailsFormat = userDetailsFormat
|
|
33
|
-
preferences.edit().putString(KALEYRA_VIDEO_CACHED_USER_DETAILS_FORMAT, gson.toJson(userDetailsFormat)).commit()
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
override fun format(userDetails: UserDetails, context: FormatContext): String = with(userDetails) {
|
|
37
|
-
if (context.isNotification) userDetailsFormat.androidNotification?.let { formatBy(it) } ?: formatBy(userDetailsFormat.default)
|
|
38
|
-
else formatBy(userDetailsFormat.default)
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
private fun UserDetails.formatBy(textToFormat: String): String {
|
|
42
|
-
var output = textToFormat
|
|
43
|
-
val regex = "(?<=\\$\\{)(.*?)(?=\\})";
|
|
44
|
-
val p = Pattern.compile(regex);
|
|
45
|
-
val m = p.matcher(textToFormat);
|
|
46
|
-
while (m.find()) {
|
|
47
|
-
val keyword = m.group()
|
|
48
|
-
val value = UserDetails::class::declaredMemberProperties.get().firstOrNull { it.name == keyword }
|
|
49
|
-
output = output.replace("\${$keyword}", value?.call(this)?.toString() ?: "\${$keyword}")
|
|
50
|
-
}
|
|
51
|
-
return output
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
companion object {
|
|
55
|
-
private const val KALEYRA_VIDEO_CACHED_USER_DETAILS_FORMATTER_PREFS = "KALEYRA_VIDEO_CACHED_USER_DETAILS_FORMATTER_PREFS"
|
|
56
|
-
private const val KALEYRA_VIDEO_CACHED_USER_DETAILS_FORMAT = "KALEYRA_VIDEO_CACHED_USER_DETAILS_FORMAT"
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
// Copyright © 2018-2023 Kaleyra S.p.a. All Rights Reserved.
|
|
2
|
-
// See LICENSE for licensing information
|
|
3
|
-
|
|
4
|
-
import Foundation
|
|
5
|
-
import Bandyer
|
|
6
|
-
|
|
7
|
-
@available(iOS 12.0, *)
|
|
8
|
-
protocol BandyerSDKProtocol: AnyObject {
|
|
9
|
-
|
|
10
|
-
var config: Bandyer.Config? { get }
|
|
11
|
-
var userDetailsProvider: Bandyer.UserDetailsProvider? { get set }
|
|
12
|
-
var callClient: Bandyer.CallClient! { get }
|
|
13
|
-
var chatClient: Bandyer.ChatClient! { get }
|
|
14
|
-
var notificationsCoordinator: Bandyer.InAppNotificationsCoordinator? { get }
|
|
15
|
-
var callRegistry: Bandyer.CallRegistry! { get }
|
|
16
|
-
|
|
17
|
-
func configure(_ config: Bandyer.Config)
|
|
18
|
-
func connect(_ session: Bandyer.Session)
|
|
19
|
-
func verifiedUser(_ verified: Bool, for call: Bandyer.Call, completion: ((Error?) -> Void)?)
|
|
20
|
-
func disconnect()
|
|
21
|
-
func reset()
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
@available(iOS 12.0, *)
|
|
25
|
-
extension BandyerSDK: BandyerSDKProtocol {}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// Copyright © 2018-2023 Kaleyra S.p.a. All Rights Reserved.
|
|
2
|
-
// See LICENSE for licensing information
|
|
3
|
-
|
|
4
|
-
import Foundation
|
|
5
|
-
import Bandyer
|
|
6
|
-
|
|
7
|
-
@available(iOS 12.0, *)
|
|
8
|
-
extension AudioCallOptions {
|
|
9
|
-
|
|
10
|
-
var callOptions: Bandyer.CallOptions {
|
|
11
|
-
.init(callType: type.callType,
|
|
12
|
-
recordingType: recordingType.callRecordingType)
|
|
13
|
-
}
|
|
14
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// Copyright © 2018-2023 Kaleyra S.p.a. All Rights Reserved.
|
|
2
|
-
// See LICENSE for licensing information
|
|
3
|
-
|
|
4
|
-
import Foundation
|
|
5
|
-
import Bandyer
|
|
6
|
-
|
|
7
|
-
@available(iOS 12.0, *)
|
|
8
|
-
extension CallOptions {
|
|
9
|
-
|
|
10
|
-
var callOptions: Bandyer.CallOptions {
|
|
11
|
-
.init(callType: .audioVideo,
|
|
12
|
-
recordingType: recordingType.callRecordingType)
|
|
13
|
-
}
|
|
14
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
// Copyright © 2018-2023 Kaleyra S.p.a. All Rights Reserved.
|
|
2
|
-
// See LICENSE for licensing information
|
|
3
|
-
|
|
4
|
-
import Foundation
|
|
5
|
-
import Bandyer
|
|
6
|
-
|
|
7
|
-
@available(iOS 12.0, *)
|
|
8
|
-
extension CreateCallOptions {
|
|
9
|
-
|
|
10
|
-
func makeStartOutgoingCallIntent() -> StartOutgoingCallIntent {
|
|
11
|
-
.init(callees: callees, options: makeCallOptions())
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
private func makeCallOptions() -> Bandyer.CallOptions {
|
|
15
|
-
.init(callType: callType.bandyerType, recordingType: recordingType?.callRecordingType ?? CallRecordingType.none)
|
|
16
|
-
}
|
|
17
|
-
}
|
|
@@ -1,158 +0,0 @@
|
|
|
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 Bandyer
|
|
7
|
-
import PushKit
|
|
8
|
-
|
|
9
|
-
@available(iOS 12.0, *)
|
|
10
|
-
extension KaleyraVideoConfiguration {
|
|
11
|
-
|
|
12
|
-
private enum ConfigurationError: Error {
|
|
13
|
-
case unsupportedEnvironment
|
|
14
|
-
case unsupportedRegion
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
var isCallkitEnabled: Bool {
|
|
18
|
-
iosConfig?.callkit?.enabled ?? true
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
var voipStrategy: VoipHandlingStrategy {
|
|
22
|
-
iosConfig?.voipHandlingStrategy ?? .automatic
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
func makeBandyerConfig(registryDelegate: PKPushRegistryDelegate? = nil) throws -> Bandyer.Config {
|
|
26
|
-
guard let bandyerEnv = environment.bandyerEnvironment else {
|
|
27
|
-
throw ConfigurationError.unsupportedEnvironment
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
guard let bandyerRegion = region.bandyerRegion else {
|
|
31
|
-
throw ConfigurationError.unsupportedRegion
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
return try ConfigBuilder(appID: appID, environment: bandyerEnv, region: bandyerRegion)
|
|
35
|
-
.callKit(iosConfig.makeCallkitConfigurationBuilder())
|
|
36
|
-
.tools(tools.makeToolsConfigurationBuilder())
|
|
37
|
-
.voip(iosConfig.makeVoipConfigurationBuilder(registryDelegate: registryDelegate))
|
|
38
|
-
.build()
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
@available(iOS 12.0, *)
|
|
43
|
-
private extension Optional where Wrapped == IosConfiguration {
|
|
44
|
-
|
|
45
|
-
func makeCallkitConfigurationBuilder() -> CallKitConfigurationBuilder {
|
|
46
|
-
switch self {
|
|
47
|
-
case .none:
|
|
48
|
-
let builder = CallKitConfigurationBuilder()
|
|
49
|
-
builder.enabled()
|
|
50
|
-
return builder
|
|
51
|
-
case .some(let wrapped):
|
|
52
|
-
return wrapped.makeCallkitConfigurationBuilder()
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
func makeVoipConfigurationBuilder(registryDelegate: PKPushRegistryDelegate?) -> VoIPPushConfigurationBuilder {
|
|
57
|
-
switch self {
|
|
58
|
-
case .none:
|
|
59
|
-
let builder = VoIPPushConfigurationBuilder()
|
|
60
|
-
builder.manual()
|
|
61
|
-
return builder
|
|
62
|
-
case .some(let wrapped):
|
|
63
|
-
return wrapped.makeVoipConfigurationBuilder(registryDelegate: registryDelegate)
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
@available(iOS 12.0, *)
|
|
69
|
-
private extension Optional where Wrapped == Tools {
|
|
70
|
-
|
|
71
|
-
func makeToolsConfigurationBuilder() -> ToolsConfigurationBuilder {
|
|
72
|
-
switch self {
|
|
73
|
-
case .none:
|
|
74
|
-
return ToolsConfigurationBuilder()
|
|
75
|
-
case .some(let wrapped):
|
|
76
|
-
return wrapped.makeToolsConfigurationBuilder()
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
@available(iOS 12.0, *)
|
|
82
|
-
private extension IosConfiguration {
|
|
83
|
-
|
|
84
|
-
func makeCallkitConfigurationBuilder() -> CallKitConfigurationBuilder {
|
|
85
|
-
let builder = CallKitConfigurationBuilder()
|
|
86
|
-
|
|
87
|
-
guard let callkitConfig = callkit else {
|
|
88
|
-
builder.enabled()
|
|
89
|
-
return builder
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
if callkitConfig.enabled ?? true {
|
|
93
|
-
builder.enabled { providerConf in
|
|
94
|
-
if let iconName = callkitConfig.appIconName,
|
|
95
|
-
let image = UIImage(named: iconName) {
|
|
96
|
-
providerConf.icon(image)
|
|
97
|
-
}
|
|
98
|
-
if let ringtone = callkitConfig.ringtoneSoundName {
|
|
99
|
-
providerConf.ringtoneSound(ringtone)
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
} else {
|
|
103
|
-
builder.disabled()
|
|
104
|
-
}
|
|
105
|
-
return builder
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
func makeVoipConfigurationBuilder(registryDelegate: PKPushRegistryDelegate?) -> VoIPPushConfigurationBuilder {
|
|
109
|
-
let builder = VoIPPushConfigurationBuilder()
|
|
110
|
-
|
|
111
|
-
if (voipHandlingStrategy == nil || voipHandlingStrategy == .automatic),
|
|
112
|
-
let delegate = registryDelegate {
|
|
113
|
-
builder.automatic(pushRegistryDelegate: delegate)
|
|
114
|
-
} else {
|
|
115
|
-
builder.manual()
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
return builder
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
@available(iOS 12.0, *)
|
|
123
|
-
private extension Tools {
|
|
124
|
-
|
|
125
|
-
func makeToolsConfigurationBuilder() -> ToolsConfigurationBuilder {
|
|
126
|
-
let builder = ToolsConfigurationBuilder()
|
|
127
|
-
|
|
128
|
-
if chat != nil {
|
|
129
|
-
builder.chat()
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
if fileShare ?? false {
|
|
133
|
-
builder.fileshare()
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
if whiteboard ?? false {
|
|
137
|
-
builder.whiteboard(uploadEnabled: true)
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
if let screenshare = screenShare {
|
|
141
|
-
if screenshare.inApp ?? false {
|
|
142
|
-
builder.inAppScreenSharing()
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
if screenshare.wholeDevice ?? false {
|
|
146
|
-
if let configURL = Bundle.main.url(forResource: "KaleyraVideoConfig", withExtension: "plist") {
|
|
147
|
-
let reader = BroadcastConfigurationPlistReader()
|
|
148
|
-
if let broadcastConfig = try? reader.read(fileURL: configURL) {
|
|
149
|
-
builder.broadcastScreenSharing(appGroupIdentifier: broadcastConfig.appGroupID,
|
|
150
|
-
broadcastExtensionBundleIdentifier: broadcastConfig.extensionBundleID)
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
return builder
|
|
157
|
-
}
|
|
158
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
// Copyright © 2018-2023 Kaleyra S.p.a. All Rights Reserved.
|
|
2
|
-
// See LICENSE for licensing information
|
|
3
|
-
|
|
4
|
-
import Foundation
|
|
5
|
-
import Bandyer
|
|
6
|
-
|
|
7
|
-
@available(iOS 12.0, *)
|
|
8
|
-
extension RecordingType {
|
|
9
|
-
|
|
10
|
-
var callRecordingType: Bandyer.CallRecordingType {
|
|
11
|
-
switch self {
|
|
12
|
-
case .automatic:
|
|
13
|
-
return .automatic
|
|
14
|
-
case .manual:
|
|
15
|
-
return .manual
|
|
16
|
-
case .none:
|
|
17
|
-
return .none
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
@available(iOS 12.0, *)
|
|
23
|
-
extension Optional where Wrapped == RecordingType {
|
|
24
|
-
|
|
25
|
-
var callRecordingType: Bandyer.CallRecordingType {
|
|
26
|
-
switch self {
|
|
27
|
-
case nil:
|
|
28
|
-
return .none
|
|
29
|
-
case .some(let wrapped):
|
|
30
|
-
return wrapped.callRecordingType
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|