omikit-plugin 3.2.72 → 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 +1 -1
- package/ios/CallProcess/CallManager.swift +28 -32
- package/omikit-plugin.podspec +1 -1
- package/package.json +1 -1
- package/src/types/index.d.ts +1 -19
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
|
|
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
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
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
|
-
|
|
393
|
-
|
|
394
|
-
|
|
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
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
396
|
+
var dataToSend: [String: Any] = [
|
|
397
|
+
"status": status.rawValue,
|
|
398
|
+
"_id": "",
|
|
399
|
+
"message": OmiUtils.messageCall(type: status.rawValue)
|
|
400
|
+
]
|
|
407
401
|
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
402
|
+
// ✅ Kiểm tra và 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
|
package/omikit-plugin.podspec
CHANGED
package/package.json
CHANGED
package/src/types/index.d.ts
CHANGED
|
@@ -56,24 +56,6 @@ declare module 'omikit-plugin' {
|
|
|
56
56
|
|
|
57
57
|
|
|
58
58
|
|
|
59
|
-
|
|
60
|
-
// export const omiEmitter: NativeEventEmitter;
|
|
61
|
-
|
|
62
|
-
// ✅ Định nghĩa lại `addListener`, `removeListener`, `removeAllListeners`
|
|
63
|
-
export interface OmiEmitterInterface extends NativeEventEmitter {
|
|
64
|
-
addListener(
|
|
65
|
-
eventType: string,
|
|
66
|
-
listener: (event: any) => void
|
|
67
|
-
): void;
|
|
68
|
-
|
|
69
|
-
removeListener(
|
|
70
|
-
eventType: string,
|
|
71
|
-
listener: (event: any) => void
|
|
72
|
-
): void;
|
|
73
|
-
|
|
74
|
-
removeAllListeners(eventType?: string): void;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
export const omiEmitter: OmiEmitterInterface;
|
|
59
|
+
export const omiEmitter: NativeEventEmitter;
|
|
78
60
|
}
|
|
79
61
|
|