mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 18:40:39 +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
|
@ -12,6 +12,7 @@ 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 +28,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,9 +43,13 @@ 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);
|
||||
|
||||
try {
|
||||
|
@ -52,6 +58,7 @@ public class UpdateProfileCommand implements JsonRpcLocalCommand {
|
|||
.withFamilyName(familyName)
|
||||
.withAbout(about)
|
||||
.withAboutEmoji(aboutEmoji)
|
||||
.withMobileCoinAddress(mobileCoinAddress)
|
||||
.withAvatar(avatarFile)
|
||||
.withDeleteAvatar(removeAvatar)
|
||||
.build());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue