Add CallLink Observed event and handling.

This commit is contained in:
Alex Hart
2024-06-06 10:39:50 -03:00
parent d3eb480d31
commit f572eb5322
7 changed files with 160 additions and 40 deletions

View File

@@ -47,6 +47,18 @@ object CallEventSyncMessageUtil {
)
}
@JvmStatic
fun createObservedCallEvent(remotePeer: RemotePeer, timestamp: Long, isOutgoing: Boolean, isVideoCall: Boolean): CallEvent {
return createCallEvent(
remotePeer.id,
remotePeer.callId.longValue(),
timestamp,
isOutgoing,
isVideoCall,
CallEvent.Event.OBSERVED
)
}
private fun createCallEvent(
recipientId: RecipientId,
callId: Long,

View File

@@ -424,6 +424,14 @@ public final class SignalCallManager implements CallManager.Observer, GroupCall.
return;
}
String eraId = info.getEraId();
if (eraId != null && !info.getJoinedMembers().isEmpty()) {
if (SignalDatabase.calls().insertAdHocCallFromObserveEvent(callLinkRecipient, System.currentTimeMillis(), eraId)) {
AppDependencies.getJobManager()
.add(CallSyncEventJob.createForObserved(callLinkRecipient.getId(), CallId.fromEra(eraId).longValue()));
}
}
linkPeekInfoStore.update(store -> {
Map<RecipientId, CallLinkPeekInfo> newHashMap = new HashMap<>(store);
newHashMap.put(id, CallLinkPeekInfo.fromPeekInfo(info));