Show Session Switchover Events

Co-authored-by: Scott Nonnenberg <scott@signal.org>
This commit is contained in:
Fedor Indutny 2023-10-23 19:40:42 +02:00 committed by GitHub
parent 70cd073a72
commit dd2493a353
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 455 additions and 17 deletions

View file

@ -1467,6 +1467,18 @@ export class SignalProtocolStore extends EventEmitter {
});
}
async hasSessionWith(serviceId: ServiceIdString): Promise<boolean> {
return this.withZone(GLOBAL_ZONE, 'hasSessionWith', async () => {
if (!this.sessions) {
throw new Error('getOpenDevices: this.sessions not yet cached!');
}
return this._getAllSessions().some(
({ fromDB }) => fromDB.serviceId === serviceId
);
});
}
async getOpenDevices(
ourServiceId: ServiceIdString,
serviceIds: ReadonlyArray<ServiceIdString>,