Add update send job for call link when joining by url.

This commit is contained in:
Alex Hart 2024-10-11 14:23:22 -03:00 committed by Greyson Parrelli
parent c4fc32988c
commit 6b66e4666b
3 changed files with 12 additions and 7 deletions

View file

@ -36,6 +36,7 @@ import org.thoughtcrime.securesms.calls.log.CallLogRow
import org.thoughtcrime.securesms.database.model.GroupCallUpdateDetailsUtil
import org.thoughtcrime.securesms.database.model.MessageId
import org.thoughtcrime.securesms.dependencies.AppDependencies
import org.thoughtcrime.securesms.jobs.CallLinkUpdateSendJob
import org.thoughtcrime.securesms.jobs.CallSyncEventJob
import org.thoughtcrime.securesms.recipients.Recipient
import org.thoughtcrime.securesms.recipients.RecipientId
@ -589,15 +590,15 @@ class CallTable(context: Context, databaseHelper: SignalDatabase) : DatabaseTabl
AppDependencies.databaseObserver.notifyCallUpdateObservers()
}
fun insertOrUpdateAdHocCallFromObserveEvent(
fun insertOrUpdateAdHocCallFromRemoteObserveEvent(
callRecipient: Recipient,
timestamp: Long,
callId: Long
) {
handleCallLinkUpdate(callRecipient, timestamp, CallId(callId), Direction.INCOMING)
handleCallLinkUpdate(callRecipient, timestamp, CallId(callId), Direction.INCOMING, skipSyncOnInsert = true)
}
fun insertAdHocCallFromObserveEvent(
fun insertAdHocCallFromLocalObserveEvent(
callRecipient: Recipient,
timestamp: Long,
eraId: String
@ -693,7 +694,8 @@ class CallTable(context: Context, databaseHelper: SignalDatabase) : DatabaseTabl
timestamp: Long,
callId: CallId?,
direction: Direction = Direction.OUTGOING,
skipTimestampUpdate: Boolean = false
skipTimestampUpdate: Boolean = false,
skipSyncOnInsert: Boolean = false
): Boolean {
check(callLinkRecipient.isCallLink)
@ -734,6 +736,10 @@ class CallTable(context: Context, databaseHelper: SignalDatabase) : DatabaseTabl
Log.d(TAG, "Inserted new call event for call link. Call Id: $callId")
AppDependencies.databaseObserver.notifyCallUpdateObservers()
if (!skipSyncOnInsert) {
AppDependencies.jobManager.add(CallLinkUpdateSendJob(callLinkRecipient.requireCallLinkRoomId()))
}
true
} else false
}

View file

@ -1421,7 +1421,7 @@ object SyncMessageProcessor {
}
val recipient = resolveCallLinkRecipient(callEvent)
SignalDatabase.calls.insertOrUpdateAdHocCallFromObserveEvent(
SignalDatabase.calls.insertOrUpdateAdHocCallFromRemoteObserveEvent(
callRecipient = recipient,
timestamp = callEvent.timestamp!!,
callId = callId

View file

@ -68,7 +68,6 @@ import org.thoughtcrime.securesms.service.webrtc.state.WebRtcEphemeralState;
import org.thoughtcrime.securesms.service.webrtc.state.WebRtcServiceState;
import org.thoughtcrime.securesms.util.AppForegroundObserver;
import org.thoughtcrime.securesms.util.RecipientAccessList;
import org.thoughtcrime.securesms.util.RemoteConfig;
import org.thoughtcrime.securesms.util.TextSecurePreferences;
import org.thoughtcrime.securesms.util.Util;
import org.thoughtcrime.securesms.util.rx.RxStore;
@ -424,7 +423,7 @@ public final class SignalCallManager implements CallManager.Observer, GroupCall.
String eraId = info.getEraId();
if (eraId != null && !info.getJoinedMembers().isEmpty()) {
if (SignalDatabase.calls().insertAdHocCallFromObserveEvent(callLinkRecipient, System.currentTimeMillis(), eraId)) {
if (SignalDatabase.calls().insertAdHocCallFromLocalObserveEvent(callLinkRecipient, System.currentTimeMillis(), eraId)) {
AppDependencies.getJobManager()
.add(CallSyncEventJob.createForObserved(callLinkRecipient.getId(), CallId.fromEra(eraId).longValue()));
}