feat: update visuals, strings, license, add clear bundle dev option

- Update icons
- Update license
- Update strings
- Add "Clear JS bundle" developer option
This commit is contained in:
PalmDevs 2024-09-15 04:24:18 +07:00
parent c384fd1a3a
commit ee3e53f943
No known key found for this signature in database
GPG key ID: 81476AE7B70A0133
15 changed files with 65 additions and 22 deletions

View file

@ -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:

View file

@ -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",

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

View file

@ -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}.",
@ -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?",
@ -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",

View file

@ -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";
@ -11,7 +11,7 @@ export { PyoncordIcon };
export default function initSettings() {
registerSection({
name: "Bunny",
name: Strings.BUNNY,
items: [
{
key: "BUNNY",

View file

@ -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";
@ -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}

View file

@ -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 {
@ -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();

View file

@ -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}

View file

@ -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

View file

@ -1,4 +1,5 @@
import { Theme } from "@lib/themes";
import { removeCacheFile } from "./fs";
// @ts-ignore
const pyonLoaderIdentity = globalThis.__PYON_LOADER__;
@ -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");
}

View file

@ -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();
@ -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 />
}
})));

View file

@ -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);
@ -40,7 +41,7 @@ export function patchTabsUI(unpatches: (() => void | boolean)[]) {
...rendererConfigValue,
VendettaCustomPage: {
type: "route",
title: () => "Bunny",
title: () => Strings.BUNNY,
screen: {
route: "VendettaCustomPage",
getComponent: () => CustomPageRenderer
@ -48,7 +49,7 @@ export function patchTabsUI(unpatches: (() => void | boolean)[]) {
},
BUNNY_CUSTOM_PAGE: {
type: "route",
title: () => "Bunny",
title: () => Strings.BUNNY,
screen: {
route: "BUNNY_CUSTOM_PAGE",
getComponent: () => CustomPageRenderer

View file

@ -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";

View file

@ -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");