mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-21 17:29:32 +01:00
Add support for new backup calls proto and call links.
This commit is contained in:
@@ -91,18 +91,22 @@ class CallLinkTable(context: Context, databaseHelper: SignalDatabase) : Database
|
||||
|
||||
fun insertCallLink(
|
||||
callLink: CallLink
|
||||
) {
|
||||
writableDatabase.withinTransaction { db ->
|
||||
): RecipientId {
|
||||
val recipientId: RecipientId = writableDatabase.withinTransaction { db ->
|
||||
val recipientId = SignalDatabase.recipients.getOrInsertFromCallLinkRoomId(callLink.roomId)
|
||||
|
||||
db
|
||||
.insertInto(TABLE_NAME)
|
||||
.values(CallLinkSerializer.serialize(callLink.copy(recipientId = recipientId)))
|
||||
.run()
|
||||
|
||||
recipientId
|
||||
}
|
||||
|
||||
ApplicationDependencies.getDatabaseObserver().notifyCallLinkObservers(callLink.roomId)
|
||||
ApplicationDependencies.getDatabaseObserver().notifyCallUpdateObservers()
|
||||
|
||||
return recipientId!!
|
||||
}
|
||||
|
||||
fun updateCallLinkCredentials(
|
||||
@@ -402,7 +406,7 @@ class CallLinkTable(context: Context, databaseHelper: SignalDatabase) : Database
|
||||
}
|
||||
}
|
||||
|
||||
private object CallLinkDeserializer : Serializer<CallLink, Cursor> {
|
||||
object CallLinkDeserializer : Serializer<CallLink, Cursor> {
|
||||
override fun serialize(data: CallLink): Cursor {
|
||||
throw UnsupportedOperationException()
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import androidx.annotation.Nullable;
|
||||
|
||||
import org.signal.core.util.Base64;
|
||||
import org.signal.core.util.logging.Log;
|
||||
import org.thoughtcrime.securesms.backup.v2.proto.GroupCallChatUpdate;
|
||||
import org.thoughtcrime.securesms.backup.v2.proto.GroupCall;
|
||||
import org.thoughtcrime.securesms.database.model.databaseprotos.GroupCallUpdateDetails;
|
||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
import org.whispersystems.signalservice.api.push.ServiceId;
|
||||
@@ -28,7 +28,7 @@ public final class GroupCallUpdateDetailsUtil {
|
||||
/**
|
||||
* Generates a group chat update message body from backup data
|
||||
*/
|
||||
public static @NonNull String createBodyFromBackup(@NonNull GroupCallChatUpdate groupCallChatUpdate) {
|
||||
public static @NonNull String createBodyFromBackup(@NonNull GroupCall groupCallChatUpdate) {
|
||||
ServiceId.ACI startedCall = groupCallChatUpdate.startedCallAci != null ? ServiceId.ACI.parseOrNull(groupCallChatUpdate.startedCallAci) : null;
|
||||
|
||||
GroupCallUpdateDetails details = new GroupCallUpdateDetails.Builder()
|
||||
@@ -36,15 +36,7 @@ public final class GroupCallUpdateDetailsUtil {
|
||||
.startedCallTimestamp(groupCallChatUpdate.startedCallTimestamp)
|
||||
.endedCallTimestamp(groupCallChatUpdate.endedCallTimestamp)
|
||||
.isCallFull(false)
|
||||
.inCallUuids(groupCallChatUpdate.inCallAcis.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.map(ServiceId.ACI::parseOrNull)
|
||||
.filter(Objects::nonNull)
|
||||
.map(ServiceId.ACI::toString)
|
||||
.collect(Collectors.toList())
|
||||
)
|
||||
.isRingingOnLocalDevice(false)
|
||||
.localUserJoined(groupCallChatUpdate.localUserJoined != GroupCallChatUpdate.LocalUserJoined.DID_NOT_JOIN)
|
||||
.build();
|
||||
|
||||
return Base64.encodeWithPadding(details.encode());
|
||||
|
||||
Reference in New Issue
Block a user