Skip to content

Commit

Permalink
Arabic rtl
Browse files Browse the repository at this point in the history
  • Loading branch information
Soopyboo32 committed Jan 4, 2025
1 parent c2c8935 commit 7556825
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/hooks/persisted/usePlugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,3 +185,8 @@ export default function usePlugins() {
updatePlugin,
};
}

export function usePluginInfo(pluginId: string) {
const installedPlugins = getMMKVObject<PluginItem[]>(INSTALLED_PLUGINS) || [];
return installedPlugins.find(plg => plg.id === pluginId);
}
12 changes: 12 additions & 0 deletions src/screens/reader/components/WebViewReader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -79,6 +80,7 @@ const WebViewReader: React.FC<WebViewReaderProps> = ({
);
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`;

Expand Down Expand Up @@ -175,6 +177,16 @@ const WebViewReader: React.FC<WebViewReaderProps> = ({
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<link rel="stylesheet" href="${assetsUriPrefix}/css/index.css">
<style>
${
pluginInfo?.lang === '‎العربية'
? `
body {
direction: rtl;
text-align: right;
}
`
: ''
}
:root {
--StatusBar-currentHeight: ${StatusBar.currentHeight}px;
--readerSettings-theme: ${readerSettings.theme};
Expand Down

0 comments on commit 7556825

Please sign in to comment.