1
0
Fork 0
mirror of https://github.com/betaflight/betaflight-configurator.git synced 2025-07-22 07:45:19 +03:00

Standardised configurator version naming.

This commit is contained in:
Michael Keller 2021-08-22 18:54:34 +12:00
parent 515f650055
commit 4480621c14
12 changed files with 221 additions and 181 deletions

View file

@ -1,6 +1,6 @@
'use strict';
const Analytics = function (trackingId, userId, appName, appVersion, changesetId, os, checkForDebugVersions, optOut, debugMode, buildType) {
const Analytics = function (trackingId, userId, appName, appVersion, gitRevision, os, checkForDebugVersions, optOut, debugMode, buildType) {
this._trackingId = trackingId;
this.setOptOut(optOut);
@ -76,7 +76,7 @@ const Analytics = function (trackingId, userId, appName, appVersion, changesetId
};
this.setDimension(this.DIMENSIONS.CONFIGURATOR_OS, os);
this.setDimension(this.DIMENSIONS.CONFIGURATOR_CHANGESET_ID, changesetId);
this.setDimension(this.DIMENSIONS.CONFIGURATOR_CHANGESET_ID, gitRevision);
this.setDimension(this.DIMENSIONS.CONFIGURATOR_USE_DEBUG_VERSIONS, checkForDebugVersions);
this.setDimension(this.DIMENSIONS.CONFIGURATOR_BUILD_TYPE, buildType);

View file

@ -29,8 +29,17 @@ const CONFIGURATOR = {
virtualApiVersion: '0.0.1',
cliActive: false,
cliValid: false,
gitChangesetId: 'unknown',
productName: 'Betaflight Configurator',
version: '0.0.1',
gitRevision: 'norevision',
latestVersion: '0.0.1',
latestVersionReleaseUrl: 'https://github.com/betaflight/betaflight-configurator/releases',
getDisplayVersion: function () {
if (this.version.indexOf(this.gitRevision) === -1) {
return `${this.version} (${this.gitRevision})`;
} else {
return `${this.version}`;
}
},
};

View file

@ -21,20 +21,23 @@ function useGlobalNodeFunctions() {
}
}
function readConfiguratorVersionMetadata() {
let manifest = chrome.runtime.getManifest();
CONFIGURATOR.productName = manifest.productName;
CONFIGURATOR.version = manifest.version;
CONFIGURATOR.gitRevision = manifest.gitRevision;
}
function appReady() {
$.getJSON('version.json', function(data) {
CONFIGURATOR.version = data.version;
CONFIGURATOR.gitChangesetId = data.gitChangesetId;
readConfiguratorVersionMetadata();
i18n.init(function() {
startProcess();
i18n.init(function() {
startProcess();
checkSetupAnalytics(function (analyticsService) {
analyticsService.sendEvent(analyticsService.EVENT_CATEGORIES.APPLICATION, 'SelectedLanguage', i18n.selectedLanguage);
});
initializeSerialBackend();
checkSetupAnalytics(function (analyticsService) {
analyticsService.sendEvent(analyticsService.EVENT_CATEGORIES.APPLICATION, 'SelectedLanguage', i18n.selectedLanguage);
});
initializeSerialBackend();
});
}
@ -74,7 +77,7 @@ function setupAnalytics(result) {
const debugMode = typeof process === "object" && process.versions['nw-flavor'] === 'sdk';
window.analytics = new Analytics('UA-123002063-1', userId, 'Betaflight Configurator', CONFIGURATOR.version, CONFIGURATOR.gitChangesetId, GUI.operating_system,
window.analytics = new Analytics('UA-123002063-1', userId, CONFIGURATOR.productName, CONFIGURATOR.version, CONFIGURATOR.gitRevision, GUI.operating_system,
checkForDebugVersions, optOut, debugMode, getBuildType());
function logException(exception) {
@ -165,9 +168,8 @@ function startProcess() {
// translate to user-selected language
i18n.localizePage();
GUI.log(i18n.getMessage('infoVersions', {
operatingSystem: GUI.operating_system,
configuratorVersion: CONFIGURATOR.version }));
GUI.log(i18n.getMessage('infoVersionOs', { operatingSystem: GUI.operating_system }));
GUI.log(i18n.getMessage('infoVersionConfigurator', { configuratorVersion: CONFIGURATOR.getDisplayVersion() }));
if (GUI.isNWJS()) {
let nwWindow = GUI.nwGui.Window.get();

View file

@ -408,7 +408,7 @@ function checkReportProblems() {
if (semver.gt(FC.CONFIG.apiVersion, CONFIGURATOR.API_VERSION_MAX_SUPPORTED)) {
const problemName = 'API_VERSION_MAX_SUPPORTED';
problemItemTemplate.clone().html(i18n.getMessage(`reportProblemsDialog${problemName}`,
[CONFIGURATOR.latestVersion, CONFIGURATOR.latestVersionReleaseUrl, CONFIGURATOR.version, FC.CONFIG.flightControllerVersion])).appendTo(problemDialogList);
[CONFIGURATOR.latestVersion, CONFIGURATOR.latestVersionReleaseUrl, CONFIGURATOR.getDisplayVersion(), FC.CONFIG.flightControllerVersion])).appendTo(problemDialogList);
needsProblemReportingDialog = true;
analytics.sendEvent(analytics.EVENT_CATEGORIES.FLIGHT_CONTROLLER, PROBLEM_ANALYTICS_EVENT,