aboutsummaryrefslogtreecommitdiffstats
path: root/src/stores/AppStore.js
diff options
context:
space:
mode:
authorLibravatar Stefan Malzner <stefan@adlk.io>2018-04-02 19:52:09 +0200
committerLibravatar GitHub <noreply@github.com>2018-04-02 19:52:09 +0200
commitc444b31bfa0c6224e5ebf2badc7d3ee513105dc5 (patch)
tree4742bde584dcec13d97b0e9da615cb7e76940a82 /src/stores/AppStore.js
parentmove windows arch config to electron-builder.yml (diff)
parentMerge branch 'chore/split-local-settings' into feature/disable-gpu-acceleration (diff)
downloadferdium-app-c444b31bfa0c6224e5ebf2badc7d3ee513105dc5.tar.gz
ferdium-app-c444b31bfa0c6224e5ebf2badc7d3ee513105dc5.tar.zst
ferdium-app-c444b31bfa0c6224e5ebf2badc7d3ee513105dc5.zip
Merge pull request #856 from meetfranz/feature/disable-gpu-acceleration
Add option to disable gpu acceleration
Diffstat (limited to 'src/stores/AppStore.js')
-rw-r--r--src/stores/AppStore.js27
1 files changed, 19 insertions, 8 deletions
diff --git a/src/stores/AppStore.js b/src/stores/AppStore.js
index 4ac8325d4..ea1e71bdc 100644
--- a/src/stores/AppStore.js
+++ b/src/stores/AppStore.js
@@ -15,6 +15,8 @@ import { gaEvent } from '../lib/analytics';
15 15
16import { getServiceIdsFromPartitions, removeServicePartitionDirectory } from '../helpers/service-helpers.js'; 16import { getServiceIdsFromPartitions, removeServicePartitionDirectory } from '../helpers/service-helpers.js';
17 17
18const debug = require('debug')('AppStore');
19
18const { app } = remote; 20const { app } = remote;
19 21
20const defaultLocale = DEFAULT_APP_SETTINGS.locale; 22const defaultLocale = DEFAULT_APP_SETTINGS.locale;
@@ -157,7 +159,7 @@ export default class AppStore extends Store {
157 159
158 // Actions 160 // Actions
159 @action _notify({ title, options, notificationId, serviceId = null }) { 161 @action _notify({ title, options, notificationId, serviceId = null }) {
160 if (this.stores.settings.all.isAppMuted) return; 162 if (this.stores.settings.all.app.isAppMuted) return;
161 163
162 const notification = new window.Notification(title, options); 164 const notification = new window.Notification(title, options);
163 notification.onclick = (e) => { 165 notification.onclick = (e) => {
@@ -238,14 +240,15 @@ export default class AppStore extends Store {
238 this.isSystemMuteOverridden = overrideSystemMute; 240 this.isSystemMuteOverridden = overrideSystemMute;
239 241
240 this.actions.settings.update({ 242 this.actions.settings.update({
241 settings: { 243 type: 'app',
244 data: {
242 isAppMuted: isMuted, 245 isAppMuted: isMuted,
243 }, 246 },
244 }); 247 });
245 } 248 }
246 249
247 @action _toggleMuteApp() { 250 @action _toggleMuteApp() {
248 this._muteApp({ isMuted: !this.stores.settings.all.isAppMuted }); 251 this._muteApp({ isMuted: !this.stores.settings.all.app.isAppMuted });
249 } 252 }
250 253
251 @action async _clearAllCache() { 254 @action async _clearAllCache() {
@@ -279,13 +282,19 @@ export default class AppStore extends Store {
279 } 282 }
280 283
281 _setLocale() { 284 _setLocale() {
282 const locale = this.stores.settings.all.locale; 285 let locale;
286 if (this.stores.user.isLoggedIn) {
287 locale = this.stores.user.data.locale;
288 }
289
283 290
284 if (locale && Object.prototype.hasOwnProperty.call(locales, locale) && locale !== this.locale) { 291 if (locale && Object.prototype.hasOwnProperty.call(locales, locale) && locale !== this.locale) {
285 this.locale = locale; 292 this.locale = locale;
286 } else if (!locale) { 293 } else if (!locale) {
287 this.locale = this._getDefaultLocale(); 294 this.locale = this._getDefaultLocale();
288 } 295 }
296
297 debug(`Set locale to "${this.locale}"`);
289 } 298 }
290 299
291 _getDefaultLocale() { 300 _getDefaultLocale() {
@@ -327,8 +336,9 @@ export default class AppStore extends Store {
327 // Helpers 336 // Helpers
328 _appStartsCounter() { 337 _appStartsCounter() {
329 this.actions.settings.update({ 338 this.actions.settings.update({
330 settings: { 339 type: 'stats',
331 appStarts: (this.stores.settings.all.appStarts || 0) + 1, 340 data: {
341 appStarts: (this.stores.settings.all.stats.appStarts || 0) + 1,
332 }, 342 },
333 }); 343 });
334 } 344 }
@@ -336,7 +346,8 @@ export default class AppStore extends Store {
336 async _autoStart() { 346 async _autoStart() {
337 this.autoLaunchOnStart = await this._checkAutoStart(); 347 this.autoLaunchOnStart = await this._checkAutoStart();
338 348
339 if (this.stores.settings.all.appStarts === 1) { 349 if (this.stores.settings.all.stats.appStarts === 1) {
350 debug('Set app to launch on start');
340 this.actions.app.launchOnStartup({ 351 this.actions.app.launchOnStartup({
341 enable: true, 352 enable: true,
342 }); 353 });
@@ -349,7 +360,7 @@ export default class AppStore extends Store {
349 360
350 _systemDND() { 361 _systemDND() {
351 const dnd = getDoNotDisturb(); 362 const dnd = getDoNotDisturb();
352 if (dnd !== this.stores.settings.all.isAppMuted && !this.isSystemMuteOverridden) { 363 if (dnd !== this.stores.settings.all.app.isAppMuted && !this.isSystemMuteOverridden) {
353 this.actions.app.muteApp({ 364 this.actions.app.muteApp({
354 isMuted: dnd, 365 isMuted: dnd,
355 overrideSystemMute: false, 366 overrideSystemMute: false,