@cometchat/calls-sdk-react-native 4.4.2-beta.1 → 5.0.0-beta.2

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 (93) hide show
  1. package/README.md +85 -19
  2. package/android/.gradle/8.9/checksums/checksums.lock +0 -0
  3. package/android/.gradle/8.9/dependencies-accessors/gc.properties +0 -0
  4. package/android/.gradle/8.9/fileChanges/last-build.bin +0 -0
  5. package/android/.gradle/8.9/fileHashes/fileHashes.lock +0 -0
  6. package/android/.gradle/8.9/gc.properties +0 -0
  7. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  8. package/android/.gradle/buildOutputCleanup/cache.properties +2 -0
  9. package/android/.gradle/vcs-1/gc.properties +0 -0
  10. package/android/build.gradle +13 -12
  11. package/android/src/main/AndroidManifest.xml +15 -6
  12. package/android/src/main/java/com/callingv5/AudioDeviceHandlerConnectionService.java +185 -0
  13. package/android/src/main/java/com/callingv5/AudioDeviceHandlerGeneric.java +254 -0
  14. package/android/src/main/java/com/{CometChatCalls → callingv5}/AudioModeModule.java +93 -56
  15. package/android/src/main/java/com/callingv5/ConnectionService.java +451 -0
  16. package/android/src/main/java/com/callingv5/KeepAwakeModule.java +53 -0
  17. package/android/src/main/java/com/callingv5/MyAppPackage.java +35 -0
  18. package/android/src/main/java/com/callingv5/RNConnectionService.java +244 -0
  19. package/android/src/main/java/com/callingv5/ToastModule.java +29 -0
  20. package/android/src/main/java/com/callingv5/utils/CometChatLogger.java +88 -0
  21. package/cometchat-calls-sdk-react-native.podspec +9 -10
  22. package/dist/index.d.mts +4066 -0
  23. package/dist/index.d.ts +4066 -9
  24. package/dist/index.js +11116 -132
  25. package/dist/index.js.map +1 -0
  26. package/dist/index.mjs +11085 -0
  27. package/dist/index.mjs.map +1 -0
  28. package/dist/polyfills/RTCPeerConnection.js +19 -0
  29. package/dist/polyfills/Storage.js +192 -0
  30. package/dist/polyfills/browser.js +337 -0
  31. package/dist/polyfills/index.js +1 -0
  32. package/dist/polyfills/ipv6utils.js +197 -0
  33. package/dist/polyfills/webrtc.js +11 -0
  34. package/ios/{JitsiAudioSession+Private.h → Audio/CometChatAudioSession+Private.h} +2 -3
  35. package/ios/{LogUtils.h → Audio/CometChatAudioSession.h} +9 -6
  36. package/ios/{JitsiAudioSession.m → Audio/CometChatAudioSession.m} +4 -3
  37. package/ios/{AudioMode.m → Modules/AudioMode.m} +15 -49
  38. package/ios/Modules/KeepAwake.h +4 -0
  39. package/ios/Modules/KeepAwake.m +29 -0
  40. package/package.json +24 -110
  41. package/LICENSE.md +0 -3
  42. package/android/src/main/java/com/CometChatCalls/AudioDeviceHandlerGeneric.java +0 -213
  43. package/android/src/main/java/com/CometChatCalls/AudioDeviceHandlerLegacy.java +0 -213
  44. package/android/src/main/java/com/CometChatCalls/BluetoothHeadsetMonitor.java +0 -187
  45. package/android/src/main/java/com/CometChatCalls/CallNotificationService.java +0 -93
  46. package/android/src/main/java/com/CometChatCalls/CallNotificationServiceModule.java +0 -48
  47. package/android/src/main/java/com/CometChatCalls/CometChatCallsPackage.java +0 -56
  48. package/android/src/main/java/com/CometChatCalls/CometChatCommonModule.java +0 -48
  49. package/android/src/main/java/com/CometChatCalls/PictureInPictureModule.java +0 -133
  50. package/android/src/main/res/drawable-mdpi/callingcomponent_icons_headphones_pluged.png +0 -0
  51. package/dist/CometChatErrorConstants.d.ts +0 -124
  52. package/dist/Constants.d.ts +0 -724
  53. package/dist/Helper copy.d.ts +0 -1
  54. package/dist/Helper.d.ts +0 -7
  55. package/dist/api/APIHandler.d.ts +0 -42
  56. package/dist/api/endpoints.d.ts +0 -7
  57. package/dist/api/helper.d.ts +0 -69
  58. package/dist/api/index.d.ts +0 -2
  59. package/dist/constants/CallConstants.d.ts +0 -136
  60. package/dist/constants/index.d.ts +0 -1
  61. package/dist/defaultCallsettings.d.ts +0 -2
  62. package/dist/models/CallAppSettings.d.ts +0 -42
  63. package/dist/models/CallGroup.d.ts +0 -14
  64. package/dist/models/CallLog.d.ts +0 -276
  65. package/dist/models/CallLogFilterParams.d.ts +0 -97
  66. package/dist/models/CallSettings.d.ts +0 -330
  67. package/dist/models/CallUser.d.ts +0 -14
  68. package/dist/models/CometChatCallLogs.d.ts +0 -193
  69. package/dist/models/CometChatCalls.d.ts +0 -110
  70. package/dist/models/CometChatCallsComponent.d.ts +0 -13
  71. package/dist/models/CometChatCallsComponentCore.d.ts +0 -18
  72. package/dist/models/CometChatCallsException.d.ts +0 -7
  73. package/dist/models/CometChatPresenterComponent.d.ts +0 -13
  74. package/dist/models/ErrorModel.d.ts +0 -11
  75. package/dist/models/Listner.d.ts +0 -69
  76. package/dist/models/ListnerHandler.d.ts +0 -10
  77. package/dist/models/MessageComponent.d.ts +0 -7
  78. package/dist/models/Participant.d.ts +0 -184
  79. package/dist/models/PresenterSettings.d.ts +0 -208
  80. package/dist/models/RTCUser.d.ts +0 -18
  81. package/dist/models/Recording.d.ts +0 -86
  82. package/dist/models/index.d.ts +0 -9
  83. package/dist/types/ICallAppSettings.d.ts +0 -6
  84. package/dist/types/ICallSettings.d.ts +0 -61
  85. package/dist/types/RTCUser.d.ts +0 -6
  86. package/dist/types/callEvents.d.ts +0 -54
  87. package/dist/types/common.d.ts +0 -18
  88. package/dist/types/index.d.ts +0 -2
  89. package/ios/AudioMode.h +0 -11
  90. package/ios/CometChatCommonModule.h +0 -6
  91. package/ios/CometChatCommonModule.m +0 -29
  92. package/ios/JitsiAudioSession.h +0 -17
  93. package/ios/react-native-calls2.xcodeproj/project.pbxproj +0 -269
@@ -0,0 +1,244 @@
1
+ package com.cometchat.calls;
2
+
3
+ import android.annotation.SuppressLint;
4
+ import android.content.Context;
5
+ import android.net.Uri;
6
+ import android.os.Build;
7
+ import android.os.Bundle;
8
+ import android.telecom.DisconnectCause;
9
+ import android.telecom.PhoneAccount;
10
+ import android.telecom.PhoneAccountHandle;
11
+ import android.telecom.TelecomManager;
12
+ import android.telecom.VideoProfile;
13
+
14
+ import androidx.annotation.Nullable;
15
+ import androidx.annotation.RequiresApi;
16
+
17
+ import com.facebook.react.bridge.Promise;
18
+ import com.facebook.react.bridge.ReactApplicationContext;
19
+ import com.facebook.react.bridge.ReactContext;
20
+ import com.facebook.react.bridge.ReactContextBaseJavaModule;
21
+ import com.facebook.react.bridge.ReactMethod;
22
+ import com.facebook.react.bridge.ReadableMap;
23
+ import com.facebook.react.module.annotations.ReactModule;
24
+ import com.facebook.react.modules.core.DeviceEventManagerModule;
25
+
26
+ /**
27
+ * The react-native side of Jitsi Meet's {@link ConnectionService}. Exposes
28
+ * the Java Script API.
29
+ *
30
+ * @author Pawel Domas
31
+ */
32
+ @RequiresApi(api = Build.VERSION_CODES.O)
33
+ @ReactModule(name = RNConnectionService.NAME)
34
+ class RNConnectionService extends ReactContextBaseJavaModule {
35
+
36
+ public static final String NAME = "ConnectionService";
37
+
38
+ private static final String TAG = ConnectionService.TAG;
39
+
40
+ private static RNConnectionService sRNConnectionServiceInstance;
41
+ /**
42
+ * Handler for dealing with call state changes. We are acting as a proxy between ConnectionService
43
+ * and other modules such as {@link AudioModeModule}.
44
+ */
45
+ private CallAudioStateListener callAudioStateListener;
46
+
47
+ /**
48
+ * Sets the audio route on all existing {@link android.telecom.Connection}s
49
+ *
50
+ * @param audioRoute the new audio route to be set. See
51
+ * {@link android.telecom.CallAudioState} constants prefixed with "ROUTE_".
52
+ */
53
+ @RequiresApi(api = Build.VERSION_CODES.O)
54
+ static void setAudioRoute(int audioRoute) {
55
+ for (ConnectionService.ConnectionImpl c
56
+ : ConnectionService.getConnections()) {
57
+ c.setAudioRoute(audioRoute);
58
+ }
59
+ }
60
+
61
+ RNConnectionService(ReactApplicationContext reactContext) {
62
+ super(reactContext);
63
+ sRNConnectionServiceInstance = this;
64
+ }
65
+
66
+ static RNConnectionService getInstance() {
67
+ return sRNConnectionServiceInstance;
68
+ }
69
+
70
+ @ReactMethod
71
+ public void addListener(String eventName) {
72
+ // Keep: Required for RN built in Event Emitter Calls.
73
+ }
74
+
75
+ @ReactMethod
76
+ public void removeListeners(Integer count) {
77
+ // Keep: Required for RN built in Event Emitter Calls.
78
+ }
79
+
80
+ /**
81
+ * Starts a new outgoing call.
82
+ *
83
+ * @param callUUID - unique call identifier assigned by Jitsi Meet to
84
+ * a conference call.
85
+ * @param handle - a call handle which by default is Jitsi Meet room's URL.
86
+ * @param hasVideo - whether or not user starts with the video turned on.
87
+ * @param promise - the Promise instance passed by the React-native bridge,
88
+ * so that this method returns a Promise on the JS side.
89
+ *
90
+ * NOTE regarding the "missingPermission" suppress - SecurityException will
91
+ * be handled as part of the Exception try catch block and the Promise will
92
+ * be rejected.
93
+ */
94
+ @SuppressLint("MissingPermission")
95
+ @ReactMethod
96
+ public void startCall(
97
+ String callUUID,
98
+ String handle,
99
+ boolean hasVideo,
100
+ Promise promise) {
101
+
102
+ ReactApplicationContext ctx = getReactApplicationContext();
103
+
104
+ Uri address = Uri.fromParts(PhoneAccount.SCHEME_SIP, handle, null);
105
+ PhoneAccountHandle accountHandle;
106
+
107
+ try {
108
+ accountHandle
109
+ = ConnectionService.registerPhoneAccount(getReactApplicationContext(), address, callUUID);
110
+ } catch (Throwable tr) {
111
+ promise.reject(tr);
112
+ return;
113
+ }
114
+
115
+ Bundle extras = new Bundle();
116
+ extras.putParcelable(
117
+ TelecomManager.EXTRA_PHONE_ACCOUNT_HANDLE,
118
+ accountHandle);
119
+ extras.putInt(
120
+ TelecomManager.EXTRA_START_CALL_WITH_VIDEO_STATE,
121
+ hasVideo
122
+ ? VideoProfile.STATE_BIDIRECTIONAL
123
+ : VideoProfile.STATE_AUDIO_ONLY);
124
+
125
+ ConnectionService.registerStartCallPromise(callUUID, promise);
126
+
127
+ TelecomManager tm = null;
128
+
129
+ try {
130
+ tm = (TelecomManager) ctx.getSystemService(Context.TELECOM_SERVICE);
131
+ tm.placeCall(address, extras);
132
+ } catch (Throwable tr) {
133
+ if (tm != null) {
134
+ try {
135
+ tm.unregisterPhoneAccount(accountHandle);
136
+ } catch (Throwable tr1) {
137
+ // UnsupportedOperationException: System does not support feature android.software.connectionservice
138
+ // was observed here. Ignore.
139
+ }
140
+ }
141
+ ConnectionService.unregisterStartCallPromise(callUUID);
142
+ promise.reject(tr);
143
+ }
144
+ }
145
+
146
+ /**
147
+ * Called by the JS side of things to mark the call as failed.
148
+ *
149
+ * @param callUUID - the call's UUID.
150
+ */
151
+ @ReactMethod
152
+ public void reportCallFailed(String callUUID) {
153
+ ConnectionService.setConnectionDisconnected(
154
+ callUUID,
155
+ new DisconnectCause(DisconnectCause.ERROR));
156
+ }
157
+
158
+ /**
159
+ * Called by the JS side of things to mark the call as disconnected.
160
+ *
161
+ * @param callUUID - the call's UUID.
162
+ */
163
+ @ReactMethod
164
+ public void endCall(String callUUID) {
165
+ ConnectionService.setConnectionDisconnected(
166
+ callUUID,
167
+ new DisconnectCause(DisconnectCause.LOCAL));
168
+ }
169
+
170
+ /**
171
+ * Called by the JS side of things to mark the call as active.
172
+ *
173
+ * @param callUUID - the call's UUID.
174
+ */
175
+ @ReactMethod
176
+ public void reportConnectedOutgoingCall(String callUUID, Promise promise) {
177
+ if (ConnectionService.setConnectionActive(callUUID)) {
178
+ promise.resolve(null);
179
+ } else {
180
+ promise.reject("CONNECTION_NOT_FOUND_ERROR", "Connection wasn't found.");
181
+ }
182
+ }
183
+
184
+ @Override
185
+ public String getName() {
186
+ return NAME;
187
+ }
188
+
189
+ /**
190
+ * Called by the JS side to update the call's state.
191
+ *
192
+ * @param callUUID - the call's UUID.
193
+ * @param callState - the map which carries info about the current call's
194
+ * state. See static fields in {@link ConnectionService.ConnectionImpl}
195
+ * prefixed with "KEY_" for the values supported by the Android
196
+ * implementation.
197
+ */
198
+ @ReactMethod
199
+ public void updateCall(String callUUID, ReadableMap callState) {
200
+ ConnectionService.updateCall(callUUID, callState);
201
+ }
202
+
203
+ public CallAudioStateListener getCallAudioStateListener() {
204
+ return callAudioStateListener;
205
+ }
206
+
207
+ public void setCallAudioStateListener(CallAudioStateListener callAudioStateListener) {
208
+ this.callAudioStateListener = callAudioStateListener;
209
+ }
210
+
211
+ /**
212
+ * Handler for call state changes. {@code ConnectionServiceImpl} will call this handler when the
213
+ * call audio state changes.
214
+ *
215
+ * @param callAudioState The current call's audio state.
216
+ */
217
+ void onCallAudioStateChange(android.telecom.CallAudioState callAudioState) {
218
+ if (callAudioStateListener != null) {
219
+ callAudioStateListener.onCallAudioStateChange(callAudioState);
220
+ }
221
+ }
222
+
223
+ interface CallAudioStateListener {
224
+ void onCallAudioStateChange(android.telecom.CallAudioState callAudioState);
225
+ }
226
+
227
+ /**
228
+ * Helper function to send an event to JavaScript.
229
+ *
230
+ * @param eventName {@code String} containing the event name.
231
+ * @param data {@code Object} optional ancillary data for the event.
232
+ */
233
+ void emitEvent(
234
+ String eventName,
235
+ @Nullable Object data) {
236
+ ReactContext reactContext = getReactApplicationContext();
237
+
238
+ if (reactContext != null) {
239
+ reactContext
240
+ .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
241
+ .emit(eventName, data);
242
+ }
243
+ }
244
+ }
@@ -0,0 +1,29 @@
1
+ package com.cometchat.calls;
2
+
3
+ import android.widget.Toast;
4
+ import androidx.annotation.NonNull;
5
+
6
+ import com.facebook.react.bridge.ReactApplicationContext;
7
+ import com.facebook.react.bridge.ReactContextBaseJavaModule;
8
+ import com.facebook.react.bridge.ReactMethod;
9
+
10
+ public class ToastModule extends ReactContextBaseJavaModule {
11
+
12
+ private final ReactApplicationContext reactContext;
13
+
14
+ public ToastModule(ReactApplicationContext reactContext) {
15
+ super(reactContext);
16
+ this.reactContext = reactContext;
17
+ }
18
+
19
+ @NonNull
20
+ @Override
21
+ public String getName() {
22
+ return "ToastModule";
23
+ }
24
+
25
+ @ReactMethod
26
+ public void showToast(String message) {
27
+ Toast.makeText(reactContext, message, Toast.LENGTH_SHORT).show();
28
+ }
29
+ }
@@ -0,0 +1,88 @@
1
+ package com.cometchat.calls.utils;
2
+
3
+ import android.util.Log;
4
+
5
+ /**
6
+ * Logging utility for CometChat calls module.
7
+ */
8
+ public class CometChatLogger {
9
+ // Log level constants
10
+ public static final int VERBOSE = Log.VERBOSE;
11
+ public static final int DEBUG = Log.DEBUG;
12
+ public static final int INFO = Log.INFO;
13
+ public static final int WARN = Log.WARN;
14
+ public static final int ERROR = Log.ERROR;
15
+
16
+ // Default log level
17
+ private static int logLevel = INFO;
18
+
19
+ /**
20
+ * Set the global logging level for CometChat logger
21
+ * @param level Log level to use (use constants from this class)
22
+ */
23
+ public static void setLogLevel(int level) {
24
+ logLevel = level;
25
+ }
26
+
27
+ /**
28
+ * Log a debug message
29
+ * @param tag Log tag
30
+ * @param message Message to log
31
+ */
32
+ public static void d(String tag, String message) {
33
+ if (logLevel <= DEBUG) {
34
+ Log.d(tag, message);
35
+ }
36
+ }
37
+
38
+ /**
39
+ * Log an info message
40
+ * @param tag Log tag
41
+ * @param message Message to log
42
+ */
43
+ public static void i(String tag, String message) {
44
+ if (logLevel <= INFO) {
45
+ Log.i(tag, message);
46
+ }
47
+ }
48
+
49
+ /**
50
+ * Log a warning message
51
+ * @param tag Log tag
52
+ * @param message Message to log
53
+ */
54
+ public static void w(String tag, String message) {
55
+ if (logLevel <= WARN) {
56
+ Log.w(tag, message);
57
+ }
58
+ }
59
+
60
+ /**
61
+ * Log an error message
62
+ * @param tag Log tag
63
+ * @param message Message to log
64
+ */
65
+ public static void e(String tag, String message) {
66
+ if (logLevel <= ERROR) {
67
+ Log.e(tag, message);
68
+ }
69
+ }
70
+
71
+ /**
72
+ * Log an error message with an exception
73
+ * @param throwable Exception to log
74
+ * @param tag Log tag
75
+ * @param message Message to log
76
+ */
77
+ public static void e(Throwable throwable, String tag, String message) {
78
+ if (logLevel <= ERROR) {
79
+ Log.e(tag, message, throwable);
80
+ }
81
+ }
82
+
83
+ public static void v(String tag, String message) {
84
+ if (logLevel <= VERBOSE) {
85
+ Log.v(tag, message);
86
+ }
87
+ }
88
+ }
@@ -1,21 +1,20 @@
1
- require "json"
1
+ require 'json'
2
2
 
