Use e164 from PniChangeNumber sync message
This commit is contained in:
parent
579329b7bf
commit
759c61d06e
3 changed files with 9 additions and 3 deletions
|
@ -580,6 +580,7 @@ message SyncMessage {
|
|||
optional bytes identityKeyPair = 1; // Serialized libsignal-client IdentityKeyPair
|
||||
optional bytes signedPreKey = 2; // Serialized libsignal-client SignedPreKeyRecord
|
||||
optional uint32 registrationId = 3;
|
||||
optional string newE164 = 4; // The e164 we have changed our number to
|
||||
}
|
||||
|
||||
message CallEvent {
|
||||
|
|
|
@ -1199,8 +1199,10 @@ export async function mergeAccountRecord(
|
|||
|
||||
if (typeof accountE164 === 'string' && accountE164) {
|
||||
await window.storage.put('accountE164', accountE164);
|
||||
if (!RemoteConfig.isEnabled('desktop.pnp')) {
|
||||
await window.storage.user.setNumber(accountE164);
|
||||
}
|
||||
}
|
||||
|
||||
if (preferredReactionEmoji.canBeSynced(rawPreferredReactionEmoji)) {
|
||||
const localPreferredReactionEmoji =
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
/* eslint-disable no-bitwise */
|
||||
|
||||
import { isBoolean, isNumber, omit } from 'lodash';
|
||||
import { isBoolean, isNumber, isString, omit } from 'lodash';
|
||||
import PQueue from 'p-queue';
|
||||
import { v4 as getGuid } from 'uuid';
|
||||
|
||||
|
@ -3197,6 +3197,7 @@ export default class MessageReceiver
|
|||
identityKeyPair,
|
||||
signedPreKey,
|
||||
registrationId,
|
||||
newE164,
|
||||
}: Proto.SyncMessage.IPniChangeNumber
|
||||
): Promise<void> {
|
||||
log.info('MessageReceiver: got pni change number sync message');
|
||||
|
@ -3212,7 +3213,8 @@ export default class MessageReceiver
|
|||
if (
|
||||
!Bytes.isNotEmpty(identityKeyPair) ||
|
||||
!Bytes.isNotEmpty(signedPreKey) ||
|
||||
!isNumber(registrationId)
|
||||
!isNumber(registrationId) ||
|
||||
!isString(newE164)
|
||||
) {
|
||||
log.warn('MessageReceiver: empty pni change number sync message');
|
||||
return;
|
||||
|
@ -3224,6 +3226,7 @@ export default class MessageReceiver
|
|||
signedPreKey,
|
||||
registrationId,
|
||||
});
|
||||
await window.storage.user.setNumber(newE164);
|
||||
}
|
||||
|
||||
private async handleStickerPackOperation(
|
||||
|
|
Loading…
Reference in a new issue