omikit-plugin 3.2.73 → 3.2.74

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 CHANGED
@@ -1089,7 +1089,7 @@ const result = await startCallWithUuid({
1089
1089
  import { omiEmitter } from 'omikit-plugin';
1090
1090
 
1091
1091
  /*
1092
- ❌ ❌ With TypeScript, in android, it seems our omiEmitter is not working properly. Please use the following manual declaration, to ensure performance
1092
+ ❌ ❌ With TypeScript, in Android, it seems our omiEmitter is not working properly. Please use the following manual declaration, to ensure performance
1093
1093
  */
1094
1094
 
1095
1095
  // 📌 For TypeScript, Android
@@ -384,41 +384,37 @@ class CallManager {
384
384
 
385
385
 
386
386
  /// Start call
387
- func startCall(_ phoneNumber: String, isVideo: Bool, completion: @escaping (_ : String) -> Void) {
388
- let secondsSinceCurrentTime = lastTimeCall.timeIntervalSinceNow
389
- guestPhone = phoneNumber
390
- var completionCalled = false // 🔥 Biến kiểm soát callback đã gọi chưa
387
+ func startCall(_ phoneNumber: String, isVideo: Bool, completion: @escaping (_: String) -> Void) {
388
+ let secondsSinceCurrentTime = lastTimeCall.timeIntervalSinceNow
389
+ guestPhone = phoneNumber
390
+ var isCompletionCalled = false // Biến kiểm soát callback để tránh gọi nhiều lần
391
391
 
392
- OmiClient.startCall(phoneNumber, isVideo: isVideo) { status in
393
- DispatchQueue.main.async {
394
- guard let callCurrent = self.omiLib.getCurrentCall() else {
395
- if !completionCalled {
396
- completion("{\"status\": \"6\", \"message\": \"REGISTER_ACCOUNT_FAIL\"}")
397
- completionCalled = true
398
- }
399
- return
400
- }
392
+ OmiClient.startCall(phoneNumber, isVideo: isVideo) { status in
393
+ DispatchQueue.main.async {
394
+ if isCompletionCalled { return } // ✅ Nếu callback đã gọi trước đó thì không thực hiện tiếp
401
395
 
402
- let dataToSend: [String: Any] = [
403
- "status": status.rawValue,
404
- "_id": String(describing: OmiCallModel(omiCall: callCurrent).uuid),
405
- "message": OmiUtils.messageCall(type: status.rawValue)
406
- ]
396
+ var dataToSend: [String: Any] = [
397
+ "status": status.rawValue,
398
+ "_id": "",
399
+ "message": OmiUtils.messageCall(type: status.rawValue)
400
+ ]
407
401
 
408
- if let jsonString = OmiUtils.convertDictionaryToJson(dictionary: dataToSend) {
409
- if !completionCalled {
410
- completion(jsonString)
411
- completionCalled = true
412
- }
413
- } else {
414
- if !completionCalled {
415
- completion("{\"status\": \"error\", \"message\": \"JSON conversion failed\"}")
416
- completionCalled = true
417
- }
418
- }
419
- }
420
- }
421
- }
402
+ // Kiểm tra lấy ID cuộc gọi nếu có
403
+ if let callCurrent = self.omiLib.getCurrentCall() {
404
+ dataToSend["_id"] = String(describing: OmiCallModel(omiCall: callCurrent).uuid)
405
+ }
406
+
407
+ // Chuyển đổi Dictionary sang JSON
408
+ if let jsonString = OmiUtils.convertDictionaryToJson(dictionary: dataToSend) {
409
+ completion(jsonString)
410
+ } else {
411
+ completion("{\"status\": \"error\", \"message\": \"JSON conversion failed\"}")
412
+ }
413
+
414
+ isCompletionCalled = true // ✅ Đánh dấu callback đã được gọi
415
+ }
416
+ }
417
+ }
422
418
 
423
419
 
424
420
  /// Start call
@@ -31,7 +31,7 @@ Pod::Spec.new do |s|
31
31
 
32
32
  # Thêm dependency bắt buộc
33
33
  s.dependency "React-Core"
34
- s.dependency "OmiKit", "1.8.9"
34
+ s.dependency "OmiKit", "1.8.10"
35
35
 
36
36
  # Đảm bảo Swift bridging header được tự động tạo
37
37
  # s.requires_arc = true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omikit-plugin",
3
- "version": "3.2.73",
3
+ "version": "3.2.74",
4
4
  "description": "Omikit Plugin by ViHAT",
5
5
  "main": "src/commonjs/index",
6
6
  "module": "lib/module/index",