Remove usage of deprecated CryptoEvents (#126)

* Remove usage of `CryptoEvent.DeviceVerificationChanged`

* Remove usage of `CryptoEvent.KeySignatureUploadFailure`

* Remove usage of `CryptoEvent.Warning`

* Merge `CryptoEvent.DevicesUpdated` and `CryptoEvent.WillUpdateDevices` behaviour
This commit is contained in:
Florian Duros 2024-10-08 10:13:44 +02:00 committed by GitHub
parent a0cb9470cc
commit 31bd10e887
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 1 additions and 196 deletions

View file

@ -1381,22 +1381,16 @@ export const useDevices = (userId: string): IDevice[] | undefined | null => {
if (!users.includes(userId)) return;
updateDevices();
};
const onDeviceVerificationChanged = (_userId: string, deviceId: string): void => {
if (_userId !== userId) return;
updateDevices();
};
const onUserTrustStatusChanged = (_userId: string, trustLevel: UserVerificationStatus): void => {
if (_userId !== userId) return;
updateDevices();
};
cli.on(CryptoEvent.DevicesUpdated, onDevicesUpdated);
cli.on(CryptoEvent.DeviceVerificationChanged, onDeviceVerificationChanged);
cli.on(CryptoEvent.UserTrustStatusChanged, onUserTrustStatusChanged);
// Handle being unmounted
return () => {
cancel = true;
cli.removeListener(CryptoEvent.DevicesUpdated, onDevicesUpdated);
cli.removeListener(CryptoEvent.DeviceVerificationChanged, onDeviceVerificationChanged);
cli.removeListener(CryptoEvent.UserTrustStatusChanged, onUserTrustStatusChanged);
};
}, [cli, userId]);