diff options
author | Vijay Aravamudhan <vraravam@users.noreply.github.com> | 2022-04-22 15:04:21 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-22 20:04:21 +0000 |
commit | 759d93dc198a3cc8c5265245c0144efa5435682b (patch) | |
tree | 53e963a085d3d12af5a2efa2f1ab6f3e5574edc7 /src/stores | |
parent | Added build scripts for linux, macos and windows to help new contributors get... (diff) | |
download | ferdium-app-759d93dc198a3cc8c5265245c0144efa5435682b.tar.gz ferdium-app-759d93dc198a3cc8c5265245c0144efa5435682b.tar.zst ferdium-app-759d93dc198a3cc8c5265245c0144efa5435682b.zip |
Turn off usage of 'debug' npm package using with electron-16 (fixes #17)
Diffstat (limited to 'src/stores')
-rw-r--r-- | src/stores/AppStore.js | 37 | ||||
-rw-r--r-- | src/stores/RecipesStore.js | 11 | ||||
-rw-r--r-- | src/stores/RequestStore.js | 5 | ||||
-rw-r--r-- | src/stores/ServicesStore.js | 55 | ||||
-rw-r--r-- | src/stores/SettingsStore.js | 11 | ||||
-rw-r--r-- | src/stores/UserStore.js | 5 |
6 files changed, 65 insertions, 59 deletions
diff --git a/src/stores/AppStore.js b/src/stores/AppStore.js index 68796b692..55cdce5f2 100644 --- a/src/stores/AppStore.js +++ b/src/stores/AppStore.js | |||
@@ -29,7 +29,8 @@ import { | |||
29 | import { openExternalUrl } from '../helpers/url-helpers'; | 29 | import { openExternalUrl } from '../helpers/url-helpers'; |
30 | import { sleep } from '../helpers/async-helpers'; | 30 | import { sleep } from '../helpers/async-helpers'; |
31 | 31 | ||
32 | const debug = require('debug')('Ferdium:AppStore'); | 32 | // TODO: Go back to 'debug' from 'console.log' when https://github.com/electron/electron/issues/31689 is fixed |
33 | // const debug = require('debug')('Ferdium:AppStore'); | ||
33 | 34 | ||
34 | const mainWindow = getCurrentWindow(); | 35 | const mainWindow = getCurrentWindow(); |
35 | 36 | ||
@@ -195,7 +196,7 @@ export default class AppStore extends Store { | |||
195 | 196 | ||
196 | // Handle deep linking (ferdium://) | 197 | // Handle deep linking (ferdium://) |
197 | ipcRenderer.on('navigateFromDeepLink', (event, data) => { | 198 | ipcRenderer.on('navigateFromDeepLink', (event, data) => { |
198 | debug('Navigate from deep link', data); | 199 | console.log('Navigate from deep link', data); |
199 | let { url } = data; | 200 | let { url } = data; |
200 | if (!url) return; | 201 | if (!url) return; |
201 | 202 | ||
@@ -217,28 +218,28 @@ export default class AppStore extends Store { | |||
217 | this.isSystemDarkModeEnabled = nativeTheme.shouldUseDarkColors; | 218 | this.isSystemDarkModeEnabled = nativeTheme.shouldUseDarkColors; |
218 | 219 | ||
219 | ipcRenderer.on('isWindowFocused', (event, isFocused) => { | 220 | ipcRenderer.on('isWindowFocused', (event, isFocused) => { |
220 | debug('Setting is focused to', isFocused); | 221 | console.log('Setting is focused to', isFocused); |
221 | this.isFocused = isFocused; | 222 | this.isFocused = isFocused; |
222 | }); | 223 | }); |
223 | 224 | ||
224 | powerMonitor.on('suspend', () => { | 225 | powerMonitor.on('suspend', () => { |
225 | debug('System suspended starting timer'); | 226 | console.log('System suspended starting timer'); |
226 | 227 | ||
227 | this.timeSuspensionStart = moment(); | 228 | this.timeSuspensionStart = moment(); |
228 | }); | 229 | }); |
229 | 230 | ||
230 | powerMonitor.on('resume', () => { | 231 | powerMonitor.on('resume', () => { |
231 | debug('System resumed, last suspended on', this.timeSuspensionStart); | 232 | console.log('System resumed, last suspended on', this.timeSuspensionStart); |
232 | this.actions.service.resetLastPollTimer(); | 233 | this.actions.service.resetLastPollTimer(); |
233 | 234 | ||
234 | if ( | 235 | if ( |
235 | this.timeSuspensionStart.add(10, 'm').isBefore(moment()) && | 236 | this.timeSuspensionStart.add(10, 'm').isBefore(moment()) && |
236 | this.stores.settings.app.get('reloadAfterResume') | 237 | this.stores.settings.app.get('reloadAfterResume') |
237 | ) { | 238 | ) { |
238 | debug('Reloading services, user info and features'); | 239 | console.log('Reloading services, user info and features'); |
239 | 240 | ||
240 | setInterval(() => { | 241 | setInterval(() => { |
241 | debug('Reload app interval is starting'); | 242 | console.log('Reload app interval is starting'); |
242 | if (this.isOnline) { | 243 | if (this.isOnline) { |
243 | window.location.reload(); | 244 | window.location.reload(); |
244 | } | 245 | } |
@@ -250,7 +251,7 @@ export default class AppStore extends Store { | |||
250 | // notifications got stuck after upgrade but forcing a notification | 251 | // notifications got stuck after upgrade but forcing a notification |
251 | // via `new Notification` triggered the permission request | 252 | // via `new Notification` triggered the permission request |
252 | if (isMac && !localStorage.getItem(CATALINA_NOTIFICATION_HACK_KEY)) { | 253 | if (isMac && !localStorage.getItem(CATALINA_NOTIFICATION_HACK_KEY)) { |
253 | debug('Triggering macOS Catalina notification permission trigger'); | 254 | console.log('Triggering macOS Catalina notification permission trigger'); |
254 | // eslint-disable-next-line no-new | 255 | // eslint-disable-next-line no-new |
255 | new window.Notification('Welcome to Ferdium 5', { | 256 | new window.Notification('Welcome to Ferdium 5', { |
256 | body: 'Have a wonderful day & happy messaging.', | 257 | body: 'Have a wonderful day & happy messaging.', |
@@ -319,7 +320,7 @@ export default class AppStore extends Store { | |||
319 | 320 | ||
320 | const notification = new window.Notification(title, options); | 321 | const notification = new window.Notification(title, options); |
321 | 322 | ||
322 | debug('New notification', title, options); | 323 | console.log('New notification', title, options); |
323 | 324 | ||
324 | notification.addEventListener('click', () => { | 325 | notification.addEventListener('click', () => { |
325 | if (serviceId) { | 326 | if (serviceId) { |
@@ -341,7 +342,7 @@ export default class AppStore extends Store { | |||
341 | } | 342 | } |
342 | mainWindow.focus(); | 343 | mainWindow.focus(); |
343 | 344 | ||
344 | debug('Notification click handler'); | 345 | console.log('Notification click handler'); |
345 | } | 346 | } |
346 | }); | 347 | }); |
347 | } | 348 | } |
@@ -370,10 +371,10 @@ export default class AppStore extends Store { | |||
370 | 371 | ||
371 | try { | 372 | try { |
372 | if (enable) { | 373 | if (enable) { |
373 | debug('enabling launch on startup', executablePath); | 374 | console.log('enabling launch on startup', executablePath); |
374 | autoLauncher.enable(); | 375 | autoLauncher.enable(); |
375 | } else { | 376 | } else { |
376 | debug('disabling launch on startup'); | 377 | console.log('disabling launch on startup'); |
377 | autoLauncher.disable(); | 378 | autoLauncher.disable(); |
378 | } | 379 | } |
379 | } catch (error) { | 380 | } catch (error) { |
@@ -388,7 +389,7 @@ export default class AppStore extends Store { | |||
388 | 389 | ||
389 | @action _checkForUpdates() { | 390 | @action _checkForUpdates() { |
390 | if (this.isOnline && this.stores.settings.app.automaticUpdates && (isMac || isWindows || process.env.APPIMAGE)) { | 391 | if (this.isOnline && this.stores.settings.app.automaticUpdates && (isMac || isWindows || process.env.APPIMAGE)) { |
391 | debug('_checkForUpdates: sending event to autoUpdate:check'); | 392 | console.log('_checkForUpdates: sending event to autoUpdate:check'); |
392 | this.updateStatus = this.updateStatusTypes.CHECKING; | 393 | this.updateStatus = this.updateStatusTypes.CHECKING; |
393 | ipcRenderer.send('autoUpdate', { | 394 | ipcRenderer.send('autoUpdate', { |
394 | action: 'check', | 395 | action: 'check', |
@@ -401,7 +402,7 @@ export default class AppStore extends Store { | |||
401 | } | 402 | } |
402 | 403 | ||
403 | @action _installUpdate() { | 404 | @action _installUpdate() { |
404 | debug('_installUpdate: sending event to autoUpdate:install'); | 405 | console.log('_installUpdate: sending event to autoUpdate:install'); |
405 | ipcRenderer.send('autoUpdate', { | 406 | ipcRenderer.send('autoUpdate', { |
406 | action: 'install', | 407 | action: 'install', |
407 | }); | 408 | }); |
@@ -487,7 +488,7 @@ export default class AppStore extends Store { | |||
487 | } | 488 | } |
488 | 489 | ||
489 | moment.locale(this.locale); | 490 | moment.locale(this.locale); |
490 | debug(`Set locale to "${this.locale}"`); | 491 | console.log(`Set locale to "${this.locale}"`); |
491 | } | 492 | } |
492 | 493 | ||
493 | _getDefaultLocale() { | 494 | _getDefaultLocale() { |
@@ -541,7 +542,7 @@ export default class AppStore extends Store { | |||
541 | this.autoLaunchOnStart = await this._checkAutoStart(); | 542 | this.autoLaunchOnStart = await this._checkAutoStart(); |
542 | 543 | ||
543 | if (this.stores.settings.all.stats.appStarts === 1) { | 544 | if (this.stores.settings.all.stats.appStarts === 1) { |
544 | debug('Set app to launch on start'); | 545 | console.log('Set app to launch on start'); |
545 | this.actions.app.launchOnStartup({ | 546 | this.actions.app.launchOnStartup({ |
546 | enable: true, | 547 | enable: true, |
547 | }); | 548 | }); |
@@ -553,9 +554,9 @@ export default class AppStore extends Store { | |||
553 | } | 554 | } |
554 | 555 | ||
555 | async _systemDND() { | 556 | async _systemDND() { |
556 | debug('Checking if Do Not Disturb Mode is on'); | 557 | console.log('Checking if Do Not Disturb Mode is on'); |
557 | const dnd = await ipcRenderer.invoke('get-dnd'); | 558 | const dnd = await ipcRenderer.invoke('get-dnd'); |
558 | debug('Do not disturb mode is', dnd); | 559 | console.log('Do not disturb mode is', dnd); |
559 | if ( | 560 | if ( |
560 | dnd !== this.stores.settings.all.app.isAppMuted && | 561 | dnd !== this.stores.settings.all.app.isAppMuted && |
561 | !this.isSystemMuteOverridden | 562 | !this.isSystemMuteOverridden |
diff --git a/src/stores/RecipesStore.js b/src/stores/RecipesStore.js index 0a3db2488..d39b87401 100644 --- a/src/stores/RecipesStore.js +++ b/src/stores/RecipesStore.js | |||
@@ -8,7 +8,8 @@ import Request from './lib/Request'; | |||
8 | import { matchRoute } from '../helpers/routing-helpers'; | 8 | import { matchRoute } from '../helpers/routing-helpers'; |
9 | import { asarRecipesPath } from '../helpers/asar-helpers'; | 9 | import { asarRecipesPath } from '../helpers/asar-helpers'; |
10 | 10 | ||
11 | const debug = require('debug')('Ferdium:RecipeStore'); | 11 | // TODO: Go back to 'debug' from 'console.log' when https://github.com/electron/electron/issues/31689 is fixed |
12 | // const debug = require('debug')('Ferdium:RecipeStore'); | ||
12 | 13 | ||
13 | export default class RecipesStore extends Store { | 14 | export default class RecipesStore extends Store { |
14 | @observable allRecipesRequest = new CachedRequest(this.api.recipes, 'all'); | 15 | @observable allRecipesRequest = new CachedRequest(this.api.recipes, 'all'); |
@@ -47,7 +48,7 @@ export default class RecipesStore extends Store { | |||
47 | return activeRecipe; | 48 | return activeRecipe; |
48 | } | 49 | } |
49 | 50 | ||
50 | debug(`Recipe ${match.id} not installed`); | 51 | console.log(`Recipe ${match.id} not installed`); |
51 | } | 52 | } |
52 | 53 | ||
53 | return null; | 54 | return null; |
@@ -78,7 +79,7 @@ export default class RecipesStore extends Store { | |||
78 | const recipes = {}; | 79 | const recipes = {}; |
79 | 80 | ||
80 | // Hackfix, reference this.all to fetch services | 81 | // Hackfix, reference this.all to fetch services |
81 | debug(`Check Recipe updates for ${this.all.map(recipe => recipe.id)}`); | 82 | console.log(`Check Recipe updates for ${this.all.map(recipe => recipe.id)}`); |
82 | 83 | ||
83 | for (const r of recipeIds) { | 84 | for (const r of recipeIds) { |
84 | const recipe = this.one(r); | 85 | const recipe = this.one(r); |
@@ -107,7 +108,7 @@ export default class RecipesStore extends Store { | |||
107 | } | 108 | } |
108 | 109 | ||
109 | const updates = [...remoteUpdates, ...localUpdates]; | 110 | const updates = [...remoteUpdates, ...localUpdates]; |
110 | debug( | 111 | console.log( |
111 | 'Got update information (local, remote):', | 112 | 'Got update information (local, remote):', |
112 | localUpdates, | 113 | localUpdates, |
113 | remoteUpdates, | 114 | remoteUpdates, |
@@ -145,7 +146,7 @@ export default class RecipesStore extends Store { | |||
145 | 146 | ||
146 | if (!this.stores.recipes.isInstalled(recipeId)) { | 147 | if (!this.stores.recipes.isInstalled(recipeId)) { |
147 | router.push('/settings/recipes'); | 148 | router.push('/settings/recipes'); |
148 | debug(`Recipe ${recipeId} is not installed, trying to install it`); | 149 | console.log(`Recipe ${recipeId} is not installed, trying to install it`); |
149 | 150 | ||
150 | const recipe = await this.installRecipeRequest.execute(recipeId) | 151 | const recipe = await this.installRecipeRequest.execute(recipeId) |
151 | ._promise; | 152 | ._promise; |
diff --git a/src/stores/RequestStore.js b/src/stores/RequestStore.js index 2e76a7023..a6991409c 100644 --- a/src/stores/RequestStore.js +++ b/src/stores/RequestStore.js | |||
@@ -4,7 +4,8 @@ import ms from 'ms'; | |||
4 | 4 | ||
5 | import Store from './lib/Store'; | 5 | import Store from './lib/Store'; |
6 | 6 | ||
7 | const debug = require('debug')('Ferdium:RequestsStore'); | 7 | // TODO: Go back to 'debug' from 'console.log' when https://github.com/electron/electron/issues/31689 is fixed |
8 | // const debug = require('debug')('Ferdium:RequestsStore'); | ||
8 | 9 | ||
9 | export default class RequestStore extends Store { | 10 | export default class RequestStore extends Store { |
10 | @observable userInfoRequest; | 11 | @observable userInfoRequest; |
@@ -65,7 +66,7 @@ export default class RequestStore extends Store { | |||
65 | } | 66 | } |
66 | 67 | ||
67 | this._autoRetry(); | 68 | this._autoRetry(); |
68 | debug(`Retry required requests delayed in ${delay / 1000}s`); | 69 | console.log(`Retry required requests delayed in ${delay / 1000}s`); |
69 | }, delay); | 70 | }, delay); |
70 | } | 71 | } |
71 | } | 72 | } |
diff --git a/src/stores/ServicesStore.js b/src/stores/ServicesStore.js index 1c800df59..3847536ca 100644 --- a/src/stores/ServicesStore.js +++ b/src/stores/ServicesStore.js | |||
@@ -19,7 +19,8 @@ import { DEFAULT_SERVICE_SETTINGS, KEEP_WS_LOADED_USID } from '../config'; | |||
19 | import { SPELLCHECKER_LOCALES } from '../i18n/languages'; | 19 | import { SPELLCHECKER_LOCALES } from '../i18n/languages'; |
20 | import { ferdiumVersion } from '../environment-remote'; | 20 | import { ferdiumVersion } from '../environment-remote'; |
21 | 21 | ||
22 | const debug = require('debug')('Ferdium:ServiceStore'); | 22 | // TODO: Go back to 'debug' from 'console.log' when https://github.com/electron/electron/issues/31689 is fixed |
23 | // const debug = require('debug')('Ferdium:ServiceStore'); | ||
23 | 24 | ||
24 | export default class ServicesStore extends Store { | 25 | export default class ServicesStore extends Store { |
25 | @observable allServicesRequest = new CachedRequest(this.api.services, 'all'); | 26 | @observable allServicesRequest = new CachedRequest(this.api.services, 'all'); |
@@ -212,7 +213,7 @@ export default class ServicesStore extends Store { | |||
212 | serviceMaintenanceTick = debounce(() => { | 213 | serviceMaintenanceTick = debounce(() => { |
213 | this._serviceMaintenance(); | 214 | this._serviceMaintenance(); |
214 | this.serviceMaintenanceTick(); | 215 | this.serviceMaintenanceTick(); |
215 | debug('Service maintenance tick'); | 216 | console.log('Service maintenance tick'); |
216 | }, ms('10s')); | 217 | }, ms('10s')); |
217 | 218 | ||
218 | /** | 219 | /** |
@@ -250,7 +251,7 @@ export default class ServicesStore extends Store { | |||
250 | // If service did not reply for more than 1m try to reload. | 251 | // If service did not reply for more than 1m try to reload. |
251 | if (!service.isActive) { | 252 | if (!service.isActive) { |
252 | if (this.stores.app.isOnline && service.lostRecipeReloadAttempt < 3) { | 253 | if (this.stores.app.isOnline && service.lostRecipeReloadAttempt < 3) { |
253 | debug( | 254 | console.log( |
254 | `Reloading service: ${service.name} (${service.id}). Attempt: ${service.lostRecipeReloadAttempt}`, | 255 | `Reloading service: ${service.name} (${service.id}). Attempt: ${service.lostRecipeReloadAttempt}`, |
255 | ); | 256 | ); |
256 | // service.webview.reload(); | 257 | // service.webview.reload(); |
@@ -259,7 +260,7 @@ export default class ServicesStore extends Store { | |||
259 | service.lostRecipeConnection = false; | 260 | service.lostRecipeConnection = false; |
260 | } | 261 | } |
261 | } else { | 262 | } else { |
262 | debug(`Service lost connection: ${service.name} (${service.id}).`); | 263 | console.log(`Service lost connection: ${service.name} (${service.id}).`); |
263 | service.lostRecipeConnection = true; | 264 | service.lostRecipeConnection = true; |
264 | } | 265 | } |
265 | } else { | 266 | } else { |
@@ -363,7 +364,7 @@ export default class ServicesStore extends Store { | |||
363 | return activeService; | 364 | return activeService; |
364 | } | 365 | } |
365 | 366 | ||
366 | debug('Service not available'); | 367 | console.log('Service not available'); |
367 | } | 368 | } |
368 | 369 | ||
369 | return null; | 370 | return null; |
@@ -397,9 +398,9 @@ export default class ServicesStore extends Store { | |||
397 | skipCleanup = false, | 398 | skipCleanup = false, |
398 | }) { | 399 | }) { |
399 | if (!this.stores.recipes.isInstalled(recipeId)) { | 400 | if (!this.stores.recipes.isInstalled(recipeId)) { |
400 | debug(`Recipe "${recipeId}" is not installed, installing recipe`); | 401 | console.log(`Recipe "${recipeId}" is not installed, installing recipe`); |
401 | await this.stores.recipes._install({ recipeId }); | 402 | await this.stores.recipes._install({ recipeId }); |
402 | debug(`Recipe "${recipeId}" installed`); | 403 | console.log(`Recipe "${recipeId}" installed`); |
403 | } | 404 | } |
404 | 405 | ||
405 | // set default values for serviceData | 406 | // set default values for serviceData |
@@ -616,7 +617,7 @@ export default class ServicesStore extends Store { | |||
616 | if (service) { | 617 | if (service) { |
617 | service.isActive = false; | 618 | service.isActive = false; |
618 | } else { | 619 | } else { |
619 | debug('No service is active'); | 620 | console.log('No service is active'); |
620 | } | 621 | } |
621 | } | 622 | } |
622 | 623 | ||
@@ -659,7 +660,7 @@ export default class ServicesStore extends Store { | |||
659 | service.webview = webview; | 660 | service.webview = webview; |
660 | 661 | ||
661 | if (!service.isAttached) { | 662 | if (!service.isAttached) { |
662 | debug('Webview is not attached, initializing'); | 663 | console.log('Webview is not attached, initializing'); |
663 | service.initializeWebViewEvents({ | 664 | service.initializeWebViewEvents({ |
664 | handleIPCMessage: this.actions.service.handleIPCMessage, | 665 | handleIPCMessage: this.actions.service.handleIPCMessage, |
665 | openWindow: this.actions.service.openWindow, | 666 | openWindow: this.actions.service.openWindow, |
@@ -708,7 +709,7 @@ export default class ServicesStore extends Store { | |||
708 | } | 709 | } |
709 | } | 710 | } |
710 | } else { | 711 | } else { |
711 | debug('No service is active'); | 712 | console.log('No service is active'); |
712 | } | 713 | } |
713 | } else { | 714 | } else { |
714 | this.allServicesRequest.invalidate(); | 715 | this.allServicesRequest.invalidate(); |
@@ -727,7 +728,7 @@ export default class ServicesStore extends Store { | |||
727 | // eslint-disable-next-line default-case | 728 | // eslint-disable-next-line default-case |
728 | switch (channel) { | 729 | switch (channel) { |
729 | case 'hello': { | 730 | case 'hello': { |
730 | debug('Received hello event from', serviceId); | 731 | console.log('Received hello event from', serviceId); |
731 | 732 | ||
732 | this._initRecipePolling(service.id); | 733 | this._initRecipePolling(service.id); |
733 | this._initializeServiceRecipeInWebview(serviceId); | 734 | this._initializeServiceRecipeInWebview(serviceId); |
@@ -741,7 +742,7 @@ export default class ServicesStore extends Store { | |||
741 | break; | 742 | break; |
742 | } | 743 | } |
743 | case 'message-counts': { | 744 | case 'message-counts': { |
744 | debug(`Received unread message info from '${serviceId}'`, args[0]); | 745 | console.log(`Received unread message info from '${serviceId}'`, args[0]); |
745 | 746 | ||
746 | this.actions.service.setUnreadMessageCount({ | 747 | this.actions.service.setUnreadMessageCount({ |
747 | serviceId, | 748 | serviceId, |
@@ -754,7 +755,7 @@ export default class ServicesStore extends Store { | |||
754 | break; | 755 | break; |
755 | } | 756 | } |
756 | case 'active-dialog-title': { | 757 | case 'active-dialog-title': { |
757 | debug(`Received active dialog title from '${serviceId}'`, args[0]); | 758 | console.log(`Received active dialog title from '${serviceId}'`, args[0]); |
758 | 759 | ||
759 | this.actions.service.setDialogTitle({ | 760 | this.actions.service.setDialogTitle({ |
760 | serviceId, | 761 | serviceId, |
@@ -919,7 +920,7 @@ export default class ServicesStore extends Store { | |||
919 | serviceId: service.id, | 920 | serviceId: service.id, |
920 | }); | 921 | }); |
921 | } else { | 922 | } else { |
922 | debug('No service is active'); | 923 | console.log('No service is active'); |
923 | } | 924 | } |
924 | } | 925 | } |
925 | 926 | ||
@@ -1027,7 +1028,7 @@ export default class ServicesStore extends Store { | |||
1027 | if (service) { | 1028 | if (service) { |
1028 | this._openDevTools({ serviceId: service.id }); | 1029 | this._openDevTools({ serviceId: service.id }); |
1029 | } else { | 1030 | } else { |
1030 | debug('No service is active'); | 1031 | console.log('No service is active'); |
1031 | } | 1032 | } |
1032 | } | 1033 | } |
1033 | 1034 | ||
@@ -1037,7 +1038,7 @@ export default class ServicesStore extends Store { | |||
1037 | return; | 1038 | return; |
1038 | } | 1039 | } |
1039 | 1040 | ||
1040 | debug(`Hibernate ${service.name}`); | 1041 | console.log(`Hibernate ${service.name}`); |
1041 | 1042 | ||
1042 | service.isHibernationRequested = true; | 1043 | service.isHibernationRequested = true; |
1043 | service.lastHibernated = Date.now(); | 1044 | service.lastHibernated = Date.now(); |
@@ -1047,7 +1048,7 @@ export default class ServicesStore extends Store { | |||
1047 | const now = Date.now(); | 1048 | const now = Date.now(); |
1048 | const service = this.one(serviceId); | 1049 | const service = this.one(serviceId); |
1049 | const automaticTag = automatic ? ' automatically ' : ' '; | 1050 | const automaticTag = automatic ? ' automatically ' : ' '; |
1050 | debug( | 1051 | console.log( |
1051 | `Waking up${automaticTag}from service hibernation for ${service.name}`, | 1052 | `Waking up${automaticTag}from service hibernation for ${service.name}`, |
1052 | ); | 1053 | ); |
1053 | 1054 | ||
@@ -1068,8 +1069,8 @@ export default class ServicesStore extends Store { | |||
1068 | // | 1069 | // |
1069 | const mainStrategy = this.stores.settings.all.app.hibernationStrategy; | 1070 | const mainStrategy = this.stores.settings.all.app.hibernationStrategy; |
1070 | let strategy = this.stores.settings.all.app.wakeUpHibernationStrategy; | 1071 | let strategy = this.stores.settings.all.app.wakeUpHibernationStrategy; |
1071 | debug(`wakeUpHibernationStrategy = ${strategy}`); | 1072 | console.log(`wakeUpHibernationStrategy = ${strategy}`); |
1072 | debug(`hibernationStrategy = ${mainStrategy}`); | 1073 | console.log(`hibernationStrategy = ${mainStrategy}`); |
1073 | if (!strategy || strategy < 1) { | 1074 | if (!strategy || strategy < 1) { |
1074 | strategy = this.stores.settings.all.app.hibernationStrategy; | 1075 | strategy = this.stores.settings.all.app.hibernationStrategy; |
1075 | } | 1076 | } |
@@ -1081,16 +1082,16 @@ export default class ServicesStore extends Store { | |||
1081 | ) { | 1082 | ) { |
1082 | // Add 10 additional seconds 50% of the time. | 1083 | // Add 10 additional seconds 50% of the time. |
1083 | splay = 10; | 1084 | splay = 10; |
1084 | debug('Added splay'); | 1085 | console.log('Added splay'); |
1085 | } else { | 1086 | } else { |
1086 | debug('skipping splay'); | 1087 | console.log('skipping splay'); |
1087 | } | 1088 | } |
1088 | // wake up again in strategy + splay seconds instead of mainStrategy seconds. | 1089 | // wake up again in strategy + splay seconds instead of mainStrategy seconds. |
1089 | service.lastUsed = now - ms(`${mainStrategy - (strategy + splay)}s`); | 1090 | service.lastUsed = now - ms(`${mainStrategy - (strategy + splay)}s`); |
1090 | } else { | 1091 | } else { |
1091 | service.lastUsed = now; | 1092 | service.lastUsed = now; |
1092 | } | 1093 | } |
1093 | debug( | 1094 | console.log( |
1094 | `Setting service.lastUsed to ${service.lastUsed} (${ | 1095 | `Setting service.lastUsed to ${service.lastUsed} (${ |
1095 | (now - service.lastUsed) / 1000 | 1096 | (now - service.lastUsed) / 1000 |
1096 | }s ago)`, | 1097 | }s ago)`, |
@@ -1100,7 +1101,7 @@ export default class ServicesStore extends Store { | |||
1100 | } | 1101 | } |
1101 | 1102 | ||
1102 | @action _resetLastPollTimer({ serviceId = null }) { | 1103 | @action _resetLastPollTimer({ serviceId = null }) { |
1103 | debug( | 1104 | console.log( |
1104 | `Reset last poll timer for ${ | 1105 | `Reset last poll timer for ${ |
1105 | serviceId ? `service: "${serviceId}"` : 'all services' | 1106 | serviceId ? `service: "${serviceId}"` : 'all services' |
1106 | }`, | 1107 | }`, |
@@ -1131,7 +1132,7 @@ export default class ServicesStore extends Store { | |||
1131 | service.dialogTitle ? ` - ${service.dialogTitle}` : '' | 1132 | service.dialogTitle ? ` - ${service.dialogTitle}` : '' |
1132 | } ${service._webview ? `- ${service._webview.getTitle()}` : ''}`; | 1133 | } ${service._webview ? `- ${service._webview.getTitle()}` : ''}`; |
1133 | } else { | 1134 | } else { |
1134 | debug('No service is active'); | 1135 | console.log('No service is active'); |
1135 | } | 1136 | } |
1136 | } | 1137 | } |
1137 | 1138 | ||
@@ -1145,7 +1146,7 @@ export default class ServicesStore extends Store { | |||
1145 | }, | 1146 | }, |
1146 | }); | 1147 | }); |
1147 | } else { | 1148 | } else { |
1148 | debug('No service is active'); | 1149 | console.log('No service is active'); |
1149 | } | 1150 | } |
1150 | } | 1151 | } |
1151 | 1152 | ||
@@ -1261,7 +1262,7 @@ export default class ServicesStore extends Store { | |||
1261 | this.allDisplayed.findIndex(service => service.isActive) === -1 && | 1262 | this.allDisplayed.findIndex(service => service.isActive) === -1 && |
1262 | this.allDisplayed.length > 0 | 1263 | this.allDisplayed.length > 0 |
1263 | ) { | 1264 | ) { |
1264 | debug('No active service found, setting active service to index 0'); | 1265 | console.log('No active service found, setting active service to index 0'); |
1265 | 1266 | ||
1266 | this._setActive({ serviceId: this.allDisplayed[0].id }); | 1267 | this._setActive({ serviceId: this.allDisplayed[0].id }); |
1267 | } | 1268 | } |
@@ -1277,7 +1278,7 @@ export default class ServicesStore extends Store { | |||
1277 | JSON.stringify(service.shareWithWebview), | 1278 | JSON.stringify(service.shareWithWebview), |
1278 | ); | 1279 | ); |
1279 | 1280 | ||
1280 | debug('Initialize recipe', service.recipe.id, service.name); | 1281 | console.log('Initialize recipe', service.recipe.id, service.name); |
1281 | service.webview.send( | 1282 | service.webview.send( |
1282 | 'initialize-recipe', | 1283 | 'initialize-recipe', |
1283 | { | 1284 | { |
diff --git a/src/stores/SettingsStore.js b/src/stores/SettingsStore.js index cfd73c705..3ba791239 100644 --- a/src/stores/SettingsStore.js +++ b/src/stores/SettingsStore.js | |||
@@ -11,7 +11,8 @@ import { hash } from '../helpers/password-helpers'; | |||
11 | import Request from './lib/Request'; | 11 | import Request from './lib/Request'; |
12 | import Store from './lib/Store'; | 12 | import Store from './lib/Store'; |
13 | 13 | ||
14 | const debug = require('debug')('Ferdium:SettingsStore'); | 14 | // TODO: Go back to 'debug' from 'console.log' when https://github.com/electron/electron/issues/31689 is fixed |
15 | // const debug = require('debug')('Ferdium:SettingsStore'); | ||
15 | 16 | ||
16 | export default class SettingsStore extends Store { | 17 | export default class SettingsStore extends Store { |
17 | @observable updateAppSettingsRequest = new Request( | 18 | @observable updateAppSettingsRequest = new Request( |
@@ -94,7 +95,7 @@ export default class SettingsStore extends Store { | |||
94 | } | 95 | } |
95 | }); | 96 | }); |
96 | } | 97 | } |
97 | debug('Get appSettings resolves', resp.type, resp.data); | 98 | console.log('Get appSettings resolves', resp.type, resp.data); |
98 | Object.assign(this._fileSystemSettingsCache[resp.type], resp.data); | 99 | Object.assign(this._fileSystemSettingsCache[resp.type], resp.data); |
99 | this.loaded = true; | 100 | this.loaded = true; |
100 | ipcRenderer.send('initialAppSettings', resp); | 101 | ipcRenderer.send('initialAppSettings', resp); |
@@ -146,10 +147,10 @@ export default class SettingsStore extends Store { | |||
146 | @action async _update({ type, data }) { | 147 | @action async _update({ type, data }) { |
147 | const appSettings = this.all; | 148 | const appSettings = this.all; |
148 | if (!this.fileSystemSettingsTypes.includes(type)) { | 149 | if (!this.fileSystemSettingsTypes.includes(type)) { |
149 | debug('Update settings', type, data, this.all); | 150 | console.log('Update settings', type, data, this.all); |
150 | localStorage.setItem(type, Object.assign(appSettings[type], data)); | 151 | localStorage.setItem(type, Object.assign(appSettings[type], data)); |
151 | } else { | 152 | } else { |
152 | debug('Update settings on file system', type, data); | 153 | console.log('Update settings on file system', type, data); |
153 | ipcRenderer.send('updateAppSettings', { | 154 | ipcRenderer.send('updateAppSettings', { |
154 | type, | 155 | type, |
155 | data, | 156 | data, |
@@ -200,7 +201,7 @@ export default class SettingsStore extends Store { | |||
200 | }); | 201 | }); |
201 | } | 202 | } |
202 | 203 | ||
203 | debug('Migrated updates settings'); | 204 | console.log('Migrated updates settings'); |
204 | }); | 205 | }); |
205 | 206 | ||
206 | this._ensureMigrationAndMarkDone('5.6.0-beta.6-settings', () => { | 207 | this._ensureMigrationAndMarkDone('5.6.0-beta.6-settings', () => { |
diff --git a/src/stores/UserStore.js b/src/stores/UserStore.js index 787ffbb56..8c413a065 100644 --- a/src/stores/UserStore.js +++ b/src/stores/UserStore.js | |||
@@ -10,7 +10,8 @@ import Store from './lib/Store'; | |||
10 | import Request from './lib/Request'; | 10 | import Request from './lib/Request'; |
11 | import CachedRequest from './lib/CachedRequest'; | 11 | import CachedRequest from './lib/CachedRequest'; |
12 | 12 | ||
13 | const debug = require('debug')('Ferdium:UserStore'); | 13 | // TODO: Go back to 'debug' from 'console.log' when https://github.com/electron/electron/issues/31689 is fixed |
14 | // const debug = require('debug')('Ferdium:UserStore'); | ||
14 | 15 | ||
15 | // TODO: split stores into UserStore and AuthStore | 16 | // TODO: split stores into UserStore and AuthStore |
16 | export default class UserStore extends Store { | 17 | export default class UserStore extends Store { |
@@ -394,7 +395,7 @@ export default class UserStore extends Store { | |||
394 | } | 395 | } |
395 | 396 | ||
396 | if (!this.data.locale) { | 397 | if (!this.data.locale) { |
397 | debug('Migrate "locale" to user data'); | 398 | console.log('Migrate "locale" to user data'); |
398 | this.actions.user.update({ | 399 | this.actions.user.update({ |
399 | userData: { | 400 | userData: { |
400 | locale: this.stores.app.locale, | 401 | locale: this.stores.app.locale, |