Skip to content

Commit

Permalink
fix FileContentPreview and RoleColorEverywhere plugins (#3)
Browse files Browse the repository at this point in the history
* fix: FileContentPreview

* fix: RoleColorEverywhere

* bump deps
  • Loading branch information
owocado authored Jan 13, 2024
1 parent d2f9b29 commit a790287
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 30 deletions.
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
"build": "node build.mjs"
},
"dependencies": {
"@swc/helpers": "^0.4.14"
"@swc/helpers": "^0.5.3"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^24.0.0",
"@rollup/plugin-node-resolve": "^15.0.1",
"@swc/core": "^1.3.35",
"esbuild": "^0.16.14",
"rollup": "^3.9.1",
"rollup-plugin-esbuild": "^5.0.0",
"vendetta-types": "^2.4.20"
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-node-resolve": "^15.2.3",
"@swc/core": "^1.3.100",
"esbuild": "^0.19.9",
"rollup": "^4.8.0",
"rollup-plugin-esbuild": "^6.1.0",
"vendetta-types": "^2.4.21"
},
"pnpm": {
"peerDependencyRules": {
Expand Down
7 changes: 4 additions & 3 deletions plugins/FileContentPreview/Settings.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { findByProps, findByStoreName } from "@vendetta/metro";
import { find, findByProps, findByStoreName } from "@vendetta/metro";
import { FormRow } from "@vendetta/ui/components/Forms";
import { ReactNative, constants } from "@vendetta/metro/common";
import { useProxy } from "@vendetta/storage";
Expand All @@ -11,7 +11,8 @@ const { ScrollView } = ReactNative;
const { Text } = General;

const ThemeStore = findByStoreName("ThemeStore");
const { meta: { resolveSemanticColor } } = findByProps("colors", "meta");
const resolveSemanticColor = find(m => m.default?.internal?.resolveSemanticColor)?.default.internal.resolveSemanticColor
?? find(m => m.meta?.resolveSemanticColor)?.meta.resolveSemanticColor ?? (() => {});

const Colors = {
text: resolveSemanticColor(ThemeStore.theme, semanticColors.TEXT_NORMAL)
Expand Down Expand Up @@ -40,4 +41,4 @@ export default () => {
</Text>
</ScrollView>
)
}
}
5 changes: 3 additions & 2 deletions plugins/FileContentPreview/ui/FCModal.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { React, ReactNative, i18n, constants } from "@vendetta/metro/common";
import { storage } from "@vendetta/plugin";
import { findByProps, findByName, findByStoreName } from "@vendetta/metro";
import { find, findByProps, findByName, findByStoreName } from "@vendetta/metro";
import { General } from "@vendetta/ui/components";
import { getAssetIDByName } from "@vendetta/ui/assets";
import { showToast } from "@vendetta/ui/toasts";
Expand All @@ -12,7 +12,8 @@ import { semanticColors } from "@vendetta/ui";
import LoadMore from "./LoadMore";

const ThemeStore = findByStoreName("ThemeStore");
const { meta: { resolveSemanticColor } } = findByProps("colors", "meta");
const resolveSemanticColor = find(m => m.default?.internal?.resolveSemanticColor)?.default.internal.resolveSemanticColor
?? find(m => m.meta?.resolveSemanticColor)?.meta.resolveSemanticColor ?? (() => {});

// https://github.com/nexpid/VendettaPlugins/blob/main/stuff/types.tsx#L43-L47
const Navigator = findByName("Navigator") ?? findByProps("Navigator")?.Navigator;
Expand Down
7 changes: 4 additions & 3 deletions plugins/FileContentPreview/ui/Swidew.jsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import { React, ReactNative } from "@vendetta/metro/common";
import { findByProps, findByStoreName } from "@vendetta/metro";
import { find, findByStoreName } from "@vendetta/metro";
import { semanticColors } from "@vendetta/ui";
import { General } from "@vendetta/ui/components";

const { StyleSheet, PanResponder } = ReactNative;
const ThemeStore = findByStoreName("ThemeStore");
const { meta: { resolveSemanticColor } } = findByProps("colors", "meta");
const { View } = General;
const { useState, useRef } = React;
const resolveSemanticColor = find(m => m.default?.internal?.resolveSemanticColor)?.default.internal.resolveSemanticColor
?? find(m => m.meta?.resolveSemanticColor)?.meta.resolveSemanticColor ?? (() => {});

const Colors = {
sliderOff: resolveSemanticColor(ThemeStore.theme, semanticColors.DEPRECATED_QUICKSWITCHER_INPUT_BACKGROUND),
Expand Down Expand Up @@ -87,4 +88,4 @@ const Swidew = ({ onSlide, value }) => {
)
}

export default Swidew;
export default Swidew;
7 changes: 4 additions & 3 deletions plugins/RoleColorEverywhere/src/Settings.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ReactNative, constants } from "@vendetta/metro/common";
import { findByProps, findByStoreName } from "@vendetta/metro";
import { find, findByStoreName } from "@vendetta/metro";
import { FormSwitchRow, FormIcon, FormSection } from "@vendetta/ui/components/Forms";
import { useProxy } from "@vendetta/storage";
import { storage } from "@vendetta/plugin";
Expand All @@ -10,7 +10,8 @@ import Swidew from "./ui/Swidew";

