1
0
Fork 1
mirror of https://github.com/Vendicated/Vencord.git synced 2025-01-10 18:06:22 +00:00

replace notifications with toatsts

This commit is contained in:
sadan 2024-09-21 15:11:29 -04:00
parent 2f3c9fd8ec
commit f73c59b09e
No known key found for this signature in database

View file

@ -4,9 +4,9 @@
* SPDX-License-Identifier: GPL-3.0-or-later * SPDX-License-Identifier: GPL-3.0-or-later
*/ */
import { showNotification } from "@api/Notifications";
import { canonicalizeMatch, canonicalizeReplace } from "@utils/patches"; import { canonicalizeMatch, canonicalizeReplace } from "@utils/patches";
import { filters, findAll, search, wreq } from "@webpack"; import { filters, findAll, search, wreq } from "@webpack";
import { Toasts } from "@webpack/common";
import { reporterData } from "debug/reporterData"; import { reporterData } from "debug/reporterData";
import { Settings } from "Vencord"; import { Settings } from "Vencord";
@ -56,10 +56,13 @@ export function initWs(isManual = false) {
} }
(settings.store.notifyOnAutoConnect || isManual) && showNotification({ (settings.store.notifyOnAutoConnect || isManual) && Toasts.show({
title: "Dev Companion Connected", message: "Connected to WebSocket",
body: "Connected to WebSocket", id: Toasts.genId(),
noPersist: true type: Toasts.Type.SUCCESS,
options: {
position: Toasts.Position.TOP
}
}); });
}); });
@ -70,11 +73,13 @@ export function initWs(isManual = false) {
logger.error("Dev Companion Error:", e); logger.error("Dev Companion Error:", e);
showNotification({ Toasts.show({
title: "Dev Companion Error", message: "Dev Companion Error",
body: (e as ErrorEvent).message || "No Error Message", id: Toasts.genId(),
color: "var(--status-danger, red)", type: Toasts.Type.FAILURE,
noPersist: true options: {
position: Toasts.Position.TOP
}
}); });
}); });
@ -83,16 +88,12 @@ export function initWs(isManual = false) {
logger.info("Dev Companion Disconnected:", e.code, e.reason); logger.info("Dev Companion Disconnected:", e.code, e.reason);
showNotification({ Toasts.show({
title: "Dev Companion Disconnected", message: "Dev Companion Disconnected",
body: e.reason || "No Reason provided", id: Toasts.genId(),
color: "var(--status-danger, red)", type: Toasts.Type.FAILURE,
noPersist: true, options: {
onClick() { position: Toasts.Position.TOP
setTimeout(() => {
socket?.close(1000, "Reconnecting");
initWs(true);
}, 2500);
} }
}); });
}); });