mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 10:30:38 +00:00
Add mobile-coin-address to updateProfile command
This commit is contained in:
parent
bf75d9b4e0
commit
34c0968f5e
6 changed files with 40 additions and 6 deletions
|
@ -270,7 +270,8 @@ class ManagerImpl implements Manager {
|
|||
updateProfile.getAboutEmoji(),
|
||||
updateProfile.isDeleteAvatar()
|
||||
? Optional.empty()
|
||||
: updateProfile.getAvatar() == null ? null : Optional.of(updateProfile.getAvatar()));
|
||||
: updateProfile.getAvatar() == null ? null : Optional.of(updateProfile.getAvatar()),
|
||||
updateProfile.getMobileCoinAddress());
|
||||
context.getSyncHelper().sendSyncFetchProfileMessage();
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ public class UpdateProfile {
|
|||
private final String aboutEmoji;
|
||||
private final File avatar;
|
||||
private final boolean deleteAvatar;
|
||||
private final byte[] mobileCoinAddress;
|
||||
|
||||
private UpdateProfile(final Builder builder) {
|
||||
givenName = builder.givenName;
|
||||
|
@ -18,6 +19,7 @@ public class UpdateProfile {
|
|||
aboutEmoji = builder.aboutEmoji;
|
||||
avatar = builder.avatar;
|
||||
deleteAvatar = builder.deleteAvatar;
|
||||
mobileCoinAddress = builder.mobileCoinAddress;
|
||||
}
|
||||
|
||||
public static Builder newBuilder() {
|
||||
|
@ -32,6 +34,7 @@ public class UpdateProfile {
|
|||
builder.aboutEmoji = copy.getAboutEmoji();
|
||||
builder.avatar = copy.getAvatar();
|
||||
builder.deleteAvatar = copy.isDeleteAvatar();
|
||||
builder.mobileCoinAddress = copy.getMobileCoinAddress();
|
||||
return builder;
|
||||
}
|
||||
|
||||
|
@ -59,6 +62,10 @@ public class UpdateProfile {
|
|||
return deleteAvatar;
|
||||
}
|
||||
|
||||
public byte[] getMobileCoinAddress() {
|
||||
return mobileCoinAddress;
|
||||
}
|
||||
|
||||
public static final class Builder {
|
||||
|
||||
private String givenName;
|
||||
|
@ -67,6 +74,7 @@ public class UpdateProfile {
|
|||
private String aboutEmoji;
|
||||
private File avatar;
|
||||
private boolean deleteAvatar;
|
||||
private byte[] mobileCoinAddress;
|
||||
|
||||
private Builder() {
|
||||
}
|
||||
|
@ -101,6 +109,11 @@ public class UpdateProfile {
|
|||
return this;
|
||||
}
|
||||
|
||||
public Builder withMobileCoinAddress(final byte[] val) {
|
||||
mobileCoinAddress = val;
|
||||
return this;
|
||||
}
|
||||
|
||||
public UpdateProfile build() {
|
||||
return new UpdateProfile(this);
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ public final class ProfileHelper {
|
|||
var profileKey = KeyUtils.createProfileKey();
|
||||
account.setProfileKey(profileKey);
|
||||
context.getAccountHelper().updateAccountAttributes();
|
||||
setProfile(true, true, null, null, null, null, null);
|
||||
setProfile(true, true, null, null, null, null, null, null);
|
||||
// TODO update profile key in storage
|
||||
|
||||
final var recipientIds = account.getRecipientStore().getRecipientIdsWithEnabledProfileSharing();
|
||||
|
@ -144,9 +144,14 @@ public final class ProfileHelper {
|
|||
* @param avatar if avatar is null the image from the local avatar store is used (if present),
|
||||
*/
|
||||
public void setProfile(
|
||||
String givenName, final String familyName, String about, String aboutEmoji, Optional<File> avatar
|
||||
String givenName,
|
||||
final String familyName,
|
||||
String about,
|
||||
String aboutEmoji,
|
||||
Optional<File> avatar,
|
||||
byte[] mobileCoinAddress
|
||||
) throws IOException {
|
||||
setProfile(true, false, givenName, familyName, about, aboutEmoji, avatar);
|
||||
setProfile(true, false, givenName, familyName, about, aboutEmoji, avatar, mobileCoinAddress);
|
||||
}
|
||||
|
||||
public void setProfile(
|
||||
|
@ -156,7 +161,8 @@ public final class ProfileHelper {
|
|||
final String familyName,
|
||||
String about,
|
||||
String aboutEmoji,
|
||||
Optional<File> avatar
|
||||
Optional<File> avatar,
|
||||
byte[] mobileCoinAddress
|
||||
) throws IOException {
|
||||
var profile = getSelfProfile();
|
||||
var builder = profile == null ? Profile.newBuilder() : Profile.newBuilder(profile);
|
||||
|
@ -172,6 +178,9 @@ public final class ProfileHelper {
|
|||
if (aboutEmoji != null) {
|
||||
builder.withAboutEmoji(aboutEmoji);
|
||||
}
|
||||
if (mobileCoinAddress != null) {
|
||||
builder.withMobileCoinAddress(mobileCoinAddress);
|
||||
}
|
||||
var newProfile = builder.build();
|
||||
|
||||
if (uploadProfile) {
|
||||
|
|
|
@ -234,6 +234,7 @@ public class StorageHelper {
|
|||
accountRecord.getFamilyName().orElse(null),
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue