diff options
author | Markus Hatvan <markus_hatvan@aon.at> | 2021-09-14 19:58:52 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-14 19:58:52 +0200 |
commit | 95df3522a15631abc51a4295cae0ea401a8d4e1e (patch) | |
tree | e5eb0f368c947683f01458e912f21756fb0d99cb /src/stores/AppStore.js | |
parent | docs: add sad270 as a contributor for bug, userTesting [skip ci] (#1941) (diff) | |
download | ferdium-app-95df3522a15631abc51a4295cae0ea401a8d4e1e.tar.gz ferdium-app-95df3522a15631abc51a4295cae0ea401a8d4e1e.tar.zst ferdium-app-95df3522a15631abc51a4295cae0ea401a8d4e1e.zip |
feat: add eslint-plugin-unicorn (#1936)
Diffstat (limited to 'src/stores/AppStore.js')
-rw-r--r-- | src/stores/AppStore.js | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/src/stores/AppStore.js b/src/stores/AppStore.js index 469e7519e..85f74a91e 100644 --- a/src/stores/AppStore.js +++ b/src/stores/AppStore.js | |||
@@ -251,16 +251,14 @@ export default class AppStore extends Store { | |||
251 | // macOS catalina notifications hack | 251 | // macOS catalina notifications hack |
252 | // notifications got stuck after upgrade but forcing a notification | 252 | // notifications got stuck after upgrade but forcing a notification |
253 | // via `new Notification` triggered the permission request | 253 | // via `new Notification` triggered the permission request |
254 | if (isMac) { | 254 | if (isMac && !localStorage.getItem(CATALINA_NOTIFICATION_HACK_KEY)) { |
255 | if (!localStorage.getItem(CATALINA_NOTIFICATION_HACK_KEY)) { | 255 | debug('Triggering macOS Catalina notification permission trigger'); |
256 | debug('Triggering macOS Catalina notification permission trigger'); | 256 | // eslint-disable-next-line no-new |
257 | // eslint-disable-next-line no-new | 257 | new window.Notification('Welcome to Ferdi 5', { |
258 | new window.Notification('Welcome to Ferdi 5', { | 258 | body: 'Have a wonderful day & happy messaging.', |
259 | body: 'Have a wonderful day & happy messaging.', | 259 | }); |
260 | }); | ||
261 | 260 | ||
262 | localStorage.setItem(CATALINA_NOTIFICATION_HACK_KEY, true); | 261 | localStorage.setItem(CATALINA_NOTIFICATION_HACK_KEY, true); |
263 | } | ||
264 | } | 262 | } |
265 | } | 263 | } |
266 | 264 | ||
@@ -325,7 +323,7 @@ export default class AppStore extends Store { | |||
325 | 323 | ||
326 | debug('New notification', title, options); | 324 | debug('New notification', title, options); |
327 | 325 | ||
328 | notification.onclick = () => { | 326 | notification.addEventListener('click', () => { |
329 | if (serviceId) { | 327 | if (serviceId) { |
330 | this.actions.service.sendIPCMessage({ | 328 | this.actions.service.sendIPCMessage({ |
331 | channel: `notification-onclick:${notificationId}`, | 329 | channel: `notification-onclick:${notificationId}`, |
@@ -346,7 +344,7 @@ export default class AppStore extends Store { | |||
346 | 344 | ||
347 | debug('Notification click handler'); | 345 | debug('Notification click handler'); |
348 | } | 346 | } |
349 | }; | 347 | }); |
350 | } | 348 | } |
351 | 349 | ||
352 | @action _setBadge({ unreadDirectMessageCount, unreadIndirectMessageCount }) { | 350 | @action _setBadge({ unreadDirectMessageCount, unreadIndirectMessageCount }) { |
@@ -360,7 +358,7 @@ export default class AppStore extends Store { | |||
360 | ) { | 358 | ) { |
361 | indicator = 0; | 359 | indicator = 0; |
362 | } else { | 360 | } else { |
363 | indicator = parseInt(indicator, 10); | 361 | indicator = Number.parseInt(indicator, 10); |
364 | } | 362 | } |
365 | 363 | ||
366 | ipcRenderer.send('updateAppIndicator', { | 364 | ipcRenderer.send('updateAppIndicator', { |
@@ -379,8 +377,8 @@ export default class AppStore extends Store { | |||
379 | debug('disabling launch on startup'); | 377 | debug('disabling launch on startup'); |
380 | autoLauncher.disable(); | 378 | autoLauncher.disable(); |
381 | } | 379 | } |
382 | } catch (err) { | 380 | } catch (error) { |
383 | console.warn(err); | 381 | console.warn(error); |
384 | } | 382 | } |
385 | } | 383 | } |
386 | 384 | ||
@@ -438,7 +436,7 @@ export default class AppStore extends Store { | |||
438 | const allServiceIds = await getServiceIdsFromPartitions(); | 436 | const allServiceIds = await getServiceIdsFromPartitions(); |
439 | const allOrphanedServiceIds = allServiceIds.filter( | 437 | const allOrphanedServiceIds = allServiceIds.filter( |
440 | id => | 438 | id => |
441 | !this.stores.services.all.find( | 439 | !this.stores.services.all.some( |
442 | s => id.replace('service-', '') === s.id, | 440 | s => id.replace('service-', '') === s.id, |
443 | ), | 441 | ), |
444 | ); | 442 | ); |
@@ -447,8 +445,8 @@ export default class AppStore extends Store { | |||
447 | await Promise.all( | 445 | await Promise.all( |
448 | allOrphanedServiceIds.map(id => removeServicePartitionDirectory(id)), | 446 | allOrphanedServiceIds.map(id => removeServicePartitionDirectory(id)), |
449 | ); | 447 | ); |
450 | } catch (ex) { | 448 | } catch (error) { |
451 | console.log('Error while deleting service partition directory - ', ex); | 449 | console.log('Error while deleting service partition directory -', error); |
452 | } | 450 | } |
453 | await Promise.all( | 451 | await Promise.all( |
454 | this.stores.services.all.map(s => | 452 | this.stores.services.all.map(s => |