Kill off references to deprecated getStoredDevice
and getStoredDevicesForUser
(#11152)
* Use new `CryptoEvent.VerificationRequestReceived` event https://github.com/matrix-org/matrix-js-sdk/pull/3514 deprecates `CryptoEvent.VerificationRequest` in favour of `CryptoEvent.VerificationRequestReceived`. Use the new event. * Factor out `getDeviceCryptoInfo` function I seem to be writing this logic several times, so let's factor it out. * Factor out `getUserDeviceIds` function Another utility function * VerificationRequestToast: `getStoredDevice` -> `getDeviceCryptoInfo` * SlashCommands: `getStoredDevice` -> `getDeviceCryptoInfo` * MemberTile: `getStoredDevicesForUser` -> `getUserDeviceIds` * Remove redundant mock of `getStoredDevicesForUser`
This commit is contained in:
parent
0a3a111327
commit
46eb34a55d
11 changed files with 189 additions and 34 deletions
|
@ -46,6 +46,7 @@ import { recordClientInformation, removeClientInformation } from "./utils/device
|
|||
import SettingsStore, { CallbackFn } from "./settings/SettingsStore";
|
||||
import { UIFeature } from "./settings/UIFeature";
|
||||
import { isBulkUnverifiedDeviceReminderSnoozed } from "./utils/device/snoozeBulkUnverifiedDeviceReminder";
|
||||
import { getUserDeviceIds } from "./utils/crypto/deviceInfo";
|
||||
|
||||
const KEY_BACKUP_POLL_INTERVAL = 5 * 60 * 1000;
|
||||
|
||||
|
@ -161,12 +162,8 @@ export default class DeviceListener {
|
|||
*/
|
||||
private async getDeviceIds(): Promise<Set<string>> {
|
||||
const cli = this.client;
|
||||
const crypto = cli?.getCrypto();
|
||||
if (crypto === undefined) return new Set();
|
||||
|
||||
const userId = cli!.getSafeUserId();
|
||||
const devices = await crypto.getUserDeviceInfo([userId]);
|
||||
return new Set(devices.get(userId)?.keys() ?? []);
|
||||
if (!cli) return new Set();
|
||||
return await getUserDeviceIds(cli, cli.getSafeUserId());
|
||||
}
|
||||
|
||||
private onWillUpdateDevices = async (users: string[], initialFetch?: boolean): Promise<void> => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue