Reconnect websocket on e164 change
This commit is contained in:
parent
30075f18fc
commit
c7873dd7ea
2 changed files with 8 additions and 3 deletions
|
@ -515,7 +515,7 @@ export async function startApp(): Promise<void> {
|
||||||
|
|
||||||
accountManager = new window.textsecure.AccountManager(server);
|
accountManager = new window.textsecure.AccountManager(server);
|
||||||
accountManager.addEventListener('registration', () => {
|
accountManager.addEventListener('registration', () => {
|
||||||
window.Whisper.events.trigger('userChanged');
|
window.Whisper.events.trigger('userChanged', false);
|
||||||
|
|
||||||
window.Signal.Util.Registration.markDone();
|
window.Signal.Util.Registration.markDone();
|
||||||
window.log.info('dispatching registration event');
|
window.log.info('dispatching registration event');
|
||||||
|
@ -1057,7 +1057,7 @@ export async function startApp(): Promise<void> {
|
||||||
});
|
});
|
||||||
convoCollection.on('reset', removeAllConversations);
|
convoCollection.on('reset', removeAllConversations);
|
||||||
|
|
||||||
window.Whisper.events.on('userChanged', () => {
|
window.Whisper.events.on('userChanged', (reconnect = false) => {
|
||||||
const newDeviceId = window.textsecure.storage.user.getDeviceId();
|
const newDeviceId = window.textsecure.storage.user.getDeviceId();
|
||||||
const newNumber = window.textsecure.storage.user.getNumber();
|
const newNumber = window.textsecure.storage.user.getNumber();
|
||||||
const newUuid = window.textsecure.storage.user.getUuid();
|
const newUuid = window.textsecure.storage.user.getUuid();
|
||||||
|
@ -1074,6 +1074,11 @@ export async function startApp(): Promise<void> {
|
||||||
ourUuid: newUuid,
|
ourUuid: newUuid,
|
||||||
regionCode: window.storage.get('regionCode'),
|
regionCode: window.storage.get('regionCode'),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (reconnect) {
|
||||||
|
window.log.info('background: reconnecting websocket on user change');
|
||||||
|
enqueueReconnectToWebSocket();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
let shortcutGuideView: WhatIsThis | null = null;
|
let shortcutGuideView: WhatIsThis | null = null;
|
||||||
|
|
|
@ -47,7 +47,7 @@ export class User {
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Notify redux about phone number change
|
// Notify redux about phone number change
|
||||||
window.Whisper.events.trigger('userChanged');
|
window.Whisper.events.trigger('userChanged', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public getNumber(): string | undefined {
|
public getNumber(): string | undefined {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue