Respect the phoneNumberSharing setting on the profile.

This commit is contained in:
Greyson Parrelli
2023-12-20 11:48:02 -05:00
committed by Clark Chen
parent 624f863da4
commit bb30535afb
24 changed files with 257 additions and 44 deletions

View File

@@ -150,6 +150,17 @@ public final class ProfileUtil {
return decryptString(profileKey, Base64.decode(encryptedStringBase64));
}
public static Optional<Boolean> decryptBoolean(@NonNull ProfileKey profileKey, @Nullable String encryptedBooleanBase64)
throws InvalidCiphertextException, IOException
{
if (encryptedBooleanBase64 == null) {
return Optional.empty();
}
ProfileCipher profileCipher = new ProfileCipher(profileKey);
return profileCipher.decryptBoolean(Base64.decode(encryptedBooleanBase64));
}
@WorkerThread
public static @NonNull MobileCoinPublicAddress getAddressForRecipient(@NonNull Recipient recipient)
throws IOException, PaymentsAddressException
@@ -347,7 +358,8 @@ public final class ProfileUtil {
aboutEmoji,
Optional.ofNullable(paymentsAddress),
avatar,
badgeIds).orElse(null);
badgeIds,
SignalStore.phoneNumberPrivacy().isPhoneNumberSharingEnabled()).orElse(null);
SignalStore.registrationValues().markHasUploadedProfile();
if (!avatar.keepTheSame) {
SignalDatabase.recipients().setProfileAvatar(Recipient.self().getId(), avatarPath);