Skip to content

Commit 2c58120

Browse files
authored
Merge pull request #20929 from calixteman/bug2022481
Add the basic telemetry for Organize feature (bug 2022481)
2 parents 16aee06 + 008181a commit 2c58120

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

web/app.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1334,6 +1334,10 @@ const PDFViewerApplication = {
13341334
classList.add("wait");
13351335

13361336
if (this.pdfThumbnailViewer?.hasStructuralChanges()) {
1337+
this.externalServices.reportTelemetry({
1338+
type: "pageOrganization",
1339+
data: { action: "save" },
1340+
});
13371341
await this.onSavePages({
13381342
data: this.pdfThumbnailViewer.getStructuralChanges(),
13391343
});

web/pdf_thumbnail_viewer.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -709,6 +709,7 @@ class PDFThumbnailViewer {
709709
this.#toggleMenuEntries(false);
710710
this.#updateStatus("select");
711711

712+
this.#reportTelemetry({ action: "move" });
712713
this.eventBus.dispatch("pagesedited", {
713714
source: this,
714715
pagesMapper,
@@ -825,7 +826,18 @@ class PDFThumbnailViewer {
825826
}
826827
}
827828

829+
#reportTelemetry(data) {
830+
this.eventBus.dispatch("reporttelemetry", {
831+
source: this,
832+
details: {
833+
type: "pageOrganization",
834+
data,
835+
},
836+
});
837+
}
838+
828839
#saveExtractedPages() {
840+
this.#reportTelemetry({ action: "exportSelected" });
829841
this.eventBus.dispatch("saveextractedpages", {
830842
source: this,
831843
data: this.#pagesMapper.extractPages(this.#selectedPages),
@@ -840,6 +852,7 @@ class PDFThumbnailViewer {
840852
// that clicking the "Done" button later only cancels the copy and does
841853
// not accidentally restore a previous paste or delete.
842854
this.#savedThumbnails = null;
855+
this.#reportTelemetry({ action: "copy" });
843856
}
844857
this.#updateStatus(this.#isCut ? "cut" : "copy");
845858
const pageNumbersToCopy = (this.#copiedPageNumbers = Uint32Array.from(
@@ -869,12 +882,14 @@ class PDFThumbnailViewer {
869882
return;
870883
}
871884

885+
this.#reportTelemetry({ action: "cut" });
872886
this.#isCut = true;
873887
this.#copyPages(false);
874888
this.#deletePages(/* type = */ "cut");
875889
}
876890

877891
#pastePages(index) {
892+
this.#reportTelemetry({ action: "paste" });
878893
const pagesMapper = this.#pagesMapper;
879894
const currentPageNumber = this.#copiedPageNumbers.includes(
880895
this._currentPageNumber
@@ -907,6 +922,7 @@ class PDFThumbnailViewer {
907922

908923
const selectedPages = this.#selectedPages;
909924
if (type === "delete") {
925+
this.#reportTelemetry({ action: "delete" });
910926
this.#updateStatus("delete");
911927
}
912928
const pagesMapper = this.#pagesMapper;

0 commit comments

Comments
 (0)