Implement getConfiguration method in Manager

This commit is contained in:
AsamK 2021-11-07 10:38:26 +01:00
parent a20bbe1246
commit e22cc457ae
5 changed files with 46 additions and 25 deletions

View file

@ -9,8 +9,10 @@ import org.asamk.signal.commands.exceptions.IOErrorException;
import org.asamk.signal.commands.exceptions.UserErrorException;
import org.asamk.signal.manager.Manager;
import org.asamk.signal.manager.NotMasterDeviceException;
import org.asamk.signal.manager.api.Configuration;
import java.io.IOException;
import java.util.Optional;
public class UpdateConfigurationCommand implements JsonRpcLocalCommand {
@ -45,7 +47,10 @@ public class UpdateConfigurationCommand implements JsonRpcLocalCommand {
final var typingIndicators = ns.getBoolean("typing-indicators");
final var linkPreviews = ns.getBoolean("link-previews");
try {
m.updateConfiguration(readReceipts, unidentifiedDeliveryIndicators, typingIndicators, linkPreviews);
m.updateConfiguration(new Configuration(Optional.ofNullable(readReceipts),
Optional.ofNullable(unidentifiedDeliveryIndicators),
Optional.ofNullable(typingIndicators),
Optional.ofNullable(linkPreviews)));
} catch (IOException e) {
throw new IOErrorException("UpdateAccount error: " + e.getMessage(), e);
} catch (NotMasterDeviceException e) {

View file

@ -7,6 +7,7 @@ import org.asamk.signal.manager.Manager;
import org.asamk.signal.manager.NotMasterDeviceException;
import org.asamk.signal.manager.StickerPackInvalidException;
import org.asamk.signal.manager.UntrustedIdentityException;
import org.asamk.signal.manager.api.Configuration;
import org.asamk.signal.manager.api.Device;
import org.asamk.signal.manager.api.Group;
import org.asamk.signal.manager.api.Identity;
@ -106,12 +107,12 @@ public class DbusManagerImpl implements Manager {
}
@Override
public void updateConfiguration(
final Boolean readReceipts,
final Boolean unidentifiedDeliveryIndicators,
final Boolean typingIndicators,
final Boolean linkPreviews
) throws IOException {
public Configuration getConfiguration() {
throw new UnsupportedOperationException();
}
@Override
public void updateConfiguration(Configuration configuration) throws IOException {
throw new UnsupportedOperationException();
}