3
- package = JSON.parse(File.read(File.join(__dir__, "package.json")))
3
+ package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
4
4
 
5
5
  Pod::Spec.new do |s|
6
- s.name = "cometchat-calls-sdk-react-native"
6
+ s.name = 'cometchat-calls-sdk-react-native'
7
7
  s.version = package["version"]
8
8
  s.summary = package["description"]
9
9
  s.homepage = package["homepage"]
10
10
  s.license = package["license"]
11
11
  s.authors = package["author"]
12
+ s.platforms = { :ios => '13.0' }
13
+ s.source = { :git => 'https://github.com/cometchat/calls-sdk-react-native.git', :tag => s.version }
12
14
 
13
- s.platforms = { :ios => "10.0" }
14
- s.source = { :git => "https://github.com/cometchat-team/cometchat-pro-call-react-native", :tag => "#{s.version}" }
15
+ s.source_files = 'ios/**/*.{h,m}'
15
16
 
16
- s.source_files = "ios/**/*.{h,m,mm}"
17
-
18
- s.dependency "React-Core"
19
-
20
- s.dependency "react-native-webrtc"
17
+ s.dependency 'React-Core'
18
+ s.dependency 'react-native-webrtc'
19
+ s.frameworks = 'AVFoundation', 'UIKit'
21
20
  end