Remove unused pre-PNP code
This commit is contained in:
parent
0ac65cb22b
commit
16dcf31906
8 changed files with 7 additions and 70 deletions
|
@ -183,7 +183,7 @@ message AccountRecord {
|
|||
optional bool preferContactAvatars = 15;
|
||||
optional uint32 universalExpireTimer = 17;
|
||||
optional bool primarySendsSms = 18;
|
||||
optional string e164 = 19;
|
||||
reserved 19; // deprecatedE164
|
||||
repeated string preferredReactionEmoji = 20;
|
||||
optional bytes subscriberId = 21;
|
||||
optional string subscriberCurrencyCode = 22;
|
||||
|
|
|
@ -15,8 +15,6 @@ import { HashType } from './types/Crypto';
|
|||
import { getCountryCode } from './types/PhoneNumber';
|
||||
|
||||
export type ConfigKeyType =
|
||||
| 'cds.disableCompatibilityMode'
|
||||
| 'desktop.cdsi.returnAcisWithoutUaks'
|
||||
| 'desktop.clientExpiration'
|
||||
| 'desktop.groupMultiTypingIndicators'
|
||||
| 'desktop.internalUser'
|
||||
|
|
|
@ -1802,9 +1802,7 @@ export async function startApp(): Promise<void> {
|
|||
try {
|
||||
// Note: we always have to register our capabilities all at once, so we do this
|
||||
// after connect on every startup
|
||||
await server.registerCapabilities({
|
||||
pni: true,
|
||||
});
|
||||
await server.registerCapabilities({});
|
||||
} catch (error) {
|
||||
log.error(
|
||||
'Error: Unable to register our capabilities.',
|
||||
|
|
|
@ -24,7 +24,6 @@ import {
|
|||
PhoneNumberDiscoverability,
|
||||
parsePhoneNumberDiscoverability,
|
||||
} from '../util/phoneNumberDiscoverability';
|
||||
import { isPnpCapable } from '../util/isPnpCapable';
|
||||
import { arePinnedConversationsEqual } from '../util/arePinnedConversationsEqual';
|
||||
import type { ConversationModel } from '../models/conversations';
|
||||
import {
|
||||
|
@ -281,14 +280,6 @@ export function toAccountRecord(
|
|||
accountRecord.primarySendsSms = Boolean(primarySendsSms);
|
||||
}
|
||||
|
||||
const accountE164 = window.storage.get('accountE164');
|
||||
// Once account becomes PNP capable - we want to stop populating this field
|
||||
// because it is deprecated in PNP world and we don't want to cause storage
|
||||
// service thrashing.
|
||||
if (accountE164 !== undefined && !isPnpCapable()) {
|
||||
accountRecord.e164 = accountE164;
|
||||
}
|
||||
|
||||
const rawPreferredReactionEmoji = window.storage.get(
|
||||
'preferredReactionEmoji'
|
||||
);
|
||||
|
@ -1194,7 +1185,6 @@ export async function mergeAccountRecord(
|
|||
preferContactAvatars,
|
||||
primarySendsSms,
|
||||
universalExpireTimer,
|
||||
e164: accountE164,
|
||||
preferredReactionEmoji: rawPreferredReactionEmoji,
|
||||
subscriberId,
|
||||
subscriberCurrencyCode,
|
||||
|
@ -1238,15 +1228,6 @@ export async function mergeAccountRecord(
|
|||
await window.storage.put('primarySendsSms', primarySendsSms);
|
||||
}
|
||||
|
||||
// Store AccountRecord.e164 in an auxiliary field that isn't used for any
|
||||
// other purpose in the app. This is required only while we are deprecating
|
||||
// the AccountRecord.e164.
|
||||
if (typeof accountE164 === 'string') {
|
||||
await window.storage.put('accountE164', accountE164);
|
||||
} else {
|
||||
await window.storage.remove('accountE164');
|
||||
}
|
||||
|
||||
if (preferredReactionEmoji.canBeSynced(rawPreferredReactionEmoji)) {
|
||||
const localPreferredReactionEmoji =
|
||||
window.storage.get('preferredReactionEmoji') || [];
|
||||
|
|
|
@ -636,12 +636,8 @@ export type WebAPIConnectType = {
|
|||
connect: (options: WebAPIConnectOptionsType) => WebAPIType;
|
||||
};
|
||||
|
||||
export type CapabilitiesType = {
|
||||
pni: boolean;
|
||||
};
|
||||
export type CapabilitiesUploadType = {
|
||||
pni: true;
|
||||
};
|
||||
export type CapabilitiesType = Record<string, never>;
|
||||
export type CapabilitiesUploadType = Record<string, never>;
|
||||
|
||||
type StickerPackManifestType = Uint8Array;
|
||||
|
||||
|
@ -2262,9 +2258,7 @@ export function initialize({
|
|||
fetchesMessages: true,
|
||||
registrationId,
|
||||
pniRegistrationId,
|
||||
capabilities: {
|
||||
pni: true,
|
||||
},
|
||||
capabilities: {},
|
||||
unidentifiedAccessKey: Bytes.toBase64(accessKey),
|
||||
},
|
||||
requireAtomic: true,
|
||||
|
@ -2315,9 +2309,7 @@ export function initialize({
|
|||
name: encryptedDeviceName,
|
||||
registrationId,
|
||||
pniRegistrationId,
|
||||
capabilities: {
|
||||
pni: true,
|
||||
},
|
||||
capabilities: {},
|
||||
},
|
||||
aciSignedPreKey: serializeSignedPreKey(aciSignedPreKey),
|
||||
pniSignedPreKey: serializeSignedPreKey(pniSignedPreKey),
|
||||
|
|
3
ts/types/Storage.d.ts
vendored
3
ts/types/Storage.d.ts
vendored
|
@ -124,9 +124,6 @@ export type StorageAccessType = {
|
|||
pinnedConversationIds: ReadonlyArray<string>;
|
||||
preferContactAvatars: boolean;
|
||||
primarySendsSms: boolean;
|
||||
// Unlike `number_id` (which also includes device id) this field is only
|
||||
// updated whenever we receive a new storage manifest
|
||||
accountE164: string;
|
||||
textFormatting: boolean;
|
||||
typingIndicators: boolean;
|
||||
sealedSenderIndicators: boolean;
|
||||
|
|
|
@ -5,7 +5,6 @@ import type { CDSResponseType } from '../textsecure/cds/Types.d';
|
|||
import type { WebAPIType } from '../textsecure/WebAPI';
|
||||
import type { AciString } from '../types/ServiceId';
|
||||
import * as log from '../logging/log';
|
||||
import { isEnabled } from '../RemoteConfig';
|
||||
import { isDirectConversation, isMe } from './whatTypeOfConversation';
|
||||
|
||||
export async function getServiceIdsForE164s(
|
||||
|
@ -36,10 +35,6 @@ export async function getServiceIdsForE164s(
|
|||
acisAndAccessKeys.push({ aci, accessKey });
|
||||
}
|
||||
|
||||
const returnAcisWithoutUaks =
|
||||
!isEnabled('cds.disableCompatibilityMode') &&
|
||||
isEnabled('desktop.cdsi.returnAcisWithoutUaks');
|
||||
|
||||
log.info(
|
||||
`getServiceIdsForE164s(${e164s}): acis=${acisAndAccessKeys.length} ` +
|
||||
`accessKeys=${acisAndAccessKeys.length}`
|
||||
|
@ -47,6 +42,6 @@ export async function getServiceIdsForE164s(
|
|||
return server.cdsLookup({
|
||||
e164s,
|
||||
acisAndAccessKeys,
|
||||
returnAcisWithoutUaks,
|
||||
returnAcisWithoutUaks: false,
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
// Copyright 2023 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import * as log from '../logging/log';
|
||||
|
||||
export function isPnpCapable(): boolean {
|
||||
const me = window.ConversationController.getOurConversation();
|
||||
if (!me) {
|
||||
log.warn('isPnpCapable: missing our conversation');
|
||||
return false;
|
||||
}
|
||||
|
||||
// These capabilities are filled by a periodic background check for our
|
||||
// account.
|
||||
const capabilities = me.get('capabilities');
|
||||
if (!capabilities) {
|
||||
log.warn('isPnpCapable: no cached capabilities');
|
||||
return false;
|
||||
}
|
||||
|
||||
// `capabilities.pni` becomes true once all linked devices and the primary
|
||||
// advertise this capability.
|
||||
return capabilities.pni === true;
|
||||
}
|
Loading…
Add table
Reference in a new issue