- 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.isPresent());
+ public void updateConfiguration(Configuration newConfiguration) throws IOException {
+ final var configuration = getRemoteObject(new DBusPath(signal.getObjectPath() + "/Configuration"),
+ Signal.Configuration.class);
+ newConfiguration.readReceipts()
+ .ifPresent(v -> configuration.Set("org.asamk.Signal.Configuration", "ReadReceipts", v));
+ newConfiguration.unidentifiedDeliveryIndicators()
+ .ifPresent(v -> configuration.Set("org.asamk.Signal.Configuration",
+ "UnidentifiedDeliveryIndicators",
+ v));
+ newConfiguration.typingIndicators()
+ .ifPresent(v -> configuration.Set("org.asamk.Signal.Configuration", "TypingIndicators", v));
+ newConfiguration.linkPreviews()
+ .ifPresent(v -> configuration.Set("org.asamk.Signal.Configuration", "LinkPreviews", v));
+ }
+
+ @Override
+ 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());