Add more granularity to accountE164 deprecation

This commit is contained in:
Fedor Indutny 2023-08-30 15:27:07 +02:00 committed by GitHub
parent 00f0ccd900
commit 765ae54e78
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View file

@ -30,6 +30,7 @@ export type ConfigKeyType =
| 'desktop.messageCleanup'
| 'desktop.messageRequests'
| 'desktop.pnp'
| 'desktop.pnp.accountE164Deprecation'
| 'desktop.retryRespondMaxAge'
| 'desktop.safetyNumberAci'
| 'desktop.safetyNumberAci.beta'

View file

@ -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);
}
}