aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/supportHelper.tsx
diff options
context:
space:
mode:
authorV <vendicated@riseup.net>2023-04-22 03:18:19 +0200
committerGitHub <noreply@github.com>2023-04-22 01:18:19 +0000
commit63fc354d483b86857bbee7f540c66ba614fc0f1f (patch)
tree6ebe100e5ff63254adfdb0c44cb473dcc339cf35 /src/plugins/supportHelper.tsx
parentc6f0c84935db37e2a18578a081404d84292fe36a (diff)
downloadVencord-63fc354d483b86857bbee7f540c66ba614fc0f1f.tar.gz
Vencord-63fc354d483b86857bbee7f540c66ba614fc0f1f.tar.bz2
Vencord-63fc354d483b86857bbee7f540c66ba614fc0f1f.zip
feat: auto-managed flux subscriptions via plugin.flux (#959)
Diffstat (limited to 'src/plugins/supportHelper.tsx')
-rw-r--r--src/plugins/supportHelper.tsx18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/plugins/supportHelper.tsx b/src/plugins/supportHelper.tsx
index 21d9059..469b5ae 100644
--- a/src/plugins/supportHelper.tsx
+++ b/src/plugins/supportHelper.tsx
@@ -21,7 +21,7 @@ import { Devs, SUPPORT_CHANNEL_ID } from "@utils/constants";
import { makeCodeblock } from "@utils/misc";
import definePlugin from "@utils/types";
import { isOutdated } from "@utils/updater";
-import { Alerts, FluxDispatcher, Forms, UserStore } from "@webpack/common";
+import { Alerts, Forms, UserStore } from "@webpack/common";
import gitHash from "~git-hash";
import plugins from "~plugins";
@@ -69,18 +69,16 @@ ${makeCodeblock(Object.keys(plugins).filter(Vencord.Plugins.isPluginEnabled).joi
}
}],
- rememberDismiss() {
- DataStore.set(REMEMBER_DISMISS_KEY, gitHash);
- },
-
- start() {
- FluxDispatcher.subscribe("CHANNEL_SELECT", async ({ channelId }) => {
+ flux: {
+ async CHANNEL_SELECT({ channelId }) {
if (channelId !== SUPPORT_CHANNEL_ID) return;
const myId = BigInt(UserStore.getCurrentUser().id);
if (Object.values(Devs).some(d => d.id === myId)) return;
if (isOutdated && gitHash !== await DataStore.get(REMEMBER_DISMISS_KEY)) {
+ const rememberDismiss = () => DataStore.set(REMEMBER_DISMISS_KEY, gitHash);
+
Alerts.show({
title: "Hold on!",
body: <div>
@@ -90,10 +88,10 @@ ${makeCodeblock(Object.keys(plugins).filter(Vencord.Plugins.isPluginEnabled).joi
to do so, in case you can't access the Updater page.
</Forms.FormText>
</div>,
- onCancel: this.rememberDismiss,
- onConfirm: this.rememberDismiss
+ onCancel: rememberDismiss,
+ onConfirm: rememberDismiss
});
}
- });
+ }
}
});