Skip to content

Commit

Permalink
hmph
Browse files Browse the repository at this point in the history
  • Loading branch information
yofukashino committed Nov 29, 2023
1 parent b8ed2dd commit a35a7eb
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 14 deletions.
9 changes: 7 additions & 2 deletions src/Components/AccountDetailsButton.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
import { plugins } from "replugged";
import { contextMenu as ContextMenuApi } from "replugged/common";
import { SettingValues } from "../index";
import { PanelButton } from "../lib/requiredModules";
import { defaultSettings } from "../lib/consts";
import FakeDeafenContextMenu from "./ContextMenu";
import Icons from "../Components/Icons";
import Utils from "../lib/utils";
export const _addPanelButton = (): React.ReactElement | null => {
if (!SettingValues.get("userPanel", defaultSettings.userPanel)) return null;
export default (): React.ReactElement | null => {
if (
!SettingValues.get("userPanel", defaultSettings.userPanel) ||
plugins.getDisabled().includes("dev.tharki.FakeDeafen")
)
return null;
const enabled = SettingValues.get("enabled", defaultSettings.enabled);
const Icon = <Icons.sound width="20" height="20" />;
const DisabledIcon = (
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ export const stop = (): void => {
removeListeners();
};

export { _addPanelButton } from "./Components/AccountDetailsButton";
export { default as _addPanelButton } from "./Components/AccountDetailsButton";

export { Settings } from "./Components/Settings.jsx";
7 changes: 3 additions & 4 deletions src/lib/requiredModules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ export const AccountDetailsClasses = webpack.getByProps<Types.AccountDetailsClas
"container",
);

export const AudioResolver = webpack.getBySource<{ exports: Types.DefaultTypes.AnyFunction }>(
"./mute.mp3",
{ raw: true },
);
export const AudioResolverPromise = webpack.waitForModule<{
exports: Types.DefaultTypes.AnyFunction;
}>(webpack.filters.bySource("./mute.mp3"), { raw: true });
6 changes: 3 additions & 3 deletions src/patches/AudioResolver.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { PluginInjector } from "../index";
import { AudioResolver } from "../lib/requiredModules";
import { AudioResolverPromise } from "../lib/requiredModules";
import { Sounds } from "../lib/consts";

export default (): void => {
export default async (): Promise<void> => {
const AudioResolver = await AudioResolverPromise;
PluginInjector.instead(AudioResolver, "exports", ([sound]: [string], res) => {
console.log(sound);
switch (sound) {
case `./${Sounds.Enable}.mp3`: {
return Sounds.EnableURL;
Expand Down
8 changes: 4 additions & 4 deletions src/patches/Menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Types from "../types";
export default (): void => {
PluginInjectorUtils.addMenuItem(Types.DefaultTypes.ContextMenuTypes.Account, (_data, menu) => {
if (!SettingValues.get("statusPicker", defaultSettings.statusPicker)) return;
const { value: muteValue, onChange: muteOnChange } = Utils.useSetting(
/* const { value: muteValue, onChange: muteOnChange } = Utils.useSetting(
SettingValues,
"soundStatus.mute",
defaultSettings.soundStatus.mute,
Expand All @@ -22,7 +22,7 @@ export default (): void => {
SettingValues,
"soundStatus.video",
defaultSettings.soundStatus.video,
);
); */
const enabled = SettingValues.get("enabled", defaultSettings.enabled);
const Icon = (
<Icons.sound
Expand Down Expand Up @@ -67,7 +67,7 @@ export default (): void => {
action={() => Utils.toggleSoundStatus(enabled)}
icon={() => (enabled ? DisabledIcon : Icon)}
showIconFirst={true}>
<ContextMenu.MenuItem label="What to fake?" id="what-to-fake" />
{/* <ContextMenu.MenuItem label="What to fake?" id="what-to-fake" />
<ContextMenu.MenuSeparator />
<ContextMenu.MenuCheckboxItem
id="mute"
Expand All @@ -86,7 +86,7 @@ export default (): void => {
label="Video"
checked={videoValue as boolean}
action={() => videoOnChange(!videoValue)}
/>
/> */}
</ContextMenu.MenuItem>,
);
});
Expand Down

0 comments on commit a35a7eb

Please sign in to comment.