From 6c95b766d6091c78e64b055c2f64ee6784720f0b Mon Sep 17 00:00:00 2001 From: Cody Henthorne Date: Mon, 26 Jun 2023 10:20:08 -0400 Subject: [PATCH] Fix answer audio call and video starting bug. --- .../securesms/WebRtcCallActivity.java | 36 ++++++++----------- app/src/main/res/values/strings.xml | 3 +- 2 files changed, 17 insertions(+), 22 deletions(-) diff --git a/app/src/main/java/org/thoughtcrime/securesms/WebRtcCallActivity.java b/app/src/main/java/org/thoughtcrime/securesms/WebRtcCallActivity.java index ebb27c73d9..8287e57e86 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/WebRtcCallActivity.java +++ b/app/src/main/java/org/thoughtcrime/securesms/WebRtcCallActivity.java @@ -114,7 +114,7 @@ public class WebRtcCallActivity extends BaseActivity implements SafetyNumberChan /** * ANSWER the call via video. */ - public static final String ANSWER_VIDEO_ACTION = WebRtcCallActivity.class.getCanonicalName() + ".ANSWER_ACTION"; + public static final String ANSWER_VIDEO_ACTION = WebRtcCallActivity.class.getCanonicalName() + ".ANSWER_VIDEO_ACTION"; public static final String DENY_ACTION = WebRtcCallActivity.class.getCanonicalName() + ".DENY_ACTION"; public static final String END_CALL_ACTION = WebRtcCallActivity.class.getCanonicalName() + ".END_CALL_ACTION"; @@ -169,8 +169,6 @@ public class WebRtcCallActivity extends BaseActivity implements SafetyNumberChan initializeViewModel(isLandscapeEnabled); initializePictureInPictureParams(); - processIntent(getIntent()); - if (ANSWER_VIDEO_ACTION.equals(getIntent().getAction())) { enableVideoIfAvailable = true; } else if (ANSWER_ACTION.equals(getIntent().getAction()) || getIntent().getBooleanExtra(EXTRA_STARTED_FROM_FULLSCREEN, false)) { @@ -180,6 +178,8 @@ public class WebRtcCallActivity extends BaseActivity implements SafetyNumberChan getIntent().removeExtra(EXTRA_ENABLE_VIDEO_IF_AVAILABLE); } + processIntent(getIntent()); + windowLayoutInfoConsumer = new WindowLayoutInfoConsumer(); windowInfoTrackerCallbackAdapter = new WindowInfoTrackerCallbackAdapter(WindowInfoTracker.getOrCreate(this)); @@ -516,26 +516,20 @@ public class WebRtcCallActivity extends BaseActivity implements SafetyNumberChan } private void handleAnswerWithVideo() { - Recipient recipient = viewModel.getRecipient().get(); + Permissions.with(this) + .request(Manifest.permission.RECORD_AUDIO, Manifest.permission.CAMERA) + .ifNecessary() + .withRationaleDialog(getString(R.string.WebRtcCallActivity_to_answer_the_call_give_signal_access_to_your_microphone_and_camera), R.drawable.ic_mic_solid_24, R.drawable.ic_video_solid_24_tinted) + .withPermanentDenialDialog(getString(R.string.WebRtcCallActivity_signal_requires_microphone_and_camera_permissions_in_order_to_make_or_receive_calls)) + .onAllGranted(() -> { + callScreen.setStatus(getString(R.string.RedPhone_answering)); - if (!recipient.equals(Recipient.UNKNOWN)) { - Permissions.with(this) - .request(Manifest.permission.RECORD_AUDIO, Manifest.permission.CAMERA) - .ifNecessary() - .withRationaleDialog(getString(R.string.WebRtcCallActivity_to_answer_the_call_from_s_give_signal_access_to_your_microphone, recipient.getDisplayName(this)), - R.drawable.ic_mic_solid_24, R.drawable.ic_video_solid_24_tinted) - .withPermanentDenialDialog(getString(R.string.WebRtcCallActivity_signal_requires_microphone_and_camera_permissions_in_order_to_make_or_receive_calls)) - .onAllGranted(() -> { - callScreen.setRecipient(recipient); - callScreen.setStatus(getString(R.string.RedPhone_answering)); + ApplicationDependencies.getSignalCallManager().acceptCall(true); - ApplicationDependencies.getSignalCallManager().acceptCall(true); - - handleSetMuteVideo(false); - }) - .onAnyDenied(this::handleDenyCall) - .execute(); - } + handleSetMuteVideo(false); + }) + .onAnyDenied(this::handleDenyCall) + .execute(); } private void handleDenyCall() { diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 0552654f81..b73b23a5e5 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -2317,7 +2317,8 @@ To answer the call, give Signal access to your microphone. - To answer the call from %s, give Signal access to your microphone. + + To answer the video call, give Signal access to your microphone and camera. Signal requires Microphone and Camera permissions in order to make or receive calls, but they have been permanently denied. Please continue to app settings, select \"Permissions\", and enable \"Microphone\" and \"Camera\". Answered on a linked device. Declined on a linked device.