arn the user about their app update status
*/
#okUpdateStatus() {
const okStatuses = [
lazy.AppUpdater.STATUS.NO_UPDATES_FOUND,
lazy.AppUpdater.STATUS.CHECKING,
lazy.AppUpdater.STATUS.NO_UPDATER,
lazy.AppUpdater.STATUS.UPDATE_DISABLED_BY_POLICY,
lazy.AppUpdater.STATUS.OTHER_INSTANCE_HANDLING_UPDATES,
undefined,
];
return okStatuses.includes(this.appUpdateStatus);
}
get strictEnabled() {
return this.setting.deps.etpStrictEnabled.value;
}
get trackersBlocked() {
return this.setting.deps.trackerCount.value;
}
get appUpdateStatus() {
return this.setting.deps.appUpdateStatus.value;
}
// This should really only be used for testing, as it
// overrides the reported app updater state
set appUpdateStatus(value) {
this.requestUpdate();
this.setting.deps.appUpdateStatus.value = value;
}
get configIssueCount() {
let filteredWarnings = [
"etpStrictEnabled",
"trackerCount",
"appUpdateStatus",
];
return Object.values(this.setting.deps).filter(
warning => !filteredWarnings.includes(warning.id) && warning.visible
).length;
}
/**
* Scrolling to an element in about:preferences is non-trivial because the fragment is controlled
* by the panel manager. So we need this logic.
*
* @param {string} panelHash - the ID of the panel the element we want to scroll to lives on
* @param {string} targetId - the ID of the element to scroll to
* @returns {Function} a callback that will perform the scroll
*/
#scrollToTargetOnPanel(panelHash, targetId) {
return function () {
// This actually scrolls to the target ID, if it exists.
// It looks in the document first, then the shadowRoot for that ID.
const scrollIntoView = () => {
let target = document.getElementById(targetId);
if (!target) {
target = this.shadowRoot.getElementById(targetId);
}
if (target) {
target.scrollIntoView({ behavior: "smooth" });
}
};
if (panelHash !== undefined && document.location.hash != panelHash) {
// If we are given a panel to go to, and we aren't already there,
// switch to that panel and when it is shown, scrollIntoView.
document.addEventListener("paneshown", scrollIntoView, { once: true });
document.location.hash = panelHash;
} else {
// Here we are already on the panel, so we can just scroll straight to it.
scrollIntoView();
}
};
}
#openWarningCardAndScroll() {
let accordion = document.getElementById("warningCard");
if (!accordion) {
return;
}
accordion.expanded = true;
this.#scrollToTargetOnPanel("#privacy", "warningCard")();
}
getStatusImage() {
if (this.configIssueCount > 0) {
return html``;
}
return html`
`;
}
/**
* Create the bullet point for the current count of "issues" in the user profile.
* Really only depends on `this.configIssueCount`
*
* @returns {TemplateResult} the HTML for the "issues" bullet of the custom element
*/
buildIssuesElement() {
if (this.configIssueCount == 0) {
return html`