mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2025-12-27 13:40:47 +00:00
Preliminary support for destinationUuid field
This commit is contained in:
@@ -5,7 +5,7 @@ import type { WebAPICredentials } from '../Types.d';
|
||||
|
||||
import { strictAssert } from '../../util/assert';
|
||||
import type { StorageInterface } from '../../types/Storage.d';
|
||||
import { UUID } from '../../types/UUID';
|
||||
import { UUID, UUIDKind } from '../../types/UUID';
|
||||
import * as log from '../../logging/log';
|
||||
|
||||
import Helpers from '../Helpers';
|
||||
@@ -70,6 +70,27 @@ export class User {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
public getPni(): UUID | undefined {
|
||||
const pni = this.storage.get('pni');
|
||||
if (pni === undefined) return undefined;
|
||||
return new UUID(pni);
|
||||
}
|
||||
|
||||
public getOurUuidKind(uuid: UUID): UUIDKind {
|
||||
const ourUuid = this.getUuid();
|
||||
|
||||
if (ourUuid?.toString() === uuid.toString()) {
|
||||
return UUIDKind.ACI;
|
||||
}
|
||||
|
||||
const pni = this.getPni();
|
||||
if (pni?.toString() === uuid.toString()) {
|
||||
return UUIDKind.PNI;
|
||||
}
|
||||
|
||||
return UUIDKind.Unknown;
|
||||
}
|
||||
|
||||
public getDeviceId(): number | undefined {
|
||||
const value = this._getDeviceIdFromUuid() || this._getDeviceIdFromNumber();
|
||||
if (value === undefined) {
|
||||
|
||||
Reference in New Issue
Block a user