Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Device manager - remove client information events when disabling setting #9384

Merged
merged 3 commits into from
Oct 10, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
tweak naming
Kerry Archibald committed Oct 10, 2022
commit d53fdc73b6f1123ca587e7131115295451dcb2b2
14 changes: 7 additions & 7 deletions src/DeviceListener.ts
Original file line number Diff line number Diff line change
@@ -93,7 +93,7 @@ export default class DeviceListener {
);
this.dispatcherRef = dis.register(this.onAction);
this.recheck();
this.recordClientInformation();
this.updateClientInformation();
}

public stop() {
@@ -219,7 +219,7 @@ export default class DeviceListener {
private onAction = ({ action }: ActionPayload) => {
if (action !== Action.OnLoggedIn) return;
this.recheck();
this.recordClientInformation();
this.updateClientInformation();
};

// The server doesn't tell us when key backup is set up, so we poll
@@ -372,20 +372,20 @@ export default class DeviceListener {
this.shouldRecordClientInformation = !!newValue;

if (this.shouldRecordClientInformation !== prevValue) {
this.recordClientInformation();
this.updateClientInformation();
}
};

private recordClientInformation = async () => {
private updateClientInformation = async () => {
try {
if (!this.shouldRecordClientInformation) {
await removeClientInformation(MatrixClientPeg.get());
} else {
if (this.shouldRecordClientInformation) {
await recordClientInformation(
MatrixClientPeg.get(),
SdkConfig.get(),
PlatformPeg.get(),
);
} else {
await removeClientInformation(MatrixClientPeg.get());
}
} catch (error) {
// this is a best effort operation