CustomAppIcons: Sturdier Find

This commit is contained in:
thororen1234 2024-07-20 02:13:04 -04:00
parent c7e48b1c26
commit 00fefab3d4
3 changed files with 12 additions and 13 deletions

View file

@ -32,8 +32,8 @@ function AppIconModal(props: ModalProps) {
appIcons.push(icon);
findByProps("UZ", "QA").UZ.push(icon);
findByProps("UZ", "QA").QA[icon.id] = icon;
findByProps("M9", "UZ", "QA").UZ.push(icon);
findByProps("M9", "UZ", "QA").QA[icon.id] = icon;
showToast("Added custom app icon!", Toasts.Type.SUCCESS);
props.onClose();
const oldIcon = findByProps("getCurrentDesktopIcon").getCurrentDesktopIcon();

View file

@ -20,8 +20,8 @@ function removeAppIcon() {
const index = icons.findIndex(icon => current_icon === icon.id);
if (index !== -1) {
icons = icons.filter(e => e.id !== current_icon);
delete findByProps("UZ", "QA").QA[current_icon];
delete findByProps("UZ", "QA").UZ[findByProps("UZ", "QA").UZ.findIndex((icon => current_icon === icon?.id))];
delete findByProps("M9", "UZ", "QA").QA[current_icon];
delete findByProps("M9", "UZ", "QA").UZ[findByProps("M9", "UZ", "QA").UZ.findIndex((icon => current_icon === icon?.id))];
localStorage.setItem("vc_app_icons", JSON.stringify(icons));
showToast("Icon successfully deleted!", Toasts.Type.SUCCESS);
FluxDispatcher.dispatch({
@ -58,8 +58,8 @@ export default definePlugin({
start() {
const appIcons = JSON.parse(localStorage.getItem("vc_app_icons") ?? "[]");
for (const icon of appIcons) {
findByProps("UZ", "QA").UZ.push(icon);
findByProps("UZ", "QA").QA[icon.id] = icon;
findByProps("M9", "UZ", "QA").UZ.push(icon);
findByProps("M9", "UZ", "QA").QA[icon.id] = icon;
}
},
stop() {
@ -87,12 +87,12 @@ export default definePlugin({
<><Forms.FormTitle>
<Forms.FormTitle>How to use?</Forms.FormTitle>
</Forms.FormTitle>
<Forms.FormText>
<Forms.FormText>Go to <Link href="/settings/appearance" onClick={e => { e.preventDefault(); closeAllModals(); FluxDispatcher.dispatch({ type: "USER_SETTINGS_MODAL_SET_SECTION", section: "Appearance" }); }}>Appearance Settings</Link> tab.</Forms.FormText>
<Forms.FormText>Scroll down to "In-app Icons" and click on "Preview App Icon".</Forms.FormText>
<Forms.FormText>And upload your own custom icon!</Forms.FormText>
<Forms.FormText>You can only use links when you are uploading your Custom Icon.</Forms.FormText>
</Forms.FormText></>
<Forms.FormText>
<Forms.FormText>Go to <Link href="/settings/appearance" onClick={e => { e.preventDefault(); closeAllModals(); FluxDispatcher.dispatch({ type: "USER_SETTINGS_MODAL_SET_SECTION", section: "Appearance" }); }}>Appearance Settings</Link> tab.</Forms.FormText>
<Forms.FormText>Scroll down to "In-app Icons" and click on "Preview App Icon".</Forms.FormText>
<Forms.FormText>And upload your own custom icon!</Forms.FormText>
<Forms.FormText>You can only use links when you are uploading your Custom Icon.</Forms.FormText>
</Forms.FormText></>
);
}
});

View file

@ -59,7 +59,6 @@ export default definePlugin({
),
patches: [
{
// Normal Profiles
find: "getUserAvatarURL:",
replacement: [
{