diff --git a/src/renderer/fixes.ts b/src/renderer/fixes.ts index ed0134f..2524023 100644 --- a/src/renderer/fixes.ts +++ b/src/renderer/fixes.ts @@ -6,9 +6,7 @@ import "./hideGarbage.css"; -import { waitFor } from "@vencord/types/webpack"; - -import { isFirstRun, isWindows, localStorage } from "./utils"; +import { isWindows, localStorage } from "./utils"; // Make clicking Notifications focus the window const originalSetOnClick = Object.getOwnPropertyDescriptor(Notification.prototype, "onclick")!.set!; @@ -22,15 +20,8 @@ Object.defineProperty(Notification.prototype, "onclick", { configurable: true }); -if (isFirstRun) { - // Hide "Download Discord Desktop now!!!!" banner - localStorage.setItem("hideNag", "true"); - - // Enable Desktop Notifications by default - waitFor("setDesktopType", m => { - m.setDesktopType("all"); - }); -} +// Hide "Download Discord Desktop now!!!!" banner +localStorage.setItem("hideNag", "true"); // FIXME: Remove eventually. // Originally, Vencord always used a Windows user agent. This seems to cause captchas diff --git a/src/renderer/patches/enableNotificationsByDefault.ts b/src/renderer/patches/enableNotificationsByDefault.ts new file mode 100644 index 0000000..f48115d --- /dev/null +++ b/src/renderer/patches/enableNotificationsByDefault.ts @@ -0,0 +1,21 @@ +/* + * SPDX-License-Identifier: GPL-3.0 + * Vesktop, a desktop app aiming to give you a snappier Discord Experience + * Copyright (c) 2023 Vendicated and Vencord contributors + */ + +import { addPatch } from "./shared"; + +addPatch({ + patches: [ + { + find: '"NotificationSettingsStore', + replacement: { + // FIXME: fix eslint rule + // eslint-disable-next-line no-useless-escape + match: /\.isPlatformEmbedded(?=\?\i\.DesktopNotificationTypes\.ALL)/g, + replace: "$&||true" + } + } + ] +}); diff --git a/src/renderer/patches/index.ts b/src/renderer/patches/index.ts index b49aefa..7d4c4b3 100644 --- a/src/renderer/patches/index.ts +++ b/src/renderer/patches/index.ts @@ -5,7 +5,8 @@ */ // TODO: Possibly auto generate glob if we have more patches in the future -import "./spellCheck"; +import "./enableNotificationsByDefault"; import "./platformClass"; -import "./windowsTitleBar"; import "./screenShareAudio"; +import "./spellCheck"; +import "./windowsTitleBar";