82
82
import static io .wazo .callkeep .Constants .EXTRA_CALLER_NAME ;
83
83
import static io .wazo .callkeep .Constants .EXTRA_CALL_UUID ;
84
84
import static io .wazo .callkeep .Constants .EXTRA_CALL_NUMBER ;
85
+ import static io .wazo .callkeep .Constants .EXTRA_HAS_VIDEO ;
85
86
import static io .wazo .callkeep .Constants .ACTION_END_CALL ;
86
87
import static io .wazo .callkeep .Constants .ACTION_ANSWER_CALL ;
87
88
import static io .wazo .callkeep .Constants .ACTION_MUTE_CALL ;
@@ -179,7 +180,7 @@ public void reportNewIncomingCall(String uuid, String number, String callerName,
179
180
Log .d (TAG , "[RNCallKeepModule] reportNewIncomingCall, uuid: " + uuid + ", number: " + number + ", callerName: " + callerName );
180
181
// @TODO: handle video
181
182
182
- this .displayIncomingCall (uuid , number , callerName );
183
+ this .displayIncomingCall (uuid , number , callerName , hasVideo );
183
184
184
185
// Send event to JS
185
186
WritableMap args = Arguments .createMap ();
@@ -308,19 +309,25 @@ public void unregisterEvents() {
308
309
309
310
@ ReactMethod
310
311
public void displayIncomingCall (String uuid , String number , String callerName ) {
312
+ this .displayIncomingCall (uuid , number , callerName , false );
313
+ }
314
+
315
+ @ ReactMethod
316
+ public void displayIncomingCall (String uuid , String number , String callerName , boolean hasVideo ) {
311
317
if (!isConnectionServiceAvailable () || !hasPhoneAccount ()) {
312
318
Log .w (TAG , "[RNCallKeepModule] displayIncomingCall ignored due to no ConnectionService or no phone account" );
313
319
return ;
314
320
}
315
321
316
- Log .d (TAG , "[RNCallKeepModule] displayIncomingCall, uuid: " + uuid + ", number: " + number + ", callerName: " + callerName );
322
+ Log .d (TAG , "[RNCallKeepModule] displayIncomingCall, uuid: " + uuid + ", number: " + number + ", callerName: " + callerName + ", hasVideo: " + hasVideo );
317
323
318
324
Bundle extras = new Bundle ();
319
325
Uri uri = Uri .fromParts (PhoneAccount .SCHEME_TEL , number , null );
320
326
321
327
extras .putParcelable (TelecomManager .EXTRA_INCOMING_CALL_ADDRESS , uri );
322
328
extras .putString (EXTRA_CALLER_NAME , callerName );
323
329
extras .putString (EXTRA_CALL_UUID , uuid );
330
+ extras .putString (EXTRA_HAS_VIDEO , String .valueOf (hasVideo ));
324
331
325
332
telecomManager .addNewIncomingCall (handle , extras );
326
333
}
@@ -344,6 +351,11 @@ public void answerIncomingCall(String uuid) {
344
351
345
352
@ ReactMethod
346
353
public void startCall (String uuid , String number , String callerName ) {
354
+ this .startCall (uuid , number , callerName , false );
355
+ }
356
+
357
+ @ ReactMethod
358
+ public void startCall (String uuid , String number , String callerName , boolean hasVideo ) {
347
359
Log .d (TAG , "[RNCallKeepModule] startCall called, uuid: " + uuid + ", number: " + number + ", callerName: " + callerName );
348
360
349
361
if (!isConnectionServiceAvailable () || !hasPhoneAccount () || !hasPermissions () || number == null ) {
@@ -358,6 +370,7 @@ public void startCall(String uuid, String number, String callerName) {
358
370
callExtras .putString (EXTRA_CALLER_NAME , callerName );
359
371
callExtras .putString (EXTRA_CALL_UUID , uuid );
360
372
callExtras .putString (EXTRA_CALL_NUMBER , number );
373
+ callExtras .putString (EXTRA_HAS_VIDEO , String .valueOf (hasVideo ));
361
374
362
375
extras .putParcelable (TelecomManager .EXTRA_PHONE_ACCOUNT_HANDLE , handle );
363
376
extras .putParcelable (TelecomManager .EXTRA_OUTGOING_CALL_EXTRAS , callExtras );
@@ -1067,7 +1080,7 @@ public void onReceive(Context context, Intent intent) {
1067
1080
WritableMap args = Arguments .createMap ();
1068
1081
HashMap <String , String > attributeMap = (HashMap <String , String >)intent .getSerializableExtra ("attributeMap" );
1069
1082
1070
- Log .d (TAG , "[RNCallKeepModule][onReceive] : " + intent .getAction ());
1083
+ Log .d (TAG , "[RNCallKeepModule][onReceive] " + intent .getAction ());
1071
1084
1072
1085
switch (intent .getAction ()) {
1073
1086
case ACTION_END_CALL :
@@ -1076,6 +1089,7 @@ public void onReceive(Context context, Intent intent) {
1076
1089
break ;
1077
1090
case ACTION_ANSWER_CALL :
1078
1091
args .putString ("callUUID" , attributeMap .get (EXTRA_CALL_UUID ));
1092
+ args .putBoolean ("withVideo" , Boolean .valueOf (attributeMap .get (EXTRA_HAS_VIDEO )));
1079
1093
sendEventToJS ("RNCallKeepPerformAnswerCallAction" , args );
1080
1094
break ;
1081
1095
case ACTION_HOLD_CALL :
@@ -1119,6 +1133,7 @@ public void onReceive(Context context, Intent intent) {
1119
1133
args .putString ("handle" , attributeMap .get (EXTRA_CALL_NUMBER ));
1120
1134
args .putString ("callUUID" , attributeMap .get (EXTRA_CALL_UUID ));
1121
1135
args .putString ("name" , attributeMap .get (EXTRA_CALLER_NAME ));
1136
+ args .putString ("hasVideo" , attributeMap .get (EXTRA_HAS_VIDEO ));
1122
1137
sendEventToJS ("RNCallKeepShowIncomingCallUi" , args );
1123
1138
break ;
1124
1139
case ACTION_WAKE_APP :
0 commit comments