]> nmode's Git Repositories - signal-cli/blobdiff - src/main/java/org/asamk/signal/dbus/DbusSignalImpl.java
Refactor manager update profile method
[signal-cli] / src / main / java / org / asamk / signal / dbus / DbusSignalImpl.java
index f4a9cda832d322f6fb3c1437c4cd77a453e45387..ec7174b23abf3c4a43358cc326ed569551993297 100644 (file)
@@ -17,6 +17,7 @@ import org.asamk.signal.manager.api.StickerPackInvalidException;
 import org.asamk.signal.manager.api.TypingAction;
 import org.asamk.signal.manager.api.UnregisteredRecipientException;
 import org.asamk.signal.manager.api.UpdateGroup;
+import org.asamk.signal.manager.api.UpdateProfile;
 import org.asamk.signal.manager.api.UserStatus;
 import org.asamk.signal.manager.groups.GroupId;
 import org.asamk.signal.manager.groups.GroupInviteLinkUrl;
@@ -662,10 +663,15 @@ public class DbusSignalImpl implements Signal {
             about = nullIfEmpty(about);
             aboutEmoji = nullIfEmpty(aboutEmoji);
             avatarPath = nullIfEmpty(avatarPath);
-            Optional<File> avatarFile = removeAvatar
-                    ? Optional.empty()
-                    : avatarPath == null ? null : Optional.of(new File(avatarPath));
-            m.setProfile(givenName, familyName, about, aboutEmoji, avatarFile);
+            File avatarFile = removeAvatar || avatarPath == null ? null : new File(avatarPath);
+            m.updateProfile(UpdateProfile.newBuilder()
+                    .withGivenName(givenName)
+                    .withFamilyName(familyName)
+                    .withAbout(about)
+                    .withAboutEmoji(aboutEmoji)
+                    .withAvatar(avatarFile)
+                    .withDeleteAvatar(removeAvatar)
+                    .build());
         } catch (IOException e) {
             throw new Error.Failure(e.getMessage());
         }