mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-24 04:58:45 +00:00
Add additional checks for serviceId during sending flow.
This commit is contained in:
committed by
Jeffrey Starke
parent
049e9460a0
commit
3c07a731c4
@@ -37,6 +37,7 @@ import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class RecipientUtil {
|
||||
|
||||
@@ -82,21 +83,21 @@ public class RecipientUtil {
|
||||
}
|
||||
}
|
||||
|
||||
public static @NonNull List<SignalServiceAddress> toSignalServiceAddresses(@NonNull Context context, @NonNull List<RecipientId> recipients)
|
||||
throws IOException
|
||||
{
|
||||
return toSignalServiceAddressesFromResolved(context, Recipient.resolvedList(recipients));
|
||||
}
|
||||
|
||||
public static @NonNull List<SignalServiceAddress> toSignalServiceAddressesFromResolved(@NonNull Context context, @NonNull List<Recipient> recipients)
|
||||
throws IOException
|
||||
{
|
||||
ensureUuidsAreAvailable(context, recipients);
|
||||
|
||||
return Stream.of(recipients)
|
||||
.map(it -> it.live().resolve())
|
||||
.map(r -> new SignalServiceAddress(r.requireServiceId(), r.getE164().orElse(null)))
|
||||
.toList();
|
||||
List<Recipient> latestRecipients = recipients.stream().map(it -> it.live().resolve()).collect(Collectors.toList());
|
||||
|
||||
if (latestRecipients.stream().anyMatch(it -> !it.getHasServiceId())) {
|
||||
throw new NotFoundException("1 or more recipients are not registered!");
|
||||
}
|
||||
|
||||
return latestRecipients
|
||||
.stream()
|
||||
.map(r -> new SignalServiceAddress(r.requireServiceId(), r.getE164().orElse(null)))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user