Some More Fixes

This commit is contained in:
thororen1234 2024-06-20 12:35:05 -04:00
parent c8acee8955
commit a5cc68d9a2
6 changed files with 50 additions and 24 deletions

View file

@ -32,13 +32,13 @@ function AppIconModal(props: ModalProps) {
appIcons.push(icon);
findByProps("ICONS", "ICONS_BY_ID").ICONS.push(icon);
findByProps("ICONS", "ICONS_BY_ID").ICONS_BY_ID[icon.id] = icon;
findByProps("UZ", "QA").UZ.push(icon);
findByProps("UZ", "QA").QA[icon.id] = icon;
showToast("Added custom app icon!", Toasts.Type.SUCCESS);
props.onClose();
const oldIcon = findByProps("getCurrentDesktopIcon").getCurrentDesktopIcon();
let random_icon = Object.keys(findByProps("ICONS_BY_ID")).filter(icon => icon !== oldIcon) as [];
let random_icon = Object.keys(findByProps("UZ")).filter(icon => icon !== oldIcon) as [];
random_icon = random_icon[Math.floor(Math.random() * random_icon.length)];
FluxDispatcher.dispatch({

View file

@ -1,3 +1,9 @@
/*
* Vencord, a Discord client mod
* Copyright (c) 2024 Vendicated and contributors
* SPDX-License-Identifier: GPL-3.0-or-later
*/
/*
* Vencord, a modification for Discord's desktop app
* Copyright (c) 2022 Vendicated and contributors
@ -32,8 +38,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("ICONS", "ICONS_BY_ID").ICONS_BY_ID[current_icon];
delete findByProps("ICONS", "ICONS_BY_ID").ICONS[findByProps("ICONS", "ICONS_BY_ID").ICONS.findIndex((icon => current_icon === icon?.id))];
delete findByProps("UZ", "QA").QA[current_icon];
delete findByProps("UZ", "QA").UZ[findByProps("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({
@ -54,7 +60,7 @@ export default definePlugin({
authors: [Devs.HappyEnderman, EquicordDevs.SerStars],
patches: [
{
find: ".PremiumUpsellTypes.APP_ICON_UPSELL",
find: /\i\.\i\.APP_ICON_UPSELL/,
replacement: [
{
match: /\w+\.jsx\)\(\w+,{markAsDismissed:\w+,isCoachmark:\w+}\)/,
@ -71,8 +77,8 @@ export default definePlugin({
console.log("Well hello there!, CustomAppIcons has started :)");
const appIcons = JSON.parse(localStorage.getItem("vc_app_icons") ?? "[]");
for (const icon of appIcons) {
findByProps("ICONS", "ICONS_BY_ID").ICONS.push(icon);
findByProps("ICONS", "ICONS_BY_ID").ICONS_BY_ID[icon.id] = icon;
findByProps("UZ", "QA").UZ.push(icon);
findByProps("UZ", "QA").QA[icon.id] = icon;
}
},
stop() {
@ -100,12 +106,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></>
);
}
});