edoctor-sendbird-calls 1.0.1-beta.1 → 1.0.1-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.
@@ -47,9 +47,9 @@ class RNSendBirdCalls: RCTEventEmitter, SendBirdCallDelegate, DirectCallDelegate
47
47
  let appId = "0BEF9C57-BA3B-474E-A40F-62B027AA47F6"
48
48
 
49
49
  let config = SendBirdCall.configure(appId: appId)
50
- if(config){
50
+ if (config != nil) {
51
51
  print(TAG + "CONFIG SUCCESS")
52
- }else {
52
+ } else {
53
53
  print(TAG + "CONFIG FAILED")
54
54
  }
55
55
  SendBirdCall.addDelegate(self, identifier: "RNSendBirdCalls")
@@ -130,6 +130,8 @@ class RNSendBirdCalls: RCTEventEmitter, SendBirdCallDelegate, DirectCallDelegate
130
130
  return
131
131
  }
132
132
 
133
+ print(TAG + "AUTHENTICATE SUCCESS" + user.userId)
134
+
133
135
  resolve(["succeeded": true ,"userId": user.userId, "nickname": user.nickname ?? ""])
134
136
  }
135
137
  }
@@ -137,9 +139,9 @@ class RNSendBirdCalls: RCTEventEmitter, SendBirdCallDelegate, DirectCallDelegate
137
139
  @objc func deAuthenticate(_ resolve: @escaping RCTPromiseResolveBlock, rejecter reject: @escaping RCTPromiseRejectBlock) -> Void {
138
140
  SendBirdCall.unregisterAllVoIPPushTokens { error in
139
141
  guard error == nil else {
140
- print("RNSendBirdCalls" + "Cerror deauthen")
142
+ print(TAG + "error deauthen")
141
143
  let message = error?.localizedDescription ?? "Có lỗi xảy ra"
142
- print("RNSendBirdCalls" + message)
144
+ print(TAG + message)
143
145
  return
144
146
  }
145
147
  }
@@ -151,15 +153,16 @@ class RNSendBirdCalls: RCTEventEmitter, SendBirdCallDelegate, DirectCallDelegate
151
153
  return
152
154
  }
153
155
 
156
+ print(TAG + "DEAUTHENTICATE SUCCESS")
154
157
  resolve(["succeeded": true ])
155
158
  }
156
159
  }
157
160
 
158
161
  @objc func initSendBird(_ appId: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) -> Void {
159
162
  let config = SendBirdCall.configure(appId: appId)
160
- if(config){
163
+ if (config != nil) {
161
164
  resolve(["succeeded": true ])
162
- }else {
165
+ } else {
163
166
  resolve(["succeeded": false ])
164
167
  }
165
168
  }
@@ -181,6 +184,7 @@ class RNSendBirdCalls: RCTEventEmitter, SendBirdCallDelegate, DirectCallDelegate
181
184
  return
182
185
  }
183
186
 
187
+ print(TAG + "DIAL SUCCESS")
184
188
  resolve(["succeeded": true ,"callId": call.callId, "caller": call.caller?.userId ?? "", "callee": call.callee?.userId ?? ""])
185
189
  }
186
190
  CALL_ACTIVE = directCall;
@@ -197,6 +201,7 @@ class RNSendBirdCalls: RCTEventEmitter, SendBirdCallDelegate, DirectCallDelegate
197
201
  CXCallManager.shared.endCXCall(call)
198
202
  let params = getParamFromDirectCall(call: call)
199
203
  params.setValue(true, forKey: "succeeded")
204
+ print(TAG + "END CALL SUCCESS")
200
205
  resolve(params)
201
206
  }
202
207
 
@@ -211,6 +216,7 @@ class RNSendBirdCalls: RCTEventEmitter, SendBirdCallDelegate, DirectCallDelegate
211
216
  call.accept(with: acceptParams)
212
217
  let params = getParamFromDirectCall(call: call)
213
218
  params.setValue(true, forKey: "succeeded")
219
+ print(TAG + "ACCEPT CALL SUCCESS")
214
220
  resolve(params)
215
221
  }
216
222
 
@@ -245,54 +251,55 @@ class RNSendBirdCalls: RCTEventEmitter, SendBirdCallDelegate, DirectCallDelegate
245
251
  resultData.append(getParamFromDirectCall(call: directCall))
246
252
  })
247
253
  }
254
+ print(TAG + "getOngoingCalls SUCCESS")
248
255
  resolve(resultData)
249
256
  }
250
257
 
