adding analytics

This commit is contained in:
Peli de Halleux 2018-02-20 08:49:28 -08:00
parent 06700ffc48
commit cb8118ab63

View File

@ -279,6 +279,7 @@ namespace pxt.editor {
let checksums: Uint8Array let checksums: Uint8Array
pxt.tickEvent("hid.flash.start");
return initAsync() return initAsync()
.then(w => { .then(w => {
wrap = w wrap = w
@ -287,8 +288,10 @@ namespace pxt.editor {
}) })
.then(() => wrap.cortexM.memory.readBlock(0x10001014, 1, pageSize)) .then(() => wrap.cortexM.memory.readBlock(0x10001014, 1, pageSize))
.then(v => { .then(v => {
if (HF2.read32(v, 0) != 0x3C000) if (HF2.read32(v, 0) != 0x3C000) {
pxt.tickEvent("hid.flash.uicrfail");
U.userError(U.lf("Please flash any MakeCode hex file using drag and drop. Flashing from app will work afterwards.")) U.userError(U.lf("Please flash any MakeCode hex file using drag and drop. Flashing from app will work afterwards."))
}
}) })
.then(() => getFlashChecksumsAsync(wrap)) .then(() => getFlashChecksumsAsync(wrap))
.then(buf => { .then(buf => {
@ -349,11 +352,13 @@ namespace pxt.editor {
}) })
.then(() => { .then(() => {
log("flash done") log("flash done")
pxt.tickEvent("hid.flash.done");
return wrap.cortexM.reset(false) return wrap.cortexM.reset(false)
}) })
}) })
.catch(e => { .catch(e => {
if (e.type === "devicenotfound" && d.reportDeviceNotFoundAsync) { if (e.type === "devicenotfound" && d.reportDeviceNotFoundAsync) {
pxt.tickEvent("hid.flash.devicenotfound");
return d.reportDeviceNotFoundAsync("/device/windows-app/troubleshoot", resp); return d.reportDeviceNotFoundAsync("/device/windows-app/troubleshoot", resp);
} else { } else {
return saveHexAsync() return saveHexAsync()