Merge pull request #1528 from dpalou/MOBILE-2607
MOBILE-2607 settings: Display last commit in about pagemain
commit
cba29471d8
19
gulpfile.js
19
gulpfile.js
|
@ -9,6 +9,7 @@ var gulp = require('gulp'),
|
||||||
flatten = require('gulp-flatten'),
|
flatten = require('gulp-flatten'),
|
||||||
npmPath = require('path'),
|
npmPath = require('path'),
|
||||||
File = gutil.File,
|
File = gutil.File,
|
||||||
|
exec = require('child_process').exec,
|
||||||
license = '' +
|
license = '' +
|
||||||
'// (C) Copyright 2015 Martin Dougiamas\n' +
|
'// (C) Copyright 2015 Martin Dougiamas\n' +
|
||||||
'//\n' +
|
'//\n' +
|
||||||
|
@ -75,7 +76,8 @@ function treatMergedData(data) {
|
||||||
var mergedOrdered = {};
|
var mergedOrdered = {};
|
||||||
|
|
||||||
for (var filepath in data) {
|
for (var filepath in data) {
|
||||||
var pathSplit = filepath.split('/');
|
var pathSplit = filepath.split('/'),
|
||||||
|
prefix;
|
||||||
|
|
||||||
pathSplit.pop();
|
pathSplit.pop();
|
||||||
|
|
||||||
|
@ -230,12 +232,21 @@ gulp.task('lang', function(done) {
|
||||||
|
|
||||||
// Convert config.json into a TypeScript class.
|
// Convert config.json into a TypeScript class.
|
||||||
gulp.task('config', function(done) {
|
gulp.task('config', function(done) {
|
||||||
|
// Get the last commit.
|
||||||
|
exec('git log -1 --pretty=format:"%H"', function (err, commit, stderr) {
|
||||||
|
if (err) {
|
||||||
|
console.error('An error occurred while getting the last commit: ' + err);
|
||||||
|
} else if (stderr) {
|
||||||
|
console.error('An error occurred while getting the last commit: ' + stderr);
|
||||||
|
}
|
||||||
|
|
||||||
gulp.src(paths.config)
|
gulp.src(paths.config)
|
||||||
.pipe(through(function(file) {
|
.pipe(through(function(file) {
|
||||||
// Convert the contents of the file into a TypeScript class.
|
// Convert the contents of the file into a TypeScript class.
|
||||||
// Disable the rule variable-name in the file.
|
// Disable the rule variable-name in the file.
|
||||||
var config = JSON.parse(file.contents.toString()),
|
var config = JSON.parse(file.contents.toString()),
|
||||||
contents = license + '// tslint:disable: variable-name\n' + 'export class CoreConfigConstants {\n';
|
contents = license + '// tslint:disable: variable-name\n' + 'export class CoreConfigConstants {\n',
|
||||||
|
that = this;
|
||||||
|
|
||||||
for (var key in config) {
|
for (var key in config) {
|
||||||
var value = config[key];
|
var value = config[key];
|
||||||
|
@ -269,8 +280,9 @@ gulp.task('config', function(done) {
|
||||||
contents += ' static ' + key + ' = ' + value + ';\n';
|
contents += ' static ' + key + ' = ' + value + ';\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add compilation time.
|
// Add compilation info.
|
||||||
contents += ' static compilationtime = ' + Date.now() + ';\n';
|
contents += ' static compilationtime = ' + Date.now() + ';\n';
|
||||||
|
contents += ' static lastcommit = \'' + commit + '\';\n';
|
||||||
|
|
||||||
contents += '}\n';
|
contents += '}\n';
|
||||||
|
|
||||||
|
@ -281,6 +293,7 @@ gulp.task('config', function(done) {
|
||||||
.pipe(gulp.dest(paths.src))
|
.pipe(gulp.dest(paths.src))
|
||||||
.on('end', done);
|
.on('end', done);
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
gulp.task('default', gulp.parallel('lang', 'config'));
|
gulp.task('default', gulp.parallel('lang', 'config'));
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
"appready": "App ready",
|
"appready": "App ready",
|
||||||
"cannotsyncoffline": "Cannot synchronise offline.",
|
"cannotsyncoffline": "Cannot synchronise offline.",
|
||||||
"cannotsyncwithoutwifi": "Cannot synchronise because the current settings only allow to synchronise when connected to Wi-Fi. Please connect to a Wi-Fi network.",
|
"cannotsyncwithoutwifi": "Cannot synchronise because the current settings only allow to synchronise when connected to Wi-Fi. Please connect to a Wi-Fi network.",
|
||||||
"compilationtime": "Compilation time",
|
"compilationinfo": "Compilation info",
|
||||||
"cordovadevicemodel": "Cordova device model",
|
"cordovadevicemodel": "Cordova device model",
|
||||||
"cordovadeviceosversion": "Cordova device OS version",
|
"cordovadeviceosversion": "Cordova device OS version",
|
||||||
"cordovadeviceplatform": "Cordova device platform",
|
"cordovadeviceplatform": "Cordova device platform",
|
||||||
|
|
|
@ -36,9 +36,10 @@
|
||||||
<h2>{{ 'core.settings.versioncode' | translate}}</h2>
|
<h2>{{ 'core.settings.versioncode' | translate}}</h2>
|
||||||
<p>{{ versionCode }}</p>
|
<p>{{ versionCode }}</p>
|
||||||
</ion-item>
|
</ion-item>
|
||||||
<ion-item text-wrap *ngIf="compilationTime">
|
<ion-item text-wrap *ngIf="compilationTime || lastCommit">
|
||||||
<h2>{{ 'core.settings.compilationtime' | translate }}</h2>
|
<h2>{{ 'core.settings.compilationinfo' | translate }}</h2>
|
||||||
<p>{{ compilationTime | coreFormatDate: "LLL Z" }}</p>
|
<p *ngIf="compilationTime">{{ compilationTime | coreFormatDate: "LLL Z" }}</p>
|
||||||
|
<p *ngIf="lastCommit">{{ lastCommit }}</p>
|
||||||
</ion-item>
|
</ion-item>
|
||||||
<ion-item text-wrap *ngIf="fileSystemRoot">
|
<ion-item text-wrap *ngIf="fileSystemRoot">
|
||||||
<h2>{{ 'core.settings.filesystemroot' | translate}}</h2>
|
<h2>{{ 'core.settings.filesystemroot' | translate}}</h2>
|
||||||
|
|
|
@ -37,6 +37,7 @@ export class CoreSettingsAboutPage {
|
||||||
versionName: string;
|
versionName: string;
|
||||||
versionCode: number;
|
versionCode: number;
|
||||||
compilationTime: number;
|
compilationTime: number;
|
||||||
|
lastCommit: string;
|
||||||
privacyPolicy: string;
|
privacyPolicy: string;
|
||||||
navigator: Navigator;
|
navigator: Navigator;
|
||||||
locationHref: string;
|
locationHref: string;
|
||||||
|
@ -63,6 +64,7 @@ export class CoreSettingsAboutPage {
|
||||||
this.versionName = CoreConfigConstants.versionname;
|
this.versionName = CoreConfigConstants.versionname;
|
||||||
this.versionCode = CoreConfigConstants.versioncode;
|
this.versionCode = CoreConfigConstants.versioncode;
|
||||||
this.compilationTime = CoreConfigConstants.compilationtime;
|
this.compilationTime = CoreConfigConstants.compilationtime;
|
||||||
|
this.lastCommit = CoreConfigConstants.lastcommit;
|
||||||
|
|
||||||
// Calculate the privacy policy to use.
|
// Calculate the privacy policy to use.
|
||||||
this.privacyPolicy = currentSite.getStoredConfig('tool_mobile_apppolicy') || currentSite.getStoredConfig('sitepolicy') ||
|
this.privacyPolicy = currentSite.getStoredConfig('tool_mobile_apppolicy') || currentSite.getStoredConfig('sitepolicy') ||
|
||||||
|
|
Loading…
Reference in New Issue