mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-23 02:10:44 +01:00
Add proper call tab return state.
This commit is contained in:
committed by
Cody Henthorne
parent
514f7cc767
commit
1f09f48e6b
@@ -12,6 +12,7 @@ import org.signal.ringrtc.PeekInfo
|
||||
import org.thoughtcrime.securesms.components.webrtc.CallLinkProfileKeySender
|
||||
import org.thoughtcrime.securesms.database.CallLinkTable
|
||||
import org.thoughtcrime.securesms.database.SignalDatabase
|
||||
import org.thoughtcrime.securesms.dependencies.AppDependencies
|
||||
import org.thoughtcrime.securesms.events.CallParticipant
|
||||
import org.thoughtcrime.securesms.recipients.Recipient
|
||||
import org.thoughtcrime.securesms.recipients.RecipientId
|
||||
@@ -58,6 +59,9 @@ class CallLinkConnectedActionProcessor(
|
||||
Log.i(tag, "Updating pending list with ${peekInfo.pendingUsers.size} entries.")
|
||||
val pendingParticipants: List<Recipient> = peekInfo.pendingUsers.map { Recipient.externalPush(ServiceId.ACI.from(it)) }
|
||||
|
||||
Log.i(tag, "Storing peek-info in in-memory cache.")
|
||||
AppDependencies.signalCallManager.emitCallLinkPeekInfoUpdate(callLink.recipientId, peekInfo)
|
||||
|
||||
return superState.builder()
|
||||
.changeCallInfoState()
|
||||
.setCallLinkPendingParticipants(pendingParticipants)
|
||||
|
||||
@@ -7,20 +7,23 @@ package org.thoughtcrime.securesms.service.webrtc
|
||||
|
||||
import org.signal.ringrtc.CallId
|
||||
import org.signal.ringrtc.PeekInfo
|
||||
import org.thoughtcrime.securesms.recipients.Recipient
|
||||
|
||||
/**
|
||||
* App-level peek info object for call links.
|
||||
*/
|
||||
data class CallLinkPeekInfo(
|
||||
val callId: CallId?,
|
||||
val isActive: Boolean
|
||||
val isActive: Boolean,
|
||||
val isJoined: Boolean
|
||||
) {
|
||||
companion object {
|
||||
@JvmStatic
|
||||
fun fromPeekInfo(peekInfo: PeekInfo): CallLinkPeekInfo {
|
||||
return CallLinkPeekInfo(
|
||||
callId = peekInfo.eraId?.let { CallId.fromEra(it) },
|
||||
isActive = peekInfo.joinedMembers.isNotEmpty()
|
||||
isActive = peekInfo.joinedMembers.isNotEmpty(),
|
||||
isJoined = peekInfo.joinedMembers.contains(Recipient.self().requireServiceId().rawUuid)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -435,11 +435,7 @@ public final class SignalCallManager implements CallManager.Observer, GroupCall.
|
||||
}
|
||||
}
|
||||
|
||||
linkPeekInfoStore.update(store -> {
|
||||
Map<RecipientId, CallLinkPeekInfo> newHashMap = new HashMap<>(store);
|
||||
newHashMap.put(id, CallLinkPeekInfo.fromPeekInfo(info));
|
||||
return newHashMap;
|
||||
});
|
||||
emitCallLinkPeekInfoUpdate(id, info);
|
||||
});
|
||||
} catch (CallException | VerificationFailedException | InvalidInputException | IOException e) {
|
||||
Log.i(TAG, "error peeking call link", e);
|
||||
@@ -447,6 +443,14 @@ public final class SignalCallManager implements CallManager.Observer, GroupCall.
|
||||
});
|
||||
}
|
||||
|
||||
public void emitCallLinkPeekInfoUpdate(@NonNull RecipientId recipientId, @NonNull PeekInfo peekInfo) {
|
||||
linkPeekInfoStore.update(store -> {
|
||||
Map<RecipientId, CallLinkPeekInfo> newHashMap = new HashMap<>(store);
|
||||
newHashMap.put(recipientId, CallLinkPeekInfo.fromPeekInfo(peekInfo));
|
||||
return newHashMap;
|
||||
});
|
||||
}
|
||||
|
||||
public void peekGroupCall(@NonNull RecipientId id) {
|
||||
peekGroupCall(id, null);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user