mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 10:30:38 +00:00
Refactor manager update profile method
This commit is contained in:
parent
7587a60387
commit
3666531f8b
8 changed files with 160 additions and 35 deletions
|
@ -22,6 +22,7 @@ import org.asamk.signal.manager.api.StickerPackInvalidException;
|
|||
import org.asamk.signal.manager.api.StickerPackUrl;
|
||||
import org.asamk.signal.manager.api.TypingAction;
|
||||
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;
|
||||
|
@ -138,19 +139,13 @@ public class DbusManagerImpl implements Manager {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setProfile(
|
||||
final String givenName,
|
||||
final String familyName,
|
||||
final String about,
|
||||
final String aboutEmoji,
|
||||
final Optional<File> avatar
|
||||
) throws IOException {
|
||||
signal.updateProfile(emptyIfNull(givenName),
|
||||
emptyIfNull(familyName),
|
||||
emptyIfNull(about),
|
||||
emptyIfNull(aboutEmoji),
|
||||
avatar == null ? "" : avatar.map(File::getPath).orElse(""),
|
||||
avatar != null && avatar.isEmpty());
|
||||
public void updateProfile(UpdateProfile updateProfile) throws IOException {
|
||||
signal.updateProfile(emptyIfNull(updateProfile.getGivenName()),
|
||||
emptyIfNull(updateProfile.getFamilyName()),
|
||||
emptyIfNull(updateProfile.getAbout()),
|
||||
emptyIfNull(updateProfile.getAboutEmoji()),
|
||||
updateProfile.getAvatar() == null ? "" : updateProfile.getAvatar().getPath(),
|
||||
updateProfile.isDeleteAvatar());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue