diff options
author | 2023-05-24 06:57:50 +0530 | |
---|---|---|
committer | 2023-05-24 16:40:43 +0530 | |
commit | e245b4fa229bee1e2ab97fcb42de3831b8bdbe5b (patch) | |
tree | d684777b3fde5470c9f99304a9f022422ffb8045 /src/stores | |
parent | 6.3.0-nightly.9 [skip ci] (diff) | |
download | ferdium-app-e245b4fa229bee1e2ab97fcb42de3831b8bdbe5b.tar.gz ferdium-app-e245b4fa229bee1e2ab97fcb42de3831b8bdbe5b.tar.zst ferdium-app-e245b4fa229bee1e2ab97fcb42de3831b8bdbe5b.zip |
Upgrade npm modules
Diffstat (limited to 'src/stores')
-rw-r--r-- | src/stores/AppStore.ts | 6 | ||||
-rw-r--r-- | src/stores/ServicesStore.ts | 41 | ||||
-rw-r--r-- | src/stores/SettingsStore.ts | 8 | ||||
-rw-r--r-- | src/stores/UIStore.ts | 14 |
4 files changed, 35 insertions, 34 deletions
diff --git a/src/stores/AppStore.ts b/src/stores/AppStore.ts index 02d616241..18b38799e 100644 --- a/src/stores/AppStore.ts +++ b/src/stores/AppStore.ts | |||
@@ -529,14 +529,14 @@ export default class AppStore extends TypedStore { | |||
529 | 529 | ||
530 | // Reactions | 530 | // Reactions |
531 | _offlineCheck() { | 531 | _offlineCheck() { |
532 | if (!this.isOnline) { | 532 | if (this.isOnline) { |
533 | this.timeOfflineStart = moment(); | ||
534 | } else { | ||
535 | const deltaTime = moment().diff(this.timeOfflineStart); | 533 | const deltaTime = moment().diff(this.timeOfflineStart); |
536 | 534 | ||
537 | if (deltaTime > ms('30m')) { | 535 | if (deltaTime > ms('30m')) { |
538 | this.actions.service.reloadAll(); | 536 | this.actions.service.reloadAll(); |
539 | } | 537 | } |
538 | } else { | ||
539 | this.timeOfflineStart = moment(); | ||
540 | } | 540 | } |
541 | } | 541 | } |
542 | 542 | ||
diff --git a/src/stores/ServicesStore.ts b/src/stores/ServicesStore.ts index 829c64d76..9c15d3a07 100644 --- a/src/stores/ServicesStore.ts +++ b/src/stores/ServicesStore.ts | |||
@@ -294,19 +294,20 @@ export default class ServicesStore extends TypedStore { | |||
294 | service.lastPoll - service.lastPollAnswer > ms('1m') | 294 | service.lastPoll - service.lastPollAnswer > ms('1m') |
295 | ) { | 295 | ) { |
296 | // If service did not reply for more than 1m try to reload. | 296 | // If service did not reply for more than 1m try to reload. |
297 | if (!service.isActive) { | 297 | if (service.isActive) { |
298 | if (this.stores.app.isOnline && service.lostRecipeReloadAttempt < 3) { | ||
299 | debug( | ||
300 | `Reloading service: ${service.name} (${service.id}). Attempt: ${service.lostRecipeReloadAttempt}`, | ||
301 | ); | ||
302 | // service.webview.reload(); | ||
303 | service.lostRecipeReloadAttempt += 1; | ||
304 | |||
305 | service.lostRecipeConnection = false; | ||
306 | } | ||
307 | } else { | ||
308 | debug(`Service lost connection: ${service.name} (${service.id}).`); | 298 | debug(`Service lost connection: ${service.name} (${service.id}).`); |
309 | service.lostRecipeConnection = true; | 299 | service.lostRecipeConnection = true; |
300 | } else if ( | ||
301 | this.stores.app.isOnline && | ||
302 | service.lostRecipeReloadAttempt < 3 | ||
303 | ) { | ||
304 | debug( | ||
305 | `Reloading service: ${service.name} (${service.id}). Attempt: ${service.lostRecipeReloadAttempt}`, | ||
306 | ); | ||
307 | // service.webview.reload(); | ||
308 | service.lostRecipeReloadAttempt += 1; | ||
309 | |||
310 | service.lostRecipeConnection = false; | ||
310 | } | 311 | } |
311 | } else { | 312 | } else { |
312 | service.lostRecipeConnection = false; | 313 | service.lostRecipeConnection = false; |
@@ -512,11 +513,11 @@ export default class ServicesStore extends TypedStore { | |||
512 | } | 513 | } |
513 | 514 | ||
514 | if (data.team) { | 515 | if (data.team) { |
515 | if (!data.customURL) { | 516 | if (data.customURL) { |
516 | serviceData.team = data.team; | ||
517 | } else { | ||
518 | // TODO: Is this correct? | 517 | // TODO: Is this correct? |
519 | serviceData.customUrl = data.team; | 518 | serviceData.customUrl = data.team; |
519 | } else { | ||
520 | serviceData.team = data.team; | ||
520 | } | 521 | } |
521 | } | 522 | } |
522 | 523 | ||
@@ -893,9 +894,7 @@ export default class ServicesStore extends TypedStore { | |||
893 | break; | 894 | break; |
894 | } | 895 | } |
895 | case 'set-service-spellchecker-language': { | 896 | case 'set-service-spellchecker-language': { |
896 | if (!args) { | 897 | if (args) { |
897 | console.warn('Did not receive locale'); | ||
898 | } else { | ||
899 | this.actions.service.updateService({ | 898 | this.actions.service.updateService({ |
900 | serviceId, | 899 | serviceId, |
901 | serviceData: { | 900 | serviceData: { |
@@ -903,6 +902,8 @@ export default class ServicesStore extends TypedStore { | |||
903 | }, | 902 | }, |
904 | redirect: false, | 903 | redirect: false, |
905 | }); | 904 | }); |
905 | } else { | ||
906 | console.warn('Did not receive locale'); | ||
906 | } | 907 | } |
907 | 908 | ||
908 | break; | 909 | break; |
@@ -1176,13 +1177,13 @@ export default class ServicesStore extends TypedStore { | |||
1176 | service.lastPoll = Date.now(); | 1177 | service.lastPoll = Date.now(); |
1177 | }; | 1178 | }; |
1178 | 1179 | ||
1179 | if (!serviceId) { | 1180 | if (serviceId) { |
1180 | for (const service of this.allDisplayed) resetTimer(service); | ||
1181 | } else { | ||
1182 | const service = this.one(serviceId); | 1181 | const service = this.one(serviceId); |
1183 | if (service) { | 1182 | if (service) { |
1184 | resetTimer(service); | 1183 | resetTimer(service); |
1185 | } | 1184 | } |
1185 | } else { | ||
1186 | for (const service of this.allDisplayed) resetTimer(service); | ||
1186 | } | 1187 | } |
1187 | } | 1188 | } |
1188 | 1189 | ||
diff --git a/src/stores/SettingsStore.ts b/src/stores/SettingsStore.ts index 811bc6f76..5ca499160 100644 --- a/src/stores/SettingsStore.ts +++ b/src/stores/SettingsStore.ts | |||
@@ -157,10 +157,7 @@ export default class SettingsStore extends TypedStore { | |||
157 | 157 | ||
158 | @action async _update({ type, data }): Promise<void> { | 158 | @action async _update({ type, data }): Promise<void> { |
159 | const appSettings = this.all; | 159 | const appSettings = this.all; |
160 | if (!this.fileSystemSettingsTypes.includes(type)) { | 160 | if (this.fileSystemSettingsTypes.includes(type)) { |
161 | debug('Update settings', type, data, this.all); | ||
162 | localStorage.setItem(type, Object.assign(appSettings[type], data)); | ||
163 | } else { | ||
164 | debug('Update settings on file system', type, data); | 161 | debug('Update settings on file system', type, data); |
165 | ipcRenderer.send('updateAppSettings', { | 162 | ipcRenderer.send('updateAppSettings', { |
166 | type, | 163 | type, |
@@ -168,6 +165,9 @@ export default class SettingsStore extends TypedStore { | |||
168 | }); | 165 | }); |
169 | 166 | ||
170 | Object.assign(this._fileSystemSettingsCache[type], data); | 167 | Object.assign(this._fileSystemSettingsCache[type], data); |
168 | } else { | ||
169 | debug('Update settings', type, data, this.all); | ||
170 | localStorage.setItem(type, Object.assign(appSettings[type], data)); | ||
171 | } | 171 | } |
172 | } | 172 | } |
173 | 173 | ||
diff --git a/src/stores/UIStore.ts b/src/stores/UIStore.ts index e0589729f..4ed45fc3b 100644 --- a/src/stores/UIStore.ts +++ b/src/stores/UIStore.ts | |||
@@ -98,7 +98,7 @@ export default class UIStore extends TypedStore { | |||
98 | 98 | ||
99 | // Actions | 99 | // Actions |
100 | @action _openSettings({ path = '/settings' }): void { | 100 | @action _openSettings({ path = '/settings' }): void { |
101 | const settingsPath = path !== '/settings' ? `/settings/${path}` : path; | 101 | const settingsPath = path === '/settings' ? path : `/settings/${path}`; |
102 | this.stores.router.push(settingsPath); | 102 | this.stores.router.push(settingsPath); |
103 | } | 103 | } |
104 | 104 | ||
@@ -116,19 +116,19 @@ export default class UIStore extends TypedStore { | |||
116 | 116 | ||
117 | // Reactions | 117 | // Reactions |
118 | _setupThemeInDOM(): void { | 118 | _setupThemeInDOM(): void { |
119 | if (!this.isDarkThemeActive) { | 119 | if (this.isDarkThemeActive) { |
120 | document.body.classList.remove('theme__dark'); | ||
121 | } else { | ||
122 | document.body.classList.add('theme__dark'); | 120 | document.body.classList.add('theme__dark'); |
121 | } else { | ||
122 | document.body.classList.remove('theme__dark'); | ||
123 | } | 123 | } |
124 | } | 124 | } |
125 | 125 | ||
126 | _setupModeInDOM(): void { | 126 | _setupModeInDOM(): void { |
127 | if (!this.isSplitModeActive) { | 127 | if (this.isSplitModeActive) { |
128 | document.body.classList.remove('mode__split'); | ||
129 | } else { | ||
130 | document.body.classList.add('mode__split'); | 128 | document.body.classList.add('mode__split'); |
131 | document.body.dataset.columns = this.splitColumnsNo.toString(); | 129 | document.body.dataset.columns = this.splitColumnsNo.toString(); |
130 | } else { | ||
131 | document.body.classList.remove('mode__split'); | ||
132 | } | 132 | } |
133 | } | 133 | } |
134 | 134 | ||