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();
}
private final String aboutEmoji;
private final File avatar;
private final boolean deleteAvatar;
+ private final byte[] mobileCoinAddress;
private UpdateProfile(final Builder builder) {
givenName = builder.givenName;
aboutEmoji = builder.aboutEmoji;
avatar = builder.avatar;
deleteAvatar = builder.deleteAvatar;
+ mobileCoinAddress = builder.mobileCoinAddress;
}
public static Builder newBuilder() {
builder.aboutEmoji = copy.getAboutEmoji();
builder.avatar = copy.getAvatar();
builder.deleteAvatar = copy.isDeleteAvatar();
+ builder.mobileCoinAddress = copy.getMobileCoinAddress();
return builder;
}
return deleteAvatar;
}
+ public byte[] getMobileCoinAddress() {
+ return mobileCoinAddress;
+ }
+
public static final class Builder {
private String givenName;
private String aboutEmoji;
private File avatar;
private boolean deleteAvatar;
+ private byte[] mobileCoinAddress;
private Builder() {
}
return this;
}
+ public Builder withMobileCoinAddress(final byte[] val) {
+ mobileCoinAddress = val;
+ return this;
+ }
+
public UpdateProfile build() {
return new UpdateProfile(this);
}
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();
* @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(
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);
if (aboutEmoji != null) {
builder.withAboutEmoji(aboutEmoji);
}
+ if (mobileCoinAddress != null) {
+ builder.withMobileCoinAddress(mobileCoinAddress);
+ }
var newProfile = builder.build();
if (uploadProfile) {
accountRecord.getFamilyName().orElse(null),
null,
null,
+ null,
null);
}
*--remove-avatar*::
Remove the avatar
+*--mobile-coin-address*::
+New MobileCoin address (Base64 encoded public address)
+
=== updateContact
Update the info associated to a number on our contact list.
import java.io.File;
import java.io.IOException;
+import java.util.Base64;
public class UpdateProfileCommand implements JsonRpcLocalCommand {
subparser.addArgument("--family-name").help("New profile family name (optional)");
subparser.addArgument("--about").help("New profile about text");
subparser.addArgument("--about-emoji").help("New profile about emoji");
+ subparser.addArgument("--mobile-coin-address").help("New MobileCoin address (Base64 encoded public address)");
final var avatarOptions = subparser.addMutuallyExclusiveGroup();
avatarOptions.addArgument("--avatar").help("Path to new profile avatar");
var familyName = ns.getString("family-name");
var about = ns.getString("about");
var aboutEmoji = ns.getString("about-emoji");
+ var mobileCoinAddressString = ns.getString("mobile-coin-address");
+ var mobileCoinAddress = mobileCoinAddressString == null
+ ? null
+ : Base64.getDecoder().decode(mobileCoinAddressString);
+
var avatarPath = ns.getString("avatar");
boolean removeAvatar = Boolean.TRUE.equals(ns.getBoolean("remove-avatar"));
-
File avatarFile = removeAvatar || avatarPath == null ? null : new File(avatarPath);
try {
.withFamilyName(familyName)
.withAbout(about)
.withAboutEmoji(aboutEmoji)
+ .withMobileCoinAddress(mobileCoinAddress)
.withAvatar(avatarFile)
.withDeleteAvatar(removeAvatar)
.build());