Update libsignal-service

This commit is contained in:
AsamK 2024-06-26 15:35:54 +02:00
parent baf7b74a61
commit 5ff66728e3
7 changed files with 26 additions and 9 deletions

View file

@ -30,7 +30,16 @@ public class ServiceConfig {
final var giftBadges = !isPrimaryDevice;
final var pni = !isPrimaryDevice;
final var paymentActivation = !isPrimaryDevice;
return new AccountAttributes.Capabilities(true, true, true, true, true, giftBadges, pni, paymentActivation);
final var deleteSync = !isPrimaryDevice;
return new AccountAttributes.Capabilities(true,
true,
true,
true,
true,
giftBadges,
pni,
paymentActivation,
deleteSync);
}
public static ServiceEnvironmentConfig getServiceEnvironmentConfig(

View file

@ -105,7 +105,7 @@ public class PinHelper {
public SecureValueRecovery.RestoreResponse.Success getRegistrationLockData(
SecureValueRecovery secureValueRecovery, AuthCredentials authCredentials, String pin
) throws IOException, IncorrectPinException {
final var restoreResponse = secureValueRecovery.restoreDataPreRegistration(authCredentials, pin);
final var restoreResponse = secureValueRecovery.restoreDataPreRegistration(authCredentials, null, pin);
switch (restoreResponse) {
case SecureValueRecovery.RestoreResponse.Success s -> {

View file

@ -92,6 +92,7 @@ import org.signal.libsignal.usernames.BaseUsernameException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.whispersystems.signalservice.api.SignalSessionLock;
import org.whispersystems.signalservice.api.messages.SignalServiceAttachment;
import org.whispersystems.signalservice.api.messages.SignalServiceDataMessage;
import org.whispersystems.signalservice.api.messages.SignalServicePreview;
import org.whispersystems.signalservice.api.messages.SignalServiceReceiptMessage;
@ -738,17 +739,23 @@ public class ManagerImpl implements Manager {
private void applyMessage(
final SignalServiceDataMessage.Builder messageBuilder, final Message message
) throws AttachmentInvalidException, IOException, UnregisteredRecipientException, InvalidStickerException {
final var additionalAttachments = new ArrayList<SignalServiceAttachment>();
if (message.messageText().length() > 2000) {
final var messageBytes = message.messageText().getBytes(StandardCharsets.UTF_8);
final var textAttachment = AttachmentUtils.createAttachmentStream(new StreamDetails(new ByteArrayInputStream(
messageBytes), MimeUtils.LONG_TEXT, messageBytes.length), Optional.empty());
messageBuilder.withBody(message.messageText().substring(0, 2000));
messageBuilder.withAttachment(context.getAttachmentHelper().uploadAttachment(textAttachment));
additionalAttachments.add(context.getAttachmentHelper().uploadAttachment(textAttachment));
} else {
messageBuilder.withBody(message.messageText());
}
if (!message.attachments().isEmpty()) {
messageBuilder.withAttachments(context.getAttachmentHelper().uploadAttachments(message.attachments()));
if (!additionalAttachments.isEmpty()) {
additionalAttachments.addAll(context.getAttachmentHelper().uploadAttachments(message.attachments()));
messageBuilder.withAttachments(additionalAttachments);
} else {
messageBuilder.withAttachments(context.getAttachmentHelper().uploadAttachments(message.attachments()));
}
}
if (!message.mentions().isEmpty()) {
messageBuilder.withMentions(resolveMentions(message.mentions()));

View file

@ -197,8 +197,7 @@ public class SignalDependencies {
Optional.empty(),
executor,
ServiceConfig.MAX_ENVELOPE_SIZE,
pushServiceSocket,
false));
pushServiceSocket));
}
public List<SecureValueRecovery> getSecureValueRecoveryV2() {

View file

@ -9,6 +9,7 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.UUID;
public class AttachmentUtils {
@ -58,6 +59,7 @@ public class AttachmentUtils {
blurHash,
null,
null,
resumableUploadSpec);
resumableUploadSpec,
UUID.randomUUID());
}
}