diff --git a/scripts/build.mjs b/scripts/build.mjs index 5f02974..dddd321 100644 --- a/scripts/build.mjs +++ b/scripts/build.mjs @@ -75,7 +75,7 @@ const config = { constModules: { globals: { "bunny-build-info": { - version: `"1.4.1.3"`, + version: `"1.4.1.4"`, }, }, }, diff --git a/src/core/i18n/index.ts b/src/core/i18n/index.ts index c3ec1ef..500f1b0 100644 --- a/src/core/i18n/index.ts +++ b/src/core/i18n/index.ts @@ -156,6 +156,16 @@ export function formatString( val: Record, ): FormatStringRet { const str = Strings[key]; - // @ts-ignore - return new IntlMessageFormat(str).format(val); + if (!str) return str as FormatStringRet; + try { + // @ts-ignore + return new IntlMessageFormat(str).format(val); + } catch (e: any) { + if (e?.name === "SyntaxError") { + logger.warn(`[i18n] Failed to parse message for key "${String(key)}":`, e.message); + return str as FormatStringRet; + } + logger.warn(`[i18n] Failed to format message for key "${String(key)}":`, e?.message ?? e); + return str as FormatStringRet; + } } diff --git a/src/core/plugins/index.ts b/src/core/plugins/index.ts index 4b70528..90e2c7f 100644 --- a/src/core/plugins/index.ts +++ b/src/core/plugins/index.ts @@ -34,7 +34,6 @@ export const getCorePlugins = (): CorePluginRecord => ({ "bunny.quickinstall": makeLazyPlugin(() => require("./quickinstall"), true), "bunny.badges": makeLazyPlugin(() => require("./badges")), "bunny.notrack": makeLazyPlugin(() => require("./notrack")), - "bunny.messagefix": makeLazyPlugin(() => require("./messagefix")), "bunny.fixembed": makeLazyPlugin(() => require("./fixembed")), "bunny.favouriteanything": makeLazyPlugin(() => require("./favouriteanything")), "bunny.nodelete": makeLazyPlugin(() => require("./nodelete")), diff --git a/src/core/plugins/messagefix/index.ts b/src/core/plugins/messagefix/index.ts deleted file mode 100644 index 0efa77d..0000000 --- a/src/core/plugins/messagefix/index.ts +++ /dev/null @@ -1,58 +0,0 @@ -import { defineCorePlugin } from ".."; -import { findByProps } from "@metro"; -import { logger } from "@lib/utils/logger"; - -// Find the MessageActions module -const MessageActions = findByProps("sendMessage"); -let originalSendMessage: Function; - -export default defineCorePlugin({ - manifest: { - id: "bunny.messagefix", - version: "1.0.0", - type: "plugin", - spec: 3, - main: "", - display: { - name: "MessageFix", - description: "Ensures messages include the required nonce parameter", - authors: [{ name: "Win8.1VMUser (plugin by ShiggyCord Team)" }], - }, - }, - - start() { - // Save original function - originalSendMessage = MessageActions.sendMessage; - - // Replace with our implementation - MessageActions.sendMessage = function ( - channelId: unknown, - message: unknown, - replyRef: unknown, - options: Record, - ) { - // Ensure options exists and has a nonce - options = options || {}; - if (!options.nonce) { - options.nonce = (BigInt(Date.now() - 1420070400000) << 22n).toString(); - } - - // Call original with fixed parameters - return (originalSendMessage as Function).call( - this, - channelId, - message, - replyRef, - options, - ); - }; - - logger.log("MessageFix: Enabled - adding nonce to all messages"); - }, - - stop() { - // Restore original function - if (originalSendMessage) MessageActions.sendMessage = originalSendMessage; - logger.log("MessageFix: Disabled"); - }, -}); diff --git a/src/core/ui/components/AddonCard.tsx b/src/core/ui/components/AddonCard.tsx index e369090..fcce763 100644 --- a/src/core/ui/components/AddonCard.tsx +++ b/src/core/ui/components/AddonCard.tsx @@ -34,6 +34,7 @@ const useStyles = createStyles({ headerLeading: { flexDirection: "column", justifyContent: "center", + flexShrink: 1, scale: 1.2, }, headerTrailing: { @@ -108,9 +109,9 @@ export default function AddonCard(props: CardProps) { - {props.headerLabel} + {props.headerLabel} {props.headerSublabel && ( - {props.headerSublabel} + {props.headerSublabel} )} diff --git a/src/lib/ui/settings/index.tsx b/src/lib/ui/settings/index.tsx index 0e96627..991f0cf 100644 --- a/src/lib/ui/settings/index.tsx +++ b/src/lib/ui/settings/index.tsx @@ -5,15 +5,14 @@ import type { ImageURISource } from "react-native"; import { patchTabsUI } from "./patches/tabs"; export interface RowConfig { - key: string; - title: () => string; - onPress?: () => any; - render?: Parameters[0]; - icon?: ImageURISource | number; - IconComponent?: React.ReactNode; - usePredicate?: () => boolean; - useTrailing?: () => string | JSX.Element; - rawTabsConfig?: Record; + key: string; + title: () => string; + onPress?: () => any; + render?: Parameters[0]; + icon?: ImageURISource | number; + IconComponent?: React.ReactNode, + usePredicate?: () => boolean, + useTrailing?: () => string | JSX.Element } export const registeredSections = {} as { diff --git a/src/lib/ui/settings/patches/tabs.tsx b/src/lib/ui/settings/patches/tabs.tsx index 959f24f..d7c462e 100644 --- a/src/lib/ui/settings/patches/tabs.tsx +++ b/src/lib/ui/settings/patches/tabs.tsx @@ -2,7 +2,6 @@ import { after } from "@lib/api/patcher"; import { TableRow } from "@metro/common/components"; import { findByNameLazy, findByPropsLazy } from "@metro/wrappers"; import { registeredSections } from "@ui/settings"; -import { Strings } from "@core/i18n"; import { CustomPageRenderer, wrapOnPress } from "./shared"; import { findInReactTree } from "@lib/utils"; @@ -29,9 +28,9 @@ export function patchTabsUI(unpatches: (() => void | boolean)[]) { IconComponent: () => , usePredicate: row.usePredicate, useTrailing: row.useTrailing, + useTitle: row.title, onPress: wrapOnPress(row.onPress, null, row.render, row.title()), withArrow: true, - ...row.rawTabsConfig, }, })), ) @@ -48,6 +47,7 @@ export function patchTabsUI(unpatches: (() => void | boolean)[]) { VendettaCustomPage: { type: "route", title: () => "ShiggyCord", + useTitle: () => "ShiggyCord", screen: { route: "VendettaCustomPage", getComponent: () => CustomPageRenderer, @@ -56,6 +56,7 @@ export function patchTabsUI(unpatches: (() => void | boolean)[]) { SHIGGYCORD_CUSTOM_PAGE: { type: "route", title: () => "ShiggyCord", + useTitle: () => "ShiggyCord", screen: { route: "SHIGGYCORD_CUSTOM_PAGE", getComponent: () => CustomPageRenderer, @@ -64,6 +65,7 @@ export function patchTabsUI(unpatches: (() => void | boolean)[]) { BUNNY_CUSTOM_PAGE: { type: "route", title: () => "ShiggyCord", + useTitle: () => "ShiggyCord", screen: { route: "BUNNY_CUSTOM_PAGE", getComponent: () => CustomPageRenderer,