Merge pull request #16989 from Snuffleupagus/more-reporttelemetry-event
Use the new "reporttelemetry" event in more viewer components
This commit is contained in:
commit
34506f8874
@ -615,8 +615,7 @@ const PDFViewerApplication = {
|
|||||||
appConfig.toolbar,
|
appConfig.toolbar,
|
||||||
eventBus,
|
eventBus,
|
||||||
l10n,
|
l10n,
|
||||||
await this._nimbusDataPromise,
|
await this._nimbusDataPromise
|
||||||
externalServices
|
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
this.toolbar = new Toolbar(appConfig.toolbar, eventBus, l10n);
|
this.toolbar = new Toolbar(appConfig.toolbar, eventBus, l10n);
|
||||||
@ -626,8 +625,7 @@ const PDFViewerApplication = {
|
|||||||
if (appConfig.secondaryToolbar) {
|
if (appConfig.secondaryToolbar) {
|
||||||
this.secondaryToolbar = new SecondaryToolbar(
|
this.secondaryToolbar = new SecondaryToolbar(
|
||||||
appConfig.secondaryToolbar,
|
appConfig.secondaryToolbar,
|
||||||
eventBus,
|
eventBus
|
||||||
externalServices
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2141,7 +2139,6 @@ const PDFViewerApplication = {
|
|||||||
eventBus._off("fileinputchange", webViewerFileInputChange);
|
eventBus._off("fileinputchange", webViewerFileInputChange);
|
||||||
eventBus._off("openfile", webViewerOpenFile);
|
eventBus._off("openfile", webViewerOpenFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")) {
|
if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")) {
|
||||||
eventBus._off("reporttelemetry", webViewerReportTelemetry);
|
eventBus._off("reporttelemetry", webViewerReportTelemetry);
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,7 @@ class SecondaryToolbar {
|
|||||||
* @param {SecondaryToolbarOptions} options
|
* @param {SecondaryToolbarOptions} options
|
||||||
* @param {EventBus} eventBus
|
* @param {EventBus} eventBus
|
||||||
*/
|
*/
|
||||||
constructor(options, eventBus, externalServices) {
|
constructor(options, eventBus) {
|
||||||
this.toolbar = options.toolbar;
|
this.toolbar = options.toolbar;
|
||||||
this.toggleButton = options.toggleButton;
|
this.toggleButton = options.toggleButton;
|
||||||
this.buttons = [
|
this.buttons = [
|
||||||
@ -155,7 +155,6 @@ class SecondaryToolbar {
|
|||||||
};
|
};
|
||||||
|
|
||||||
this.eventBus = eventBus;
|
this.eventBus = eventBus;
|
||||||
this.externalServices = externalServices;
|
|
||||||
this.opened = false;
|
this.opened = false;
|
||||||
|
|
||||||
// Bind the event listeners for click, cursor tool, and scroll/spread mode
|
// Bind the event listeners for click, cursor tool, and scroll/spread mode
|
||||||
@ -214,9 +213,12 @@ class SecondaryToolbar {
|
|||||||
if (close) {
|
if (close) {
|
||||||
this.close();
|
this.close();
|
||||||
}
|
}
|
||||||
this.externalServices.reportTelemetry({
|
this.eventBus.dispatch("reporttelemetry", {
|
||||||
type: "buttons",
|
source: this,
|
||||||
data: { id: element.id },
|
details: {
|
||||||
|
type: "buttons",
|
||||||
|
data: { id: element.id },
|
||||||
|
},
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -25,18 +25,14 @@ class Toolbar {
|
|||||||
|
|
||||||
#eventBus;
|
#eventBus;
|
||||||
|
|
||||||
#externalServices;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {ToolbarOptions} options
|
* @param {ToolbarOptions} options
|
||||||
* @param {EventBus} eventBus
|
* @param {EventBus} eventBus
|
||||||
* @param {IL10n} _l10n - Localization service.
|
* @param {IL10n} _l10n - Localization service.
|
||||||
* @param {Object} nimbusData - Nimbus configuration.
|
* @param {Object} nimbusData - Nimbus configuration.
|
||||||
* @param {Object} externalServices - Interface for external services.
|
|
||||||
*/
|
*/
|
||||||
constructor(options, eventBus, _l10n, nimbusData, externalServices) {
|
constructor(options, eventBus, _l10n, nimbusData) {
|
||||||
this.#eventBus = eventBus;
|
this.#eventBus = eventBus;
|
||||||
this.#externalServices = externalServices;
|
|
||||||
const buttons = [
|
const buttons = [
|
||||||
{
|
{
|
||||||
element: options.download,
|
element: options.download,
|
||||||
@ -88,9 +84,12 @@ class Toolbar {
|
|||||||
element.addEventListener("click", evt => {
|
element.addEventListener("click", evt => {
|
||||||
if (eventName !== null) {
|
if (eventName !== null) {
|
||||||
this.#eventBus.dispatch(eventName, { source: this, ...eventDetails });
|
this.#eventBus.dispatch(eventName, { source: this, ...eventDetails });
|
||||||
this.#externalServices.reportTelemetry({
|
this.#eventBus.dispatch("reporttelemetry", {
|
||||||
type: "gv-buttons",
|
source: this,
|
||||||
data: { id: `${element.id}_tapped` },
|
details: {
|
||||||
|
type: "gv-buttons",
|
||||||
|
data: { id: `${element.id}_tapped` },
|
||||||
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user