Rename PUPU to ShiggyCord and bump version

- Rename i18n keys and string usages (PUPU -> SHIGGYCORD) and export
shiggycordIcon instead of PupuIcon - Replace navigation route/keys
PUPU_CUSTOM_PAGE -> SHIGGYCORD_CUSTOM_PAGE - Bump bunny-build-info
version to 1.1.4-2 - Minor formatting and refactor in
PluginInfoActionSheet and shared code
This commit is contained in:
kmmiio99o 2025-10-18 20:14:41 +02:00
parent 6cade8b8f4
commit d3754c2195
14 changed files with 225 additions and 169 deletions

View file

@ -77,7 +77,7 @@ const config = {
constModules: {
globals: {
"bunny-build-info": {
version: `"1.1.4-1"`,
version: `"1.1.4-2"`,
},
},
},

View file

@ -6,8 +6,8 @@
"ARE_YOU_SURE_TO_DELETE_THEME": "Are you sure you wish to delete {name}?",
"ASSET_BROWSER": "Asset Browser",
"BRAND": "Brand",
"PUPU": "ShiggyCord",
"PUPU_URL": "ShiggyCord URL",
"SHIGGYCORD": "ShiggyCord",
"SHIGGYCORD_URL": "ShiggyCord URL",
"BROWSER": "Browser",
"BYTECODE": "Bytecode",
"CANCEL": "Cancel",

View file

@ -1,4 +1,4 @@
import PupuIcon from "@assets/icons/shiggy.png";
import shiggycordIcon from "@assets/icons/shiggy.png";
import { Strings } from "@core/i18n";
import { useProxy } from "@core/vendetta/storage";
import { findAssetId } from "@lib/api/assets";
@ -7,7 +7,7 @@ import { settings } from "@lib/api/settings";
import { registerSection } from "@ui/settings";
import { version } from "bunny-build-info";
export { PupuIcon };
export { shiggycordIcon };
export default function initSettings() {
registerSection({
@ -15,8 +15,8 @@ export default function initSettings() {
items: [
{
key: "SHIGGYCORD",
title: () => Strings.PUPU,
icon: { uri: PupuIcon },
title: () => Strings.SHIGGYCORD,
icon: { uri: shiggycordIcon },
render: () => import("@core/ui/settings/pages/General"),
useTrailing: () => `(${version})`,
},

View file

@ -189,7 +189,7 @@ export default function Developer() {
(loaderConfig.customLoadUrl.url = v)
}
placeholder="http://localhost:4040/shiggycord.js"
label={Strings.PUPU_URL}
label={Strings.SHIGGYCORD_URL}
/>
}
/>
@ -204,7 +204,7 @@ export default function Developer() {
icon={<TableRow.Icon source={findAssetId("ic_image")} />}
trailing={TableRow.Arrow}
onPress={() =>
navigation.push("PUPU_CUSTOM_PAGE", {
navigation.push("SHIGGYCORD_CUSTOM_PAGE", {
title: Strings.ASSET_BROWSER,
render: AssetBrowser,
})
@ -231,7 +231,7 @@ export default function Developer() {
// @ts-expect-error
// Of course, to trigger an error, we need to do something incorrectly. The below will do!
{
label: Strings.PUPU,
label: Strings.SHIGGYCORD,
onPress: () =>
navigation.push("SHIGGYCORD_CUSTOM_PAGE", {
render: () => <undefined />,
@ -241,7 +241,7 @@ export default function Developer() {
label: "Discord",
isDestructive: true,
onPress: () =>
navigation.push("PUPU_CUSTOM_PAGE", {
navigation.push("SHIGGYCORD_CUSTOM_PAGE", {
noErrorBoundary: true,
}),
},
@ -259,7 +259,7 @@ export default function Developer() {
icon={<TableRow.Icon source={findAssetId("TrashIcon")} />}
onPress={() => {
openAlert(
"pupu-clear-bundle-reload-confirmation",
"shiggycord-clear-bundle-reload-confirmation",
<AlertModal
title={Strings.MODAL_RELOAD_REQUIRED}
content={Strings.MODAL_RELOAD_REQUIRED_DESC}

View file

@ -1,5 +1,5 @@
import { Strings } from "@core/i18n";
import { PupuIcon } from "@core/ui/settings";
import { shiggycordIcon } from "@core/ui/settings";
import Version from "@core/ui/settings/pages/General/Version";
import { useProxy } from "@core/vendetta/storage";
import { getDebugInfo } from "@lib/api/debug";
@ -56,9 +56,9 @@ export default function About() {
const coreVersions = [
{
label: Strings.PUPU,
label: Strings.SHIGGYCORD,
version: debugInfo.bunny.version,
icon: { uri: PupuIcon },
icon: { uri: shiggycordIcon },
},
{
label: "Discord",
@ -128,7 +128,7 @@ export default function About() {
>
<View style={{ alignItems: "center", paddingVertical: 16 }}>
<Text variant="heading-xl/bold" style={{ textAlign: "center" }}>
{Strings.PUPU}
{Strings.SHIGGYCORD}
</Text>
<Text
variant="text-md/medium"

View file

@ -1,6 +1,6 @@
import { isSafeMode, toggleSafeMode } from "@core/debug/safeMode";
import { Strings } from "@core/i18n";
import { PupuIcon } from "@core/ui/settings";
import { shiggycordIcon } from "@core/ui/settings";
import About from "@core/ui/settings/pages/General/About";
import { useProxy } from "@core/vendetta/storage";
import { findAssetId } from "@lib/api/assets";
@ -150,7 +150,7 @@ export default function General() {
<TableRowGroup title="App Information">
<TableRow
label="ShiggyCord"
icon={<TableRow.Icon source={{ uri: PupuIcon }} />}
icon={<TableRow.Icon source={{ uri: shiggycordIcon }} />}
trailing={<TableRow.TrailingText text={debugInfo.bunny.version} />}
/>
<TableRow
@ -274,7 +274,7 @@ export default function General() {
/>
}
onPress={() =>
navigation.push("PUPU_CUSTOM_PAGE", {
navigation.push("SHIGGYCORD_CUSTOM_PAGE", {
title: Strings.ABOUT,
render: () => <About />,
})

View file

@ -118,7 +118,7 @@ const Actions = () => {
icon={findAssetId("WrenchIcon")}
disabled={!plugin.getPluginSettingsComponent()}
onPress={() =>
navigation.push("PUPU_CUSTOM_PAGE", {
navigation.push("SHIGGYCORD_CUSTOM_PAGE", {
title: plugin.name,
render: plugin.getPluginSettingsComponent(),
})

View file

@ -1,4 +1,4 @@
import { PupuIcon } from "@core/ui/settings";
import { shiggycordIcon } from "@core/ui/settings";
import {
disablePlugin,
enablePlugin,
@ -22,7 +22,7 @@ export default function unifyBunnyPlugin(
getBadges() {
return [
{ source: { uri: PupuIcon } },
{ source: { uri: shiggycordIcon } },
// { source: findAssetId("CheckmarkLargeBoldIcon")! }
];
},

View file

@ -196,7 +196,7 @@ export default function PluginInfoActionSheet({
disabled={!plugin.getPluginSettingsComponent()}
icon={findAssetId("WrenchIcon")}
onPress={() => {
navigation.push("PUPU_CUSTOM_PAGE", {
navigation.push("SHIGGYCORD_CUSTOM_PAGE", {
title: plugin.name,
render: plugin.getPluginSettingsComponent(),
});

View file

@ -4,137 +4,190 @@ import { VdPluginManager } from "@core/vendetta/plugins";
import { purgeStorage } from "@core/vendetta/storage";
import { findAssetId } from "@lib/api/assets";
import { clipboard } from "@metro/common";
import { ActionSheet, ActionSheetRow, Button, TableRow, Text } from "@metro/common/components";
import {
ActionSheet,
ActionSheetRow,
Button,
TableRow,
Text,
} from "@metro/common/components";
import { hideSheet } from "@ui/sheets";
import { showToast } from "@ui/toasts";
import { ScrollView, View } from "react-native";
import { PluginInfoActionSheetProps } from "./common";
export default function PluginInfoActionSheet({ plugin, navigation }: PluginInfoActionSheetProps) {
plugin.usePluginState();
export default function PluginInfoActionSheet({
plugin,
navigation,
}: PluginInfoActionSheetProps) {
plugin.usePluginState();
const vdPlugin = VdPluginManager.plugins[plugin.id];
const SettingsComponent = plugin.getPluginSettingsComponent();
const vdPlugin = VdPluginManager.plugins[plugin.id];
const SettingsComponent = plugin.getPluginSettingsComponent();
return <ActionSheet>
<ScrollView>
<View style={{ flexDirection: "row", alignItems: "center", paddingVertical: 24 }}>
<Text variant="heading-xl/semibold">
{plugin.name}
</Text>
<View style={{ marginLeft: "auto" }}>
{SettingsComponent && <Button
size="md"
text="Configure"
variant="secondary"
icon={findAssetId("WrenchIcon")}
onPress={() => {
hideSheet("PluginInfoActionSheet");
navigation.push("PUPU_CUSTOM_PAGE", {
title: plugin.name,
render: SettingsComponent,
});
}}
/>}
</View>
</View>
<ActionSheetRow.Group>
<ActionSheetRow
label={Strings.REFETCH}
icon={<TableRow.Icon source={findAssetId("RetryIcon")} />}
onPress={async () => {
if (vdPlugin.enabled) VdPluginManager.stopPlugin(plugin.id, false);
return (
<ActionSheet>
<ScrollView>
<View
style={{
flexDirection: "row",
alignItems: "center",
paddingVertical: 24,
}}
>
<Text variant="heading-xl/semibold">{plugin.name}</Text>
<View style={{ marginLeft: "auto" }}>
{SettingsComponent && (
<Button
size="md"
text="Configure"
variant="secondary"
icon={findAssetId("WrenchIcon")}
onPress={() => {
hideSheet("PluginInfoActionSheet");
navigation.push("SHIGGYCORD_CUSTOM_PAGE", {
title: plugin.name,
render: SettingsComponent,
});
}}
/>
)}
</View>
</View>
<ActionSheetRow.Group>
<ActionSheetRow
label={Strings.REFETCH}
icon={<TableRow.Icon source={findAssetId("RetryIcon")} />}
onPress={async () => {
if (vdPlugin.enabled)
VdPluginManager.stopPlugin(plugin.id, false);
try {
await VdPluginManager.fetchPlugin(plugin.id);
showToast(Strings.PLUGIN_REFETCH_SUCCESSFUL, findAssetId("toast_image_saved"));
} catch {
showToast(Strings.PLUGIN_REFETCH_FAILED, findAssetId("Small"));
}
try {
await VdPluginManager.fetchPlugin(plugin.id);
showToast(
Strings.PLUGIN_REFETCH_SUCCESSFUL,
findAssetId("toast_image_saved"),
);
} catch {
showToast(Strings.PLUGIN_REFETCH_FAILED, findAssetId("Small"));
}
if (vdPlugin.enabled) await VdPluginManager.startPlugin(plugin.id);
hideSheet("PluginInfoActionSheet");
}}
/>
<ActionSheetRow
label={Strings.COPY_URL}
icon={<TableRow.Icon source={findAssetId("LinkIcon")} />}
onPress={() => {
clipboard.setString(plugin.id);
showToast.showCopyToClipboard();
}}
/>
<ActionSheetRow
label={vdPlugin.update ? Strings.DISABLE_UPDATES : Strings.ENABLE_UPDATES}
icon={<TableRow.Icon source={findAssetId("DownloadIcon")} />}
onPress={() => {
vdPlugin.update = !vdPlugin.update;
showToast(formatString("TOASTS_PLUGIN_UPDATE", {
update: vdPlugin.update,
name: plugin.name
}), findAssetId("toast_image_saved"));
}}
/>
<ActionSheetRow
label={Strings.CLEAR_DATA}
icon={<TableRow.Icon variant="danger" source={findAssetId("CopyIcon")} />}
variant="danger"
onPress={() => showConfirmationAlert({
title: Strings.HOLD_UP,
content: formatString("ARE_YOU_SURE_TO_CLEAR_DATA", { name: plugin.name }),
confirmText: Strings.CLEAR,
cancelText: Strings.CANCEL,
confirmColor: "red",
onConfirm: async () => {
if (vdPlugin.enabled) VdPluginManager.stopPlugin(plugin.id, false);
if (vdPlugin.enabled)
await VdPluginManager.startPlugin(plugin.id);
hideSheet("PluginInfoActionSheet");
}}
/>
<ActionSheetRow
label={Strings.COPY_URL}
icon={<TableRow.Icon source={findAssetId("LinkIcon")} />}
onPress={() => {
clipboard.setString(plugin.id);
showToast.showCopyToClipboard();
}}
/>
<ActionSheetRow
label={
vdPlugin.update ? Strings.DISABLE_UPDATES : Strings.ENABLE_UPDATES
}
icon={<TableRow.Icon source={findAssetId("DownloadIcon")} />}
onPress={() => {
vdPlugin.update = !vdPlugin.update;
showToast(
formatString("TOASTS_PLUGIN_UPDATE", {
update: vdPlugin.update,
name: plugin.name,
}),
findAssetId("toast_image_saved"),
);
}}
/>
<ActionSheetRow
label={Strings.CLEAR_DATA}
icon={
<TableRow.Icon
variant="danger"
source={findAssetId("CopyIcon")}
/>
}
variant="danger"
onPress={() =>
showConfirmationAlert({
title: Strings.HOLD_UP,
content: formatString("ARE_YOU_SURE_TO_CLEAR_DATA", {
name: plugin.name,
}),
confirmText: Strings.CLEAR,
cancelText: Strings.CANCEL,
confirmColor: "red",
onConfirm: async () => {
if (vdPlugin.enabled)
VdPluginManager.stopPlugin(plugin.id, false);
try {
await VdPluginManager.fetchPlugin(plugin.id);
showToast(Strings.PLUGIN_REFETCH_SUCCESSFUL, findAssetId("toast_image_saved"));
} catch {
showToast(Strings.PLUGIN_REFETCH_FAILED, findAssetId("Small"));
}
try {
await VdPluginManager.fetchPlugin(plugin.id);
showToast(
Strings.PLUGIN_REFETCH_SUCCESSFUL,
findAssetId("toast_image_saved"),
);
} catch {
showToast(
Strings.PLUGIN_REFETCH_FAILED,
findAssetId("Small"),
);
}
let message: any[];
try {
purgeStorage(plugin.id);
message = ["CLEAR_DATA_SUCCESSFUL", "trash"];
} catch {
message = ["CLEAR_DATA_FAILED", "Small"];
}
let message: any[];
try {
purgeStorage(plugin.id);
message = ["CLEAR_DATA_SUCCESSFUL", "trash"];
} catch {
message = ["CLEAR_DATA_FAILED", "Small"];
}
showToast(
formatString(message[0], { name: plugin.name }),
findAssetId(message[1])
);
showToast(
formatString(message[0], { name: plugin.name }),
findAssetId(message[1]),
);
if (vdPlugin.enabled) await VdPluginManager.startPlugin(plugin.id);
hideSheet("PluginInfoActionSheet");
}
})}
/>
<ActionSheetRow
label={Strings.DELETE}
icon={<TableRow.Icon variant="danger" source={findAssetId("TrashIcon")} />}
variant="danger"
onPress={() => showConfirmationAlert({
title: Strings.HOLD_UP,
content: formatString("ARE_YOU_SURE_TO_DELETE_PLUGIN", { name: plugin.name }),
confirmText: Strings.DELETE,
cancelText: Strings.CANCEL,
confirmColor: "red",
onConfirm: () => {
try {
VdPluginManager.removePlugin(plugin.id);
} catch (e) {
showToast(String(e), findAssetId("Small"));
}
hideSheet("PluginInfoActionSheet");
}
})}
/>
</ActionSheetRow.Group>
</ScrollView>
</ActionSheet>;
if (vdPlugin.enabled)
await VdPluginManager.startPlugin(plugin.id);
hideSheet("PluginInfoActionSheet");
},
})
}
/>
<ActionSheetRow
label={Strings.DELETE}
icon={
<TableRow.Icon
variant="danger"
source={findAssetId("TrashIcon")}
/>
}
variant="danger"
onPress={() =>
showConfirmationAlert({
title: Strings.HOLD_UP,
content: formatString("ARE_YOU_SURE_TO_DELETE_PLUGIN", {
name: plugin.name,
}),
confirmText: Strings.DELETE,
cancelText: Strings.CANCEL,
confirmColor: "red",
onConfirm: () => {
try {
VdPluginManager.removePlugin(plugin.id);
} catch (e) {
showToast(String(e), findAssetId("Small"));
}
hideSheet("PluginInfoActionSheet");
},
})
}
/>
</ActionSheetRow.Group>
</ScrollView>
</ActionSheet>
);
}

View file

@ -64,7 +64,7 @@ export function patchPanelUI(unpatches: (() => void | boolean)[]) {
title: "ShiggyCord",
render: () => <CustomPageRenderer />,
},
PUPU_CUSTOM_PAGE: {
SHIGGYCORD_CUSTOM_PAGE: {
title: "ShiggyCord",
render: () => <CustomPageRenderer />,
},

View file

@ -6,37 +6,40 @@ import { RowConfig } from "@ui/settings";
const tabsNavigationRef = findByPropsLazy("getRootNavigationRef");
export const CustomPageRenderer = React.memo(() => {
const navigation = NavigationNative.useNavigation();
const route = NavigationNative.useRoute();
const navigation = NavigationNative.useNavigation();
const route = NavigationNative.useRoute();
const { render: PageComponent, ...args } = route.params;
const { render: PageComponent, ...args } = route.params;
React.useEffect(() => void navigation.setOptions({ ...args }), []);
React.useEffect(() => void navigation.setOptions({ ...args }), []);
return <ErrorBoundary><PageComponent /></ErrorBoundary>;
return (
<ErrorBoundary>
<PageComponent />
</ErrorBoundary>
);
});
export function wrapOnPress(
onPress: (() => unknown) | undefined,
navigation?: any,
renderPromise?: RowConfig["render"],
screenOptions?: string | Record<string, any>,
props?: any,
onPress: (() => unknown) | undefined,
navigation?: any,
renderPromise?: RowConfig["render"],
screenOptions?: string | Record<string, any>,
props?: any,
) {
return async () => {
if (onPress) return void onPress();
return async () => {
if (onPress) return void onPress();
const Component = await renderPromise!!().then(m => m.default);
const Component = await renderPromise!!().then((m) => m.default);
if (typeof screenOptions === "string") {
screenOptions = { title: screenOptions };
}
if (typeof screenOptions === "string") {
screenOptions = { title: screenOptions };
}
navigation ??= tabsNavigationRef.getRootNavigationRef();
navigation.navigate("PUPU_CUSTOM_PAGE", {
...screenOptions,
render: () => <Component {...props} />
});
};
navigation ??= tabsNavigationRef.getRootNavigationRef();
navigation.navigate("SHIGGYCORD_CUSTOM_PAGE", {
...screenOptions,
render: () => <Component {...props} />,
});
};
}

View file

@ -53,11 +53,11 @@ export function patchTabsUI(unpatches: (() => void | boolean)[]) {
getComponent: () => CustomPageRenderer,
},
},
PUPU_CUSTOM_PAGE: {
SHIGGYCORD_CUSTOM_PAGE: {
type: "route",
title: () => "ShiggyCord",
screen: {
route: "PUPU_CUSTOM_PAGE",
route: "SHIGGYCORD_CUSTOM_PAGE",
getComponent: () => CustomPageRenderer,
},
},

2
src/modules.d.ts vendored
View file

@ -1,5 +1,5 @@
declare module "bunny-build-info" {
const version: "1.1.4-1";
const version: "1.1.4-2";
}
declare module "*.png" {