mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-28 18:10:38 +00:00
Refresh username after registering
This commit is contained in:
parent
6106e1878b
commit
64436bc9ab
2 changed files with 11 additions and 0 deletions
|
@ -292,6 +292,10 @@ class ManagerImpl implements Manager {
|
||||||
context.getSyncHelper().sendSyncFetchProfileMessage();
|
context.getSyncHelper().sendSyncFetchProfileMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void refreshCurrentUsername() throws IOException, BaseUsernameException {
|
||||||
|
context.getAccountHelper().refreshCurrentUsername();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String setUsername(final String username) throws IOException, InvalidUsernameException {
|
public String setUsername(final String username) throws IOException, InvalidUsernameException {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -29,6 +29,7 @@ import org.asamk.signal.manager.helper.PinHelper;
|
||||||
import org.asamk.signal.manager.storage.SignalAccount;
|
import org.asamk.signal.manager.storage.SignalAccount;
|
||||||
import org.asamk.signal.manager.util.NumberVerificationUtils;
|
import org.asamk.signal.manager.util.NumberVerificationUtils;
|
||||||
import org.asamk.signal.manager.util.Utils;
|
import org.asamk.signal.manager.util.Utils;
|
||||||
|
import org.signal.libsignal.usernames.BaseUsernameException;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.whispersystems.signalservice.api.SignalServiceAccountManager;
|
import org.whispersystems.signalservice.api.SignalServiceAccountManager;
|
||||||
|
@ -163,6 +164,12 @@ class RegistrationManagerImpl implements RegistrationManager {
|
||||||
logger.warn("Failed to set default profile: {}", e.getMessage());
|
logger.warn("Failed to set default profile: {}", e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
m.refreshCurrentUsername();
|
||||||
|
} catch (IOException | BaseUsernameException e) {
|
||||||
|
logger.warn("Failed to refresh current username", e);
|
||||||
|
}
|
||||||
|
|
||||||
if (newManagerListener != null) {
|
if (newManagerListener != null) {
|
||||||
newManagerListener.accept(m);
|
newManagerListener.accept(m);
|
||||||
m = null;
|
m = null;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue