Allow call links to exist in the calls tab.

This commit is contained in:
Alex Hart
2023-05-22 13:48:41 -03:00
committed by Nicholas
parent 97d95f37cc
commit 987f9b9dba
29 changed files with 657 additions and 117 deletions

View File

@@ -52,8 +52,8 @@ public class IdleActionProcessor extends WebRtcActionProcessor {
Log.i(TAG, "handleOutgoingCall():");
Recipient recipient = Recipient.resolved(remotePeer.getId());
if (recipient.isGroup()) {
Log.w(TAG, "Aborting attempt to start 1:1 call for group recipient: " + remotePeer.getId());
if (recipient.isGroup() || recipient.isCallLink()) {
Log.w(TAG, "Aborting attempt to start 1:1 call for group or call link recipient: " + remotePeer.getId());
return currentState;
}
@@ -65,7 +65,7 @@ public class IdleActionProcessor extends WebRtcActionProcessor {
protected @NonNull WebRtcServiceState handlePreJoinCall(@NonNull WebRtcServiceState currentState, @NonNull RemotePeer remotePeer) {
Log.i(TAG, "handlePreJoinCall():");
boolean isGroupCall = remotePeer.getRecipient().isPushV2Group();
boolean isGroupCall = remotePeer.getRecipient().isPushV2Group() || remotePeer.getRecipient().isCallLink();
WebRtcActionProcessor processor = isGroupCall ? new GroupPreJoinActionProcessor(webRtcInteractor)
: new PreJoinActionProcessor(webRtcInteractor);

View File

@@ -8,14 +8,39 @@ package org.thoughtcrime.securesms.service.webrtc.links
import android.os.Parcelable
import com.google.protobuf.ByteString
import kotlinx.parcelize.Parcelize
import org.signal.core.util.Serializer
import org.signal.ringrtc.CallLinkRootKey
import org.thoughtcrime.securesms.util.Base64
@Parcelize
class CallLinkRoomId private constructor(private val roomId: ByteArray) : Parcelable {
fun serialize(): String = Base64.encodeBytes(roomId)
fun serialize(): String = DatabaseSerializer.serialize(this)
fun encodeForProto(): ByteString = ByteString.copyFrom(roomId)
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (javaClass != other?.javaClass) return false
other as CallLinkRoomId
if (!roomId.contentEquals(other.roomId)) return false
return true
}
override fun hashCode(): Int {
return roomId.contentHashCode()
}
object DatabaseSerializer : Serializer<CallLinkRoomId, String> {
override fun serialize(data: CallLinkRoomId): String {
return Base64.encodeBytes(data.roomId)
}
override fun deserialize(data: String): CallLinkRoomId {
return fromBytes(Base64.decode(data))
}
}
companion object {
@JvmStatic