]> nmode's Git Repositories - signal-cli/blobdiff - src/main/java/org/asamk/signal/commands/UpdateProfileCommand.java
Improve addDevice error message
[signal-cli] / src / main / java / org / asamk / signal / commands / UpdateProfileCommand.java
index 1edb6df985ced69758327e8f19042d5b3ac0da65..cea2da0dfe0a449eeae0aa231e67fc0effd2f29d 100644 (file)
@@ -10,8 +10,8 @@ import org.asamk.signal.manager.Manager;
 import org.asamk.signal.manager.api.UpdateProfile;
 import org.asamk.signal.output.OutputWriter;
 
-import java.io.File;
 import java.io.IOException;
+import java.util.Base64;
 
 public class UpdateProfileCommand implements JsonRpcLocalCommand {
 
@@ -27,6 +27,7 @@ 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");
@@ -41,10 +42,14 @@ public class UpdateProfileCommand implements JsonRpcLocalCommand {
         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);
+        String avatarFile = removeAvatar || avatarPath == null ? null : avatarPath;
 
         try {
             m.updateProfile(UpdateProfile.newBuilder()
@@ -52,6 +57,7 @@ public class UpdateProfileCommand implements JsonRpcLocalCommand {
                     .withFamilyName(familyName)
                     .withAbout(about)
                     .withAboutEmoji(aboutEmoji)
+                    .withMobileCoinAddress(mobileCoinAddress)
                     .withAvatar(avatarFile)
                     .withDeleteAvatar(removeAvatar)
                     .build());