Skip to content

Commit efda613

Browse files
committed
chore: add drag and drop metrics
1 parent a3bfa68 commit efda613

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

src/utils/DragAndDrop.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
define(function (require, exports, module) {
2323

2424

25-
var Async = require("utils/Async"),
25+
const Async = require("utils/Async"),
2626
CommandManager = require("command/CommandManager"),
2727
Commands = require("command/Commands"),
2828
Dialogs = require("widgets/Dialogs"),
@@ -33,6 +33,7 @@ define(function (require, exports, module) {
3333
FileUtils = require("file/FileUtils"),
3434
ProjectManager = require("project/ProjectManager"),
3535
Strings = require("strings"),
36+
Metrics = require("utils/Metrics"),
3637
StringUtils = require("utils/StringUtils");
3738

3839
const _PREF_DRAG_AND_DROP = "dragAndDrop"; // used in debug menu
@@ -117,6 +118,7 @@ define(function (require, exports, module) {
117118
}
118119
}
119120

121+
Metrics.countEvent(Metrics.EVENT_TYPE.PLATFORM, "dragAndDrop", "fileOpen");
120122
CommandManager.execute(Commands.CMD_ADD_TO_WORKINGSET_AND_OPEN,
121123
{fullPath: path, silent: true})
122124
.done(function () {
@@ -128,6 +130,7 @@ define(function (require, exports, module) {
128130
});
129131
} else if (!err && item.isDirectory && paths.length === 1) {
130132
// One folder was dropped, open it.
133+
Metrics.countEvent(Metrics.EVENT_TYPE.PLATFORM, "dragAndDrop", "projectOpen");
131134
ProjectManager.openProject(path)
132135
.done(function () {
133136
result.resolve();
@@ -191,6 +194,7 @@ define(function (require, exports, module) {
191194
|| payload.windowLabelOfListener !== window.__TAURI__.window.appWindow.label){
192195
return;
193196
}
197+
Metrics.countEvent(Metrics.EVENT_TYPE.PLATFORM, "dragAndDrop", "any");
194198
const droppedVirtualPaths = [];
195199
for(const droppedPath of payload.pathList) {
196200
try{
@@ -295,7 +299,8 @@ define(function (require, exports, module) {
295299
function handleDrop(event) {
296300
event = event.originalEvent || event;
297301

298-
var files = event.dataTransfer.files;
302+
const files = event.dataTransfer.files;
303+
Metrics.countEvent(Metrics.EVENT_TYPE.PLATFORM, "dragAndDrop", "any");
299304

300305
stopURIListPropagation(files, event);
301306

src/utils/Metrics.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,13 @@ define(function (require, exports, module) {
9090
* @type {Object}
9191
*/
9292
const EVENT_TYPE = {
93-
PLATFORM: "phoenix.platform",
93+
PLATFORM: "platform",
9494
PROJECT: "project",
9595
THEMES: "themes",
9696
EXTENSIONS: "extensions",
9797
NOTIFICATIONS: "notifications",
98-
UI: "phoenix.UI",
99-
UI_MENU: "phoenix.UIMenu",
98+
UI: "UI",
99+
UI_MENU: "UIMenu",
100100
UI_DIALOG: "ui-dialog",
101101
UI_BOTTOM_PANEL: "ui-bottomPanel",
102102
UI_SIDE_PANEL: "ui-sidePanel",

0 commit comments

Comments
 (0)