251
258
  @objc func muteMicrophone(_ resolve: @escaping RCTPromiseResolveBlock, rejecter reject: @escaping RCTPromiseRejectBlock) {
252
259
  print(TAG + "muteMicrophone")
253
- if(CALL_ACTIVE != nil){
260
+ if (CALL_ACTIVE != nil) {
254
261
  CALL_ACTIVE?.muteMicrophone()
255
262
  resolve(["succeeded": true])
256
- }else {
263
+ } else {
257
264
  resolve(["succeeded": false , "errorMessage": "Cuộc gọi không tồn tại"])
258
265
  }
259
266
  }
260
267
 
261
268
  @objc func unmuteMicrophone(_ resolve: @escaping RCTPromiseResolveBlock, rejecter reject: @escaping RCTPromiseRejectBlock) {
262
269
  print(TAG + "unmuteMicrophone")
263
- if(CALL_ACTIVE != nil){
270
+ if (CALL_ACTIVE != nil) {
264
271
  CALL_ACTIVE?.unmuteMicrophone()
265
272
  resolve(["succeeded": true])
266
- }else {
273
+ } else {
267
274
  resolve(["succeeded": false , "errorMessage": "Cuộc gọi không tồn tại"])
268
275
  }
269
276
  }
270
277
 
271
278
  @objc func startVideo(_ resolve: @escaping RCTPromiseResolveBlock, rejecter reject: @escaping RCTPromiseRejectBlock) {
272
279
  print(TAG + "startVideo")
273
- if(CALL_ACTIVE != nil){
280
+ if (CALL_ACTIVE != nil) {
274
281
  CALL_ACTIVE?.startVideo()
275
282
  resolve(["succeeded": true])
276
- }else {
283
+ } else {
277
284
  resolve(["succeeded": false , "errorMessage": "Cuộc gọi không tồn tại"])
278
285
  }
279
286
  }
280
287
 
281
288
  @objc func stopVideo(_ resolve: @escaping RCTPromiseResolveBlock, rejecter reject: @escaping RCTPromiseRejectBlock) {
282
289
  print(TAG + "stopVideo")
283
- if(CALL_ACTIVE != nil){
290
+ if (CALL_ACTIVE != nil) {
284
291
  CALL_ACTIVE?.stopVideo()
285
292
  resolve(["succeeded": true])
286
- }else {
293
+ } else {
287
294
  resolve(["succeeded": false , "errorMessage": "Cuộc gọi không tồn tại"])
288
295
  }
289
296
  }
290
297
 
291
298
  @objc func switchCamera(_ resolve: @escaping RCTPromiseResolveBlock, rejecter reject: @escaping RCTPromiseRejectBlock) {
292
299
  print(TAG + "switchCamera")
293
- if(CALL_ACTIVE != nil){
300
+ if (CALL_ACTIVE != nil) {
294
301
  CALL_ACTIVE?.switchCamera { error in
295
- if(error != nil){
302
+ if (error != nil) {
296
303
  let code = "\(error?.errorCode.rawValue ?? 0)"
297
304
  let message = error?.localizedDescription ?? "Có lỗi xảy ra"
298
305
  resolve(["succeeded": false , "errorCode": code, "errorMessage": message])
@@ -313,9 +320,9 @@ class RNSendBirdCalls: RCTEventEmitter, SendBirdCallDelegate, DirectCallDelegate
313
320
 
314
321
  let options = isRemote ? RecordingOptions(recordingType: .localAudioRemoteAudioAndVideo, directoryPath: documentsDirectory, fileName: fileName) : RecordingOptions(recordingType: .localAudioAndVideoRemoteAudio, directoryPath: documentsDirectory, fileName: fileName)
315
322
 
316
- if(CALL_ACTIVE != nil){
323
+ if (CALL_ACTIVE != nil) {
317
324
  CALL_ACTIVE?.startRecording(options: options) { (recordingId, error) in
318
- if(error == nil){
325
+ if (error == nil) {
319
326
  let result: NSDictionary = [
320
327
  "succeeded": true,
321
328
  "recordingId": recordingId ?? "",
@@ -340,7 +347,7 @@ class RNSendBirdCalls: RCTEventEmitter, SendBirdCallDelegate, DirectCallDelegate
340
347
 
341
348
  @objc func stopRecording(_ recordingId: String, isVideoCall: Bool, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock){
342
349
  print(TAG + "stopRecording")
343
- if(CALL_ACTIVE != nil){
350
+ if (CALL_ACTIVE != nil) {
344
351
  let resultStop: Bool = ((CALL_ACTIVE?.stopRecording(recordingId: recordingId)) != nil)
345
352
  let result: NSDictionary = [
346
353
  "succeeded": resultStop,
@@ -356,7 +363,7 @@ class RNSendBirdCalls: RCTEventEmitter, SendBirdCallDelegate, DirectCallDelegate
356
363
 
357
364
  @objc func endAllCalls(_ resolve: @escaping RCTPromiseResolveBlock, rejecter reject: @escaping RCTPromiseRejectBlock) {
358
365
  let ongoingCalls = SendBirdCall.getOngoingCalls()
359
- if(ongoingCalls.count > 0){
366
+ if (ongoingCalls.count > 0) {
360
367
  ongoingCalls.forEach({ directCall in
361
368
  directCall.end()
362
369
  CXCallManager.shared.endCXCall(directCall)
@@ -367,7 +374,7 @@ class RNSendBirdCalls: RCTEventEmitter, SendBirdCallDelegate, DirectCallDelegate
367
374
 
368
375
  func endCalls() {
369
376
  let ongoingCalls = SendBirdCall.getOngoingCalls()
370
- if(ongoingCalls.count > 0){
377
+ if (ongoingCalls.count > 0) {
371
378
  ongoingCalls.forEach({ directCall in
372
379
  directCall.end()
373
380
  CXCallManager.shared.endCXCall(directCall)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "edoctor-sendbird-calls",
3
- "version": "1.0.1-beta.1",
3
+ "version": "1.0.1-beta.2",
4
4
  "description": "edoctor-sendbird-calls",
5
5
  "source": "./src/index.tsx",
6
6
  "main": "./lib/module/index.js",