Fixes and ShowHiddenChannels improvements (#634)

~ Fixes #630
~ Fixes #618
This commit is contained in:
Nuckyz 2023-03-21 03:07:16 -03:00 committed by GitHub
parent d482d33d6f
commit 586b26d2d4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 147 additions and 47 deletions

View file

@ -18,10 +18,11 @@
import { addContextMenuPatch, NavContextMenuPatchCallback, removeContextMenuPatch } from "@api/ContextMenu";
import { showNotification } from "@api/Notifications";
import { definePluginSettings } from "@api/settings";
import { Devs } from "@utils/constants";
import Logger from "@utils/Logger";
import { canonicalizeMatch, canonicalizeReplace } from "@utils/patches";
import definePlugin from "@utils/types";
import definePlugin, { OptionType } from "@utils/types";
import { filters, findAll, search } from "@webpack";
import { Menu } from "@webpack/common";
@ -65,6 +66,14 @@ interface FindData {
args: Array<StringNode | FunctionNode>;
}
const settings = definePluginSettings({
notifyOnAutoConnect: {
description: "Wheter to notify when Dev Companion has automatically connected.",
type: OptionType.BOOLEAN,
default: true
}
});
function parseNode(node: Node) {
switch (node.type) {
case "string":
@ -91,7 +100,7 @@ function initWs(isManual = false) {
logger.info("Connected to WebSocket");
showNotification({
(settings.store.notifyOnAutoConnect || isManual) && showNotification({
title: "Dev Companion Connected",
body: "Connected to WebSocket"
});
@ -241,6 +250,7 @@ export default definePlugin({
description: "Dev Companion Plugin",
authors: [Devs.Ven],
dependencies: ["ContextMenuAPI"],
settings,
start() {
initWs();