diff --git a/src/api/Notifications/Notifications.tsx b/src/api/Notifications/Notifications.tsx
index c842ec887..600ea63d1 100644
--- a/src/api/Notifications/Notifications.tsx
+++ b/src/api/Notifications/Notifications.tsx
@@ -77,6 +77,8 @@ function _showNotification(notification: NotificationData, id: number) {
}
function shouldBeNative() {
+ if (typeof Notification === "undefined") return false;
+
const { useNative } = Settings.notifications;
if (useNative === "always") return true;
if (useNative === "not-focused") return !document.hasFocus();
diff --git a/src/components/VencordSettings/VencordTab.tsx b/src/components/VencordSettings/VencordTab.tsx
index 7bb5353b1..751220856 100644
--- a/src/components/VencordSettings/VencordTab.tsx
+++ b/src/components/VencordSettings/VencordTab.tsx
@@ -18,7 +18,7 @@
import { openNotificationLogModal } from "@api/Notifications/notificationLog";
-import { useSettings } from "@api/settings";
+import { Settings, useSettings } from "@api/settings";
import { classNameFactory } from "@api/Styles";
import DonateButton from "@components/DonateButton";
import ErrorBoundary from "@components/ErrorBoundary";
@@ -43,7 +43,6 @@ function VencordSettings() {
fallbackValue: "Loading..."
});
const settings = useSettings();
- const notifSettings = settings.notifications;
const donateImage = React.useMemo(() => Math.random() > 0.5 ? DEFAULT_DONATE_IMAGE : SHIGGY_DONATE_IMAGE, []);
@@ -158,8 +157,16 @@ function VencordSettings() {
+ {typeof Notification !== "undefined" && }
+
+ );
+}
+
+function NotificationSection({ settings }: { settings: typeof Settings["notifications"]; }) {
+ return (
+ <>
Notification Style
- {notifSettings.useNative !== "never" && Notification.permission === "denied" && (
+ {settings.useNative !== "never" && Notification?.permission === "denied" && (
Desktop Notification Permission denied
You have denied Notification Permissions. Thus, Desktop notifications will not work!
@@ -178,35 +185,35 @@ function VencordSettings() {
{ label: "Only use Desktop notifications when Discord is not focused", value: "not-focused", default: true },
{ label: "Always use Desktop notifications", value: "always" },
{ label: "Always use Vencord notifications", value: "never" },
- ] satisfies Array<{ value: typeof settings["notifications"]["useNative"]; } & Record>}
+ ] satisfies Array<{ value: typeof settings["useNative"]; } & Record>}
closeOnSelect={true}
- select={v => notifSettings.useNative = v}
- isSelected={v => v === notifSettings.useNative}
+ select={v => settings.useNative = v}
+ isSelected={v => v === settings.useNative}
serialize={identity}
/>
Notification Position