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