aboutsummaryrefslogtreecommitdiffstats
path: root/src/stores/AppStore.js
diff options
context:
space:
mode:
authorLibravatar Stefan Malzner <stefan@adlk.io>2018-11-30 14:32:45 +0100
committerLibravatar Stefan Malzner <stefan@adlk.io>2018-11-30 14:32:45 +0100
commit3d87c0e45cead95ddb6c11fc6540b82e375bdcf5 (patch)
treec91f425a39cb585242d6df5b4070de4a2141b3b4 /src/stores/AppStore.js
parentMerge branch 'update/monetization' into develop (diff)
downloadferdium-app-3d87c0e45cead95ddb6c11fc6540b82e375bdcf5.tar.gz
ferdium-app-3d87c0e45cead95ddb6c11fc6540b82e375bdcf5.tar.zst
ferdium-app-3d87c0e45cead95ddb6c11fc6540b82e375bdcf5.zip
feat(App): Improved spell checker & context menu
Diffstat (limited to 'src/stores/AppStore.js')
-rw-r--r--src/stores/AppStore.js64
1 files changed, 34 insertions, 30 deletions
diff --git a/src/stores/AppStore.js b/src/stores/AppStore.js
index 3e8b18801..45335c488 100644
--- a/src/stores/AppStore.js
+++ b/src/stores/AppStore.js
@@ -13,6 +13,7 @@ import { isMac, isLinux, isWindows } from '../environment';
13import locales from '../i18n/translations'; 13import locales from '../i18n/translations';
14import { gaEvent } from '../lib/analytics'; 14import { gaEvent } from '../lib/analytics';
15import { onVisibilityChange } from '../helpers/visibility-helper'; 15import { onVisibilityChange } from '../helpers/visibility-helper';
16import { getLocale } from '../helpers/i18n-helpers';
16 17
17import { getServiceIdsFromPartitions, removeServicePartitionDirectory } from '../helpers/service-helpers.js'; 18import { getServiceIdsFromPartitions, removeServicePartitionDirectory } from '../helpers/service-helpers.js';
18 19
@@ -59,6 +60,8 @@ export default class AppStore extends Store {
59 60
60 @observable isFocused = true; 61 @observable isFocused = true;
61 62
63 dictionaries = [];
64
62 constructor(...args) { 65 constructor(...args) {
63 super(...args); 66 super(...args);
64 67
@@ -82,7 +85,7 @@ export default class AppStore extends Store {
82 ]); 85 ]);
83 } 86 }
84 87
85 setup() { 88 async setup() {
86 this._appStartsCounter(); 89 this._appStartsCounter();
87 // Focus the active service 90 // Focus the active service
88 window.addEventListener('focus', this.actions.service.focusActiveService); 91 window.addEventListener('focus', this.actions.service.focusActiveService);
@@ -169,11 +172,6 @@ export default class AppStore extends Store {
169 172
170 onVisibilityChange((isVisible) => { 173 onVisibilityChange((isVisible) => {
171 this.isFocused = isVisible; 174 this.isFocused = isVisible;
172 // debug('Last focus', moment().diff(this.timeLastFocusStart));
173
174 // if (isVisible) {
175 // this.timeLastFocusStart = moment();
176 // }
177 175
178 debug('Window is visible/focused', isVisible); 176 debug('Window is visible/focused', isVisible);
179 }); 177 });
@@ -322,31 +320,37 @@ export default class AppStore extends Store {
322 } 320 }
323 321
324 _getDefaultLocale() { 322 _getDefaultLocale() {
325 let locale = app.getLocale(); 323 return getLocale({
326 if (locales[locale] === undefined) { 324 locale: app.getLocale(),
327 let localeFuzzy; 325 locales,
328 Object.keys(locales).forEach((localStr) => { 326 defaultLocale,
329 if (locales && Object.hasOwnProperty.call(locales, localStr)) { 327 fallbackLocale: DEFAULT_APP_SETTINGS.fallbackLocale,
330 if (locale.substring(0, 2) === localStr.substring(0, 2)) { 328 });
331 localeFuzzy = localStr;
332 }
333 }
334 });
335
336 if (localeFuzzy !== undefined) {
337 locale = localeFuzzy;
338 }
339 }
340
341 if (locales[locale] === undefined) {
342 locale = defaultLocale;
343 }
344
345 if (!locale) {
346 locale = DEFAULT_APP_SETTINGS.fallbackLocale;
347 }
348 329
349 return locale; 330 // if (locales[locale] === undefined) {
331 // let localeFuzzy;
332 // Object.keys(locales).forEach((localStr) => {
333 // if (locales && Object.hasOwnProperty.call(locales, localStr)) {
334 // if (locale.substring(0, 2) === localStr.substring(0, 2)) {
335 // localeFuzzy = localStr;
336 // }
337 // }
338 // });
339
340 // if (localeFuzzy !== undefined) {
341 // locale = localeFuzzy;
342 // }
343 // }
344
345 // if (locales[locale] === undefined) {
346 // locale = defaultLocale;
347 // }
348
349 // if (!locale) {
350 // locale = DEFAULT_APP_SETTINGS.fallbackLocale;
351 // }
352
353 // return locale;
350 } 354 }
351 355
352 _muteAppHandler() { 356 _muteAppHandler() {