Skip to content

Commit

Permalink
feat: update visuals, strings, license, add clear bundle dev option
Browse files Browse the repository at this point in the history
- Update icons
- Update license
- Update strings
- Add "Clear JS bundle" developer option
  • Loading branch information
PalmDevs committed Sep 14, 2024
1 parent c384fd1 commit ee3e53f
Show file tree
Hide file tree
Showing 15 changed files with 65 additions and 22 deletions.
1 change: 1 addition & 0 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ BSD 3-Clause License

Copyright (c) 2023, Team Vendetta
Copyright (c) 2024, pylixonly
Copyright (c) 2024, Team Revenge

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "bunny",
"name": "revenge",
"private": true,
"author": {
"name": "Pyoncord Team",
"url": "https://github.com/pyoncord"
"name": "Revenge Team",
"url": "https://github.com/revenge-mod"
},
"scripts": {
"build": "node scripts/build.mjs",
Expand Down
Binary file removed src/assets/icons/pyoncord.png
Binary file not shown.
Binary file added src/assets/icons/revenge.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 9 additions & 5 deletions src/core/i18n/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@
"ARE_YOU_SURE_TO_DELETE_THEME": "Are you sure you wish to delete {name}?",
"ASSET_BROWSER": "Asset Browser",
"BRAND": "Brand",
"BUNNY": "Bunny",
"BUNNY": "Revenge",
"BUNNY_URL": "Bunny URL",
"BYTECODE": "Bytecode",
"CANCEL": "Cancel",
"CLEAR": "Clear",
"CLEAR_BUNDLE": "Clear JS bundle",
"CLEAR_BUNDLE_DESC": "Clear the cached bundle. This will force a re-download of the bundle next app launch.",
"CLEAR_DATA": "Clear data",
"CLEAR_DATA_FAILED": "Failed to clear data for {name}!",
"CLEAR_DATA_SUCCESSFUL": "Cleared data for {name}.",
Expand Down Expand Up @@ -66,6 +68,8 @@
"MANUFACTURER": "Manufacturer",
"MESSAGE": "Message",
"MISCELLANEOUS": "Miscellaneous",
"MODAL_RELOAD_REQUIRED": "Reload app?",
"MODAL_RELOAD_REQUIRED_DESC": "A reload is required to see the changes. Do you want to reload now?",
"MODAL_THEME_REFETCHED": "Theme refetched",
"MODAL_THEME_REFETCHED_DESC": "A reload is required to see the changes. Do you want to reload now?",
"MODAL_UNPROXIED_PLUGIN_DESC": "The plugin you are trying to install has not been proxied/verified by staffs. Are you sure you want to continue?",
Expand All @@ -81,10 +85,10 @@
"REFETCH": "Refetch",
"RELOAD": "Reload",
"RELOAD_DISCORD": "Reload Discord",
"RELOAD_IN_NORMAL_MODE": "Reload in Normal Mode",
"RELOAD_IN_NORMAL_MODE_DESC": "This will reload Discord normally",
"RELOAD_IN_SAFE_MODE": "Reload in Safe Mode",
"RELOAD_IN_SAFE_MODE_DESC": "This will reload Discord without loading addons",
"RELOAD_IN_NORMAL_MODE": "Reload in normal mode",
"RELOAD_IN_NORMAL_MODE_DESC": "Safe mode currently enabled, tap to reload in normal mode",
"RELOAD_IN_SAFE_MODE": "Reload in safe mode",
"RELOAD_IN_SAFE_MODE_DESC": "Tap to reload Discord without loading addons",
"REMOVE": "Remove",
"RESTART_REQUIRED_TO_TAKE_EFFECT": "Restart is required to take effect",
"RETRY": "Retry",
Expand Down
4 changes: 2 additions & 2 deletions src/core/ui/settings/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import PyoncordIcon from "@assets/icons/pyoncord.png";
import PyoncordIcon from "@assets/icons/revenge.png";
import { Strings } from "@core/i18n";
import { findAssetId } from "@lib/api/assets";
import { isFontSupported, isThemeSupported } from "@lib/api/native/loader";
Expand All @@ -11,7 +11,7 @@ export { PyoncordIcon };

export default function initSettings() {
registerSection({
name: "Bunny",
name: Strings.BUNNY,
items: [
{
key: "BUNNY",
Expand Down
20 changes: 20 additions & 0 deletions src/core/ui/settings/pages/Developer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,13 @@ import { findByProps } from "@metro/wrappers";
import { semanticColors } from "@ui/color";
import { ErrorBoundary } from "@ui/components";
import { createStyles, TextStyleSheet } from "@ui/styles";
import { NativeModules } from "react-native";
import { ScrollView, StyleSheet } from "react-native";

const { hideActionSheet } = lazyDestructure(() => findByProps("openLazy", "hideActionSheet"));
const { showSimpleActionSheet } = lazyDestructure(() => findByProps("showSimpleActionSheet"));
const { openAlert, dismissAlert } = lazyDestructure(() => findByProps("openAlert", "dismissAlert"));
const { AlertModal, AlertActionButton } = lazyDestructure(() => findByProps("AlertModal", "AlertActions"));

const RDT_EMBED_LINK = "https://raw.githubusercontent.com/amsyarasyiq/rdt-embedder/main/dist.js";

Expand Down Expand Up @@ -96,6 +99,23 @@ export default function Developer() {
</TableRowGroup>
</>}
<TableRowGroup title="Other">
<TableRow
label={Strings.CLEAR_BUNDLE}
subLabel={Strings.CLEAR_BUNDLE_DESC}
icon={<TableRow.Icon source={findAssetId("trash")} />}
onPress={() => {
openAlert("revenge-clear-bundle-reload-confirmation", <AlertModal
title={Strings.MODAL_RELOAD_REQUIRED}
content={Strings.MODAL_RELOAD_REQUIRED_DESC}
actions={
<Stack>
<AlertActionButton text={Strings.RELOAD} variant="primary" onPress={() => NativeModules.BundleUpdaterManager.reload()} />
<AlertActionButton text={Strings.CANCEL} variant="secondary" />
</Stack>
}
/>);
}}
/>
<TableRow
arrow
label={Strings.ASSET_BROWSER}
Expand Down
4 changes: 2 additions & 2 deletions src/core/ui/settings/pages/General/Version.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { findAssetId } from "@lib/api/assets";
import { clipboard } from "@metro/common";
import { LegacyFormText, TableRow } from "@metro/common/components";
import { TableRow, TableRowTrailingText } from "@metro/common/components";
import { showToast } from "@ui/toasts";

interface VersionProps {
Expand All @@ -14,7 +14,7 @@ export default function Version({ label, version, icon }: VersionProps) {
<TableRow
label={label}
icon={<TableRow.Icon source={findAssetId(icon)} />}
trailing={<LegacyFormText>{version}</LegacyFormText>}
trailing={<TableRowTrailingText text={version} />}
onPress={() => {
clipboard.setString(`${label} - ${version}`);
showToast.showCopyToClipboard();
Expand Down
7 changes: 4 additions & 3 deletions src/core/ui/settings/pages/General/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,12 @@ export default function General() {
icon={<TableRow.Icon source={findAssetId("ic_message_retry")} />}
onPress={() => NativeModules.BundleUpdaterManager.reload()}
/>
<TableRow
label={settings.safeMode?.enabled ? Strings.RELOAD_IN_NORMAL_MODE : Strings.RELOAD_IN_SAFE_MODE}
<TableSwitchRow
label={Strings.SAFE_MODE}
subLabel={settings.safeMode?.enabled ? Strings.RELOAD_IN_NORMAL_MODE_DESC : Strings.RELOAD_IN_SAFE_MODE_DESC}
icon={<TableRow.Icon source={findAssetId("ic_privacy_24px")} />}
onPress={toggleSafeMode}
value={settings.safeMode?.enabled}
onValueChange={toggleSafeMode}
/>
<TableSwitchRow
label={Strings.DEVELOPER_SETTINGS}
Expand Down
9 changes: 9 additions & 0 deletions src/lib/api/native/fs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@ export async function removeFile(path: string, prefix = "pyoncord/") {
return void await FileManager.removeFile("documents", `${prefix}${path}`);
}

/**
* Remove file from given path, currently no check for any failure
* @param path Path to the file
*/
export async function removeCacheFile(path: string, prefix = "pyoncord/") {
if (typeof FileManager.removeFile !== "function") throw new Error("'fs.removeFile' is not supported");
return void await FileManager.removeFile("cache", `${prefix}${path}`);
}

/**
* Check if the file or directory given by the path exists
* @param path Path to the file
Expand Down
6 changes: 6 additions & 0 deletions src/lib/api/native/loader.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Theme } from "@lib/themes";
import { removeCacheFile } from "./fs";

// @ts-ignore
const pyonLoaderIdentity = globalThis.__PYON_LOADER__;
Expand Down Expand Up @@ -221,3 +222,8 @@ export function isFontSupported() {

return false;
}

export async function clearBundle() {
// TODO: This should be not be hardcoded, maybe put in loader.json?
return void await removeCacheFile("bundle.js");
}
5 changes: 3 additions & 2 deletions src/lib/ui/settings/patches/panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { findByNameLazy } from "@metro/wrappers";
import { registeredSections } from "@ui/settings";

import { CustomPageRenderer, wrapOnPress } from "./shared";
import { Strings } from "@core/i18n";

function SettingsSection() {
const navigation = NavigationNative.useNavigation();
Expand All @@ -31,11 +32,11 @@ export function patchPanelUI(unpatches: (() => void | boolean)[]) {
unpatches.push(after("default", findByNameLazy("getScreens", false), (_a, screens) => ({
...screens,
VendettaCustomPage: {
title: "Bunny",
title: Strings.BUNNY,
render: () => <CustomPageRenderer />
},
BUNNY_CUSTOM_PAGE: {
title: "Bunny",
title: Strings.BUNNY,
render: () => <CustomPageRenderer />
}
})));
Expand Down
5 changes: 3 additions & 2 deletions src/lib/ui/settings/patches/tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { findByNameLazy, findByPropsLazy } from "@metro/wrappers";
import { registeredSections } from "@ui/settings";

import { CustomPageRenderer, wrapOnPress } from "./shared";
import { Strings } from "@core/i18n";

const settingConstants = findByPropsLazy("SETTING_RENDERER_CONFIG");
const SettingsOverviewScreen = findByNameLazy("SettingsOverviewScreen", false);
Expand Down Expand Up @@ -40,15 +41,15 @@ export function patchTabsUI(unpatches: (() => void | boolean)[]) {
...rendererConfigValue,
VendettaCustomPage: {
type: "route",
title: () => "Bunny",
title: () => Strings.BUNNY,
screen: {
route: "VendettaCustomPage",
getComponent: () => CustomPageRenderer
}
},
BUNNY_CUSTOM_PAGE: {
type: "route",
title: () => "Bunny",
title: () => Strings.BUNNY,
screen: {
route: "BUNNY_CUSTOM_PAGE",
getComponent: () => CustomPageRenderer
Expand Down
4 changes: 2 additions & 2 deletions src/lib/utils/constants.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export const DISCORD_SERVER = "https://discord.gg/XjYgWXHb9Q";
export const GITHUB = "https://github.com/pyoncord";
export const DISCORD_SERVER = "https://discord.com/invite/ddcQf3s2Uq";
export const GITHUB = "https://github.com/revenge-mod";
export const HTTP_REGEX = /^https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_+.~#?&/=]*)$/;
export const HTTP_REGEX_MULTI = /https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_+.~#?&//=]*)/g;
export const VD_PROXY_PREFIX = "https://vd-plugins.github.io/proxy";
Expand Down
2 changes: 1 addition & 1 deletion src/lib/utils/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ export interface Logger {
}

export const DiscordLogger = findByNameLazy("Logger");
export const logger: Logger = new DiscordLogger("Bunny");
export const logger: Logger = new DiscordLogger("Revenge");

0 comments on commit ee3e53f

Please sign in to comment.