const { Text, View } = General;
const ThemeStore = findByStoreName("ThemeStore");
const { meta: { resolveSemanticColor } } = findByProps("colors", "meta");
const resolveSemanticColor = find(m => m.default?.internal?.resolveSemanticColor)?.default.internal.resolveSemanticColor
?? find(m => m.meta?.resolveSemanticColor)?.meta.resolveSemanticColor ?? (() => {});

const Icons = {
Typing: getAssetIDByName('ic_messages'),
Expand Down Expand Up @@ -69,4 +70,4 @@ export default () => {
</FormSection>
</ReactNative.ScrollView>
);
};
};
5 changes: 3 additions & 2 deletions plugins/RoleColorEverywhere/src/patches/Rows.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { ReactNative } from '@vendetta/metro/common';
import { after, before } from "@vendetta/patcher";
import { findByProps, findByStoreName, findByName } from "@vendetta/metro";
import { find, findByStoreName, findByName } from "@vendetta/metro";
import { semanticColors } from "@vendetta/ui";
import { storage } from "@vendetta/plugin";

const ThemeStore = findByStoreName("ThemeStore");
const { meta: { resolveSemanticColor } } = findByProps("colors", "meta");
const resolveSemanticColor = find(m => m.default?.internal?.resolveSemanticColor)?.default.internal.resolveSemanticColor
?? find(m => m.meta?.resolveSemanticColor)?.meta.resolveSemanticColor ?? (() => {});

const RowManager = findByName("RowManager");
const GuildMemberStore = findByStoreName("GuildMemberStore");
Expand Down
7 changes: 4 additions & 3 deletions plugins/RoleColorEverywhere/src/patches/TypingWrapper.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import { React, constants } from '@vendetta/metro/common';
import { after } from "@vendetta/patcher";
import { findByProps, findByStoreName } from "@vendetta/metro";
import { find, findByProps, findByStoreName } from "@vendetta/metro";
import { General } from "@vendetta/ui/components";
import { semanticColors } from "@vendetta/ui";
import { storage } from "@vendetta/plugin";

const { Text } = General;

const ThemeStore = findByStoreName("ThemeStore");
const { meta: { resolveSemanticColor } } = findByProps("colors", "meta");
const resolveSemanticColor = find(m => m.default?.internal?.resolveSemanticColor)?.default.internal.resolveSemanticColor
?? find(m => m.meta?.resolveSemanticColor)?.meta.resolveSemanticColor ?? (() => {});

const UserStore = findByStoreName("UserStore");
const RelationshipStore = findByStoreName("RelationshipStore");
Expand Down Expand Up @@ -48,4 +49,4 @@ export default function patchTypingWrapper() {

});
});
};
};
7 changes: 4 additions & 3 deletions plugins/RoleColorEverywhere/src/patches/VoiceUserConnected.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { after } from "@vendetta/patcher";
import { findByName, findByProps, findByStoreName } from "@vendetta/metro";
import { find, findByName, findByStoreName } from "@vendetta/metro";
import { storage } from "@vendetta/plugin";
import { semanticColors } from "@vendetta/ui";

const ThemeStore = findByStoreName("ThemeStore");
const { meta: { resolveSemanticColor } } = findByProps("colors", "meta");
const resolveSemanticColor = find(m => m.default?.internal?.resolveSemanticColor)?.default.internal.resolveSemanticColor
?? find(m => m.meta?.resolveSemanticColor)?.meta.resolveSemanticColor ?? (() => {});

export default function patchVoiceUserConnected() {
return after("default", findByName("VoiceUserConnected", false),([args],res)=>{
Expand All @@ -20,4 +21,4 @@ export default function patchVoiceUserConnected() {
});
} catch { };
});
};
};
7 changes: 4 additions & 3 deletions plugins/RoleColorEverywhere/src/ui/Swidew.jsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { React, ReactNative } from "@vendetta/metro/common";
import { findByProps, findByStoreName } from "@vendetta/metro";
import { find, findByStoreName } from "@vendetta/metro";
import { semanticColors } from "@vendetta/ui";
import { General } from "@vendetta/ui/components";

const { StyleSheet, PanResponder } = ReactNative;
const ThemeStore = findByStoreName("ThemeStore");
const { meta: { resolveSemanticColor } } = findByProps("colors", "meta");
const resolveSemanticColor = find(m => m.default?.internal?.resolveSemanticColor)?.default.internal.resolveSemanticColor
?? find(m => m.meta?.resolveSemanticColor)?.meta.resolveSemanticColor ?? (() => {});
const { View } = General;
const { useState, useRef } = React;

Expand Down Expand Up @@ -87,4 +88,4 @@ const Swidew = ({ onSlide, value }) => {
)
}

export default Swidew;
export default Swidew;

0 comments on commit a790287

Please sign in to comment.