fix things using lodash (#1882)
This commit is contained in:
parent
9c13befcb6
commit
c7a20769f9
@ -34,7 +34,7 @@ import { openModalLazy } from "@utils/modal";
|
|||||||
import { useAwaiter } from "@utils/react";
|
import { useAwaiter } from "@utils/react";
|
||||||
import { Plugin } from "@utils/types";
|
import { Plugin } from "@utils/types";
|
||||||
import { findByPropsLazy } from "@webpack";
|
import { findByPropsLazy } from "@webpack";
|
||||||
import { Alerts, Button, Card, Forms, Parser, React, Select, Text, TextInput, Toasts, Tooltip } from "@webpack/common";
|
import { Alerts, Button, Card, Forms, Parser, React, Select, Text, TextInput, Toasts, Tooltip, lodash } from "@webpack/common";
|
||||||
|
|
||||||
import Plugins from "~plugins";
|
import Plugins from "~plugins";
|
||||||
|
|
||||||
@ -251,7 +251,7 @@ export default function PluginSettings() {
|
|||||||
}
|
}
|
||||||
DataStore.set("Vencord_existingPlugins", existingTimestamps);
|
DataStore.set("Vencord_existingPlugins", existingTimestamps);
|
||||||
|
|
||||||
return window._.isEqual(newPlugins, sortedPluginNames) ? [] : newPlugins;
|
return lodash.isEqual(newPlugins, sortedPluginNames) ? [] : newPlugins;
|
||||||
}));
|
}));
|
||||||
|
|
||||||
type P = JSX.Element | JSX.Element[];
|
type P = JSX.Element | JSX.Element[];
|
||||||
|
@ -25,7 +25,7 @@ import { proxyLazy } from "@utils/lazy";
|
|||||||
import { Logger } from "@utils/Logger";
|
import { Logger } from "@utils/Logger";
|
||||||
import definePlugin, { OptionType } from "@utils/types";
|
import definePlugin, { OptionType } from "@utils/types";
|
||||||
import { findByCodeLazy, findByPropsLazy, findLazy, findStoreLazy } from "@webpack";
|
import { findByCodeLazy, findByPropsLazy, findLazy, findStoreLazy } from "@webpack";
|
||||||
import { ChannelStore, EmojiStore, FluxDispatcher, Parser, PermissionStore, UserStore } from "@webpack/common";
|
import { ChannelStore, EmojiStore, FluxDispatcher, lodash, Parser, PermissionStore, UserStore } from "@webpack/common";
|
||||||
import type { Message } from "discord-types/general";
|
import type { Message } from "discord-types/general";
|
||||||
import { applyPalette, GIFEncoder, quantize } from "gifenc";
|
import { applyPalette, GIFEncoder, quantize } from "gifenc";
|
||||||
import type { ReactElement, ReactNode } from "react";
|
import type { ReactElement, ReactNode } from "react";
|
||||||
@ -532,7 +532,7 @@ export default definePlugin({
|
|||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return modifyChildren(window._.cloneDeep(content));
|
return modifyChildren(lodash.cloneDeep(content));
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
new Logger("FakeNitro").error(err);
|
new Logger("FakeNitro").error(err);
|
||||||
return content;
|
return content;
|
||||||
|
@ -26,7 +26,7 @@ import { useAwaiter } from "@utils/react";
|
|||||||
import definePlugin from "@utils/types";
|
import definePlugin from "@utils/types";
|
||||||
import { chooseFile } from "@utils/web";
|
import { chooseFile } from "@utils/web";
|
||||||
import { findByPropsLazy, findLazy, findStoreLazy } from "@webpack";
|
import { findByPropsLazy, findLazy, findStoreLazy } from "@webpack";
|
||||||
import { Button, FluxDispatcher, Forms, Menu, PermissionsBits, PermissionStore, RestAPI, SelectedChannelStore, showToast, SnowflakeUtils, Toasts, useEffect, useState } from "@webpack/common";
|
import { Button, FluxDispatcher, Forms, lodash, Menu, PermissionsBits, PermissionStore, RestAPI, SelectedChannelStore, showToast, SnowflakeUtils, Toasts, useEffect, useState } from "@webpack/common";
|
||||||
import { ComponentType } from "react";
|
import { ComponentType } from "react";
|
||||||
|
|
||||||
import { VoiceRecorderDesktop } from "./DesktopRecorder";
|
import { VoiceRecorderDesktop } from "./DesktopRecorder";
|
||||||
@ -138,7 +138,7 @@ function Modal({ modalProps }: { modalProps: ModalProps; }) {
|
|||||||
const channelData = audioBuffer.getChannelData(0);
|
const channelData = audioBuffer.getChannelData(0);
|
||||||
|
|
||||||
// average the samples into much lower resolution bins, maximum of 256 total bins
|
// average the samples into much lower resolution bins, maximum of 256 total bins
|
||||||
const bins = new Uint8Array(window._.clamp(Math.floor(audioBuffer.duration * 10), Math.min(32, channelData.length), 256));
|
const bins = new Uint8Array(lodash.clamp(Math.floor(audioBuffer.duration * 10), Math.min(32, channelData.length), 256));
|
||||||
const samplesPerBin = Math.floor(channelData.length / bins.length);
|
const samplesPerBin = Math.floor(channelData.length / bins.length);
|
||||||
|
|
||||||
// Get root mean square of each bin
|
// Get root mean square of each bin
|
||||||
|
@ -33,6 +33,8 @@ export const moment: typeof import("moment") = findByPropsLazy("parseTwoDigitYea
|
|||||||
|
|
||||||
export const hljs: typeof import("highlight.js") = findByPropsLazy("highlight");
|
export const hljs: typeof import("highlight.js") = findByPropsLazy("highlight");
|
||||||
|
|
||||||
|
export const lodash: typeof import("lodash") = findByPropsLazy("debounce", "cloneDeep");
|
||||||
|
|
||||||
export const i18n: t.i18n = findLazy(m => m.Messages?.["en-US"]);
|
export const i18n: t.i18n = findLazy(m => m.Messages?.["en-US"]);
|
||||||
|
|
||||||
export let SnowflakeUtils: t.SnowflakeUtils;
|
export let SnowflakeUtils: t.SnowflakeUtils;
|
||||||
|
Loading…
Reference in New Issue
Block a user