Electron-142 - Included build version in the about app section

This commit is contained in:
Kiran Niranjan
2017-10-30 14:25:33 +05:30
committed by Kiran Niranjan
parent eee6fe8bc9
commit 564950ec92
3 changed files with 16 additions and 4 deletions

View File

@@ -6,6 +6,7 @@ const path = require('path');
const fs = require('fs');
const log = require('../log.js');
const logLevels = require('../enums/logLevels.js');
const buildVersion = require('../../package.json').buildVersion;
let aboutWindow;
@@ -78,6 +79,10 @@ function openAboutWindow(windowName) {
aboutWindow.show();
});
aboutWindow.webContents.on('did-finish-load', () => {
aboutWindow.webContents.send('buildVersion', buildVersion || '0');
});
aboutWindow.on('close', () => {
destroyWindow();
});

View File

@@ -1,5 +1,5 @@
'use strict';
const { remote } = require('electron');
const { remote, ipcRenderer } = require('electron');
renderDom();
@@ -9,13 +9,19 @@ renderDom();
function renderDom() {
document.addEventListener('DOMContentLoaded', function () {
const applicationName = remote.app.getName() || 'Symphony';
const version = remote.app.getVersion();
let appName = document.getElementById('app-name');
let versionText = document.getElementById('version');
let copyright = document.getElementById('copyright');
appName.innerHTML = applicationName;
versionText.innerHTML = version ? `Version ${version} (${version})` : null;
copyright.innerHTML = `Copyright © ${new Date().getFullYear()} ${applicationName}`
});
}
ipcRenderer.on('buildVersion', (event, buildVersion) => {
let versionText = document.getElementById('version');
const version = remote.app.getVersion();
if (versionText) {
versionText.innerHTML = version ? `Version ${version} (${version}.${buildVersion})` : null;
}
});

View File

@@ -2,6 +2,7 @@
"name": "Symphony",
"productName": "Symphony",
"version": "2.0.0",
"buildVersion": "",
"description": "Symphony desktop app (Foundation ODP)",
"author": "Symphony",
"main": "js/main.js",