fix StreamerMode being re-enabled after user disables it
This commit is contained in:
+21
-1
@@ -17,6 +17,8 @@ const logger = new Logger("VesktopRPC", "#5865f2");
|
|||||||
|
|
||||||
const arRPC = Vencord.Plugins.plugins["WebRichPresence (arRPC)"] as typeof arRpcPlugin;
|
const arRPC = Vencord.Plugins.plugins["WebRichPresence (arRPC)"] as typeof arRpcPlugin;
|
||||||
|
|
||||||
|
let userDisabledStreamerMode = false;
|
||||||
|
|
||||||
onIpcCommand(IpcCommands.RPC_ACTIVITY, async jsonData => {
|
onIpcCommand(IpcCommands.RPC_ACTIVITY, async jsonData => {
|
||||||
if (!Settings.store.arRPC) return;
|
if (!Settings.store.arRPC) return;
|
||||||
|
|
||||||
@@ -25,17 +27,35 @@ onIpcCommand(IpcCommands.RPC_ACTIVITY, async jsonData => {
|
|||||||
const data = JSON.parse(jsonData);
|
const data = JSON.parse(jsonData);
|
||||||
|
|
||||||
if (data.socketId === "STREAMERMODE" && StreamerModeStore.autoToggle) {
|
if (data.socketId === "STREAMERMODE" && StreamerModeStore.autoToggle) {
|
||||||
|
const value = data.activity?.application_id === "STREAMERMODE";
|
||||||
|
|
||||||
|
if (!value) {
|
||||||
|
userDisabledStreamerMode = false;
|
||||||
|
} else if (userDisabledStreamerMode) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
FluxDispatcher.dispatch({
|
FluxDispatcher.dispatch({
|
||||||
type: "STREAMER_MODE_UPDATE",
|
type: "STREAMER_MODE_UPDATE",
|
||||||
key: "enabled",
|
key: "enabled",
|
||||||
value: data.activity?.application_id === "STREAMERMODE"
|
value,
|
||||||
|
isAuto: true
|
||||||
});
|
});
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
arRPC.handleEvent(new MessageEvent("message", { data: jsonData }));
|
arRPC.handleEvent(new MessageEvent("message", { data: jsonData }));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
onceReady.then(() => {
|
||||||
|
FluxDispatcher.subscribe("STREAMER_MODE_UPDATE", e => {
|
||||||
|
if (!e.isAuto && !e.value) {
|
||||||
|
userDisabledStreamerMode = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
onIpcCommand(IpcCommands.RPC_INVITE, async code => {
|
onIpcCommand(IpcCommands.RPC_INVITE, async code => {
|
||||||
const { invite } = await InviteActions.resolveInvite(code, "Desktop Modal");
|
const { invite } = await InviteActions.resolveInvite(code, "Desktop Modal");
|
||||||
if (!invite) return false;
|
if (!invite) return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user