diff --git a/src/hooks/persisted/usePlugins.ts b/src/hooks/persisted/usePlugins.ts index c135ae044..002920f7e 100644 --- a/src/hooks/persisted/usePlugins.ts +++ b/src/hooks/persisted/usePlugins.ts @@ -185,3 +185,8 @@ export default function usePlugins() { updatePlugin, }; } + +export function usePluginInfo(pluginId: string) { + const installedPlugins = getMMKVObject(INSTALLED_PLUGINS) || []; + return installedPlugins.find(plg => plg.id === pluginId); +} diff --git a/src/screens/reader/components/WebViewReader.tsx b/src/screens/reader/components/WebViewReader.tsx index 7928b02ec..c75e1dc3f 100644 --- a/src/screens/reader/components/WebViewReader.tsx +++ b/src/screens/reader/components/WebViewReader.tsx @@ -21,6 +21,7 @@ import { getBatteryLevelSync } from 'react-native-device-info'; import * as Speech from 'expo-speech'; import { PLUGIN_STORAGE } from '@utils/Storages'; import { useChapterContext } from '../ChapterContext'; +import { usePluginInfo } from '@hooks/persisted/usePlugins'; type WebViewPostEvent = { type: string; @@ -79,6 +80,7 @@ const WebViewReader: React.FC = ({ ); const batteryLevel = useMemo(getBatteryLevelSync, []); const plugin = getPlugin(novel?.pluginId); + const pluginInfo = usePluginInfo(novel?.pluginId); const pluginCustomJS = `file://${PLUGIN_STORAGE}/${plugin?.id}/custom.js`; const pluginCustomCSS = `file://${PLUGIN_STORAGE}/${plugin?.id}/custom.css`; @@ -175,6 +177,16 @@ const WebViewReader: React.FC = ({