Skip to content

Commit

Permalink
Merge branch 'LNReader:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
Batorian authored Jun 18, 2024
2 parents 8ddb3df + ea33690 commit 587256c
Show file tree
Hide file tree
Showing 25 changed files with 469 additions and 485 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,5 @@ web-build/

.vscode/
src/sources/en/generators/
*.lockb
*.lockb
.tool-versions
3 changes: 2 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
**/node_modules
**/node_modules
android
3 changes: 1 addition & 2 deletions App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import BackgroundService from 'react-native-background-actions';

import { createTables } from '@database/db';
import AppErrorBoundary from '@components/AppErrorBoundary/AppErrorBoundary';
import { deserializePlugins } from '@plugins/pluginManager';

import Main from './src/navigators/Main';
import { BottomSheetModalProvider } from '@gorhom/bottom-sheet';
Expand All @@ -32,7 +31,7 @@ Notifications.setNotificationHandler({
});

createTables();
deserializePlugins().then(() => LottieSplashScreen.hide());
LottieSplashScreen.hide();
if (!BackgroundService.isRunning()) {
MMKVStorage.delete(BACKGROUND_ACTION);
}
Expand Down
112 changes: 1 addition & 111 deletions android/app/src/main/assets/js/text-vibe.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -123,17 +123,9 @@ class FileManager(context: ReactApplicationContext) :
}
}

@ReactMethod
fun readFile(path: String?, promise: Promise) {
try {
val sb = StringBuilder()
val br = BufferedReader(FileReader(path))
var line: String?
while (br.readLine().also { line = it } != null) sb.append(line).append('\n')
promise.resolve(sb.toString())
} catch (e: Exception) {
promise.reject(e)
}
@ReactMethod(isBlockingSynchronousMethod = true)
fun readFile(path: String): String {
return File(path).bufferedReader().readText()
}

@ReactMethod
Expand Down
43 changes: 42 additions & 1 deletion src/components/SearchbarV2/SearchbarV2.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,30 @@
import React, { useRef } from 'react';
import React, { useRef, useState } from 'react';
import { Pressable, StyleSheet, View, TextInput } from 'react-native';
import { useSafeAreaInsets } from 'react-native-safe-area-context';

import IconButtonV2 from '../IconButtonV2/IconButtonV2';
import { ThemeColors } from '../../theme/types';
import { Menu } from 'react-native-paper';

interface RightIcon {
iconName: string;
color?: string;
onPress: () => void;
}

interface MenuButton {
title: string;
onPress: () => void;
}

interface SearcbarProps {
searchText: string;
placeholder: string;
onChangeText?: (text: string) => void;
onSubmitEditing?: () => void;
leftIcon: string;
rightIcons?: RightIcon[];
menuButtons?: MenuButton[];
handleBackAction?: () => void;
clearSearchbar: () => void;
onLeftIconPress?: () => void;
Expand All @@ -31,13 +38,15 @@ const Searchbar: React.FC<SearcbarProps> = ({
onSubmitEditing,
leftIcon,
rightIcons,
menuButtons,
handleBackAction,
clearSearchbar,
onLeftIconPress,
theme,
}) => {
const searchbarRef = useRef<any>(null);
const focusSearchbar = () => searchbarRef.current.focus();
const [extraMenu, showExtraMenu] = useState(false);

const { top, right, left } = useSafeAreaInsets();
const marginTop = top + 8;
Expand Down Expand Up @@ -100,6 +109,38 @@ const Searchbar: React.FC<SearcbarProps> = ({
theme={theme}
/>
))}
{menuButtons?.length ? (
<Menu
visible={extraMenu}
onDismiss={() => showExtraMenu(false)}
anchor={
<IconButtonV2
name="dots-vertical"
color={theme.onSurface}
onPress={() => showExtraMenu(true)}
theme={theme}
/>
}
contentStyle={{
backgroundColor: theme.surface2,
}}
>
{menuButtons?.map((button, index) => (
<Menu.Item
key={index}
title={button.title}
style={{ backgroundColor: theme.surface2 }}
titleStyle={{
color: theme.onSurface,
}}
onPress={() => {
showExtraMenu(false);
button.onPress();
}}
/>
))}
</Menu>
) : null}
</Pressable>
</View>
);
Expand Down
1 change: 1 addition & 0 deletions src/database/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export interface ChapterInfo {
chapterNumber?: number;
page: string;
progress: number | null;
position?: number;
}

export interface DownloadedChapter extends ChapterInfo {
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/common/useFullscreenMode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const useFullscreenMode = () => {
StatusBar.setHidden(false);
NavigationBar.setVisibilityAsync('visible');
setStatusBarColor(theme);
changeNavigationBarColor(Color(theme.surface2).hex(), !theme.isDark);
changeNavigationBarColor(Color(theme.surface2).hex(), theme.isDark);
});

return unsubscribe;
Expand Down
4 changes: 2 additions & 2 deletions src/native/FileManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ interface ReadDirResult {

interface FileManagerInterface {
writeFile: (path: string, content: string) => Promise<void>;
readFile: (path: string) => Promise<string>;
readFile: (path: string) => string;
resolveExternalContentUri: (uriString: string) => Promise<string | null>;
copyFile: (sourcePath: string, destPath: string) => Promise<void>;
moveFile: (sourcePath: string, destPath: string) => Promise<void>;
exists: (filePath: string) => Promise<boolean>;
mkdir: (filePath: string) => Promise<void>; // create parents;
mkdir: (filePath: string) => Promise<void>; // create parents, and do nothing if exists;
unlink: (filePath: string) => Promise<void>; // remove recursively
readDir: (dirPath: string) => Promise<ReadDirResult[]>; // file/sub-folder names
pickFolder: () => Promise<string | null>; // return path of folderc
Expand Down
Loading

0 comments on commit 587256c

Please sign in to comment.