Allow anyone to join a call link.
This commit is contained in:
parent
c3be92d365
commit
9912a5fdfe
7 changed files with 10 additions and 50 deletions
|
@ -14,7 +14,6 @@ import org.thoughtcrime.securesms.database.DatabaseObserver
|
|||
import org.thoughtcrime.securesms.database.SignalDatabase
|
||||
import org.thoughtcrime.securesms.dependencies.AppDependencies
|
||||
import org.thoughtcrime.securesms.service.webrtc.links.CallLinkRoomId
|
||||
import org.thoughtcrime.securesms.util.RemoteConfig
|
||||
import java.net.URLDecoder
|
||||
|
||||
/**
|
||||
|
@ -63,10 +62,6 @@ object CallLinks {
|
|||
|
||||
@JvmStatic
|
||||
fun parseUrl(url: String): CallLinkRootKey? {
|
||||
if (!RemoteConfig.adHocCalling) {
|
||||
return null
|
||||
}
|
||||
|
||||
if (!url.startsWith(HTTPS_LINK_PREFIX) && !url.startsWith(SNGL_LINK_PREFIX)) {
|
||||
Log.w(TAG, "Invalid url prefix.")
|
||||
return null
|
||||
|
|
|
@ -1163,18 +1163,16 @@ public final class ConversationItem extends RelativeLayout implements BindableCo
|
|||
//noinspection ConstantConditions
|
||||
LinkPreview linkPreview = ((MmsMessageRecord) messageRecord).getLinkPreviews().get(0);
|
||||
|
||||
if (RemoteConfig.adHocCalling()) {
|
||||
CallLinkRootKey callLinkRootKey = CallLinks.parseUrl(linkPreview.getUrl());
|
||||
if (callLinkRootKey != null) {
|
||||
joinCallLinkStub.setVisibility(View.VISIBLE);
|
||||
joinCallLinkStub.get().setTextColor(ContextCompat.getColor(context, messageRecord.isOutgoing() ? R.color.signal_light_colorOnPrimary : R.color.signal_colorOnPrimaryContainer));
|
||||
joinCallLinkStub.get().setBackgroundColor(ContextCompat.getColor(context, messageRecord.isOutgoing() ? R.color.signal_light_colorTransparent2 : R.color.signal_colorOnPrimary));
|
||||
joinCallLinkStub.get().setOnClickListener(v -> {
|
||||
if (eventListener != null) {
|
||||
eventListener.onJoinCallLink(callLinkRootKey);
|
||||
}
|
||||
});
|
||||
}
|
||||
CallLinkRootKey callLinkRootKey = CallLinks.parseUrl(linkPreview.getUrl());
|
||||
if (callLinkRootKey != null) {
|
||||
joinCallLinkStub.setVisibility(View.VISIBLE);
|
||||
joinCallLinkStub.get().setTextColor(ContextCompat.getColor(context, messageRecord.isOutgoing() ? R.color.signal_light_colorOnPrimary : R.color.signal_colorOnPrimaryContainer));
|
||||
joinCallLinkStub.get().setBackgroundColor(ContextCompat.getColor(context, messageRecord.isOutgoing() ? R.color.signal_light_colorTransparent2 : R.color.signal_colorOnPrimary));
|
||||
joinCallLinkStub.get().setOnClickListener(v -> {
|
||||
if (eventListener != null) {
|
||||
eventListener.onJoinCallLink(callLinkRootKey);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (hasBigImageLinkPreview(messageRecord)) {
|
||||
|
|
|
@ -12,7 +12,6 @@ import org.thoughtcrime.securesms.jobmanager.JsonJobData
|
|||
import org.thoughtcrime.securesms.jobmanager.impl.NetworkConstraint
|
||||
import org.thoughtcrime.securesms.recipients.Recipient
|
||||
import org.thoughtcrime.securesms.recipients.RecipientId
|
||||
import org.thoughtcrime.securesms.util.RemoteConfig
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
/**
|
||||
|
@ -46,11 +45,6 @@ internal class CallLinkPeekJob private constructor(
|
|||
)
|
||||
|
||||
override fun onRun() {
|
||||
if (!RemoteConfig.adHocCalling) {
|
||||
Log.i(TAG, "Ad hoc calling is disabled. Dropping peek for call link.")
|
||||
return
|
||||
}
|
||||
|
||||
val recipient = Recipient.resolved(callLinkRecipientId)
|
||||
if (!recipient.isCallLink) {
|
||||
Log.w(TAG, "Recipient was not a call link. Ignoring.")
|
||||
|
|
|
@ -13,7 +13,6 @@ import org.thoughtcrime.securesms.jobmanager.Job
|
|||
import org.thoughtcrime.securesms.jobmanager.impl.NetworkConstraint
|
||||
import org.thoughtcrime.securesms.jobs.protos.CallLinkUpdateSendJobData
|
||||
import org.thoughtcrime.securesms.service.webrtc.links.CallLinkRoomId
|
||||
import org.thoughtcrime.securesms.util.RemoteConfig
|
||||
import org.whispersystems.signalservice.api.messages.multidevice.SignalServiceSyncMessage
|
||||
import org.whispersystems.signalservice.api.push.exceptions.PushNetworkException
|
||||
import org.whispersystems.signalservice.api.push.exceptions.ServerRejectedException
|
||||
|
@ -63,11 +62,6 @@ class CallLinkUpdateSendJob private constructor(
|
|||
override fun onFailure() = Unit
|
||||
|
||||
override fun onRun() {
|
||||
if (!RemoteConfig.adHocCalling) {
|
||||
Log.i(TAG, "Call links are not enabled. Exiting.")
|
||||
return
|
||||
}
|
||||
|
||||
val callLink = SignalDatabase.callLinks.getCallLinkByRoomId(callLinkRoomId)
|
||||
if (callLink?.credentials == null) {
|
||||
Log.i(TAG, "Call link not found or missing credentials. Exiting.")
|
||||
|
|
|
@ -95,7 +95,6 @@ import org.thoughtcrime.securesms.util.EarlyMessageCacheEntry
|
|||
import org.thoughtcrime.securesms.util.IdentityUtil
|
||||
import org.thoughtcrime.securesms.util.MediaUtil
|
||||
import org.thoughtcrime.securesms.util.MessageConstraintsUtil
|
||||
import org.thoughtcrime.securesms.util.RemoteConfig
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences
|
||||
import org.thoughtcrime.securesms.util.Util
|
||||
import org.whispersystems.signalservice.api.crypto.EnvelopeMetadata
|
||||
|
@ -1407,11 +1406,6 @@ object SyncMessageProcessor {
|
|||
|
||||
@Throws(BadGroupIdException::class)
|
||||
private fun handleSynchronizeGroupOrAdHocCallEvent(callEvent: SyncMessage.CallEvent, envelopeTimestamp: Long) {
|
||||
if (!RemoteConfig.adHocCalling && callEvent.type == SyncMessage.CallEvent.Type.AD_HOC_CALL) {
|
||||
log(envelopeTimestamp, "Ad-Hoc calling is not currently supported by this client, ignoring.")
|
||||
return
|
||||
}
|
||||
|
||||
val callId: Long = callEvent.id!!
|
||||
val timestamp: Long = callEvent.timestamp ?: 0L
|
||||
val type: CallTable.Type? = CallTable.Type.from(callEvent.type)
|
||||
|
|
|
@ -392,11 +392,6 @@ public final class SignalCallManager implements CallManager.Observer, GroupCall.
|
|||
return;
|
||||
}
|
||||
|
||||
if (!RemoteConfig.adHocCalling()) {
|
||||
Log.i(TAG, "Ad Hoc Calling is disabled. Ignoring request to peek.");
|
||||
return;
|
||||
}
|
||||
|
||||
networkExecutor.execute(() -> {
|
||||
try {
|
||||
Recipient callLinkRecipient = Recipient.resolved(id);
|
||||
|
|
|
@ -312,11 +312,6 @@ public class CommunicationActions {
|
|||
return;
|
||||
}
|
||||
|
||||
if (!RemoteConfig.adHocCalling()) {
|
||||
Toast.makeText(activity, R.string.CommunicationActions_cant_join_call, Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
||||
CallLinkRootKey rootKey = CallLinks.parseUrl(potentialUrl);
|
||||
if (rootKey == null) {
|
||||
Log.w(TAG, "Failed to parse root key from call link");
|
||||
|
@ -342,11 +337,6 @@ public class CommunicationActions {
|
|||
}
|
||||
|
||||
private static void startVideoCall(@NonNull CallContext callContext, @NonNull CallLinkRootKey rootKey) {
|
||||
if (!RemoteConfig.adHocCalling()) {
|
||||
Toast.makeText(callContext.getContext(), R.string.CommunicationActions_cant_join_call, Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
||||
SimpleTask.run(() -> {
|
||||
CallLinkRoomId roomId = CallLinkRoomId.fromBytes(rootKey.deriveRoomId());
|
||||
CallLinkTable.CallLink callLink = SignalDatabase.callLinks().getOrCreateCallLinkByRootKey(rootKey);
|
||||
|
|
Loading…
Add table
Reference in a new issue