Preliminary support for destinationUuid field
This commit is contained in:
parent
bb15cfc622
commit
066a23a6a9
8 changed files with 154 additions and 36 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue