From 8d46077ac21b0e185dab94146c55c0fdb47cb2b3 Mon Sep 17 00:00:00 2001 From: David Baker Date: Tue, 8 Nov 2016 10:47:01 +0000 Subject: [PATCH] Support for get_app_version --- src/vector/platform/ElectronPlatform.js | 5 +++++ src/vector/platform/WebPlatform.js | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/src/vector/platform/ElectronPlatform.js b/src/vector/platform/ElectronPlatform.js index 810fa984f6..c7455a7100 100644 --- a/src/vector/platform/ElectronPlatform.js +++ b/src/vector/platform/ElectronPlatform.js @@ -19,6 +19,7 @@ limitations under the License. import VectorBasePlatform from './VectorBasePlatform'; import dis from 'matrix-react-sdk/lib/dispatcher'; +import q from 'q'; const electron = require('electron'); const remote = electron.remote; @@ -84,6 +85,10 @@ export default class ElectronPlatform extends VectorBasePlatform { notif.close(); } + getAppVersion() { + return q(electron.remote.app.getVersion()); + } + pollForUpdate() { // In electron we control the update process ourselves, since // it needs to run in the main process, so we just run the timer diff --git a/src/vector/platform/WebPlatform.js b/src/vector/platform/WebPlatform.js index 4d99496729..b5459aec87 100644 --- a/src/vector/platform/WebPlatform.js +++ b/src/vector/platform/WebPlatform.js @@ -144,6 +144,13 @@ export default class WebPlatform extends VectorBasePlatform { return deferred.promise; } + getAppVersion() { + if (this.runningVersion !== null) { + return q(this.runningVersion); + } + return this._getVersion(); + } + pollForUpdate() { this._getVersion().done((ver) => { if (this.runningVersion == null) {