improve method for enabling notifications by default

This commit is contained in:
V 2023-12-28 04:19:56 +01:00
parent d71d0c1cc4
commit 7565eb39a4
No known key found for this signature in database
GPG key ID: A1DC0CFB5615D905
3 changed files with 27 additions and 14 deletions

View file

@ -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,16 +20,9 @@ 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");
});
}
// FIXME: Remove eventually.
// Originally, Vencord always used a Windows user agent. This seems to cause captchas
// Now, we use a platform specific UA - HOWEVER, discord FOR SOME REASON????? caches

View file

@ -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"
}
}
]
});

View file

@ -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";