omikit-plugin 3.0.4 → 3.0.5
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/android/build.gradle
CHANGED
|
@@ -107,7 +107,7 @@ dependencies {
|
|
|
107
107
|
implementation "com.facebook.react:react-native:+" // From node_modules
|
|
108
108
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
109
109
|
// implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version")
|
|
110
|
-
api 'vn.vihat.omicall:omi-sdk:2.0.
|
|
110
|
+
api 'vn.vihat.omicall:omi-sdk:2.0.23'
|
|
111
111
|
// implementation fileTree(include: ['*.jar'], dir: 'libs')
|
|
112
112
|
// implementation files('OmiSDK.aar')
|
|
113
113
|
implementation "com.google.android.flexbox:flexbox:3.0.0"
|
|
@@ -119,7 +119,7 @@ dependencies {
|
|
|
119
119
|
exclude module: 'okhttp'
|
|
120
120
|
}
|
|
121
121
|
implementation "com.squareup.retrofit2:converter-gson:2.9.0"
|
|
122
|
-
implementation "com.squareup.okhttp3:okhttp:4.9.1"
|
|
122
|
+
implementation "com.squareup.okhttp3:okhttp:4.9.1"
|
|
123
123
|
implementation "com.squareup.okhttp3:okhttp-urlconnection:4.9.1"
|
|
124
124
|
implementation "com.squareup.okhttp3:logging-interceptor:4.9.1"
|
|
125
125
|
implementation "com.google.code.gson:gson:2.8.9"
|
|
@@ -45,6 +45,7 @@ class OmikitPluginModule(reactContext: ReactApplicationContext?) :
|
|
|
45
45
|
|
|
46
46
|
override fun incomingReceived(callerId: Int?, phoneNumber: String?, isVideo: Boolean?) {
|
|
47
47
|
isIncomming = true;
|
|
48
|
+
Log.d("OMISDK", "=>> START IN COMMING CALL REVICED => ")
|
|
48
49
|
val map: WritableMap = WritableNativeMap()
|
|
49
50
|
map.putBoolean("isVideo", isVideo ?: true)
|
|
50
51
|
map.putBoolean("incoming", isIncomming)
|
|
@@ -63,6 +64,7 @@ class OmikitPluginModule(reactContext: ReactApplicationContext?) :
|
|
|
63
64
|
transactionId: String?,
|
|
64
65
|
) {
|
|
65
66
|
isAnserCall = true
|
|
67
|
+
Log.d("OMISDK", "=>> ON CALL ESTABLISHED => ")
|
|
66
68
|
Handler(Looper.getMainLooper()).postDelayed({
|
|
67
69
|
Log.d("OmikitReactNative", "onCallEstablished")
|
|
68
70
|
val map: WritableMap = WritableNativeMap()
|
|
@@ -72,10 +74,11 @@ class OmikitPluginModule(reactContext: ReactApplicationContext?) :
|
|
|
72
74
|
map.putString("transactionId", transactionId)
|
|
73
75
|
map.putInt("status", CallState.confirmed.value)
|
|
74
76
|
sendEvent(CALL_STATE_CHANGED, map)
|
|
75
|
-
},
|
|
77
|
+
}, 200)
|
|
76
78
|
}
|
|
77
79
|
|
|
78
80
|
override fun onCallEnd(callInfo: MutableMap<String, Any?>, statusCode: Int) {
|
|
81
|
+
Log.d("OMISDK", "=>> ON CALL END => ")
|
|
79
82
|
val call = callInfo as Map<*, *>
|
|
80
83
|
val map: WritableMap = WritableNativeMap()
|
|
81
84
|
val timeStartToAnswer = call["time_start_to_answer"] as Long?
|
|
@@ -93,6 +96,7 @@ class OmikitPluginModule(reactContext: ReactApplicationContext?) :
|
|
|
93
96
|
}
|
|
94
97
|
|
|
95
98
|
override fun onConnecting() {
|
|
99
|
+
Log.d("OMISDK", "=>> ON CONNECTING CALL => ")
|
|
96
100
|
val map: WritableMap = WritableNativeMap()
|
|
97
101
|
map.putString("callerNumber", "")
|
|
98
102
|
map.putBoolean("isVideo", NotificationService.isVideo)
|
|
@@ -108,6 +112,7 @@ class OmikitPluginModule(reactContext: ReactApplicationContext?) :
|
|
|
108
112
|
val map: WritableMap = WritableNativeMap()
|
|
109
113
|
|
|
110
114
|
if(callDirection == "inbound") {
|
|
115
|
+
Log.d("OMISDK", "=>> ON IN COMMING CALL => ")
|
|
111
116
|
map.putString("callerNumber", OmiClient.prePhoneNumber)
|
|
112
117
|
map.putBoolean("isVideo", NotificationService.isVideo)
|
|
113
118
|
map.putBoolean("incoming", true)
|
|
@@ -119,6 +124,7 @@ class OmikitPluginModule(reactContext: ReactApplicationContext?) :
|
|
|
119
124
|
map.putString("transactionId", transactionId ?: "")
|
|
120
125
|
map.putInt("status", CallState.early.value)
|
|
121
126
|
map.putBoolean("incoming", false)
|
|
127
|
+
Log.d("OMISDK", "=>> ON RINGING CALL => ")
|
|
122
128
|
}
|
|
123
129
|
sendEvent(CALL_STATE_CHANGED, map)
|
|
124
130
|
}
|
|
@@ -149,6 +155,7 @@ class OmikitPluginModule(reactContext: ReactApplicationContext?) :
|
|
|
149
155
|
}
|
|
150
156
|
|
|
151
157
|
override fun onOutgoingStarted(callerId: Int, phoneNumber: String?, isVideo: Boolean?) {
|
|
158
|
+
Log.d("OMISDK", "=>> ON OUT GOING STARTED CALL => ")
|
|
152
159
|
val map: WritableMap = WritableNativeMap()
|
|
153
160
|
map.putString("callerNumber", "")
|
|
154
161
|
map.putBoolean("isVideo", NotificationService.isVideo)
|
|
@@ -369,13 +376,14 @@ class OmikitPluginModule(reactContext: ReactApplicationContext?) :
|
|
|
369
376
|
// map.putString("status", startCallResult)
|
|
370
377
|
map.putString("_id", "")
|
|
371
378
|
// map.putString("message", startCallResult as String)
|
|
372
|
-
|
|
379
|
+
Log.d("OMISDK", "=>> ON START CALL => $map")
|
|
373
380
|
promise.resolve(true)
|
|
374
381
|
}
|
|
375
382
|
} else {
|
|
376
383
|
map.putString("status","4")
|
|
377
384
|
map.putString("_id", "")
|
|
378
385
|
map.putString("message", messageCall(4) as String)
|
|
386
|
+
Log.d("OMISDK", "=>> ON START CALL FAIL BECAUSE NEED PERMISSION => $map")
|
|
379
387
|
promise.resolve(false)
|
|
380
388
|
}
|
|
381
389
|
}
|
|
@@ -409,28 +417,22 @@ class OmikitPluginModule(reactContext: ReactApplicationContext?) :
|
|
|
409
417
|
@ReactMethod
|
|
410
418
|
fun joinCall(promise: Promise) {
|
|
411
419
|
currentActivity?.runOnUiThread {
|
|
412
|
-
|
|
413
|
-
|
|
420
|
+
if(reactApplicationContext != null) {
|
|
421
|
+
OmiClient.getInstance(reactApplicationContext!!).pickUp()
|
|
422
|
+
promise.resolve(true)
|
|
423
|
+
}
|
|
414
424
|
}
|
|
415
425
|
}
|
|
416
426
|
|
|
417
427
|
@ReactMethod
|
|
418
428
|
fun endCall(promise: Promise) {
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
map.putString("source_number", call["source_number"] as String)
|
|
427
|
-
map.putString("destination_number", call["destination_number"] as String)
|
|
428
|
-
map.putDouble("time_start_to_answer", (timeStartToAnswer ?: 0).toDouble())
|
|
429
|
-
map.putDouble("time_end", timeEnd.toDouble())
|
|
430
|
-
map.putString("sip_user", call["sip_user"] as String)
|
|
431
|
-
map.putString("disposition", call["disposition"] as String)
|
|
432
|
-
promise.resolve(map)
|
|
433
|
-
}
|
|
429
|
+
if(isIncomming && !isAnserCall){
|
|
430
|
+
OmiClient.getInstance(reactApplicationContext!!).decline()
|
|
431
|
+
} else {
|
|
432
|
+
OmiClient.getInstance(reactApplicationContext!!).hangUp()
|
|
433
|
+
}
|
|
434
|
+
promise.resolve(true)
|
|
435
|
+
|
|
434
436
|
}
|
|
435
437
|
|
|
436
438
|
@ReactMethod
|