Merge pull request #15264 from calixteman/editing_telemetry
[Editor] Add some telemetry to know how often the editing features are used (bug 1782254)
This commit is contained in:
commit
4f6cd05a53
@ -31,6 +31,7 @@ class AnnotationStorage {
|
||||
// can have undesirable effects.
|
||||
this.onSetModified = null;
|
||||
this.onResetModified = null;
|
||||
this.onAnnotationEditor = null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -100,6 +101,13 @@ class AnnotationStorage {
|
||||
if (modified) {
|
||||
this.#setModified();
|
||||
}
|
||||
|
||||
if (
|
||||
value instanceof AnnotationEditor &&
|
||||
typeof this.onAnnotationEditor === "function"
|
||||
) {
|
||||
this.onAnnotationEditor(value.constructor._type);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -164,6 +172,15 @@ class AnnotationStorage {
|
||||
return clone;
|
||||
}
|
||||
|
||||
get hasAnnotationEditors() {
|
||||
for (const value of this._storage.values()) {
|
||||
if (value instanceof AnnotationEditor) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* PLEASE NOTE: Only intended for usage within the API itself.
|
||||
* @ignore
|
||||
|
@ -63,6 +63,8 @@ class FreeTextEditor extends AnnotationEditor {
|
||||
],
|
||||
]);
|
||||
|
||||
static _type = "freetext";
|
||||
|
||||
constructor(params) {
|
||||
super({ ...params, name: "freeTextEditor" });
|
||||
this.#color =
|
||||
|
@ -67,6 +67,8 @@ class InkEditor extends AnnotationEditor {
|
||||
|
||||
static _l10nPromise;
|
||||
|
||||
static _type = "ink";
|
||||
|
||||
constructor(params) {
|
||||
super({ ...params, name: "inkEditor" });
|
||||
this.color = params.color || null;
|
||||
|
24
web/app.js
24
web/app.js
@ -1044,6 +1044,15 @@ const PDFViewerApplication = {
|
||||
await this.pdfScriptingManager.dispatchDidSave();
|
||||
this._saveInProgress = false;
|
||||
}
|
||||
|
||||
if (this.pdfDocument?.annotationStorage.hasAnnotationEditors) {
|
||||
this.externalServices.reportTelemetry({
|
||||
type: "editing",
|
||||
data: {
|
||||
type: "save",
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
downloadOrSave() {
|
||||
@ -1734,6 +1743,12 @@ const PDFViewerApplication = {
|
||||
delete this._annotationStorageModified;
|
||||
}
|
||||
};
|
||||
annotationStorage.onAnnotationEditor = typeStr => {
|
||||
this.externalServices.reportTelemetry({
|
||||
type: "editing",
|
||||
data: { type: typeStr },
|
||||
});
|
||||
};
|
||||
},
|
||||
|
||||
setInitialView(
|
||||
@ -1872,6 +1887,15 @@ const PDFViewerApplication = {
|
||||
this.externalServices.reportTelemetry({
|
||||
type: "print",
|
||||
});
|
||||
|
||||
if (this.pdfDocument?.annotationStorage.hasAnnotationEditors) {
|
||||
this.externalServices.reportTelemetry({
|
||||
type: "editing",
|
||||
data: {
|
||||
type: "print",
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
afterPrint() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user