mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-22 09:49:30 +01:00
Expand account consistency checks.
This commit is contained in:
@@ -43,6 +43,7 @@ import org.whispersystems.signalservice.api.crypto.UnidentifiedAccessPair;
|
||||
import org.whispersystems.signalservice.api.profiles.AvatarUploadParams;
|
||||
import org.whispersystems.signalservice.api.profiles.ProfileAndCredential;
|
||||
import org.whispersystems.signalservice.api.profiles.SignalServiceProfile;
|
||||
import org.whispersystems.signalservice.api.push.ServiceId;
|
||||
import org.whispersystems.signalservice.api.push.SignalServiceAddress;
|
||||
import org.whispersystems.signalservice.api.services.ProfileService;
|
||||
import org.whispersystems.signalservice.api.util.StreamDetails;
|
||||
@@ -108,6 +109,22 @@ public final class ProfileUtil {
|
||||
return new ProfileService.ProfileResponseProcessor(response.second()).getResultOrThrow();
|
||||
}
|
||||
|
||||
@WorkerThread
|
||||
public static @NonNull ProfileAndCredential retrieveProfileSync(@NonNull ServiceId.PNI pni,
|
||||
@NonNull SignalServiceProfile.RequestType requestType)
|
||||
throws IOException
|
||||
{
|
||||
ProfileService profileService = ApplicationDependencies.getProfileService();
|
||||
|
||||
ServiceResponse<ProfileAndCredential> response = Single
|
||||
.fromCallable(() -> new SignalServiceAddress(pni))
|
||||
.flatMap(address -> profileService.getProfile(address, Optional.empty(), Optional.empty(), requestType, Locale.getDefault()))
|
||||
.onErrorReturn(t -> ServiceResponse.forUnknownError(t))
|
||||
.blockingGet();
|
||||
|
||||
return new ProfileService.ProfileResponseProcessor(response).getResultOrThrow();
|
||||
}
|
||||
|
||||
public static Single<Pair<Recipient, ServiceResponse<ProfileAndCredential>>> retrieveProfile(@NonNull Context context,
|
||||
@NonNull Recipient recipient,
|
||||
@NonNull SignalServiceProfile.RequestType requestType)
|
||||
|
||||
Reference in New Issue
Block a user