mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 10:30:38 +00:00
Reexport dbus objects when self number changes
This commit is contained in:
parent
796f4d0d96
commit
f207c2abc3
5 changed files with 36 additions and 9 deletions
|
@ -261,6 +261,8 @@ public interface Manager extends Closeable {
|
|||
*/
|
||||
boolean trustIdentityAllKeys(RecipientIdentifier.Single recipient) throws UnregisteredRecipientException;
|
||||
|
||||
void addAddressChangedListener(Runnable listener);
|
||||
|
||||
void addClosedListener(Runnable listener);
|
||||
|
||||
@Override
|
||||
|
|
|
@ -109,6 +109,7 @@ class ManagerImpl implements Manager {
|
|||
private final Set<ReceiveMessageHandler> weakHandlers = new HashSet<>();
|
||||
private final Set<ReceiveMessageHandler> messageHandlers = new HashSet<>();
|
||||
private final List<Runnable> closedListeners = new ArrayList<>();
|
||||
private final List<Runnable> addressChangedListeners = new ArrayList<>();
|
||||
private final CompositeDisposable disposable = new CompositeDisposable();
|
||||
|
||||
ManagerImpl(
|
||||
|
@ -139,12 +140,12 @@ class ManagerImpl implements Manager {
|
|||
final var attachmentStore = new AttachmentStore(pathConfig.attachmentsPath());
|
||||
final var stickerPackStore = new StickerPackStore(pathConfig.stickerPacksPath());
|
||||
|
||||
this.context = new Context(account,
|
||||
accountFileUpdater,
|
||||
dependencies,
|
||||
avatarStore,
|
||||
attachmentStore,
|
||||
stickerPackStore);
|
||||
this.context = new Context(account, (number, aci) -> {
|
||||
accountFileUpdater.updateAccountIdentifiers(number, aci);
|
||||
synchronized (addressChangedListeners) {
|
||||
addressChangedListeners.forEach(Runnable::run);
|
||||
}
|
||||
}, dependencies, avatarStore, attachmentStore, stickerPackStore);
|
||||
this.context.getAccountHelper().setUnregisteredListener(this::close);
|
||||
this.context.getReceiveHelper().setAuthenticationFailureListener(this::close);
|
||||
this.context.getReceiveHelper().setCaughtUpWithOldMessagesListener(() -> {
|
||||
|
@ -998,6 +999,13 @@ class ManagerImpl implements Manager {
|
|||
return updated;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addAddressChangedListener(final Runnable listener) {
|
||||
synchronized (addressChangedListeners) {
|
||||
addressChangedListeners.add(listener);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addClosedListener(final Runnable listener) {
|
||||
synchronized (closedListeners) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue