fix background in themes and change version to normal 1.4

fix by purple_eyez from revenge, shiggies for him (may likely still not
work on some phones)
This commit is contained in:
Kernel Builder 2026-01-01 18:12:08 +01:00
parent 3f0c22342a
commit 179679f215
No known key found for this signature in database
GPG key ID: 163FE39F7772D2EC
2 changed files with 29 additions and 24 deletions

View file

@ -75,7 +75,7 @@ const config = {
constModules: {
globals: {
"bunny-build-info": {
version: `"Jolly 1.4"`,
version: `"1.4"`,
},
},
},

View file

@ -7,16 +7,16 @@ import { findByFilePathLazy } from "@metro";
import chroma from "chroma-js";
import { ImageBackground, StyleSheet } from "react-native";
const Messages = findByFilePathLazy("components_native/chat/Messages.tsx", true);
const Messages = findByFilePathLazy("modules/messages/native/Messages.tsx", true);
function ThemeBackground({ children }: { children: React.ReactNode }) {
function ThemeBackground({ children }: { children: React.ReactNode; }) {
useObservable([colorsPref]);
if (!_colorRef.current
|| colorsPref.customBackground === "hidden"
|| !_colorRef.current.background?.url
|| _colorRef.current.background?.blur && (typeof _colorRef.current.background?.blur !== "number")
){
) {
return children;
}
@ -30,30 +30,35 @@ function ThemeBackground({ children }: { children: React.ReactNode }) {
}
export default function patchChatBackground() {
try {
const patches = [
after("render", Messages, (_, ret) => {
if (!_colorRef.current || !_colorRef.current.background?.url) return;
const messagesComponent = findInReactTree(
ret,
x => x && "HACK_fixModalInteraction" in x.props && x?.props?.style
);
after("render", Messages, (_, ret) => {
if (!_colorRef.current || !_colorRef.current.background?.url) return;
if (messagesComponent) {
const flattened = StyleSheet.flatten(messagesComponent.props.style);
const backgroundColor = chroma(
flattened.backgroundColor || "black"
).alpha(
1 - (_colorRef.current.background?.opacity ?? 1)
).hex();
const messagesComponent = findInReactTree(
ret,
x => x && "HACK_fixModalInteraction" in x.props && x?.props?.style
);
messagesComponent.props.style = StyleSheet.flatten([
messagesComponent.props.style,
{ backgroundColor }
]);
}
if (messagesComponent) {
const flattened = StyleSheet.flatten(messagesComponent.props.style);
const backgroundColor = chroma(
flattened.backgroundColor || "black"
).alpha(
1 - (_colorRef.current.background?.opacity ?? 1)
).hex();
return <ThemeBackground>{ret}</ThemeBackground>;
})
messagesComponent.props.style = StyleSheet.flatten([
messagesComponent.props.style,
{ backgroundColor }
]);
}
return <ThemeBackground>{ret}</ThemeBackground>;
})
];
return () => patches.forEach(x => x());
} catch (e) {
}
}