omikit-plugin 3.0.2 → 3.0.4
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 +25 -3
- package/android/build.gradle +24 -9
- package/android/src/main/java/com/omikitplugin/FLLocalCameraView.kt +1 -1
- package/android/src/main/java/com/omikitplugin/FLRemoteCameraModule.kt +1 -1
- package/android/src/main/java/com/omikitplugin/OmikitPluginModule.kt +161 -105
- package/android/src/main/java/com/omikitplugin/state/CallState.kt +7 -6
- package/ios/CallProcess/CallManager.swift +109 -47
- package/ios/CallProcess/CallState.swift +13 -1
- package/ios/CallProcess/OmiUtils.swift +53 -0
- package/ios/Model/OmiCallModel.swift +66 -0
- package/ios/Model/StartCalModel.swift +17 -0
- package/lib/commonjs/omi_call_state.js +10 -10
- package/lib/commonjs/omi_call_state.js.map +1 -1
- package/lib/commonjs/omi_local_camera.js.map +1 -1
- package/lib/commonjs/omi_remote_camera.js.map +1 -1
- package/lib/commonjs/omi_start_call_status.js +4 -4
- package/lib/commonjs/omi_start_call_status.js.map +1 -1
- package/lib/commonjs/omikit.js +1 -0
- package/lib/commonjs/omikit.js.map +1 -1
- package/lib/module/omi_call_state.js +10 -10
- package/lib/module/omi_call_state.js.map +1 -1
- package/lib/module/omi_local_camera.js.map +1 -1
- package/lib/module/omi_remote_camera.js.map +1 -1
- package/lib/module/omi_start_call_status.js +3 -3
- package/lib/module/omi_start_call_status.js.map +1 -1
- package/lib/module/omikit.js +1 -0
- package/lib/module/omikit.js.map +1 -1
- package/lib/typescript/omi_call_state.d.ts +7 -7
- package/lib/typescript/omi_call_state.d.ts.map +1 -1
- package/lib/typescript/omikit.d.ts +4 -4
- package/lib/typescript/omikit.d.ts.map +1 -1
- package/omikit-plugin.podspec +1 -1
- package/package.json +1 -1
- package/src/omi_call_state.tsx +7 -7
- package/src/omikit.tsx +5 -4
- package/CHANGELOG.md +0 -86
package/README.md
CHANGED
|
@@ -657,10 +657,32 @@ useEffect(() => {
|
|
|
657
657
|
```
|
|
658
658
|
|
|
659
659
|
- Important event `onCallStateChanged`: We provide it to listen call state change.
|
|
660
|
+
//OmiAction have 2 variables: actionName and data
|
|
661
|
+
```
|
|
662
|
+
- Action Name value:
|
|
663
|
+
- `onCallStateChanged`: Call state changed.
|
|
664
|
+
- `onSwitchboardAnswer`: Switchboard sip is listening.
|
|
665
|
+
- List status call:
|
|
666
|
+
+ unknown(0),
|
|
667
|
+
+ calling(1),
|
|
668
|
+
+ incoming(2),
|
|
669
|
+
+ early(3),
|
|
670
|
+
+ connecting(4),
|
|
671
|
+
+ confirmed(5),
|
|
672
|
+
+ disconnected(6);
|
|
673
|
+
+ onCallStateChanged is call state tracking event. We will return status of state. Please refer `OmiCallState`.
|
|
674
|
+
`onCallStateChanged value:`
|
|
675
|
+
+ isVideo: value boolean (true is call Video)
|
|
676
|
+
+ status: number (value matching with List status call )
|
|
677
|
+
+ callerNumber: phone number
|
|
678
|
+
+ incoming: boolean - status call incoming or outgoing
|
|
679
|
+
+ _id: option (id of every call)
|
|
680
|
+
|
|
681
|
+
+ `Incoming call` state lifecycle: incoming -> connecting -> confirmed -> disconnected
|
|
682
|
+
+ `Outgoing call` state lifecycle: calling -> early -> connecting -> confirmed -> disconnected
|
|
683
|
+
|
|
684
|
+
+ onSwitchboardAnswer have callback when employee answered script call.
|
|
660
685
|
|
|
661
|
-
+ It is call state tracking event. We will return status of state. Please refer `OmiCallState`.
|
|
662
|
-
+ Incoming call state lifecycle: incoming(receive on foreround state) -> early -> connecting -> confirmed -> disconnected
|
|
663
|
-
+ Outgoing call state lifecycle: calling -> early (call created) -> connecting -> confirmed -> disconnected
|
|
664
686
|
|
|
665
687
|
- Action Name value:
|
|
666
688
|
- `OmiCallEvent.onMuted`: Audio changed.
|
package/android/build.gradle
CHANGED
|
@@ -15,12 +15,12 @@ buildscript {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
dependencies {
|
|
18
|
-
classpath
|
|
19
|
-
// noinspection DifferentKotlinGradleVersion
|
|
18
|
+
classpath 'com.android.tools.build:gradle-api:7.1.2'
|
|
20
19
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
|
21
20
|
classpath 'com.google.dagger:hilt-android-gradle-plugin:2.39.1'
|
|
22
21
|
classpath 'com.github.kezong:fat-aar:1.3.8'
|
|
23
22
|
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4.29.3"
|
|
23
|
+
classpath 'com.android.tools.build:gradle:4.0.0'
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
|
|
@@ -28,11 +28,12 @@ def isNewArchitectureEnabled() {
|
|
|
28
28
|
return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
apply plugin:
|
|
32
|
-
apply plugin:
|
|
31
|
+
apply plugin: 'com.android.library'
|
|
32
|
+
apply plugin: 'kotlin-android'
|
|
33
33
|
apply plugin: 'kotlin-kapt'
|
|
34
34
|
apply plugin: 'kotlin-parcelize'
|
|
35
35
|
|
|
36
|
+
|
|
36
37
|
if (isNewArchitectureEnabled()) {
|
|
37
38
|
apply plugin: "com.facebook.react"
|
|
38
39
|
}
|
|
@@ -68,6 +69,10 @@ android {
|
|
|
68
69
|
targetCompatibility JavaVersion.VERSION_1_8
|
|
69
70
|
}
|
|
70
71
|
|
|
72
|
+
// kotlinOptions {
|
|
73
|
+
// jvmTarget = '1.8'
|
|
74
|
+
// }
|
|
75
|
+
|
|
71
76
|
dataBinding {
|
|
72
77
|
enabled = true
|
|
73
78
|
}
|
|
@@ -101,14 +106,15 @@ dependencies {
|
|
|
101
106
|
// implementation "com.facebook.react:react-native"
|
|
102
107
|
implementation "com.facebook.react:react-native:+" // From node_modules
|
|
103
108
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
104
|
-
|
|
105
|
-
api 'vn.vihat.omicall:omi-sdk:
|
|
109
|
+
// implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version")
|
|
110
|
+
api 'vn.vihat.omicall:omi-sdk:2.0.19'
|
|
106
111
|
// implementation fileTree(include: ['*.jar'], dir: 'libs')
|
|
107
112
|
// implementation files('OmiSDK.aar')
|
|
108
|
-
implementation
|
|
109
|
-
implementation
|
|
113
|
+
implementation "com.google.android.flexbox:flexbox:3.0.0"
|
|
114
|
+
implementation "androidx.appcompat:appcompat:1.6.1"
|
|
115
|
+
implementation "androidx.lifecycle:lifecycle-process:2.6.1"
|
|
116
|
+
implementation "com.google.android.material:material:1.9.0"
|
|
110
117
|
implementation 'com.google.firebase:firebase-messaging-ktx:23.1.2'
|
|
111
|
-
implementation 'androidx.lifecycle:lifecycle-process:2.1.0'
|
|
112
118
|
implementation("com.squareup.retrofit2:retrofit:2.9.0") {
|
|
113
119
|
exclude module: 'okhttp'
|
|
114
120
|
}
|
|
@@ -119,6 +125,15 @@ dependencies {
|
|
|
119
125
|
implementation "com.google.code.gson:gson:2.8.9"
|
|
120
126
|
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.2'
|
|
121
127
|
implementation "androidx.security:security-crypto:1.1.0-alpha06"
|
|
128
|
+
implementation(platform("org.jetbrains.kotlin:kotlin-bom:1.8.0"))
|
|
129
|
+
implementation "com.github.bumptech.glide:glide:4.15.1"
|
|
130
|
+
annotationProcessor "com.github.bumptech.glide:compiler:4.15.1"
|
|
131
|
+
implementation("androidx.work:work-runtime:2.8.1")
|
|
132
|
+
|
|
133
|
+
def coroutines_version = '1.7.2'
|
|
134
|
+
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version"
|
|
135
|
+
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
|
|
136
|
+
|
|
122
137
|
}
|
|
123
138
|
|
|
124
139
|
if (isNewArchitectureEnabled()) {
|
|
@@ -33,7 +33,7 @@ class FLLocalCameraView(private val context: ReactApplicationContext) :
|
|
|
33
33
|
|
|
34
34
|
fun refreshTexture() {
|
|
35
35
|
cameraView.surfaceTexture?.let {
|
|
36
|
-
OmiClient.
|
|
36
|
+
// OmiClient.getInstance().setupLocalVideoFeed(Surface(it))
|
|
37
37
|
ScaleManager.adjustAspectRatio(
|
|
38
38
|
cameraView,
|
|
39
39
|
Size(cameraView.width, cameraView.height),
|
|
@@ -26,7 +26,7 @@ class FLRemoteCameraModule(reactContext: ReactApplicationContext, remoteViewMana
|
|
|
26
26
|
@ReactMethod
|
|
27
27
|
fun refresh(promise: Promise) {
|
|
28
28
|
cameraView.surfaceTexture?.let {
|
|
29
|
-
OmiClient.instance.setupIncomingVideoFeed(Surface(it))
|
|
29
|
+
// OmiClient.instance.setupIncomingVideoFeed(Surface(it))
|
|
30
30
|
ScaleManager.adjustAspectRatio(cameraView,
|
|
31
31
|
Size(cameraView.width, cameraView.height),
|
|
32
32
|
Size(1280,720)
|
|
@@ -34,35 +34,45 @@ import vn.vihat.omicall.omisdk.utils.SipServiceConstants
|
|
|
34
34
|
class OmikitPluginModule(reactContext: ReactApplicationContext?) :
|
|
35
35
|
ReactContextBaseJavaModule(reactContext), ActivityEventListener, OmiListener {
|
|
36
36
|
private val mainScope = CoroutineScope(Dispatchers.Main)
|
|
37
|
+
private var isIncomming: Boolean = false
|
|
38
|
+
private var callerNumberTemp: String = ""
|
|
39
|
+
private var isAnserCall: Boolean = false
|
|
40
|
+
|
|
37
41
|
|
|
38
42
|
override fun getName(): String {
|
|
39
43
|
return NAME
|
|
40
44
|
}
|
|
41
45
|
|
|
42
46
|
override fun incomingReceived(callerId: Int?, phoneNumber: String?, isVideo: Boolean?) {
|
|
47
|
+
isIncomming = true;
|
|
43
48
|
val map: WritableMap = WritableNativeMap()
|
|
44
49
|
map.putBoolean("isVideo", isVideo ?: true)
|
|
50
|
+
map.putBoolean("incoming", isIncomming)
|
|
45
51
|
map.putString("callerNumber", phoneNumber)
|
|
52
|
+
map.putString("_id", "")
|
|
46
53
|
map.putInt("status", CallState.incoming.value)
|
|
47
54
|
sendEvent(CALL_STATE_CHANGED, map)
|
|
48
55
|
Log.d("omikit", "incomingReceived: ")
|
|
49
56
|
}
|
|
50
57
|
|
|
51
|
-
override fun
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
58
|
+
override fun onCallEstablished(
|
|
59
|
+
callerId: Int,
|
|
60
|
+
phoneNumber: String?,
|
|
61
|
+
isVideo: Boolean?,
|
|
62
|
+
startTime: Long,
|
|
63
|
+
transactionId: String?,
|
|
64
|
+
) {
|
|
65
|
+
isAnserCall = true
|
|
66
|
+
Handler(Looper.getMainLooper()).postDelayed({
|
|
67
|
+
Log.d("OmikitReactNative", "onCallEstablished")
|
|
68
|
+
val map: WritableMap = WritableNativeMap()
|
|
69
|
+
map.putString("callerNumber", phoneNumber)
|
|
70
|
+
map.putBoolean("isVideo", isVideo ?: true)
|
|
71
|
+
map.putBoolean("incoming", isIncomming)
|
|
72
|
+
map.putString("transactionId", transactionId)
|
|
73
|
+
map.putInt("status", CallState.confirmed.value)
|
|
74
|
+
sendEvent(CALL_STATE_CHANGED, map)
|
|
75
|
+
}, 500)
|
|
66
76
|
}
|
|
67
77
|
|
|
68
78
|
override fun onCallEnd(callInfo: MutableMap<String, Any?>, statusCode: Int) {
|
|
@@ -82,33 +92,55 @@ class OmikitPluginModule(reactContext: ReactApplicationContext?) :
|
|
|
82
92
|
sendEvent(CALL_STATE_CHANGED, map)
|
|
83
93
|
}
|
|
84
94
|
|
|
85
|
-
override fun onCallEstablished(
|
|
86
|
-
callerId: Int,
|
|
87
|
-
phoneNumber: String?,
|
|
88
|
-
isVideo: Boolean?,
|
|
89
|
-
startTime: Long,
|
|
90
|
-
transactionId: String?,
|
|
91
|
-
) {
|
|
92
|
-
Handler(Looper.getMainLooper()).postDelayed({
|
|
93
|
-
Log.d("OmikitReactNative", "onCallEstablished")
|
|
94
|
-
val map: WritableMap = WritableNativeMap()
|
|
95
|
-
map.putString("callerNumber", phoneNumber)
|
|
96
|
-
map.putBoolean("isVideo", isVideo ?: true)
|
|
97
|
-
map.putString("transactionId", transactionId)
|
|
98
|
-
map.putInt("status", CallState.confirmed.value)
|
|
99
|
-
sendEvent(CALL_STATE_CHANGED, map)
|
|
100
|
-
}, 500)
|
|
101
|
-
}
|
|
102
|
-
|
|
103
95
|
override fun onConnecting() {
|
|
104
96
|
val map: WritableMap = WritableNativeMap()
|
|
105
97
|
map.putString("callerNumber", "")
|
|
106
98
|
map.putBoolean("isVideo", NotificationService.isVideo)
|
|
99
|
+
map.putBoolean("incoming", isIncomming)
|
|
107
100
|
map.putString("transactionId", "")
|
|
101
|
+
map.putString("_id", "")
|
|
108
102
|
map.putInt("status", CallState.connecting.value)
|
|
109
103
|
sendEvent(CALL_STATE_CHANGED, map)
|
|
110
104
|
}
|
|
111
105
|
|
|
106
|
+
override fun onRinging(callerId: Int, transactionId: String?) {
|
|
107
|
+
var callDirection = OmiClient.callDirection
|
|
108
|
+
val map: WritableMap = WritableNativeMap()
|
|
109
|
+
|
|
110
|
+
if(callDirection == "inbound") {
|
|
111
|
+
map.putString("callerNumber", OmiClient.prePhoneNumber)
|
|
112
|
+
map.putBoolean("isVideo", NotificationService.isVideo)
|
|
113
|
+
map.putBoolean("incoming", true)
|
|
114
|
+
map.putString("transactionId", transactionId ?: "")
|
|
115
|
+
map.putInt("status", CallState.incoming.value)
|
|
116
|
+
} else {
|
|
117
|
+
map.putString("callerNumber", "")
|
|
118
|
+
map.putBoolean("isVideo", NotificationService.isVideo)
|
|
119
|
+
map.putString("transactionId", transactionId ?: "")
|
|
120
|
+
map.putInt("status", CallState.early.value)
|
|
121
|
+
map.putBoolean("incoming", false)
|
|
122
|
+
}
|
|
123
|
+
sendEvent(CALL_STATE_CHANGED, map)
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
override fun networkHealth(stat: Map<String, *>, quality: Int) {
|
|
128
|
+
val map: WritableMap = WritableNativeMap()
|
|
129
|
+
map.putInt("quality", quality)
|
|
130
|
+
sendEvent(CALL_QUALITY, map)
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
override fun onAudioChanged(audioInfo: Map<String, Any>) {
|
|
134
|
+
val audio: WritableMap = WritableNativeMap()
|
|
135
|
+
audio.putString("name", audioInfo["name"] as String)
|
|
136
|
+
audio.putInt("type", audioInfo["type"] as Int)
|
|
137
|
+
val map: WritableMap = WritableNativeMap()
|
|
138
|
+
val writeList = WritableNativeArray()
|
|
139
|
+
writeList.pushMap(audio)
|
|
140
|
+
map.putArray("data", writeList)
|
|
141
|
+
sendEvent(AUDIO_CHANGE, map)
|
|
142
|
+
}
|
|
143
|
+
|
|
112
144
|
|
|
113
145
|
override fun onHold(isHold: Boolean) {
|
|
114
146
|
}
|
|
@@ -122,15 +154,8 @@ class OmikitPluginModule(reactContext: ReactApplicationContext?) :
|
|
|
122
154
|
map.putBoolean("isVideo", NotificationService.isVideo)
|
|
123
155
|
map.putString("transactionId", "")
|
|
124
156
|
map.putInt("status", CallState.calling.value)
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
override fun onRinging(callerId: Int, transactionId: String?) {
|
|
129
|
-
val map: WritableMap = WritableNativeMap()
|
|
130
|
-
map.putString("callerNumber", "")
|
|
131
|
-
map.putBoolean("isVideo", false)
|
|
132
|
-
map.putString("transactionId", transactionId ?: "")
|
|
133
|
-
map.putInt("status", CallState.early.value)
|
|
157
|
+
map.putString("_id", "")
|
|
158
|
+
map.putBoolean("incoming",isIncomming)
|
|
134
159
|
sendEvent(CALL_STATE_CHANGED, map)
|
|
135
160
|
}
|
|
136
161
|
|
|
@@ -150,18 +175,37 @@ class OmikitPluginModule(reactContext: ReactApplicationContext?) :
|
|
|
150
175
|
}
|
|
151
176
|
}
|
|
152
177
|
|
|
178
|
+
private fun messageCall(type: Int): String {
|
|
179
|
+
return when (type) {
|
|
180
|
+
0 -> "INVALID_UUID"
|
|
181
|
+
1 -> "INVALID_PHONE_NUMBER"
|
|
182
|
+
2 -> "SAME_PHONE_NUMBER_WITH_PHONE_REGISTER"
|
|
183
|
+
3 -> "MAX_RETRY"
|
|
184
|
+
4 -> "PERMISSION_DENIED"
|
|
185
|
+
5 -> "COULD_NOT_FIND_END_POINT"
|
|
186
|
+
6 -> "REGISTER_ACCOUNT_FAIL"
|
|
187
|
+
7 -> "START_CALL_FAIL"
|
|
188
|
+
8 -> "START_CALL_SUCCESS"
|
|
189
|
+
9 -> "HAVE_ANOTHER_CALL"
|
|
190
|
+
else -> "START_CALL_SUCCESS"
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
153
194
|
override fun initialize() {
|
|
154
195
|
super.initialize()
|
|
155
196
|
reactApplicationContext!!.addActivityEventListener(this)
|
|
156
197
|
Handler(Looper.getMainLooper()).post {
|
|
157
|
-
|
|
158
|
-
|
|
198
|
+
OmiClient(context = reactApplicationContext!!)
|
|
199
|
+
OmiClient.getInstance(reactApplicationContext!!).addCallStateListener(this)
|
|
200
|
+
OmiClient.getInstance(reactApplicationContext!!)
|
|
201
|
+
OmiClient.isAppReady = true;
|
|
202
|
+
OmiClient.getInstance(reactApplicationContext!!).addCallStateListener(this)
|
|
159
203
|
}
|
|
160
204
|
}
|
|
161
205
|
|
|
162
206
|
@ReactMethod
|
|
163
207
|
fun startServices(promise: Promise) {
|
|
164
|
-
OmiClient.
|
|
208
|
+
OmiClient.getInstance(reactApplicationContext!!).addAccountListener(accountListener)
|
|
165
209
|
promise.resolve(true)
|
|
166
210
|
}
|
|
167
211
|
|
|
@@ -185,34 +229,37 @@ class OmikitPluginModule(reactContext: ReactApplicationContext?) :
|
|
|
185
229
|
@ReactMethod
|
|
186
230
|
fun configPushNotification(data: ReadableMap, promise: Promise) {
|
|
187
231
|
currentActivity?.runOnUiThread {
|
|
188
|
-
val notificationIcon =
|
|
189
|
-
val prefix = data
|
|
190
|
-
val incomingBackgroundColor = data
|
|
191
|
-
val incomingAcceptButtonImage = data
|
|
192
|
-
val incomingDeclineButtonImage = data
|
|
193
|
-
val prefixMissedCallMessage = data
|
|
194
|
-
val backImage = data
|
|
195
|
-
val userImage = data
|
|
196
|
-
val userNameKey = data
|
|
197
|
-
val channelId = data
|
|
198
|
-
val
|
|
199
|
-
val
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
232
|
+
val notificationIcon = data.getString("notificationIcon") ?: ""
|
|
233
|
+
val prefix = data?.getString("prefix") ?: ""
|
|
234
|
+
val incomingBackgroundColor = data?.getString("incomingBackgroundColor") ?: ""
|
|
235
|
+
val incomingAcceptButtonImage = data?.getString("incomingAcceptButtonImage") ?: ""
|
|
236
|
+
val incomingDeclineButtonImage = data?.getString("incomingDeclineButtonImage") ?: ""
|
|
237
|
+
val prefixMissedCallMessage = data?.getString("prefixMissedCallMessage") ?: ""
|
|
238
|
+
val backImage = data?.getString("backImage") ?: ""
|
|
239
|
+
val userImage = data?.getString("userImage") ?: ""
|
|
240
|
+
val userNameKey = data?.getString("userNameKey") ?: ""
|
|
241
|
+
val channelId = data?.getString("channelId") ?: ""
|
|
242
|
+
val missedCallTitle = data?.getString("missedCallTitle") ?: ""
|
|
243
|
+
val audioNotificationDescription = data?.getString("audioNotificationDescription") ?: ""
|
|
244
|
+
val videoNotificationDescription = data?.getString("videoNotificationDescription") ?: ""
|
|
245
|
+
val displayNameType = data?.getString("displayNameType") ?: ""
|
|
246
|
+
|
|
247
|
+
OmiClient.getInstance(reactApplicationContext!!).configPushNotification(
|
|
248
|
+
showMissedCall = true,
|
|
249
|
+
notificationIcon = notificationIcon ?: "ic_notification",
|
|
250
|
+
notificationAvatar = userImage ?: "ic_inbound_avatar_notification",
|
|
251
|
+
fullScreenAvatar = userImage ?: "ic_inbound_avatar_fullscreen",
|
|
252
|
+
internalCallText = "Gọi nội bộ",
|
|
253
|
+
videoCallText = "Gọi Video",
|
|
254
|
+
inboundCallText = prefix,
|
|
255
|
+
unknownContactText = "Cuộc gọi không xác định",
|
|
256
|
+
showUUID = false,
|
|
257
|
+
inboundChannelId = "${channelId}-inbound",
|
|
258
|
+
inboundChannelName = "Cuộc gọi đến",
|
|
259
|
+
missedChannelId = "${channelId}-missed",
|
|
260
|
+
missedChannelName = "Cuộc gọi nhỡ",
|
|
261
|
+
displayNameType = userNameKey ?: "full_name",
|
|
262
|
+
notificationMissedCallPrefix = prefixMissedCallMessage ?: "Cuộc gọi nhỡ từ"
|
|
216
263
|
)
|
|
217
264
|
promise.resolve(true)
|
|
218
265
|
}
|
|
@@ -222,20 +269,17 @@ class OmikitPluginModule(reactContext: ReactApplicationContext?) :
|
|
|
222
269
|
fun initCallWithUserPassword(data: ReadableMap, promise: Promise) {
|
|
223
270
|
currentActivity?.runOnUiThread {
|
|
224
271
|
val userName = data.getString("userName")
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
)
|
|
237
|
-
}
|
|
238
|
-
requestPermission(isVideo)
|
|
272
|
+
Log.d("dataOmi", "INIT_CALL_USER_PASSWORD ==>> $data ")
|
|
273
|
+
Log.d("dataOmi", "INIT_CALL_USER_PASSWORD ==>> $userName ")
|
|
274
|
+
val password = data.getString("password")
|
|
275
|
+
val realm = data.getString("realm")
|
|
276
|
+
val host = data.getString("host")
|
|
277
|
+
val isVideo = data.getBoolean("isVideo")
|
|
278
|
+
if (userName != null && password != null && realm != null && host != null) {
|
|
279
|
+
Log.d("dataOmi", "INIT_CALL_USER_PASSWORD $userName -- $password --$realm --$isVideo -- $host ")
|
|
280
|
+
OmiClient.register(userName, password, realm , isVideo ?: true, host)
|
|
281
|
+
}
|
|
282
|
+
// requestPermission(isVideo ?: true)
|
|
239
283
|
promise.resolve(true)
|
|
240
284
|
}
|
|
241
285
|
}
|
|
@@ -249,6 +293,7 @@ class OmikitPluginModule(reactContext: ReactApplicationContext?) :
|
|
|
249
293
|
val apiKey = data.getString("apiKey")
|
|
250
294
|
val isVideo = data.getBoolean("isVideo")
|
|
251
295
|
val phone = data.getString("phone")
|
|
296
|
+
|
|
252
297
|
withContext(Dispatchers.Default) {
|
|
253
298
|
try {
|
|
254
299
|
if (usrName != null && usrUuid != null && apiKey != null) {
|
|
@@ -273,7 +318,7 @@ class OmikitPluginModule(reactContext: ReactApplicationContext?) :
|
|
|
273
318
|
@ReactMethod
|
|
274
319
|
fun getInitialCall(promise: Promise) {
|
|
275
320
|
currentActivity?.runOnUiThread {
|
|
276
|
-
val call = OmiClient.
|
|
321
|
+
val call = OmiClient.getInstance(reactApplicationContext!!).getCurrentCallInfo()
|
|
277
322
|
if (call != null) {
|
|
278
323
|
val map: WritableMap = WritableNativeMap()
|
|
279
324
|
map.putString("callerNumber", call["callerNumber"] as String)
|
|
@@ -293,7 +338,7 @@ class OmikitPluginModule(reactContext: ReactApplicationContext?) :
|
|
|
293
338
|
val deviceTokenAndroid = data.getString("fcmToken") as String
|
|
294
339
|
withContext(Dispatchers.Default) {
|
|
295
340
|
try {
|
|
296
|
-
OmiClient.
|
|
341
|
+
OmiClient.getInstance(reactApplicationContext!!).updatePushToken(
|
|
297
342
|
"",
|
|
298
343
|
deviceTokenAndroid,
|
|
299
344
|
)
|
|
@@ -312,14 +357,25 @@ class OmikitPluginModule(reactContext: ReactApplicationContext?) :
|
|
|
312
357
|
reactApplicationContext!!,
|
|
313
358
|
Manifest.permission.RECORD_AUDIO
|
|
314
359
|
)
|
|
360
|
+
val map: WritableMap = WritableNativeMap()
|
|
315
361
|
if (audio == PackageManager.PERMISSION_GRANTED) {
|
|
316
362
|
currentActivity?.runOnUiThread {
|
|
317
363
|
val phoneNumber = data.getString("phoneNumber") as String
|
|
318
364
|
val isVideo = data.getBoolean("isVideo")
|
|
319
|
-
OmiClient.
|
|
365
|
+
val startCallResult = OmiClient.getInstance(reactApplicationContext!!).startCall(phoneNumber, isVideo)
|
|
366
|
+
Log.d("dataOmi", "startCall ==>> ${startCallResult} ")
|
|
367
|
+
Log.d("dataOmi", "startCall2 ==>> ${startCallResult.value} ")
|
|
368
|
+
// var status = startCallResult.value as String
|
|
369
|
+
// map.putString("status", startCallResult)
|
|
370
|
+
map.putString("_id", "")
|
|
371
|
+
// map.putString("message", startCallResult as String)
|
|
372
|
+
Log.d("dataOmi", "startCall ==>> ${map} ")
|
|
320
373
|
promise.resolve(true)
|
|
321
374
|
}
|
|
322
375
|
} else {
|
|
376
|
+
map.putString("status","4")
|
|
377
|
+
map.putString("_id", "")
|
|
378
|
+
map.putString("message", messageCall(4) as String)
|
|
323
379
|
promise.resolve(false)
|
|
324
380
|
}
|
|
325
381
|
}
|
|
@@ -338,7 +394,7 @@ class OmikitPluginModule(reactContext: ReactApplicationContext?) :
|
|
|
338
394
|
try {
|
|
339
395
|
val uuid = data.getString("usrUuid") as String
|
|
340
396
|
val isVideo = data.getBoolean("isVideo")
|
|
341
|
-
callResult = OmiClient.
|
|
397
|
+
callResult = OmiClient.getInstance(reactApplicationContext!!).startCallWithUuid(uuid = uuid, isVideo = isVideo)
|
|
342
398
|
} catch (_: Throwable) {
|
|
343
399
|
|
|
344
400
|
}
|
|
@@ -353,7 +409,7 @@ class OmikitPluginModule(reactContext: ReactApplicationContext?) :
|
|
|
353
409
|
@ReactMethod
|
|
354
410
|
fun joinCall(promise: Promise) {
|
|
355
411
|
currentActivity?.runOnUiThread {
|
|
356
|
-
OmiClient.
|
|
412
|
+
OmiClient.getInstance(reactApplicationContext!!).pickUp()
|
|
357
413
|
promise.resolve(true)
|
|
358
414
|
}
|
|
359
415
|
}
|
|
@@ -361,7 +417,7 @@ class OmikitPluginModule(reactContext: ReactApplicationContext?) :
|
|
|
361
417
|
@ReactMethod
|
|
362
418
|
fun endCall(promise: Promise) {
|
|
363
419
|
currentActivity?.runOnUiThread {
|
|
364
|
-
val call = OmiClient.
|
|
420
|
+
val call = OmiClient.getInstance(reactApplicationContext!!).hangUp()
|
|
365
421
|
val map: WritableMap = WritableNativeMap()
|
|
366
422
|
val timeStartToAnswer = call?.get("time_start_to_answer") as Long?
|
|
367
423
|
val timeEnd = call?.get("time_end") as Long
|
|
@@ -383,7 +439,7 @@ class OmikitPluginModule(reactContext: ReactApplicationContext?) :
|
|
|
383
439
|
var newStatus: Boolean? = null
|
|
384
440
|
withContext(Dispatchers.Default) {
|
|
385
441
|
try {
|
|
386
|
-
newStatus = OmiClient.
|
|
442
|
+
newStatus = OmiClient.getInstance(reactApplicationContext!!).toggleMute()
|
|
387
443
|
} catch (_: Throwable) {
|
|
388
444
|
|
|
389
445
|
}
|
|
@@ -396,7 +452,7 @@ class OmikitPluginModule(reactContext: ReactApplicationContext?) :
|
|
|
396
452
|
@ReactMethod
|
|
397
453
|
fun toggleSpeaker(promise: Promise) {
|
|
398
454
|
currentActivity?.runOnUiThread {
|
|
399
|
-
val newStatus = OmiClient.
|
|
455
|
+
val newStatus = OmiClient.getInstance(reactApplicationContext!!).toggleSpeaker()
|
|
400
456
|
promise.resolve(newStatus)
|
|
401
457
|
sendEvent(SPEAKER, newStatus)
|
|
402
458
|
}
|
|
@@ -414,7 +470,7 @@ class OmikitPluginModule(reactContext: ReactApplicationContext?) :
|
|
|
414
470
|
characterCode = 11
|
|
415
471
|
}
|
|
416
472
|
if (characterCode != null) {
|
|
417
|
-
OmiClient.
|
|
473
|
+
OmiClient.getInstance(reactApplicationContext!!).sendDtmf(characterCode)
|
|
418
474
|
}
|
|
419
475
|
promise.resolve(true)
|
|
420
476
|
}
|
|
@@ -423,7 +479,7 @@ class OmikitPluginModule(reactContext: ReactApplicationContext?) :
|
|
|
423
479
|
@ReactMethod
|
|
424
480
|
fun switchOmiCamera(promise: Promise) {
|
|
425
481
|
currentActivity?.runOnUiThread {
|
|
426
|
-
OmiClient.
|
|
482
|
+
OmiClient.getInstance(reactApplicationContext!!).switchCamera()
|
|
427
483
|
promise.resolve(true)
|
|
428
484
|
}
|
|
429
485
|
}
|
|
@@ -431,7 +487,7 @@ class OmikitPluginModule(reactContext: ReactApplicationContext?) :
|
|
|
431
487
|
@ReactMethod
|
|
432
488
|
fun toggleOmiVideo(promise: Promise) {
|
|
433
489
|
currentActivity?.runOnUiThread {
|
|
434
|
-
OmiClient.
|
|
490
|
+
OmiClient.getInstance(reactApplicationContext!!).toggleCamera()
|
|
435
491
|
promise.resolve(true)
|
|
436
492
|
}
|
|
437
493
|
}
|
|
@@ -441,7 +497,7 @@ class OmikitPluginModule(reactContext: ReactApplicationContext?) :
|
|
|
441
497
|
mainScope.launch {
|
|
442
498
|
withContext(Dispatchers.Default) {
|
|
443
499
|
try {
|
|
444
|
-
OmiClient.
|
|
500
|
+
OmiClient.getInstance(reactApplicationContext!!).logout()
|
|
445
501
|
} catch (_: Throwable) {
|
|
446
502
|
|
|
447
503
|
}
|
|
@@ -456,7 +512,7 @@ class OmikitPluginModule(reactContext: ReactApplicationContext?) :
|
|
|
456
512
|
var callResult: Any? = null
|
|
457
513
|
withContext(Dispatchers.Default) {
|
|
458
514
|
try {
|
|
459
|
-
callResult = OmiClient.
|
|
515
|
+
callResult = OmiClient.getInstance(reactApplicationContext!!).getCurrentUser()
|
|
460
516
|
} catch (_: Throwable) {
|
|
461
517
|
|
|
462
518
|
}
|
|
@@ -481,7 +537,7 @@ class OmikitPluginModule(reactContext: ReactApplicationContext?) :
|
|
|
481
537
|
var callResult: Any? = null
|
|
482
538
|
withContext(Dispatchers.Default) {
|
|
483
539
|
try {
|
|
484
|
-
callResult = OmiClient.
|
|
540
|
+
callResult = OmiClient.getInstance(reactApplicationContext!!).getIncomingCallUser()
|
|
485
541
|
} catch (_: Throwable) {
|
|
486
542
|
|
|
487
543
|
}
|
|
@@ -506,7 +562,7 @@ class OmikitPluginModule(reactContext: ReactApplicationContext?) :
|
|
|
506
562
|
var callResult: Any? = null
|
|
507
563
|
withContext(Dispatchers.Default) {
|
|
508
564
|
try {
|
|
509
|
-
callResult = OmiClient.
|
|
565
|
+
callResult = OmiClient.getInstance(reactApplicationContext!!).getUserInfo(phone as String)
|
|
510
566
|
} catch (_: Throwable) {
|
|
511
567
|
}
|
|
512
568
|
}
|
|
@@ -526,7 +582,7 @@ class OmikitPluginModule(reactContext: ReactApplicationContext?) :
|
|
|
526
582
|
|
|
527
583
|
@ReactMethod
|
|
528
584
|
fun getAudio(promise: Promise) {
|
|
529
|
-
val inputs = OmiClient.
|
|
585
|
+
val inputs = OmiClient.getInstance(reactApplicationContext!!).getAudioOutputs()
|
|
530
586
|
val writeList = WritableNativeArray()
|
|
531
587
|
inputs.forEach {
|
|
532
588
|
val map = WritableNativeMap()
|
|
@@ -539,7 +595,7 @@ class OmikitPluginModule(reactContext: ReactApplicationContext?) :
|
|
|
539
595
|
|
|
540
596
|
@ReactMethod
|
|
541
597
|
fun getCurrentAudio(promise: Promise) {
|
|
542
|
-
val currentAudio = OmiClient.
|
|
598
|
+
val currentAudio = OmiClient.getInstance(reactApplicationContext!!).getCurrentAudio()
|
|
543
599
|
val map: WritableMap = WritableNativeMap()
|
|
544
600
|
map.putString("name", currentAudio["name"] as String)
|
|
545
601
|
map.putInt("type", currentAudio["type"] as Int)
|
|
@@ -551,7 +607,7 @@ class OmikitPluginModule(reactContext: ReactApplicationContext?) :
|
|
|
551
607
|
@ReactMethod
|
|
552
608
|
fun setAudio(data: ReadableMap, promise: Promise) {
|
|
553
609
|
val portType = data.getInt("portType")
|
|
554
|
-
OmiClient.
|
|
610
|
+
OmiClient.getInstance(reactApplicationContext!!).setAudio(portType)
|
|
555
611
|
promise.resolve(true)
|
|
556
612
|
}
|
|
557
613
|
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
package com.omikitplugin.state
|
|
2
2
|
|
|
3
3
|
enum class CallState(_value: Int) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
unknown(0),
|
|
5
|
+
calling(1),
|
|
6
|
+
incoming(2),
|
|
7
|
+
early(3),
|
|
8
|
+
connecting(4),
|
|
9
|
+
confirmed(5),
|
|
10
|
+
disconnected(6);
|
|
10
11
|
|
|
11
12
|
val value = _value
|
|
12
13
|
}
|