mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-21 00:59:49 +01:00
Add support for call link epochs.
This commit is contained in:
@@ -27,6 +27,7 @@ import org.signal.core.util.concurrent.JvmRxExtensions;
|
||||
import org.signal.core.util.concurrent.SignalExecutors;
|
||||
import org.signal.core.util.concurrent.SimpleTask;
|
||||
import org.signal.core.util.logging.Log;
|
||||
import org.signal.ringrtc.CallLinkEpoch;
|
||||
import org.signal.ringrtc.CallLinkRootKey;
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.calls.links.CallLinks;
|
||||
@@ -325,8 +326,8 @@ public class CommunicationActions {
|
||||
return;
|
||||
}
|
||||
|
||||
CallLinkRootKey rootKey = CallLinks.parseUrl(potentialUrl);
|
||||
if (rootKey == null) {
|
||||
CallLinks.CallLinkParseResult linkParseResult = CallLinks.parseUrl(potentialUrl);
|
||||
if (linkParseResult == null) {
|
||||
Log.w(TAG, "Failed to parse root key from call link");
|
||||
new MaterialAlertDialogBuilder(activity)
|
||||
.setTitle(R.string.CommunicationActions_invalid_link)
|
||||
@@ -336,7 +337,7 @@ public class CommunicationActions {
|
||||
return;
|
||||
}
|
||||
|
||||
startVideoCall(new ActivityCallContext(activity), rootKey, onUserAlreadyInAnotherCall);
|
||||
startVideoCall(new ActivityCallContext(activity), linkParseResult.getRootKey(), linkParseResult.getEpoch(), onUserAlreadyInAnotherCall);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -345,14 +346,14 @@ public class CommunicationActions {
|
||||
*
|
||||
* @param fragment The fragment, which will be used for context and permissions routing.
|
||||
*/
|
||||
public static void startVideoCall(@NonNull Fragment fragment, @NonNull CallLinkRootKey rootKey, @NonNull OnUserAlreadyInAnotherCall onUserAlreadyInAnotherCall) {
|
||||
startVideoCall(new FragmentCallContext(fragment), rootKey, onUserAlreadyInAnotherCall);
|
||||
public static void startVideoCall(@NonNull Fragment fragment, @NonNull CallLinkRootKey rootKey, @Nullable CallLinkEpoch epoch, @NonNull OnUserAlreadyInAnotherCall onUserAlreadyInAnotherCall) {
|
||||
startVideoCall(new FragmentCallContext(fragment), rootKey, epoch, onUserAlreadyInAnotherCall);
|
||||
}
|
||||
|
||||
private static void startVideoCall(@NonNull CallContext callContext, @NonNull CallLinkRootKey rootKey, @NonNull OnUserAlreadyInAnotherCall onUserAlreadyInAnotherCall) {
|
||||
private static void startVideoCall(@NonNull CallContext callContext, @NonNull CallLinkRootKey rootKey, @Nullable CallLinkEpoch epoch, @NonNull OnUserAlreadyInAnotherCall onUserAlreadyInAnotherCall) {
|
||||
SimpleTask.run(() -> {
|
||||
CallLinkRoomId roomId = CallLinkRoomId.fromBytes(rootKey.deriveRoomId());
|
||||
CallLinkTable.CallLink callLink = SignalDatabase.callLinks().getOrCreateCallLinkByRootKey(rootKey);
|
||||
CallLinkTable.CallLink callLink = SignalDatabase.callLinks().getOrCreateCallLinkByRootKey(rootKey, epoch);
|
||||
|
||||
if (callLink.getState().hasBeenRevoked()) {
|
||||
return Optional.<Recipient>empty();
|
||||
|
||||
Reference in New Issue
Block a user