Improvements to analytics collection.
parent
5a3bda615d
commit
6b7ac3e542
19
gulpfile.js
19
gulpfile.js
|
@ -22,6 +22,7 @@ const concat = require('gulp-concat');
|
|||
const install = require("gulp-install");
|
||||
const rename = require('gulp-rename');
|
||||
const os = require('os');
|
||||
const git = require('gulp-git');
|
||||
|
||||
const DIST_DIR = './dist/';
|
||||
const APPS_DIR = './apps/';
|
||||
|
@ -60,7 +61,9 @@ gulp.task('clean-release', clean_release);
|
|||
|
||||
gulp.task('clean-cache', clean_cache);
|
||||
|
||||
var distBuild = gulp.series(dist_src, dist_locale, dist_libraries, dist_resources);
|
||||
gulp.task('get-changeset-id', getChangesetId);
|
||||
|
||||
var distBuild = gulp.series(dist_src, dist_locale, dist_libraries, dist_resources, getChangesetId);
|
||||
var distRebuild = gulp.series(clean_dist, distBuild);
|
||||
gulp.task('dist', distRebuild);
|
||||
|
||||
|
@ -433,6 +436,20 @@ function buildNWApps(platforms, flavor, dir, done) {
|
|||
}
|
||||
}
|
||||
|
||||
function getChangesetId(done) {
|
||||
git.exec({args : 'log -1 --format="%h"'}, function (err, stdout) {
|
||||
if (err) {
|
||||
throw err;
|
||||
}
|
||||
|
||||
var versionData = { gitChangesetId: stdout.trim() }
|
||||
var destFile = path.join(DIST_DIR, 'version.json');
|
||||
|
||||
fs.writeFile(destFile, JSON.stringify(versionData) , function () {
|
||||
done();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function start_debug(done) {
|
||||
|
||||
|
|
|
@ -201,6 +201,12 @@
|
|||
"integrity": "sha1-q8av7tzqUugJzcA3au0845Y10X8=",
|
||||
"dev": true
|
||||
},
|
||||
"any-shell-escape": {
|
||||
"version": "0.1.1",
|
||||
"resolved": "https://registry.npmjs.org/any-shell-escape/-/any-shell-escape-0.1.1.tgz",
|
||||
"integrity": "sha1-1Vq5ciRMcaml4asIefML8RCAaVk=",
|
||||
"dev": true
|
||||
},
|
||||
"anymatch": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/anymatch/-/anymatch-2.0.0.tgz",
|
||||
|
@ -2374,6 +2380,15 @@
|
|||
"parse-filepath": "^1.0.1"
|
||||
}
|
||||
},
|
||||
"first-chunk-stream": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/first-chunk-stream/-/first-chunk-stream-2.0.0.tgz",
|
||||
"integrity": "sha1-G97NuOCDwGZLkZRVgVd6Q6nzHXA=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"readable-stream": "^2.0.2"
|
||||
}
|
||||
},
|
||||
"flagged-respawn": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/flagged-respawn/-/flagged-respawn-1.0.0.tgz",
|
||||
|
@ -3465,6 +3480,43 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"gulp-git": {
|
||||
"version": "2.8.0",
|
||||
"resolved": "https://registry.npmjs.org/gulp-git/-/gulp-git-2.8.0.tgz",
|
||||
"integrity": "sha512-45pahZGIcsb6eCJS9EGCdXqYBbxE1dtSbS03iXIF3dHHor1r37KMqwoQQJv1SXJjpLKc6ei+rdvIl7Ar6tB+ow==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"any-shell-escape": "^0.1.1",
|
||||
"fancy-log": "^1.3.2",
|
||||
"lodash.template": "^4.4.0",
|
||||
"plugin-error": "^0.1.2",
|
||||
"require-dir": "^1.0.0",
|
||||
"strip-bom-stream": "^3.0.0",
|
||||
"through2": "^2.0.3",
|
||||
"vinyl": "^2.0.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"lodash.template": {
|
||||
"version": "4.4.0",
|
||||
"resolved": "https://registry.npmjs.org/lodash.template/-/lodash.template-4.4.0.tgz",
|
||||
"integrity": "sha1-5zoDhcg1VZF0bgILmWecaQ5o+6A=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"lodash._reinterpolate": "~3.0.0",
|
||||
"lodash.templatesettings": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"lodash.templatesettings": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/lodash.templatesettings/-/lodash.templatesettings-4.1.0.tgz",
|
||||
"integrity": "sha1-K01OlbpEDZFf8IvImeRVNmZxMxY=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"lodash._reinterpolate": "~3.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"gulp-install": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/gulp-install/-/gulp-install-1.1.0.tgz",
|
||||
|
@ -6920,6 +6972,12 @@
|
|||
"when": "^3.7.7"
|
||||
}
|
||||
},
|
||||
"require-dir": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/require-dir/-/require-dir-1.0.0.tgz",
|
||||
"integrity": "sha512-PUJcQVTP4n6F8Un1GEEWhqnmBMfukVsL5gqwBxt7RF+nP+9hSOLJ/vSs5iUoXw1UWDgzqg9B/IIb15kfQKWsAQ==",
|
||||
"dev": true
|
||||
},
|
||||
"require-directory": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
|
||||
|
@ -7764,6 +7822,25 @@
|
|||
"is-utf8": "^0.2.0"
|
||||
}
|
||||
},
|
||||
"strip-bom-buf": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/strip-bom-buf/-/strip-bom-buf-1.0.0.tgz",
|
||||
"integrity": "sha1-HLRar1dTD0yvhsf3UXnSyaUd1XI=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"is-utf8": "^0.2.1"
|
||||
}
|
||||
},
|
||||
"strip-bom-stream": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/strip-bom-stream/-/strip-bom-stream-3.0.0.tgz",
|
||||
"integrity": "sha1-lWvMXYRDD2klapDtgjdlzYWOFZw=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"first-chunk-stream": "^2.0.0",
|
||||
"strip-bom-buf": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"strip-eof": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz",
|
||||
|
|
|
@ -52,6 +52,7 @@
|
|||
"gulp": "~4.0.0",
|
||||
"gulp-concat": "~2.6.1",
|
||||
"gulp-debian": "~0.1.8",
|
||||
"gulp-git": "^2.8.0",
|
||||
"gulp-install": "^1.1.0",
|
||||
"gulp-rename": "~1.2.2",
|
||||
"gulp-zip": "^4.1.0",
|
||||
|
|
|
@ -1473,6 +1473,12 @@ dialog {
|
|||
transition: none;
|
||||
}
|
||||
|
||||
.connect_b a.connect.disabled {
|
||||
background-color: #808080;
|
||||
pointer-events: none;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.connect_b a.connect {
|
||||
background-color: #ffbb00;
|
||||
border: 1px solid #dba718;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
var Analytics = function (trackingId, userId, appName, appVersion, buildType, optOut, debugMode) {
|
||||
var Analytics = function (trackingId, userId, appName, appVersion, changesetId, buildType, checkForDebugVersions, optOut, debugMode) {
|
||||
this._trackingId = trackingId;
|
||||
|
||||
this.setOptOut(optOut);
|
||||
|
@ -58,6 +58,8 @@ var Analytics = function (trackingId, userId, appName, appVersion, buildType, op
|
|||
FIRMWARE_CHANNEL: 10,
|
||||
LOGGING_STATUS: 11,
|
||||
MCU_ID: 12,
|
||||
CONFIGURATOR_CHANGESET_ID: 13,
|
||||
CONFIGURATOR_USE_DEBUG_VERSIONS: 14,
|
||||
};
|
||||
|
||||
this.METRICS = {
|
||||
|
@ -66,6 +68,8 @@ var Analytics = function (trackingId, userId, appName, appVersion, buildType, op
|
|||
};
|
||||
|
||||
this.setDimension(this.DIMENSIONS.CONFIGURATOR_BUILD_TYPE, buildType);
|
||||
this.setDimension(this.DIMENSIONS.CONFIGURATOR_CHANGESET_ID, changesetId);
|
||||
this.setDimension(this.DIMENSIONS.CONFIGURATOR_USE_DEBUG_VERSIONS, checkForDebugVersions);
|
||||
|
||||
this.resetFlightControllerData();
|
||||
this.resetFirmwareData();
|
||||
|
|
|
@ -15,12 +15,16 @@ $(document).ready(function () {
|
|||
function checkSetupAnalytics(callback) {
|
||||
if (!analytics) {
|
||||
setTimeout(function () {
|
||||
chrome.storage.local.get(['userId', 'analyticsOptOut'], function (result) {
|
||||
if (!analytics) {
|
||||
setupAnalytics(result);
|
||||
}
|
||||
chrome.storage.local.get(['userId', 'analyticsOptOut', 'checkForConfiguratorUnstableVersions', ], function (result) {
|
||||
$.getJSON('version.json', function(data) {
|
||||
var gitChangesetId = data.gitChangesetId;
|
||||
|
||||
callback(analytics);
|
||||
if (!analytics) {
|
||||
setupAnalytics(result, gitChangesetId);
|
||||
}
|
||||
|
||||
callback(analytics);
|
||||
});
|
||||
});
|
||||
});
|
||||
} else if (callback) {
|
||||
|
@ -28,7 +32,7 @@ function checkSetupAnalytics(callback) {
|
|||
}
|
||||
};
|
||||
|
||||
function setupAnalytics(result) {
|
||||
function setupAnalytics(result, gitChangesetId) {
|
||||
var userId;
|
||||
if (result.userId) {
|
||||
userId = result.userId;
|
||||
|
@ -40,10 +44,11 @@ function setupAnalytics(result) {
|
|||
}
|
||||
|
||||
var optOut = !!result.analyticsOptOut;
|
||||
var checkForDebugVersions = !!result.checkForConfiguratorUnstableVersions;
|
||||
|
||||
var debugMode = process.versions['nw-flavor'] === 'sdk';
|
||||
|
||||
analytics = new Analytics('UA-123002063-1', userId, 'Betaflight Configurator', getManifestVersion(), GUI.operating_system, optOut, debugMode);
|
||||
analytics = new Analytics('UA-123002063-1', userId, 'Betaflight Configurator', getManifestVersion(), gitChangesetId, GUI.operating_system, checkForDebugVersions, optOut, debugMode);
|
||||
|
||||
function logException(exception) {
|
||||
analytics.sendException(exception.stack);
|
||||
|
@ -69,6 +74,8 @@ function setupAnalytics(result) {
|
|||
// Looks like we're in Chrome - but the event does not actually get fired
|
||||
chrome.runtime.onSuspend.addListener(sendCloseEvent);
|
||||
}
|
||||
|
||||
$('.connect_b a.connect').removeClass('disabled');
|
||||
}
|
||||
|
||||
//Process to execute to real start the app
|
||||
|
|
|
@ -125,7 +125,7 @@
|
|||
<div id="port-picker">
|
||||
<div class="connect_controls" id="connectbutton">
|
||||
<div class="connect_b">
|
||||
<a class="connect" href="#"></a>
|
||||
<a class="connect disabled" href="#"></a>
|
||||
</div>
|
||||
<a class="connect_state" i18n="connect"></a>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue