aboutsummaryrefslogtreecommitdiffstats
path: root/src/stores/AppStore.js
diff options
context:
space:
mode:
authorLibravatar Stefan Malzner <stefan@adlk.io>2019-10-08 19:46:50 +0200
committerLibravatar Stefan Malzner <stefan@adlk.io>2019-10-08 19:46:50 +0200
commitd3009b91b487627e5d510ac01d79c29c90c82053 (patch)
tree739eb684c3c227ca121df2df445ed352a32c8129 /src/stores/AppStore.js
parentFix non-related issues (diff)
parentremove external url event (diff)
downloadferdium-app-d3009b91b487627e5d510ac01d79c29c90c82053.tar.gz
ferdium-app-d3009b91b487627e5d510ac01d79c29c90c82053.tar.zst
ferdium-app-d3009b91b487627e5d510ac01d79c29c90c82053.zip
Merge branch 'release/5.4.0-beta.3' into fix/only-load-workspace-related-services
Diffstat (limited to 'src/stores/AppStore.js')
-rw-r--r--src/stores/AppStore.js29
1 files changed, 26 insertions, 3 deletions
diff --git a/src/stores/AppStore.js b/src/stores/AppStore.js
index 0398b7533..4a00cb294 100644
--- a/src/stores/AppStore.js
+++ b/src/stores/AppStore.js
@@ -27,7 +27,9 @@ import { sleep } from '../helpers/async-helpers';
27 27
28const debug = require('debug')('Franz:AppStore'); 28const debug = require('debug')('Franz:AppStore');
29 29
30const { app, systemPreferences, screen } = remote; 30const {
31 app, systemPreferences, screen, powerMonitor,
32} = remote;
31 33
32const mainWindow = remote.getCurrentWindow(); 34const mainWindow = remote.getCurrentWindow();
33 35
@@ -55,6 +57,8 @@ export default class AppStore extends Store {
55 57
56 @observable isOnline = navigator.onLine; 58 @observable isOnline = navigator.onLine;
57 59
60 @observable timeSuspensionStart;
61
58 @observable timeOfflineStart; 62 @observable timeOfflineStart;
59 63
60 @observable updateStatus = null; 64 @observable updateStatus = null;
@@ -180,6 +184,27 @@ export default class AppStore extends Store {
180 gaPage(pathname); 184 gaPage(pathname);
181 }); 185 });
182 186
187 powerMonitor.on('suspend', () => {
188 debug('System suspended starting timer');
189
190 this.timeSuspensionStart = moment();
191 });
192
193 powerMonitor.on('resume', () => {
194 debug('System resumed, last suspended on', this.timeSuspensionStart.toString());
195
196 if (this.timeSuspensionStart.add(10, 'm').isBefore(moment())) {
197 debug('Reloading services, user info and features');
198
199 this.actions.service.reloadAll();
200
201 this.stores.user.getUserInfoRequest.invalidate({ immediately: true });
202 this.stores.features.featuresRequest.invalidate({ immediately: true });
203
204 statsEvent('resumed-app');
205 }
206 });
207
183 statsEvent('app-start'); 208 statsEvent('app-start');
184 } 209 }
185 210
@@ -279,8 +304,6 @@ export default class AppStore extends Store {
279 if (isValidExternalURL(url)) { 304 if (isValidExternalURL(url)) {
280 shell.openExternal(url); 305 shell.openExternal(url);
281 } 306 }
282
283 gaEvent('External URL', 'open', parsedUrl.host);
284 } 307 }
285 308
286 @action _checkForUpdates() { 309 @action _checkForUpdates() {