Skip to content

Commit

Permalink
Update Changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
domi-btnr committed Jan 14, 2025
1 parent 682aa96 commit 7d1a32d
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 241 deletions.
52 changes: 9 additions & 43 deletions InvisibleTyping/index.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import React from "react";
import { Logger, Patcher, UI, Utils, Webpack } from "@api";
import { Logger, Patcher, Utils, Webpack } from "@api";
import manifest from "@manifest";
import Styles from "@styles";

import showChangelog from "../common/Changelog";

import InvisibleTypingButton from "./components/typingButton";
import SettingsPanel from "./components/settings";
import Settings from "./modules/settings";
import { TypingModule } from "./modules/shared";

import "./changelog.scss";

export default class InvisibleTyping {
start() {
Styles.load();
this.showChangelog();
showChangelog(manifest);
this.patchTyping();
this.patchChannelTextArea();
}
Expand All @@ -22,43 +22,6 @@ export default class InvisibleTyping {
Patcher.unpatchAll();
}

showChangelog() {
if (
!manifest?.changelog?.length ||
Settings.get("lastVersion") === manifest.version
) return;

const i18n = Webpack.getByKeys("getLocale");
const formatter = new Intl.DateTimeFormat(i18n.getLocale(), {
month: "long",
day: "numeric",
year: "numeric"
});

const title = (
<div className="Changelog-Title-Wrapper">
<h1>What's New - {manifest.name}</h1>
<div>{formatter.format(new Date(manifest.changelogDate))} - v{manifest.version}</div>
</div>
)

const items = manifest?.changelog?.map(item => (
<div className="Changelog-Item">
<h4 className={`Changelog-Header ${item.type}`}>{item.title}</h4>
{item.items.map(item => (
<span>{item}</span>
))}
</div>
));

"changelogImage" in manifest && items.unshift(
<img className="Changelog-Banner" src={manifest.changelogImage} />
);

Settings.set("lastVersion", manifest.version);

UI.alert(title as unknown as string, items);
}

patchTyping() {
Patcher.instead(TypingModule, "startTyping", (_, [channelId]: [string], originalMethod) => {
Expand All @@ -74,11 +37,14 @@ export default class InvisibleTyping {
const ChannelTextArea = Webpack.getModule(m => m?.type?.render?.toString?.()?.includes?.("CHANNEL_TEXT_AREA"))

Patcher.after(ChannelTextArea.type, "render", (_, __, res) => {
const isProfilePopout = Utils.findInTree(res, e => Array.isArray(e?.value) && e.value.some(v => v === "bite size profile popout"), { walkable: ["children", "props"] });
if (isProfilePopout) return;

const chatBar = Utils.findInTree(res, e => Array.isArray(e?.children) && e.children.some(c => c?.props?.className?.startsWith("attachButton")), { walkable: ["children", "props"] });
if (!chatBar) return Logger.error("[InvisibleTyping] Failed to find ChatBar");
if (!chatBar) return Logger.error("Failed to find ChatBar");

const textAreaState = Utils.findInTree(chatBar, e => e?.props?.channel, { walkable: ["children"] });
if (!textAreaState) return Logger.error("[InvisibleTyping] Failed to find textAreaState");
if (!textAreaState) return Logger.error("Failed to find textAreaState");

chatBar.children.splice(-1, 0, <InvisibleTypingButton channel={textAreaState?.props?.channel} isEmpty={!Boolean(textAreaState?.props?.editorTextContent)} />);
});
Expand Down
55 changes: 0 additions & 55 deletions PlatformIndicators/changelog.scss

This file was deleted.

59 changes: 12 additions & 47 deletions PlatformIndicators/index.jsx
Original file line number Diff line number Diff line change
@@ -1,63 +1,28 @@
import {DOM, Patcher, ReactUtils, Webpack, UI, Utils} from "@api";
import React from "react";
import { DOM, Patcher, ReactUtils, Webpack, Utils } from "@api";
import manifest from "@manifest";
import Styles from "@styles";
import React from "react";
import Settings from "./modules/settings";
import {findInReactTree} from "./modules/utils";

import showChangelog from "../common/Changelog";

import StatusIndicators from "./components/indicators";
import SettingsPanel from "./components/settings";
import Settings from "./modules/settings";
import { findInReactTree } from "./modules/utils";

export default class PlatformIndicators {
getSettingsPanel() {
return <SettingsPanel />;
}

start() {
this.showChangelog();
Styles.load();
showChangelog(manifest);
this.patchDMs();
this.patchMemberList();
this.patchChat();
this.patchBadges();
this.patchFriendList();
Styles.load();
}

showChangelog() {
if (
!manifest?.changelog?.length ||
Settings.get("lastVersion") === manifest.version
) return;

const i18n = Webpack.getByKeys("getLocale");
const formatter = new Intl.DateTimeFormat(i18n.getLocale(), {
month: "long",
day: "numeric",
year: "numeric"
});

const title = (
<div className="Changelog-Title-Wrapper">
<h1>What's New - {manifest.name}</h1>
<div>{formatter.format(new Date(manifest.changelogDate))} - v{manifest.version}</div>
</div>
)

const items = manifest?.changelog?.map(item => (
<div className="Changelog-Item">
<h4 className={`Changelog-Header ${item.type}`}>{item.title}</h4>
{item.items.map(item => (
<span>{item}</span>
))}
</div>
));

"changelogImage" in manifest && items.unshift(
<img className="Changelog-Banner" src={manifest.changelogImage} />
);

Settings.set("lastVersion", manifest.version);

UI.alert(title, items);
}

patchDMs() {
Expand All @@ -75,7 +40,7 @@ export default class PlatformIndicators {
<UserContext.Provider value={props.user}>
{res}
</UserContext.Provider>
);
);
});
});

Expand Down Expand Up @@ -149,15 +114,15 @@ export default class PlatformIndicators {
const UserContext = React.createContext(null);
const [ProfileInfoRow, KEY_PIR] = Webpack.getWithKey(Webpack.Filters.byStrings("user", "profileType"));
const [BadgeList, Key_BL] = Webpack.getWithKey(Webpack.Filters.byStrings("badges", "badgeClassName"));

Patcher.after(ProfileInfoRow, KEY_PIR, (_, [props], res) => {
if (!Settings.get("showInBadges", true)) return;
if (Settings.get("ignoreBots", true) && props.user.bot) return;
return (
<UserContext.Provider value={props.user}>
{res}
</UserContext.Provider>
);
);
});

Patcher.after(BadgeList, Key_BL, (_, __, res) => {
Expand Down
55 changes: 0 additions & 55 deletions PronounDB/changelog.scss

This file was deleted.

44 changes: 3 additions & 41 deletions PronounDB/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ import { ContextMenu, Patcher, UI, Utils, Webpack } from "@api";
import manifest from "@manifest";
import Styles from "@styles";

import showChangelog from "../common/Changelog";

import PronounInputModal from "./components/pronounsModal";
import PronounsTag from "./components/pronounsTag";
import SettingsPanel from "./components/settings";
import Settings from "./modules/settings";

import "./changelog.scss";
import PronounsDB from "./modules/database";

export default class PronounDB {
start() {
Styles.load();
this.showChangelog();
showChangelog(manifest);
this.patchMessageTimestamp();
this.patchUserProfile();
this.patchContextMenu()
Expand All @@ -24,44 +24,6 @@ export default class PronounDB {
Patcher.unpatchAll();
}

showChangelog() {
if (
!manifest?.changelog?.length ||
Settings.get("lastVersion") === manifest.version
) return;

const i18n = Webpack.getByKeys("getLocale");
const formatter = new Intl.DateTimeFormat(i18n.getLocale(), {
month: "long",
day: "numeric",
year: "numeric"
});

const title = (
<div className="Changelog-Title-Wrapper">
<h1>What's New - {manifest.name}</h1>
<div>{formatter.format(new Date(manifest.changelogDate))} - v{manifest.version}</div>
</div>
)

const items = manifest?.changelog?.map(item => (
<div className="Changelog-Item">
<h4 className={`Changelog-Header ${item.type}`}>{item.title}</h4>
{item.items.map(item => (
<span>{item}</span>
))}
</div>
));

"changelogImage" in manifest && items.unshift(
<img className="Changelog-Banner" src={manifest.changelogImage} />
);

Settings.set("lastVersion", manifest.version);

UI.alert(title, items);
}

patchMessageTimestamp() {
const [Module, Key] = Webpack.getWithKey(Webpack.Filters.byStrings("isInteractionPlaceholder", ".application.id"))
Patcher.after(Module, Key, (_, __, res) => {
Expand Down
Loading

0 comments on commit 7d1a32d

Please sign in to comment.