diff options
| author | Jonas Dellinger <jonas@dellinger.dev> | 2023-06-24 12:59:39 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-06-24 12:59:39 +0200 |
| commit | ef9afa8cbca29a3dd83454f44264a4682e968c59 (patch) | |
| tree | 5eb5033ba579ab6159d593cb01d8cf9b011f1942 /frontend/src/plugin-loader.tsx | |
| parent | 143461d59793665f9e54d05ba00b16c55dfec57f (diff) | |
| download | decky-loader-ef9afa8cbca29a3dd83454f44264a4682e968c59.tar.gz decky-loader-ef9afa8cbca29a3dd83454f44264a4682e968c59.zip | |
Add notification settings, which allows muting decky/plugin toast notifications (#479)
* Add notification settings, which allows muting decky/plugin toast notifications
* Fix typos
Diffstat (limited to 'frontend/src/plugin-loader.tsx')
| -rw-r--r-- | frontend/src/plugin-loader.tsx | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/frontend/src/plugin-loader.tsx b/frontend/src/plugin-loader.tsx index e2ffc44a..b27a19bb 100644 --- a/frontend/src/plugin-loader.tsx +++ b/frontend/src/plugin-loader.tsx @@ -24,6 +24,7 @@ import PluginView from './components/PluginView'; import WithSuspense from './components/WithSuspense'; import { HiddenPluginsService } from './hidden-plugins-service'; import Logger from './logger'; +import { NotificationService } from './notification-service'; import { InstallType, Plugin } from './plugin'; import RouterHook from './router-hook'; import { deinitSteamFixes, initSteamFixes } from './steamfixes'; @@ -47,7 +48,9 @@ class PluginLoader extends Logger { private routerHook: RouterHook = new RouterHook(); public toaster: Toaster = new Toaster(); private deckyState: DeckyState = new DeckyState(); + public hiddenPluginsService = new HiddenPluginsService(this.deckyState); + public notificationService = new NotificationService(this.deckyState); private reloadLock: boolean = false; // stores a list of plugin names which requested to be reloaded @@ -121,18 +124,20 @@ class PluginLoader extends Logger { public async notifyUpdates() { const versionInfo = await this.updateVersion(); if (versionInfo?.remote && versionInfo?.remote?.tag_name != versionInfo?.current) { - this.toaster.toast({ - title: <TranslationHelper trans_class={TranslationClass.PLUGIN_LOADER} trans_text="decky_title" />, - body: ( - <TranslationHelper - trans_class={TranslationClass.PLUGIN_LOADER} - trans_text="decky_update_available" - i18n_args={{ tag_name: versionInfo?.remote?.tag_name }} - /> - ), - onClick: () => Router.Navigate('/decky/settings'), - }); this.deckyState.setHasLoaderUpdate(true); + if (this.notificationService.shouldNotify('deckyUpdates')) { + this.toaster.toast({ + title: <TranslationHelper trans_class={TranslationClass.PLUGIN_LOADER} trans_text="decky_title" />, + body: ( + <TranslationHelper + trans_class={TranslationClass.PLUGIN_LOADER} + trans_text="decky_update_available" + i18n_args={{ tag_name: versionInfo?.remote?.tag_name }} + /> + ), + onClick: () => Router.Navigate('/decky/settings'), + }); + } } await sleep(7000); await this.notifyPluginUpdates(); @@ -146,7 +151,7 @@ class PluginLoader extends Logger { public async notifyPluginUpdates() { const updates = await this.checkPluginUpdates(); - if (updates?.size > 0) { + if (updates?.size > 0 && this.notificationService.shouldNotify('pluginUpdates')) { this.toaster.toast({ title: <TranslationHelper trans_class={TranslationClass.PLUGIN_LOADER} trans_text="decky_title" />, body: ( @@ -220,6 +225,7 @@ class PluginLoader extends Logger { }); this.hiddenPluginsService.init(); + this.notificationService.init(); } public deinit() { |
