aboutsummaryrefslogtreecommitdiff
path: root/src/api/Notifications/Notifications.tsx
diff options
context:
space:
mode:
authorV <vendicated@riseup.net>2023-04-01 02:47:49 +0200
committerGitHub <noreply@github.com>2023-04-01 02:47:49 +0200
commit6960a439c9c2af261517b00b0b16a7fc5756c48b (patch)
tree4e1832c5cc295b26046e193ac5cf60bcd2590568 /src/api/Notifications/Notifications.tsx
parent4dff1c5bd5b16e926bc628acf11118344832a374 (diff)
downloadVencord-6960a439c9c2af261517b00b0b16a7fc5756c48b.tar.gz
Vencord-6960a439c9c2af261517b00b0b16a7fc5756c48b.tar.bz2
Vencord-6960a439c9c2af261517b00b0b16a7fc5756c48b.zip
Add Notification log (#745)
Diffstat (limited to 'src/api/Notifications/Notifications.tsx')
-rw-r--r--src/api/Notifications/Notifications.tsx7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/api/Notifications/Notifications.tsx b/src/api/Notifications/Notifications.tsx
index a6b2ccd..c842ec8 100644
--- a/src/api/Notifications/Notifications.tsx
+++ b/src/api/Notifications/Notifications.tsx
@@ -23,6 +23,7 @@ import type { ReactNode } from "react";
import type { Root } from "react-dom/client";
import NotificationComponent from "./NotificationComponent";
+import { persistNotification } from "./notificationLog";
const NotificationQueue = new Queue();
@@ -56,6 +57,10 @@ export interface NotificationData {
color?: string;
/** Whether this notification should not have a timeout */
permanent?: boolean;
+ /** Whether this notification should not be persisted in the Notification Log */
+ noPersist?: boolean;
+ /** Whether this notification should be dismissed when clicked (defaults to true) */
+ dismissOnClick?: boolean;
}
function _showNotification(notification: NotificationData, id: number) {
@@ -86,6 +91,8 @@ export async function requestPermission() {
}
export async function showNotification(data: NotificationData) {
+ persistNotification(data);
+
if (shouldBeNative() && await requestPermission()) {
const { title, body, icon, image, onClick = null, onClose = null } = data;
const n = new Notification(title, {