omikit-plugin 3.3.8 → 3.3.10
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
|
@@ -1273,7 +1273,10 @@ useEffect(() => {
|
|
|
1273
1273
|
omiEmitter.addListener(OmiCallEvent.onClickMissedCall, clickMissedCall);
|
|
1274
1274
|
omiEmitter.addListener(OmiCallEvent.onSwitchboardAnswer, onSwitchboardAnswer);
|
|
1275
1275
|
omiEmitter.addListener(OmiCallEvent.onCallQuality, onCallQuality);
|
|
1276
|
-
|
|
1276
|
+
|
|
1277
|
+
omiEmitter.addListener(OmiCallEvent.onAudioChange, onAudioChange);
|
|
1278
|
+
|
|
1279
|
+
|
|
1277
1280
|
if(Platform.OS == "android") {
|
|
1278
1281
|
omiEmitter.addListener(OmiCallEvent.onRequestPermissionAndroid, onRequestPermission);
|
|
1279
1282
|
}
|
|
@@ -1292,7 +1295,8 @@ useEffect(() => {
|
|
|
1292
1295
|
omiEmitter.removeAllListeners(OmiCallEvent.onHold);
|
|
1293
1296
|
omiEmitter.removeAllListeners(OmiCallEvent.onSpeaker);
|
|
1294
1297
|
omiEmitter.removeAllListeners(OmiCallEvent.onSwitchboardAnswer);
|
|
1295
|
-
|
|
1298
|
+
omiEmitter.removeAllListeners(OmiCallEvent.onAudioChange);
|
|
1299
|
+
|
|
1296
1300
|
if(Platform.OS == "android") {
|
|
1297
1301
|
omiEmitter.removeAllListeners(OmiCallEvent.onRequestPermissionAndroid);
|
|
1298
1302
|
}
|
|
@@ -1386,6 +1390,12 @@ const onSwitchboardAnswer = (data: any) => {
|
|
|
1386
1390
|
const { sip } = data
|
|
1387
1391
|
// sip: String
|
|
1388
1392
|
}
|
|
1393
|
+
|
|
1394
|
+
// * onAudioChange have callback when the user switches the audio output device (headphones)
|
|
1395
|
+
const onAudioChange = (audioData: any) => {
|
|
1396
|
+
const { data } = audioData;
|
|
1397
|
+
|
|
1398
|
+
}
|
|
1389
1399
|
```
|
|
1390
1400
|
|
|
1391
1401
|
✨ Table describing `code_end_call, codeEndCall` status
|
package/android/build.gradle
CHANGED
|
@@ -122,7 +122,7 @@ dependencies {
|
|
|
122
122
|
implementation("androidx.work:work-runtime:2.8.1")
|
|
123
123
|
implementation "androidx.security:security-crypto:1.1.0-alpha06"
|
|
124
124
|
// api 'vn.vihat.omicall:omi-sdk:2.3.23'
|
|
125
|
-
api "io.omicrm.vihat:omi-sdk:2.3.
|
|
125
|
+
api "io.omicrm.vihat:omi-sdk:2.3.91"
|
|
126
126
|
|
|
127
127
|
implementation "com.facebook.react:react-native:+" // From node_modules
|
|
128
128
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
@@ -412,15 +412,8 @@ class OmikitPluginModule(reactContext: ReactApplicationContext?) :
|
|
|
412
412
|
}
|
|
413
413
|
}
|
|
414
414
|
|
|
415
|
-
// ✅ Helper function
|
|
416
|
-
|
|
417
|
-
try {
|
|
418
|
-
Log.w("OmikitPlugin", "⚠️ DEPRECATED: preventAutoUnregisterCrash() - Use Silent Registration API instead")
|
|
419
|
-
OmiClient.getInstance(reactApplicationContext!!).preventAutoUnregister(reason)
|
|
420
|
-
} catch (e: Exception) {
|
|
421
|
-
Log.e("OmikitPlugin", "❌ Failed to prevent AUTO-UNREGISTER: ${e.message}", e)
|
|
422
|
-
}
|
|
423
|
-
}
|
|
415
|
+
// ✅ Helper function removed - deprecated in new SDK version
|
|
416
|
+
// preventAutoUnregisterCrash is no longer supported
|
|
424
417
|
|
|
425
418
|
// ✅ Method để check status AUTO-UNREGISTER (DEPRECATED)
|
|
426
419
|
@ReactMethod
|
|
@@ -449,14 +442,9 @@ class OmikitPluginModule(reactContext: ReactApplicationContext?) :
|
|
|
449
442
|
// ✅ Method để manually prevent AUTO-UNREGISTER (DEPRECATED)
|
|
450
443
|
@ReactMethod
|
|
451
444
|
fun preventAutoUnregister(reason: String, promise: Promise) {
|
|
452
|
-
Log.w("OmikitPlugin", "⚠️ DEPRECATED: preventAutoUnregister() -
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
promise.resolve(true)
|
|
456
|
-
} catch (e: Exception) {
|
|
457
|
-
Log.e("OmikitPlugin", "❌ Manual prevent failed: ${e.message}", e)
|
|
458
|
-
promise.resolve(false)
|
|
459
|
-
}
|
|
445
|
+
Log.w("OmikitPlugin", "⚠️ DEPRECATED: preventAutoUnregister() - No longer supported in new SDK version")
|
|
446
|
+
// Function removed - no longer supported
|
|
447
|
+
promise.resolve(false)
|
|
460
448
|
}
|
|
461
449
|
|
|
462
450
|
// ✅ Convenience methods cho các scenario phổ biến (DEPRECATED)
|
|
@@ -723,20 +711,27 @@ class OmikitPluginModule(reactContext: ReactApplicationContext?) :
|
|
|
723
711
|
"fcmToken" to firebaseToken
|
|
724
712
|
), promise)) return@withContext
|
|
725
713
|
|
|
714
|
+
// ✅ Cleanup trước khi register
|
|
715
|
+
try {
|
|
716
|
+
OmiClient.getInstance(reactApplicationContext!!).logout()
|
|
717
|
+
delay(500) // Chờ cleanup hoàn tất
|
|
718
|
+
} catch (e: Exception) {
|
|
719
|
+
Log.w("OmikitPlugin", "⚠️ Cleanup warning (expected): ${e.message}")
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
Log.d("OmikitPlugin", "🔑 Using API key registration for user: $usrName")
|
|
723
|
+
|
|
726
724
|
loginResult = OmiClient.registerWithApiKey(
|
|
727
|
-
apiKey
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
isVideo
|
|
732
|
-
firebaseToken
|
|
733
|
-
projectId
|
|
725
|
+
apiKey ?: "",
|
|
726
|
+
usrName ?: "",
|
|
727
|
+
phone ?: "",
|
|
728
|
+
usrUuid ?: "",
|
|
729
|
+
isVideo,
|
|
730
|
+
firebaseToken
|
|
734
731
|
)
|
|
735
732
|
|
|
736
|
-
// ✅ Sử dụng API mới để ngăn chặn AUTO-UNREGISTER sau khi register thành công
|
|
737
733
|
if (loginResult) {
|
|
738
|
-
Log.d("OmikitPlugin", "
|
|
739
|
-
preventAutoUnregisterCrash("Successful API key registration - userName: $usrName")
|
|
734
|
+
Log.d("OmikitPlugin", "✅ API key registration successful")
|
|
740
735
|
promise.resolve(true)
|
|
741
736
|
} else {
|
|
742
737
|
Log.e("OmikitPlugin", "❌ API key registration failed")
|
|
@@ -855,6 +850,7 @@ class OmikitPluginModule(reactContext: ReactApplicationContext?) :
|
|
|
855
850
|
reactApplicationContext!!,
|
|
856
851
|
Manifest.permission.RECORD_AUDIO
|
|
857
852
|
)
|
|
853
|
+
val map: WritableMap = WritableNativeMap()
|
|
858
854
|
if (audio == PackageManager.PERMISSION_GRANTED) {
|
|
859
855
|
mainScope.launch {
|
|
860
856
|
var callResult: OmiStartCallStatus? = null
|
|
@@ -863,16 +859,39 @@ class OmikitPluginModule(reactContext: ReactApplicationContext?) :
|
|
|
863
859
|
val uuid = data.getString("usrUuid") as String
|
|
864
860
|
val isVideo = data.getBoolean("isVideo")
|
|
865
861
|
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
862
|
+
// Check if OmiClient instance and service are ready before making call
|
|
863
|
+
val omiClient = OmiClient.getInstance(reactApplicationContext!!)
|
|
864
|
+
if (omiClient == null) {
|
|
865
|
+
callResult = null
|
|
866
|
+
return@withContext
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
// Add small delay to ensure service is fully initialized
|
|
870
|
+
kotlinx.coroutines.delay(100)
|
|
871
|
+
|
|
872
|
+
callResult = omiClient.startCallWithUuid(uuid = uuid, isVideo = isVideo)
|
|
873
|
+
} catch (e: IllegalStateException) {
|
|
874
|
+
// Handle service not ready state
|
|
875
|
+
callResult = null
|
|
876
|
+
} catch (e: NullPointerException) {
|
|
877
|
+
// Handle null pointer exceptions
|
|
878
|
+
callResult = null
|
|
879
|
+
} catch (e: Throwable) {
|
|
880
|
+
// Handle any other exceptions
|
|
881
|
+
callResult = null
|
|
870
882
|
}
|
|
871
883
|
}
|
|
872
|
-
|
|
884
|
+
var statusCalltemp = callResult?.ordinal ?: 8
|
|
885
|
+
map.putInt("status", statusCalltemp)
|
|
886
|
+
map.putString("_id", "")
|
|
887
|
+
map.putString("message", messageCall(statusCalltemp) as String)
|
|
888
|
+
promise.resolve(map)
|
|
873
889
|
}
|
|
874
890
|
} else {
|
|
875
|
-
|
|
891
|
+
map.putInt("status", 4)
|
|
892
|
+
map.putString("_id", "")
|
|
893
|
+
map.putString("message", messageCall(406) as String)
|
|
894
|
+
promise.resolve(map)
|
|
876
895
|
}
|
|
877
896
|
}
|
|
878
897
|
|
|
@@ -1585,10 +1604,10 @@ class OmikitPluginModule(reactContext: ReactApplicationContext?) :
|
|
|
1585
1604
|
// ✅ Thêm listener cho AUTO-UNREGISTER status
|
|
1586
1605
|
private val autoUnregisterListener = object : OmiListener {
|
|
1587
1606
|
override fun onAutoUnregisterStatus(isScheduled: Boolean, timeUntilExecution: Long) {
|
|
1588
|
-
// ✅
|
|
1607
|
+
// ✅ Auto-unregister prevention removed - no longer supported in new SDK
|
|
1589
1608
|
if (isScheduled && timeUntilExecution > 0 && timeUntilExecution < 3000) {
|
|
1590
|
-
Log.w("OmikitPlugin", "🚨 AUTO-UNREGISTER sắp thực hiện trong ${timeUntilExecution}ms -
|
|
1591
|
-
preventAutoUnregisterCrash
|
|
1609
|
+
Log.w("OmikitPlugin", "🚨 AUTO-UNREGISTER sắp thực hiện trong ${timeUntilExecution}ms - SDK tự xử lý")
|
|
1610
|
+
// preventAutoUnregisterCrash deprecated - SDK handles automatically
|
|
1592
1611
|
}
|
|
1593
1612
|
|
|
1594
1613
|
// ✅ Gửi event cho React Native
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "omikit-plugin",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.10",
|
|
4
4
|
"description": "Omikit Plugin by ViHAT",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"engines": {
|
|
79
79
|
"node": ">= 16.0.0"
|
|
80
80
|
},
|
|
81
|
-
"packageManager": "
|
|
81
|
+
"packageManager": "yarn@1.22.15",
|
|
82
82
|
"jest": {
|
|
83
83
|
"preset": "react-native",
|
|
84
84
|
"modulePathIgnorePatterns": [
|