Skip to content

Commit 8693397

Browse files
committed
Add missing hasVideo attribute in some methods
1 parent 3e9a3ed commit 8693397

File tree

3 files changed

+21
-5
lines changed

3 files changed

+21
-5
lines changed

android/src/main/java/io/wazo/callkeep/Constants.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ public class Constants {
2222
public static final String EXTRA_CALL_NUMBER_SCHEMA = "EXTRA_CALL_NUMBER_SCHEMA";
2323
public static final String EXTRA_CALL_UUID = "EXTRA_CALL_UUID";
2424
public static final String EXTRA_CALLER_NAME = "EXTRA_CALLER_NAME";
25+
public static final String EXTRA_HAS_VIDEO = "EXTRA_HAS_VIDEO";
2526
// Can't use telecom.EXTRA_DISABLE_ADD_CALL ...
2627
public static final String EXTRA_DISABLE_ADD_CALL = "android.telecom.extra.DISABLE_ADD_CALL";
2728

android/src/main/java/io/wazo/callkeep/RNCallKeepModule.java

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@
8282
import static io.wazo.callkeep.Constants.EXTRA_CALLER_NAME;
8383
import static io.wazo.callkeep.Constants.EXTRA_CALL_UUID;
8484
import static io.wazo.callkeep.Constants.EXTRA_CALL_NUMBER;
85+
import static io.wazo.callkeep.Constants.EXTRA_HAS_VIDEO;
8586
import static io.wazo.callkeep.Constants.ACTION_END_CALL;
8687
import static io.wazo.callkeep.Constants.ACTION_ANSWER_CALL;
8788
import static io.wazo.callkeep.Constants.ACTION_MUTE_CALL;
@@ -179,7 +180,7 @@ public void reportNewIncomingCall(String uuid, String number, String callerName,
179180
Log.d(TAG, "[RNCallKeepModule] reportNewIncomingCall, uuid: " + uuid + ", number: " + number + ", callerName: " + callerName);
180181
// @TODO: handle video
181182

182-
this.displayIncomingCall(uuid, number, callerName);
183+
this.displayIncomingCall(uuid, number, callerName, hasVideo);
183184

184185
// Send event to JS
185186
WritableMap args = Arguments.createMap();
@@ -308,19 +309,25 @@ public void unregisterEvents() {
308309

309310
@ReactMethod
310311
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) {
311317
if (!isConnectionServiceAvailable() || !hasPhoneAccount()) {
312318
Log.w(TAG, "[RNCallKeepModule] displayIncomingCall ignored due to no ConnectionService or no phone account");
313319
return;
314320
}
315321

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);
317323

318324
Bundle extras = new Bundle();
319325
Uri uri = Uri.fromParts(PhoneAccount.SCHEME_TEL, number, null);
320326

321327
extras.putParcelable(TelecomManager.EXTRA_INCOMING_CALL_ADDRESS, uri);
322328
extras.putString(EXTRA_CALLER_NAME, callerName);
323329
extras.putString(EXTRA_CALL_UUID, uuid);
330+
extras.putString(EXTRA_HAS_VIDEO, String.valueOf(hasVideo));
324331

325332
telecomManager.addNewIncomingCall(handle, extras);
326333
}
@@ -344,6 +351,11 @@ public void answerIncomingCall(String uuid) {
344351

345352
@ReactMethod
346353
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) {
347359
Log.d(TAG, "[RNCallKeepModule] startCall called, uuid: " + uuid + ", number: " + number + ", callerName: " + callerName);
348360

349361
if (!isConnectionServiceAvailable() || !hasPhoneAccount() || !hasPermissions() || number == null) {
@@ -358,6 +370,7 @@ public void startCall(String uuid, String number, String callerName) {
358370
callExtras.putString(EXTRA_CALLER_NAME, callerName);
359371
callExtras.putString(EXTRA_CALL_UUID, uuid);
360372
callExtras.putString(EXTRA_CALL_NUMBER, number);
373+
callExtras.putString(EXTRA_HAS_VIDEO, String.valueOf(hasVideo));
361374

362375
extras.putParcelable(TelecomManager.EXTRA_PHONE_ACCOUNT_HANDLE, handle);
363376
extras.putParcelable(TelecomManager.EXTRA_OUTGOING_CALL_EXTRAS, callExtras);
@@ -1067,7 +1080,7 @@ public void onReceive(Context context, Intent intent) {
10671080
WritableMap args = Arguments.createMap();
10681081
HashMap<String, String> attributeMap = (HashMap<String, String>)intent.getSerializableExtra("attributeMap");
10691082

1070-
Log.d(TAG, "[RNCallKeepModule][onReceive] :" + intent.getAction());
1083+
Log.d(TAG, "[RNCallKeepModule][onReceive] " + intent.getAction());
10711084

10721085
switch (intent.getAction()) {
10731086
case ACTION_END_CALL:
@@ -1076,6 +1089,7 @@ public void onReceive(Context context, Intent intent) {
10761089
break;
10771090
case ACTION_ANSWER_CALL:
10781091
args.putString("callUUID", attributeMap.get(EXTRA_CALL_UUID));
1092+
args.putBoolean("withVideo", Boolean.valueOf(attributeMap.get(EXTRA_HAS_VIDEO)));
10791093
sendEventToJS("RNCallKeepPerformAnswerCallAction", args);
10801094
break;
10811095
case ACTION_HOLD_CALL:
@@ -1119,6 +1133,7 @@ public void onReceive(Context context, Intent intent) {
11191133
args.putString("handle", attributeMap.get(EXTRA_CALL_NUMBER));
11201134
args.putString("callUUID", attributeMap.get(EXTRA_CALL_UUID));
11211135
args.putString("name", attributeMap.get(EXTRA_CALLER_NAME));
1136+
args.putString("hasVideo", attributeMap.get(EXTRA_HAS_VIDEO));
11221137
sendEventToJS("RNCallKeepShowIncomingCallUi", args);
11231138
break;
11241139
case ACTION_WAKE_APP:

index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ class RNCallKeep {
8888
options = null
8989
) => {
9090
if (!isIOS) {
91-
RNCallKeepModule.displayIncomingCall(uuid, handle, localizedCallerName);
91+
RNCallKeepModule.displayIncomingCall(uuid, handle, localizedCallerName, hasVideo);
9292
return;
9393
}
9494

@@ -117,7 +117,7 @@ class RNCallKeep {
117117

118118
startCall = (uuid, handle, contactIdentifier, handleType = 'number', hasVideo = false) => {
119119
if (!isIOS) {
120-
RNCallKeepModule.startCall(uuid, handle, contactIdentifier);
120+
RNCallKeepModule.startCall(uuid, handle, contactIdentifier, hasVideo);
121121
return;
122122
}
123123

0 commit comments

Comments
 (0)