Merge branch 'develop' into sort-imports
Signed-off-by: Aaron Raimist <aaron@raim.ist>
This commit is contained in:
commit
7b94e13a84
642 changed files with 30052 additions and 8035 deletions
|
@ -29,6 +29,7 @@ const BREADCRUMBS_EVENT_TYPE = "im.vector.setting.breadcrumbs";
|
|||
const BREADCRUMBS_EVENT_TYPES = [BREADCRUMBS_LEGACY_EVENT_TYPE, BREADCRUMBS_EVENT_TYPE];
|
||||
const RECENT_EMOJI_EVENT_TYPE = "io.element.recent_emoji";
|
||||
const INTEG_PROVISIONING_EVENT_TYPE = "im.vector.setting.integration_provisioning";
|
||||
const ANALYTICS_EVENT_TYPE = "im.vector.analytics";
|
||||
|
||||
/**
|
||||
* Gets and sets settings at the "account" level for the current user.
|
||||
|
@ -57,7 +58,7 @@ export default class AccountSettingsHandler extends MatrixClientBackedSettingsHa
|
|||
}
|
||||
|
||||
this.watchers.notifyUpdate("urlPreviewsEnabled", null, SettingLevel.ACCOUNT, val);
|
||||
} else if (event.getType() === "im.vector.web.settings") {
|
||||
} else if (event.getType() === "im.vector.web.settings" || event.getType() === ANALYTICS_EVENT_TYPE) {
|
||||
// Figure out what changed and fire those updates
|
||||
const prevContent = prevEvent ? prevEvent.getContent() : {};
|
||||
const changedSettings = objectKeyChanges<Record<string, any>>(prevContent, event.getContent());
|
||||
|
@ -128,6 +129,13 @@ export default class AccountSettingsHandler extends MatrixClientBackedSettingsHa
|
|||
return value;
|
||||
}
|
||||
|
||||
if (settingName === "pseudonymousAnalyticsOptIn") {
|
||||
const content = this.getSettings(ANALYTICS_EVENT_TYPE) || {};
|
||||
// Check to make sure that we actually got a boolean
|
||||
if (typeof(content[settingName]) !== "boolean") return null;
|
||||
return content[settingName];
|
||||
}
|
||||
|
||||
const settings = this.getSettings() || {};
|
||||
let preferredValue = settings[settingName];
|
||||
|
||||
|
@ -180,6 +188,14 @@ export default class AccountSettingsHandler extends MatrixClientBackedSettingsHa
|
|||
return;
|
||||
}
|
||||
|
||||
// Special case analytics
|
||||
if (settingName === "pseudonymousAnalyticsOptIn") {
|
||||
const content = this.getSettings(ANALYTICS_EVENT_TYPE) || {};
|
||||
content[settingName] = newValue;
|
||||
await MatrixClientPeg.get().setAccountData(ANALYTICS_EVENT_TYPE, content);
|
||||
return;
|
||||
}
|
||||
|
||||
const content = this.getSettings() || {};
|
||||
content[settingName] = newValue;
|
||||
await MatrixClientPeg.get().setAccountData("im.vector.web.settings", content);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue