mirror of
https://github.com/oxen-io/session-android.git
synced 2025-06-08 18:28:33 +00:00
Add Calling Requests.
This commit is contained in:
parent
5a12eedc2c
commit
1e250ee95c
@ -304,7 +304,7 @@ dependencies {
|
|||||||
|
|
||||||
implementation 'org.signal:argon2:13.1@aar'
|
implementation 'org.signal:argon2:13.1@aar'
|
||||||
|
|
||||||
implementation 'org.signal:ringrtc-android:2.2.0'
|
implementation 'org.signal:ringrtc-android:2.3.1'
|
||||||
|
|
||||||
implementation "me.leolin:ShortcutBadger:1.1.16"
|
implementation "me.leolin:ShortcutBadger:1.1.16"
|
||||||
implementation 'se.emilsjolander:stickylistheaders:2.7.0'
|
implementation 'se.emilsjolander:stickylistheaders:2.7.0'
|
||||||
|
@ -122,6 +122,12 @@
|
|||||||
android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation"
|
android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation"
|
||||||
android:launchMode="singleTask"/>
|
android:launchMode="singleTask"/>
|
||||||
|
|
||||||
|
<activity android:name=".messagerequests.CalleeMustAcceptMessageRequestActivity"
|
||||||
|
android:theme="@style/TextSecure.DarkNoActionBar"
|
||||||
|
android:screenOrientation="portrait"
|
||||||
|
android:noHistory="true"
|
||||||
|
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
||||||
|
|
||||||
<activity android:name=".InviteActivity"
|
<activity android:name=".InviteActivity"
|
||||||
android:theme="@style/Signal.Light.NoActionBar.Invite"
|
android:theme="@style/Signal.Light.NoActionBar.Invite"
|
||||||
android:windowSoftInputMode="stateHidden"
|
android:windowSoftInputMode="stateHidden"
|
||||||
|
@ -51,6 +51,7 @@ import org.thoughtcrime.securesms.components.webrtc.WebRtcCallViewModel;
|
|||||||
import org.thoughtcrime.securesms.crypto.storage.TextSecureIdentityKeyStore;
|
import org.thoughtcrime.securesms.crypto.storage.TextSecureIdentityKeyStore;
|
||||||
import org.thoughtcrime.securesms.events.WebRtcViewModel;
|
import org.thoughtcrime.securesms.events.WebRtcViewModel;
|
||||||
import org.thoughtcrime.securesms.logging.Log;
|
import org.thoughtcrime.securesms.logging.Log;
|
||||||
|
import org.thoughtcrime.securesms.messagerequests.CalleeMustAcceptMessageRequestActivity;
|
||||||
import org.thoughtcrime.securesms.permissions.Permissions;
|
import org.thoughtcrime.securesms.permissions.Permissions;
|
||||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||||
import org.thoughtcrime.securesms.ringrtc.RemotePeer;
|
import org.thoughtcrime.securesms.ringrtc.RemotePeer;
|
||||||
@ -391,6 +392,9 @@ public class WebRtcCallActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
EventBus.getDefault().removeStickyEvent(WebRtcViewModel.class);
|
EventBus.getDefault().removeStickyEvent(WebRtcViewModel.class);
|
||||||
|
|
||||||
|
if (hangupType == HangupMessage.Type.NEED_PERMISSION) {
|
||||||
|
startActivity(CalleeMustAcceptMessageRequestActivity.createIntent(this, recipient.getId()));
|
||||||
|
}
|
||||||
delayedFinish();
|
delayedFinish();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -517,6 +521,7 @@ public class WebRtcCallActivity extends AppCompatActivity {
|
|||||||
case CALL_ACCEPTED_ELSEWHERE: handleTerminate(event.getRecipient(), HangupMessage.Type.ACCEPTED); break;
|
case CALL_ACCEPTED_ELSEWHERE: handleTerminate(event.getRecipient(), HangupMessage.Type.ACCEPTED); break;
|
||||||
case CALL_DECLINED_ELSEWHERE: handleTerminate(event.getRecipient(), HangupMessage.Type.DECLINED); break;
|
case CALL_DECLINED_ELSEWHERE: handleTerminate(event.getRecipient(), HangupMessage.Type.DECLINED); break;
|
||||||
case CALL_ONGOING_ELSEWHERE: handleTerminate(event.getRecipient(), HangupMessage.Type.BUSY); break;
|
case CALL_ONGOING_ELSEWHERE: handleTerminate(event.getRecipient(), HangupMessage.Type.BUSY); break;
|
||||||
|
case CALL_NEEDS_PERMISSION: handleTerminate(event.getRecipient(), HangupMessage.Type.NEED_PERMISSION); break;
|
||||||
case NO_SUCH_USER: handleNoSuchUser(event); break;
|
case NO_SUCH_USER: handleNoSuchUser(event); break;
|
||||||
case RECIPIENT_UNAVAILABLE: handleRecipientUnavailable(event); break;
|
case RECIPIENT_UNAVAILABLE: handleRecipientUnavailable(event); break;
|
||||||
case CALL_INCOMING: handleIncomingCall(event); break;
|
case CALL_INCOMING: handleIncomingCall(event); break;
|
||||||
|
@ -286,6 +286,7 @@ public class WebRtcCallView extends FrameLayout {
|
|||||||
public void setStatusFromHangupType(@NonNull HangupMessage.Type hangupType) {
|
public void setStatusFromHangupType(@NonNull HangupMessage.Type hangupType) {
|
||||||
switch (hangupType) {
|
switch (hangupType) {
|
||||||
case NORMAL:
|
case NORMAL:
|
||||||
|
case NEED_PERMISSION:
|
||||||
status.setText(R.string.RedPhone_ending_call);
|
status.setText(R.string.RedPhone_ending_call);
|
||||||
break;
|
break;
|
||||||
case ACCEPTED:
|
case ACCEPTED:
|
||||||
|
@ -621,13 +621,13 @@ public class SmsDatabase extends MessagingDatabase {
|
|||||||
long messageId = db.insert(TABLE_NAME, null, values);
|
long messageId = db.insert(TABLE_NAME, null, values);
|
||||||
|
|
||||||
DatabaseFactory.getThreadDatabase(context).update(threadId, true);
|
DatabaseFactory.getThreadDatabase(context).update(threadId, true);
|
||||||
notifyConversationListeners(threadId);
|
|
||||||
ApplicationDependencies.getJobManager().add(new TrimThreadJob(threadId));
|
|
||||||
|
|
||||||
if (unread) {
|
if (unread) {
|
||||||
DatabaseFactory.getThreadDatabase(context).incrementUnread(threadId, 1);
|
DatabaseFactory.getThreadDatabase(context).incrementUnread(threadId, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
notifyConversationListeners(threadId);
|
||||||
|
ApplicationDependencies.getJobManager().add(new TrimThreadJob(threadId));
|
||||||
|
|
||||||
return new Pair<>(messageId, threadId);
|
return new Pair<>(messageId, threadId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -311,7 +311,11 @@ public class ThreadDatabase extends Database {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasCalledSince(@NonNull Recipient recipient, long timestamp) {
|
public boolean hasCalledSince(@NonNull Recipient recipient, long timestamp) {
|
||||||
return DatabaseFactory.getMmsSmsDatabase(context).hasReceivedAnyCallsSince(getThreadIdFor(recipient), timestamp);
|
return hasReceivedAnyCallsSince(getThreadIdFor(recipient), timestamp);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasReceivedAnyCallsSince(long threadId, long timestamp) {
|
||||||
|
return DatabaseFactory.getMmsSmsDatabase(context).hasReceivedAnyCallsSince(threadId, timestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<MarkedMessageInfo> setEntireThreadRead(long threadId) {
|
public List<MarkedMessageInfo> setEntireThreadRead(long threadId) {
|
||||||
|
@ -19,6 +19,7 @@ public class WebRtcViewModel {
|
|||||||
CALL_RINGING,
|
CALL_RINGING,
|
||||||
CALL_BUSY,
|
CALL_BUSY,
|
||||||
CALL_DISCONNECTED,
|
CALL_DISCONNECTED,
|
||||||
|
CALL_NEEDS_PERMISSION,
|
||||||
|
|
||||||
// Error states
|
// Error states
|
||||||
NETWORK_FAILURE,
|
NETWORK_FAILURE,
|
||||||
|
@ -1,20 +1,18 @@
|
|||||||
package org.thoughtcrime.securesms.messagerequests;
|
package org.thoughtcrime.securesms.messagerequests;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.fragment.app.DialogFragment;
|
|
||||||
import androidx.lifecycle.ViewModelProviders;
|
import androidx.lifecycle.ViewModelProviders;
|
||||||
|
|
||||||
|
import org.thoughtcrime.securesms.BaseActivity;
|
||||||
import org.thoughtcrime.securesms.R;
|
import org.thoughtcrime.securesms.R;
|
||||||
import org.thoughtcrime.securesms.components.AvatarImageView;
|
import org.thoughtcrime.securesms.components.AvatarImageView;
|
||||||
import org.thoughtcrime.securesms.contacts.avatars.FallbackContactPhoto;
|
import org.thoughtcrime.securesms.contacts.avatars.FallbackContactPhoto;
|
||||||
@ -25,56 +23,45 @@ import org.thoughtcrime.securesms.recipients.RecipientId;
|
|||||||
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
public class CalleeMustAcceptMessageRequestDialogFragment extends DialogFragment {
|
import static android.content.Intent.FLAG_ACTIVITY_NO_ANIMATION;
|
||||||
|
|
||||||
|
public class CalleeMustAcceptMessageRequestActivity extends BaseActivity {
|
||||||
|
|
||||||
private static final long TIMEOUT_MS = TimeUnit.SECONDS.toMillis(10);
|
private static final long TIMEOUT_MS = TimeUnit.SECONDS.toMillis(10);
|
||||||
private static final String ARG_RECIPIENT_ID = "arg.recipient.id";
|
private static final String RECIPIENT_ID_EXTRA = "extra.recipient.id";
|
||||||
|
|
||||||
private TextView description;
|
private TextView description;
|
||||||
private AvatarImageView avatar;
|
private AvatarImageView avatar;
|
||||||
private View okay;
|
private View okay;
|
||||||
|
|
||||||
private final Handler handler = new Handler(Looper.getMainLooper());
|
private final Handler handler = new Handler(Looper.getMainLooper());
|
||||||
private final Runnable dismisser = this::dismiss;
|
private final Runnable finisher = this::finish;
|
||||||
|
|
||||||
public static DialogFragment create(@NonNull RecipientId recipientId) {
|
public static Intent createIntent(@NonNull Context context, @NonNull RecipientId recipientId) {
|
||||||
DialogFragment fragment = new CalleeMustAcceptMessageRequestDialogFragment();
|
Intent intent = new Intent(context, CalleeMustAcceptMessageRequestActivity.class);
|
||||||
Bundle args = new Bundle();
|
intent.setFlags(FLAG_ACTIVITY_NO_ANIMATION);
|
||||||
|
intent.putExtra(RECIPIENT_ID_EXTRA, recipientId);
|
||||||
args.putParcelable(ARG_RECIPIENT_ID, recipientId);
|
return intent;
|
||||||
|
|
||||||
fragment.setArguments(args);
|
|
||||||
|
|
||||||
return fragment;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.callee_must_accept_message_request_dialog_fragment);
|
||||||
|
|
||||||
setStyle(DialogFragment.STYLE_NO_FRAME, R.style.TextSecure_DarkNoActionBar);
|
description = findViewById(R.id.description);
|
||||||
}
|
avatar = findViewById(R.id.avatar);
|
||||||
|
okay = findViewById(R.id.okay);
|
||||||
@Override
|
|
||||||
public @Nullable View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
|
||||||
return inflater.inflate(R.layout.callee_must_accept_message_request_dialog_fragment, container, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
|
||||||
description = view.findViewById(R.id.description);
|
|
||||||
avatar = view.findViewById(R.id.avatar);
|
|
||||||
okay = view.findViewById(R.id.okay);
|
|
||||||
|
|
||||||
avatar.setFallbackPhotoProvider(new FallbackPhotoProvider());
|
avatar.setFallbackPhotoProvider(new FallbackPhotoProvider());
|
||||||
okay.setOnClickListener(v -> dismiss());
|
okay.setOnClickListener(v -> finish());
|
||||||
|
|
||||||
RecipientId recipientId = requireArguments().getParcelable(ARG_RECIPIENT_ID);
|
RecipientId recipientId = getIntent().getParcelableExtra(RECIPIENT_ID_EXTRA);
|
||||||
CalleeMustAcceptMessageRequestViewModel.Factory factory = new CalleeMustAcceptMessageRequestViewModel.Factory(recipientId);
|
CalleeMustAcceptMessageRequestViewModel.Factory factory = new CalleeMustAcceptMessageRequestViewModel.Factory(recipientId);
|
||||||
CalleeMustAcceptMessageRequestViewModel viewModel = ViewModelProviders.of(this, factory).get(CalleeMustAcceptMessageRequestViewModel.class);
|
CalleeMustAcceptMessageRequestViewModel viewModel = ViewModelProviders.of(this, factory).get(CalleeMustAcceptMessageRequestViewModel.class);
|
||||||
|
|
||||||
viewModel.getRecipient().observe(getViewLifecycleOwner(), recipient -> {
|
viewModel.getRecipient().observe(this, recipient -> {
|
||||||
description.setText(getString(R.string.CalleeMustAcceptMessageRequestDialogFragment__s_will_get_a_message_request_from_you, recipient.getDisplayName(requireContext())));
|
description.setText(getString(R.string.CalleeMustAcceptMessageRequestDialogFragment__s_will_get_a_message_request_from_you, recipient.getDisplayName(this)));
|
||||||
avatar.setAvatar(GlideApp.with(this), recipient, false);
|
avatar.setAvatar(GlideApp.with(this), recipient, false);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -83,14 +70,14 @@ public class CalleeMustAcceptMessageRequestDialogFragment extends DialogFragment
|
|||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
|
||||||
handler.postDelayed(dismisser, TIMEOUT_MS);
|
handler.postDelayed(finisher, TIMEOUT_MS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPause() {
|
public void onPause() {
|
||||||
super.onPause();
|
super.onPause();
|
||||||
|
|
||||||
handler.removeCallbacks(dismisser);
|
handler.removeCallbacks(finisher);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class FallbackPhotoProvider extends Recipient.FallbackPhotoProvider {
|
private static class FallbackPhotoProvider extends Recipient.FallbackPhotoProvider {
|
@ -190,7 +190,7 @@ public class RecipientUtil {
|
|||||||
threadRecipient.isForceSmsSelection() ||
|
threadRecipient.isForceSmsSelection() ||
|
||||||
!threadRecipient.isRegistered() ||
|
!threadRecipient.isRegistered() ||
|
||||||
hasSentMessageInThread(context, threadId) ||
|
hasSentMessageInThread(context, threadId) ||
|
||||||
noSecureMessagesInThread(context, threadId) ||
|
noSecureMessagesAndNoCallsInThread(context, threadId) ||
|
||||||
isPreMessageRequestThread(context, threadId);
|
isPreMessageRequestThread(context, threadId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -200,8 +200,9 @@ public class RecipientUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@WorkerThread
|
@WorkerThread
|
||||||
private static boolean noSecureMessagesInThread(@NonNull Context context, long threadId) {
|
private static boolean noSecureMessagesAndNoCallsInThread(@NonNull Context context, long threadId) {
|
||||||
return DatabaseFactory.getMmsSmsDatabase(context).getSecureConversationCount(threadId) == 0;
|
return DatabaseFactory.getMmsSmsDatabase(context).getSecureConversationCount(threadId) == 0 &&
|
||||||
|
!DatabaseFactory.getThreadDatabase(context).hasReceivedAnyCallsSince(threadId, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@WorkerThread
|
@WorkerThread
|
||||||
|
@ -150,6 +150,7 @@ public class WebRtcCallService extends Service implements CallManager.Observer,
|
|||||||
public static final String ACTION_ENDED_REMOTE_HANGUP_ACCEPTED = "ENDED_REMOTE_HANGUP_ACCEPTED";
|
public static final String ACTION_ENDED_REMOTE_HANGUP_ACCEPTED = "ENDED_REMOTE_HANGUP_ACCEPTED";
|
||||||
public static final String ACTION_ENDED_REMOTE_HANGUP_DECLINED = "ENDED_REMOTE_HANGUP_DECLINED";
|
public static final String ACTION_ENDED_REMOTE_HANGUP_DECLINED = "ENDED_REMOTE_HANGUP_DECLINED";
|
||||||
public static final String ACTION_ENDED_REMOTE_HANGUP_BUSY = "ENDED_REMOTE_HANGUP_BUSY";
|
public static final String ACTION_ENDED_REMOTE_HANGUP_BUSY = "ENDED_REMOTE_HANGUP_BUSY";
|
||||||
|
public static final String ACTION_ENDED_REMOTE_HANGUP_NEED_PERMISSION = "ENDED_REMOTE_HANGUP_NEED_PERMISSION";
|
||||||
public static final String ACTION_ENDED_REMOTE_BUSY = "ENDED_REMOTE_BUSY";
|
public static final String ACTION_ENDED_REMOTE_BUSY = "ENDED_REMOTE_BUSY";
|
||||||
public static final String ACTION_ENDED_REMOTE_GLARE = "ENDED_REMOTE_GLARE";
|
public static final String ACTION_ENDED_REMOTE_GLARE = "ENDED_REMOTE_GLARE";
|
||||||
public static final String ACTION_ENDED_TIMEOUT = "ENDED_TIMEOUT";
|
public static final String ACTION_ENDED_TIMEOUT = "ENDED_TIMEOUT";
|
||||||
@ -247,6 +248,7 @@ public class WebRtcCallService extends Service implements CallManager.Observer,
|
|||||||
else if (intent.getAction().equals(ACTION_ENDED_REMOTE_HANGUP_BUSY)) handleEndedRemoteHangupBusy(intent);
|
else if (intent.getAction().equals(ACTION_ENDED_REMOTE_HANGUP_BUSY)) handleEndedRemoteHangupBusy(intent);
|
||||||
else if (intent.getAction().equals(ACTION_ENDED_REMOTE_HANGUP_DECLINED)) handleEndedRemoteHangupDeclined(intent);
|
else if (intent.getAction().equals(ACTION_ENDED_REMOTE_HANGUP_DECLINED)) handleEndedRemoteHangupDeclined(intent);
|
||||||
else if (intent.getAction().equals(ACTION_ENDED_REMOTE_BUSY)) handleEndedRemoteBusy(intent);
|
else if (intent.getAction().equals(ACTION_ENDED_REMOTE_BUSY)) handleEndedRemoteBusy(intent);
|
||||||
|
else if (intent.getAction().equals(ACTION_ENDED_REMOTE_HANGUP_NEED_PERMISSION)) handleEndedRemoteNeedPermission(intent);
|
||||||
else if (intent.getAction().equals(ACTION_ENDED_REMOTE_GLARE)) handleEndedRemoteGlare(intent);
|
else if (intent.getAction().equals(ACTION_ENDED_REMOTE_GLARE)) handleEndedRemoteGlare(intent);
|
||||||
else if (intent.getAction().equals(ACTION_ENDED_TIMEOUT)) handleEndedTimeout(intent);
|
else if (intent.getAction().equals(ACTION_ENDED_TIMEOUT)) handleEndedTimeout(intent);
|
||||||
else if (intent.getAction().equals(ACTION_ENDED_INTERNAL_FAILURE)) handleEndedInternalFailure(intent);
|
else if (intent.getAction().equals(ACTION_ENDED_INTERNAL_FAILURE)) handleEndedInternalFailure(intent);
|
||||||
@ -403,9 +405,10 @@ public class WebRtcCallService extends Service implements CallManager.Observer,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (offerType == OfferMessage.Type.NEED_PERMISSION || FeatureFlags.profileForCalling() && !remotePeer.getRecipient().resolve().isProfileSharing()) {
|
if (FeatureFlags.profileForCalling() && (remotePeer.getRecipient() == null || !RecipientUtil.isMessageRequestAccepted(getApplicationContext(), remotePeer.getRecipient()))) {
|
||||||
Log.i(TAG, "handleReceivedOffer(): Caller is untrusted.");
|
Log.i(TAG, "handleReceivedOffer(): Caller is untrusted.");
|
||||||
intent.putExtra(EXTRA_BROADCAST, true);
|
intent.putExtra(EXTRA_BROADCAST, true);
|
||||||
|
intent.putExtra(EXTRA_HANGUP_TYPE, HangupMessage.Type.NEED_PERMISSION.getCode());
|
||||||
handleSendHangup(intent);
|
handleSendHangup(intent);
|
||||||
insertMissedCall(remotePeer, true);
|
insertMissedCall(remotePeer, true);
|
||||||
return;
|
return;
|
||||||
@ -706,11 +709,6 @@ public class WebRtcCallService extends Service implements CallManager.Observer,
|
|||||||
|
|
||||||
Log.i(TAG, "handleSendOffer: id: " + callId.format(remoteDevice));
|
Log.i(TAG, "handleSendOffer: id: " + callId.format(remoteDevice));
|
||||||
|
|
||||||
if (FeatureFlags.profileForCalling() && remotePeer.getRecipient().resolve().getProfileKey() == null) {
|
|
||||||
offer = "";
|
|
||||||
offerType = OfferMessage.Type.NEED_PERMISSION;
|
|
||||||
}
|
|
||||||
|
|
||||||
OfferMessage offerMessage = new OfferMessage(callId.longValue(), offer, offerType);
|
OfferMessage offerMessage = new OfferMessage(callId.longValue(), offer, offerType);
|
||||||
Integer destinationDeviceId = broadcast ? null : remoteDevice;
|
Integer destinationDeviceId = broadcast ? null : remoteDevice;
|
||||||
SignalServiceCallMessage callMessage = SignalServiceCallMessage.forOffer(offerMessage, true, destinationDeviceId);
|
SignalServiceCallMessage callMessage = SignalServiceCallMessage.forOffer(offerMessage, true, destinationDeviceId);
|
||||||
@ -1137,6 +1135,16 @@ public class WebRtcCallService extends Service implements CallManager.Observer,
|
|||||||
}, WebRtcCallActivity.BUSY_SIGNAL_DELAY_FINISH);
|
}, WebRtcCallActivity.BUSY_SIGNAL_DELAY_FINISH);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void handleEndedRemoteNeedPermission(Intent intent) {
|
||||||
|
RemotePeer remotePeer = getRemotePeer(intent);
|
||||||
|
|
||||||
|
Log.i(TAG, "handleEndedRemoteNeedPermission(): call_id: " + remotePeer.getCallId());
|
||||||
|
|
||||||
|
if (remotePeer.callIdEquals(activePeer)) {
|
||||||
|
sendMessage(WebRtcViewModel.State.CALL_NEEDS_PERMISSION, remotePeer, localCameraState, remoteVideoEnabled, bluetoothAvailable, microphoneEnabled, isRemoteVideoOffer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void handleEndedRemoteGlare(Intent intent) {
|
private void handleEndedRemoteGlare(Intent intent) {
|
||||||
RemotePeer remotePeer = getRemotePeer(intent);
|
RemotePeer remotePeer = getRemotePeer(intent);
|
||||||
|
|
||||||
@ -1386,6 +1394,8 @@ public class WebRtcCallService extends Service implements CallManager.Observer,
|
|||||||
return CallManager.HangupType.NORMAL;
|
return CallManager.HangupType.NORMAL;
|
||||||
case DECLINED:
|
case DECLINED:
|
||||||
return CallManager.HangupType.DECLINED;
|
return CallManager.HangupType.DECLINED;
|
||||||
|
case NEED_PERMISSION:
|
||||||
|
return CallManager.HangupType.NEED_PERMISSION;
|
||||||
default:
|
default:
|
||||||
throw new IllegalArgumentException("Unexpected hangup type: " + hangupType);
|
throw new IllegalArgumentException("Unexpected hangup type: " + hangupType);
|
||||||
}
|
}
|
||||||
@ -1401,6 +1411,8 @@ public class WebRtcCallService extends Service implements CallManager.Observer,
|
|||||||
return HangupMessage.Type.NORMAL;
|
return HangupMessage.Type.NORMAL;
|
||||||
case DECLINED:
|
case DECLINED:
|
||||||
return HangupMessage.Type.DECLINED;
|
return HangupMessage.Type.DECLINED;
|
||||||
|
case NEED_PERMISSION:
|
||||||
|
return HangupMessage.Type.NEED_PERMISSION;
|
||||||
default:
|
default:
|
||||||
throw new IllegalArgumentException("Unexpected hangup type: " + hangupType);
|
throw new IllegalArgumentException("Unexpected hangup type: " + hangupType);
|
||||||
}
|
}
|
||||||
@ -1723,6 +1735,9 @@ public class WebRtcCallService extends Service implements CallManager.Observer,
|
|||||||
case ENDED_REMOTE_HANGUP:
|
case ENDED_REMOTE_HANGUP:
|
||||||
intent.setAction(ACTION_ENDED_REMOTE_HANGUP);
|
intent.setAction(ACTION_ENDED_REMOTE_HANGUP);
|
||||||
break;
|
break;
|
||||||
|
case ENDED_REMOTE_HANGUP_NEED_PERMISSION:
|
||||||
|
intent.setAction(ACTION_ENDED_REMOTE_HANGUP_NEED_PERMISSION);
|
||||||
|
break;
|
||||||
case ENDED_REMOTE_HANGUP_ACCEPTED:
|
case ENDED_REMOTE_HANGUP_ACCEPTED:
|
||||||
intent.setAction(ACTION_ENDED_REMOTE_HANGUP_ACCEPTED);
|
intent.setAction(ACTION_ENDED_REMOTE_HANGUP_ACCEPTED);
|
||||||
break;
|
break;
|
||||||
|
@ -25,7 +25,6 @@ import org.thoughtcrime.securesms.WebRtcCallActivity;
|
|||||||
import org.thoughtcrime.securesms.conversation.ConversationActivity;
|
import org.thoughtcrime.securesms.conversation.ConversationActivity;
|
||||||
import org.thoughtcrime.securesms.database.DatabaseFactory;
|
import org.thoughtcrime.securesms.database.DatabaseFactory;
|
||||||
import org.thoughtcrime.securesms.logging.Log;
|
import org.thoughtcrime.securesms.logging.Log;
|
||||||
import org.thoughtcrime.securesms.messagerequests.CalleeMustAcceptMessageRequestDialogFragment;
|
|
||||||
import org.thoughtcrime.securesms.permissions.Permissions;
|
import org.thoughtcrime.securesms.permissions.Permissions;
|
||||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||||
import org.thoughtcrime.securesms.ringrtc.RemotePeer;
|
import org.thoughtcrime.securesms.ringrtc.RemotePeer;
|
||||||
@ -197,16 +196,11 @@ public class CommunicationActions {
|
|||||||
|
|
||||||
MessageSender.onMessageSent();
|
MessageSender.onMessageSent();
|
||||||
|
|
||||||
if (FeatureFlags.profileForCalling() && recipient.resolve().getProfileKey() == null) {
|
|
||||||
CalleeMustAcceptMessageRequestDialogFragment.create(recipient.getId())
|
|
||||||
.show(activity.getSupportFragmentManager(), null);
|
|
||||||
} else {
|
|
||||||
Intent activityIntent = new Intent(activity, WebRtcCallActivity.class);
|
Intent activityIntent = new Intent(activity, WebRtcCallActivity.class);
|
||||||
|
|
||||||
activityIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
activityIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
|
||||||
activity.startActivity(activityIntent);
|
activity.startActivity(activityIntent);
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.execute();
|
.execute();
|
||||||
}
|
}
|
||||||
@ -228,17 +222,12 @@ public class CommunicationActions {
|
|||||||
|
|
||||||
MessageSender.onMessageSent();
|
MessageSender.onMessageSent();
|
||||||
|
|
||||||
if (FeatureFlags.profileForCalling() && recipient.resolve().getProfileKey() == null) {
|
|
||||||
CalleeMustAcceptMessageRequestDialogFragment.create(recipient.getId())
|
|
||||||
.show(activity.getSupportFragmentManager(), null);
|
|
||||||
} else {
|
|
||||||
Intent activityIntent = new Intent(activity, WebRtcCallActivity.class);
|
Intent activityIntent = new Intent(activity, WebRtcCallActivity.class);
|
||||||
|
|
||||||
activityIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
activityIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||||
.putExtra(WebRtcCallActivity.EXTRA_ENABLE_VIDEO_IF_AVAILABLE, true);
|
.putExtra(WebRtcCallActivity.EXTRA_ENABLE_VIDEO_IF_AVAILABLE, true);
|
||||||
|
|
||||||
activity.startActivity(activityIntent);
|
activity.startActivity(activityIntent);
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.execute();
|
.execute();
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ public final class FeatureFlags {
|
|||||||
private static final String PINS_MEGAPHONE_KILL_SWITCH = "android.pinsMegaphoneKillSwitch";
|
private static final String PINS_MEGAPHONE_KILL_SWITCH = "android.pinsMegaphoneKillSwitch";
|
||||||
private static final String ATTACHMENTS_V3 = "android.attachmentsV3";
|
private static final String ATTACHMENTS_V3 = "android.attachmentsV3";
|
||||||
private static final String REMOTE_DELETE = "android.remoteDelete";
|
private static final String REMOTE_DELETE = "android.remoteDelete";
|
||||||
private static final String PROFILE_FOR_CALLING = "android.profileForCalling";
|
private static final String PROFILE_FOR_CALLING = "android.profileForCalling.2";
|
||||||
private static final String CALLING_PIP = "android.callingPip";
|
private static final String CALLING_PIP = "android.callingPip";
|
||||||
private static final String VERSIONED_PROFILES_1 = "android.versionedProfiles";
|
private static final String VERSIONED_PROFILES_1 = "android.versionedProfiles";
|
||||||
private static final String VERSIONED_PROFILES_2 = "android.versionedProfiles.2";
|
private static final String VERSIONED_PROFILES_2 = "android.versionedProfiles.2";
|
||||||
|
@ -432,8 +432,8 @@ dependencyVerification {
|
|||||||
['org.signal:argon2:13.1',
|
['org.signal:argon2:13.1',
|
||||||
'0f686ccff0d4842bfcc74d92e8dc780a5f159b9376e37a1189fabbcdac458bef'],
|
'0f686ccff0d4842bfcc74d92e8dc780a5f159b9376e37a1189fabbcdac458bef'],
|
||||||
|
|
||||||
['org.signal:ringrtc-android:2.2.0',
|
['org.signal:ringrtc-android:2.3.1',
|
||||||
'10da52bd63cb6c0ba45927928b0da3fd59621e3e698ef17f2dbbb1d3b293e80e'],
|
'2860e38b3e01c25ff23abdb848bd3fd772ffddb4387ea7838b71e2400da1648d'],
|
||||||
|
|
||||||
['org.signal:signal-metadata-java:0.1.2',
|
['org.signal:signal-metadata-java:0.1.2',
|
||||||
'6aaeb6a33bf3161a3e6ac9db7678277f7a4cf5a2c96b84342e4007ee49bab1bd'],
|
'6aaeb6a33bf3161a3e6ac9db7678277f7a4cf5a2c96b84342e4007ee49bab1bd'],
|
||||||
|
@ -37,7 +37,8 @@ public class HangupMessage {
|
|||||||
NORMAL("normal", SignalServiceProtos.CallMessage.Hangup.Type.HANGUP_NORMAL),
|
NORMAL("normal", SignalServiceProtos.CallMessage.Hangup.Type.HANGUP_NORMAL),
|
||||||
ACCEPTED("accepted", SignalServiceProtos.CallMessage.Hangup.Type.HANGUP_ACCEPTED),
|
ACCEPTED("accepted", SignalServiceProtos.CallMessage.Hangup.Type.HANGUP_ACCEPTED),
|
||||||
DECLINED("declined", SignalServiceProtos.CallMessage.Hangup.Type.HANGUP_DECLINED),
|
DECLINED("declined", SignalServiceProtos.CallMessage.Hangup.Type.HANGUP_DECLINED),
|
||||||
BUSY("busy", SignalServiceProtos.CallMessage.Hangup.Type.HANGUP_BUSY);
|
BUSY("busy", SignalServiceProtos.CallMessage.Hangup.Type.HANGUP_BUSY),
|
||||||
|
NEED_PERMISSION("need_permission", SignalServiceProtos.CallMessage.Hangup.Type.HANGUP_NEED_PERMISSION);
|
||||||
|
|
||||||
private final String code;
|
private final String code;
|
||||||
private final SignalServiceProtos.CallMessage.Hangup.Type protoType;
|
private final SignalServiceProtos.CallMessage.Hangup.Type protoType;
|
||||||
|
@ -29,8 +29,7 @@ public class OfferMessage {
|
|||||||
|
|
||||||
public enum Type {
|
public enum Type {
|
||||||
AUDIO_CALL("audio_call", SignalServiceProtos.CallMessage.Offer.Type.OFFER_AUDIO_CALL),
|
AUDIO_CALL("audio_call", SignalServiceProtos.CallMessage.Offer.Type.OFFER_AUDIO_CALL),
|
||||||
VIDEO_CALL("video_call", SignalServiceProtos.CallMessage.Offer.Type.OFFER_VIDEO_CALL),
|
VIDEO_CALL("video_call", SignalServiceProtos.CallMessage.Offer.Type.OFFER_VIDEO_CALL);
|
||||||
NEED_PERMISSION("need_permission", SignalServiceProtos.CallMessage.Offer.Type.OFFER_NEED_PERMISSION);
|
|
||||||
|
|
||||||
private final String code;
|
private final String code;
|
||||||
private final SignalServiceProtos.CallMessage.Offer.Type protoType;
|
private final SignalServiceProtos.CallMessage.Offer.Type protoType;
|
||||||
|
@ -46,7 +46,7 @@ message CallMessage {
|
|||||||
enum Type {
|
enum Type {
|
||||||
OFFER_AUDIO_CALL = 0;
|
OFFER_AUDIO_CALL = 0;
|
||||||
OFFER_VIDEO_CALL = 1;
|
OFFER_VIDEO_CALL = 1;
|
||||||
OFFER_NEED_PERMISSION = 2;
|
// 2 is reserved, removed OFFER_NEED_PERMISSION
|
||||||
}
|
}
|
||||||
|
|
||||||
optional uint64 id = 1;
|
optional uint64 id = 1;
|
||||||
@ -76,6 +76,7 @@ message CallMessage {
|
|||||||
HANGUP_ACCEPTED = 1;
|
HANGUP_ACCEPTED = 1;
|
||||||
HANGUP_DECLINED = 2;
|
HANGUP_DECLINED = 2;
|
||||||
HANGUP_BUSY = 3;
|
HANGUP_BUSY = 3;
|
||||||
|
HANGUP_NEED_PERMISSION = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
optional uint64 id = 1;
|
optional uint64 id = 1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user