Merge branch 'master' into dbus_isregistered

This commit is contained in:
John Freed 2021-09-22 19:59:45 +02:00
commit 4484b3d089
2 changed files with 27 additions and 0 deletions

View file

@ -91,6 +91,10 @@ public interface Signal extends DBusInterface {
String name, String about, String aboutEmoji, String avatarPath, boolean removeAvatar
) throws Error.Failure;
void removePin();
void setPin(String registrationLockPin);
String version();
List<String> listNumbers();

View file

@ -25,6 +25,7 @@ import org.whispersystems.signalservice.api.groupsv2.GroupLinkNotActiveException
import org.whispersystems.signalservice.api.messages.SendMessageResult;
import org.whispersystems.signalservice.api.push.exceptions.UnregisteredUserException;
import org.whispersystems.signalservice.api.util.InvalidNumberException;
import org.whispersystems.signalservice.internal.contacts.crypto.UnauthenticatedResponseException;
import java.io.File;
import java.io.IOException;
@ -440,6 +441,28 @@ public class DbusSignalImpl implements Signal {
}
}
@Override
public void removePin() {
try {
m.setRegistrationLockPin(Optional.absent());
} catch (UnauthenticatedResponseException e) {
throw new Error.Failure("Remove pin failed with unauthenticated response: " + e.getMessage());
} catch (IOException e) {
throw new Error.Failure("Remove pin error: " + e.getMessage());
}
}
@Override
public void setPin(String registrationLockPin) {
try {
m.setRegistrationLockPin(Optional.of(registrationLockPin));
} catch (UnauthenticatedResponseException e) {
throw new Error.Failure("Set pin error failed with unauthenticated response: " + e.getMessage());
} catch (IOException e) {
throw new Error.Failure("Set pin error: " + e.getMessage());
}
}
// Provide option to query a version string in order to react on potential
// future interface changes
@Override