feat: add option to put Avatar somewhere else

This commit is contained in:
kmmiio99o 2026-07-02 12:39:47 +02:00
parent 4414c2d291
commit 7b0e6d68f6
No known key found for this signature in database
GPG key ID: AC9D7747D423B9BF
2 changed files with 27 additions and 8 deletions

View file

@ -10,6 +10,7 @@ const Flux = findByProps("useStateFromStores");
const { Pressable, View } = ReactNative;
const ChatInputActions = find(m => m?.type?.displayName === "ChatInputActions") || findByName("ChatInputActions");
const ChatInputSendButton = find(m => m?.type?.displayName === "ChatInputSendButton") || findByName("ChatInputSendButton");
const Avatar = findByProps("default", "AvatarSizes", "getStatusSize")?.default || findByProps("getStatusSize")?.default || findByName("Avatar");
@ -99,31 +100,39 @@ export default {
showStatusCutout: true,
profileType: "server",
showInDms: true,
position: "after_actions",
};
for (const key in defaults) {
plugin.storage[key] = plugin.storage[key] ?? defaults[key];
}
if (!ChatInputActions) return;
if (ChatInputActions.type) {
if (ChatInputActions) {
const target = ChatInputActions.type || ChatInputActions;
patches.push(
after("render", ChatInputActions.type, (args, ret) => {
after("render", target, (args, ret) => {
const position = getSetting("position", "after_actions");
if (position === "near_send") return ret;
return (
<View style={{ flexDirection: "row", alignItems: "center" }}>
{position === "before_actions" && <AvatarAction />}
{ret}
<AvatarAction />
{position === "after_actions" && <AvatarAction />}
</View>
);
})
);
} else {
}
if (ChatInputSendButton) {
const target = ChatInputSendButton.type || ChatInputSendButton;
patches.push(
after("render", ChatInputActions, (args, ret) => {
after("render", target, (args, ret) => {
const position = getSetting("position", "after_actions");
if (position !== "near_send") return ret;
return (
<View style={{ flexDirection: "row", alignItems: "center" }}>
{ret}
<AvatarAction />
{ret}
</View>
);
})

View file

@ -47,6 +47,16 @@ export default function ChatboxAvatarSettings() {
<TableRadioRow value="main" label="Prefer Main Profile" />
</TableRadioGroup>
</TableRowGroup>
<TableRowGroup title="Position">
<TableRadioGroup
value={get("position", "after_actions")}
onChange={(v: string) => { set("position", v); forceUpdate(); }}
>
<TableRadioRow value="before_actions" label="Before Action Buttons" />
<TableRadioRow value="after_actions" label="After Action Buttons" />
<TableRadioRow value="near_send" label="Near Send Button" />
</TableRadioGroup>
</TableRowGroup>
<TableRowGroup title="Status Icon">
<TableRadioGroup
value={get("showStatusCutout", true) ? "true" : "false"}