aboutsummaryrefslogtreecommitdiff
path: root/src/api/Notices.ts
diff options
context:
space:
mode:
authorVendicated <vendicated@riseup.net>2022-10-01 00:42:50 +0200
committerVendicated <vendicated@riseup.net>2022-10-01 00:42:50 +0200
commit8161a07dba401f04dac93f861e6b2cffe53ab7e3 (patch)
tree1499e825bcd6a162bc43507f492b262e9b1901ed /src/api/Notices.ts
parent9aaa47ea4e9ac068bf5fcbb997e31d722f43f1e5 (diff)
downloadVencord-8161a07dba401f04dac93f861e6b2cffe53ab7e3.tar.gz
Vencord-8161a07dba401f04dac93f861e6b2cffe53ab7e3.tar.bz2
Vencord-8161a07dba401f04dac93f861e6b2cffe53ab7e3.zip
Add in client updater, Notices API
Diffstat (limited to 'src/api/Notices.ts')
-rw-r--r--src/api/Notices.ts24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/api/Notices.ts b/src/api/Notices.ts
new file mode 100644
index 0000000..66cae0e
--- /dev/null
+++ b/src/api/Notices.ts
@@ -0,0 +1,24 @@
+import { waitFor } from "../webpack";
+
+let NoticesModule: any;
+waitFor(m => m.show && m.dismiss && !m.suppressAll, m => NoticesModule = m);
+
+export const noticesQueue = [] as any[];
+export let currentNotice: any = null;
+
+export function popNotice() {
+ NoticesModule.dismiss();
+}
+
+export function nextNotice() {
+ currentNotice = noticesQueue.shift();
+
+ if (currentNotice) {
+ NoticesModule.show(...currentNotice, "VencordNotice");
+ }
+}
+
+export function showNotice(message: string, buttonText: string, onOkClick: () => void) {
+ noticesQueue.push(["GENERIC", message, buttonText, onOkClick]);
+ if (!currentNotice) nextNotice();
+}