mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-30 02:50:39 +00:00
Remove libsignal-service from manager lib API
This commit is contained in:
parent
9075cc1a30
commit
2ab42ca547
31 changed files with 269 additions and 96 deletions
|
@ -8,12 +8,11 @@ import org.asamk.signal.manager.Manager;
|
|||
import org.asamk.signal.manager.ProvisioningManager;
|
||||
import org.asamk.signal.manager.RegistrationManager;
|
||||
import org.asamk.signal.manager.UserAlreadyExists;
|
||||
import org.asamk.signal.manager.api.CaptchaRequiredException;
|
||||
import org.asamk.signal.manager.api.IncorrectPinException;
|
||||
import org.asamk.signal.manager.api.Pair;
|
||||
import org.asamk.signal.manager.api.PinLockedException;
|
||||
import org.freedesktop.dbus.DBusPath;
|
||||
import org.whispersystems.signalservice.api.KeyBackupServicePinException;
|
||||
import org.whispersystems.signalservice.api.KeyBackupSystemNoDataException;
|
||||
import org.whispersystems.signalservice.api.push.exceptions.CaptchaRequiredException;
|
||||
import org.whispersystems.signalservice.api.util.PhoneNumberFormatter;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
|
@ -100,7 +99,7 @@ public class DbusSignalControlImpl implements org.asamk.SignalControl {
|
|||
public void registerWithCaptcha(
|
||||
final String number, final boolean voiceVerification, final String captcha
|
||||
) throws Error.Failure, Error.InvalidNumber {
|
||||
if (!PhoneNumberFormatter.isValidNumber(number, null)) {
|
||||
if (!Manager.isValidNumber(number, null)) {
|
||||
throw new SignalControl.Error.InvalidNumber(
|
||||
"Invalid username (phone number), make sure you include the country code.");
|
||||
}
|
||||
|
@ -126,7 +125,7 @@ public class DbusSignalControlImpl implements org.asamk.SignalControl {
|
|||
try (final RegistrationManager registrationManager = c.getNewRegistrationManager(number)) {
|
||||
final Manager manager = registrationManager.verifyAccount(verificationCode, pin);
|
||||
addManager(manager);
|
||||
} catch (IOException | KeyBackupSystemNoDataException | KeyBackupServicePinException e) {
|
||||
} catch (IOException | PinLockedException | IncorrectPinException e) {
|
||||
throw new SignalControl.Error.Failure(e.getClass().getSimpleName() + " " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue