From 765ae54e78b8ecd3156fa74ec1738e65248a0ab4 Mon Sep 17 00:00:00 2001 From: Fedor Indutny <79877362+indutny-signal@users.noreply.github.com> Date: Wed, 30 Aug 2023 15:27:07 +0200 Subject: [PATCH] Add more granularity to accountE164 deprecation --- ts/RemoteConfig.ts | 1 + ts/services/storageRecordOps.ts | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ts/RemoteConfig.ts b/ts/RemoteConfig.ts index dad585e54..cc2e0ab35 100644 --- a/ts/RemoteConfig.ts +++ b/ts/RemoteConfig.ts @@ -30,6 +30,7 @@ export type ConfigKeyType = | 'desktop.messageCleanup' | 'desktop.messageRequests' | 'desktop.pnp' + | 'desktop.pnp.accountE164Deprecation' | 'desktop.retryRespondMaxAge' | 'desktop.safetyNumberAci' | 'desktop.safetyNumberAci.beta' diff --git a/ts/services/storageRecordOps.ts b/ts/services/storageRecordOps.ts index 42c12d07d..53a19145d 100644 --- a/ts/services/storageRecordOps.ts +++ b/ts/services/storageRecordOps.ts @@ -24,6 +24,7 @@ import { PhoneNumberDiscoverability, parsePhoneNumberDiscoverability, } from '../util/phoneNumberDiscoverability'; +import { isPnpEnabled } from '../util/isPnpEnabled'; import { arePinnedConversationsEqual } from '../util/arePinnedConversationsEqual'; import type { ConversationModel } from '../models/conversations'; import { @@ -1219,9 +1220,13 @@ export async function mergeAccountRecord( await window.storage.put('primarySendsSms', primarySendsSms); } - if (typeof accountE164 === 'string' && accountE164) { + if (typeof accountE164 === 'string') { await window.storage.put('accountE164', accountE164); - if (!RemoteConfig.isEnabled('desktop.pnp')) { + if ( + !RemoteConfig.isEnabled('desktop.pnp') && + !RemoteConfig.isEnabled('desktop.pnp.accountE164Deprecation') && + !isPnpEnabled() + ) { await window.storage.user.setNumber(accountE164); } }