Unlink on device conflict 4409

This commit is contained in:
Jamie Kyle 2024-02-21 12:33:56 -08:00 committed by GitHub
parent e12b5fd0af
commit a27890b988
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 11 additions and 0 deletions

View file

@ -248,6 +248,11 @@ export class SocketManager extends EventListener {
return;
}
if (code === 4409) {
this.emit('deviceConflict');
return;
}
void reconnect();
});
}
@ -700,6 +705,7 @@ export class SocketManager extends EventListener {
callback: (error: HTTPError) => void
): this;
public override on(type: 'statusChange', callback: () => void): this;
public override on(type: 'deviceConflict', callback: () => void): this;
public override on(
type: string | symbol,
@ -711,6 +717,7 @@ export class SocketManager extends EventListener {
public override emit(type: 'authError', error: HTTPError): boolean;
public override emit(type: 'statusChange'): boolean;
public override emit(type: 'deviceConflict'): boolean;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
public override emit(type: string | symbol, ...args: Array<any>): boolean {

View file

@ -1320,6 +1320,10 @@ export function initialize({
window.Whisper.events.trigger('unlinkAndDisconnect');
});
socketManager.on('deviceConflict', () => {
window.Whisper.events.trigger('unlinkAndDisconnect');
});
if (useWebSocket) {
void socketManager.authenticate({ username, password });
}