diff options
author | Xinto <48173186+X1nto@users.noreply.github.com> | 2023-03-19 13:21:26 +0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-19 09:21:26 +0000 |
commit | 4aff11421f1cccaf34a7c983fd8dc9a841042947 (patch) | |
tree | e7313c34ddf2312493a86afd6f7309a3c81f7e63 /src/Vencord.ts | |
parent | ea642d9e901d42f0f5f73ba1f9cfeb3d1e595332 (diff) | |
download | Vencord-4aff11421f1cccaf34a7c983fd8dc9a841042947.tar.gz Vencord-4aff11421f1cccaf34a7c983fd8dc9a841042947.tar.bz2 Vencord-4aff11421f1cccaf34a7c983fd8dc9a841042947.zip |
Replace update notices with notifications (#558)
Diffstat (limited to 'src/Vencord.ts')
-rw-r--r-- | src/Vencord.ts | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/src/Vencord.ts b/src/Vencord.ts index ba7d01f..98bc83a 100644 --- a/src/Vencord.ts +++ b/src/Vencord.ts @@ -27,7 +27,7 @@ export { PlainSettings, Settings }; import "./utils/quickCss"; import "./webpack/patchWebpack"; -import { popNotice, showNotice } from "./api/Notices"; +import { showNotification } from "./api/Notifications"; import { PlainSettings, Settings } from "./api/settings"; import { patches, PMLogger, startAllPlugins } from "./plugins"; import { checkForUpdates, rebuild, update, UpdateLogger } from "./utils/updater"; @@ -49,32 +49,30 @@ async function init() { if (Settings.autoUpdate) { await update(); const needsFullRestart = await rebuild(); - setTimeout(() => { - showNotice( - "Vencord has been updated!", - "Restart", - () => { + if (Settings.autoUpdateNotification) + showNotification({ + title: "Vencord has been updated!", + body: "Click here to restart", + permanent: true, + onClick() { if (needsFullRestart) window.DiscordNative.app.relaunch(); else location.reload(); } - ); - }, 10_000); + }); return; } if (Settings.notifyAboutUpdates) - setTimeout(() => { - showNotice( - "A Vencord update is available!", - "View Update", - () => { - popNotice(); - SettingsRouter.open("VencordUpdater"); - } - ); - }, 10_000); + showNotification({ + title: "A Vencord update is available!", + body: "Click here to view the update", + permanent: true, + onClick() { + SettingsRouter.open("VencordUpdater"); + } + }); } catch (err) { UpdateLogger.error("Failed to check for updates", err); } |