absorb updater.js into the Platforms, gets rid of pointless setInterval in Electron
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> (cherry picked from commit 24e8a30) Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
24a5297fc8
commit
0e6012ad45
4 changed files with 17 additions and 33 deletions
|
@ -59,7 +59,6 @@ var sdk = require("matrix-react-sdk");
|
||||||
const PlatformPeg = require("matrix-react-sdk/lib/PlatformPeg");
|
const PlatformPeg = require("matrix-react-sdk/lib/PlatformPeg");
|
||||||
sdk.loadSkin(require('../component-index'));
|
sdk.loadSkin(require('../component-index'));
|
||||||
var VectorConferenceHandler = require('../VectorConferenceHandler');
|
var VectorConferenceHandler = require('../VectorConferenceHandler');
|
||||||
var UpdateChecker = require("./updater");
|
|
||||||
var q = require('q');
|
var q = require('q');
|
||||||
var request = require('browser-request');
|
var request = require('browser-request');
|
||||||
import * as UserSettingsStore from 'matrix-react-sdk/lib/UserSettingsStore';
|
import * as UserSettingsStore from 'matrix-react-sdk/lib/UserSettingsStore';
|
||||||
|
@ -277,7 +276,9 @@ async function loadApp() {
|
||||||
Unable to load config file: please refresh the page to try again.
|
Unable to load config file: please refresh the page to try again.
|
||||||
</div>, document.getElementById('matrixchat'));
|
</div>, document.getElementById('matrixchat'));
|
||||||
} else if (validBrowser) {
|
} else if (validBrowser) {
|
||||||
UpdateChecker.start();
|
const platform = PlatformPeg.get();
|
||||||
|
platform.startUpdater();
|
||||||
|
|
||||||
const MatrixChat = sdk.getComponent('structures.MatrixChat');
|
const MatrixChat = sdk.getComponent('structures.MatrixChat');
|
||||||
window.matrixChat = ReactDOM.render(
|
window.matrixChat = ReactDOM.render(
|
||||||
<MatrixChat
|
<MatrixChat
|
||||||
|
@ -290,7 +291,7 @@ async function loadApp() {
|
||||||
enableGuest={true}
|
enableGuest={true}
|
||||||
onLoadCompleted={onLoadCompleted}
|
onLoadCompleted={onLoadCompleted}
|
||||||
initialScreenAfterLogin={getScreenFromLocation(window.location)}
|
initialScreenAfterLogin={getScreenFromLocation(window.location)}
|
||||||
defaultDeviceDisplayName={PlatformPeg.get().getDefaultDeviceDisplayName()}
|
defaultDeviceDisplayName={platform.getDefaultDeviceDisplayName()}
|
||||||
/>,
|
/>,
|
||||||
document.getElementById('matrixchat')
|
document.getElementById('matrixchat')
|
||||||
);
|
);
|
||||||
|
|
|
@ -74,6 +74,12 @@ export default class VectorBasePlatform extends BasePlatform {
|
||||||
this._updateFavicon();
|
this._updateFavicon();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Begin update polling, if applicable
|
||||||
|
*/
|
||||||
|
startUpdater() {
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check for the availability of an update to the version of the
|
* Check for the availability of an update to the version of the
|
||||||
* app that's currently running.
|
* app that's currently running.
|
||||||
|
|
|
@ -26,6 +26,8 @@ import q from 'q';
|
||||||
import url from 'url';
|
import url from 'url';
|
||||||
import UAParser from 'ua-parser-js';
|
import UAParser from 'ua-parser-js';
|
||||||
|
|
||||||
|
var POKE_RATE_MS = 10 * 60 * 1000; // 10 min
|
||||||
|
|
||||||
export default class WebPlatform extends VectorBasePlatform {
|
export default class WebPlatform extends VectorBasePlatform {
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
|
@ -132,6 +134,11 @@ export default class WebPlatform extends VectorBasePlatform {
|
||||||
return this._getVersion();
|
return this._getVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
startUpdater() {
|
||||||
|
this.pollForUpdate();
|
||||||
|
setInterval(this.pollForUpdate, POKE_RATE_MS);
|
||||||
|
}
|
||||||
|
|
||||||
pollForUpdate() {
|
pollForUpdate() {
|
||||||
this._getVersion().done((ver) => {
|
this._getVersion().done((ver) => {
|
||||||
if (this.runningVersion === null) {
|
if (this.runningVersion === null) {
|
||||||
|
|
|
@ -1,30 +0,0 @@
|
||||||
/*
|
|
||||||
Copyright 2016 OpenMarket Ltd
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import PlatformPeg from 'matrix-react-sdk/lib/PlatformPeg';
|
|
||||||
|
|
||||||
var POKE_RATE_MS = 10 * 60 * 1000; // 10 min
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
start: function() {
|
|
||||||
module.exports.poll();
|
|
||||||
setInterval(module.exports.poll, POKE_RATE_MS);
|
|
||||||
},
|
|
||||||
|
|
||||||
poll: function() {
|
|
||||||
PlatformPeg.get().pollForUpdate();
|
|
||||||
}
|
|
||||||
};
|
|
Loading…
Reference in a new issue