Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSON generated settings #1158

Open
wants to merge 49 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
4a41c7b
started
CD-Z Jun 12, 2024
7638205
Working Display Mode and Items per row
CD-Z Jun 14, 2024
446669f
finished general setting screen (except show last update)
CD-Z Jun 15, 2024
28e5f66
added all desciptions to generalsettigs
CD-Z Jun 15, 2024
d7cdec9
added Appearance settings themePicker
CD-Z Jun 15, 2024
44914be
added Pure black dark mode
CD-Z Jun 15, 2024
891a9f0
added useKeyboardHeight hook
CD-Z Jun 15, 2024
309c627
Working accentColorModal
CD-Z Jun 15, 2024
0c5a67b
finished appearance screen
CD-Z Jun 15, 2024
8471c88
removed console.log
CD-Z Jun 15, 2024
9118e83
added dragable readersettings webview
CD-Z Jun 15, 2024
9b49262
added dynamic SettingsStack
CD-Z Jun 16, 2024
c9bf5e0
progress on reader settings
CD-Z Jun 23, 2024
08f46f6
added TextArea settings
CD-Z Jun 25, 2024
9e47434
added display settings
CD-Z Jun 25, 2024
3607133
finally starting
CD-Z Sep 20, 2024
78dcc0d
extracted types from Settings.ts
CD-Z Sep 20, 2024
edc1821
upadted imports
CD-Z Sep 20, 2024
801ca2c
changed folderstructure
CD-Z Sep 20, 2024
d5c581d
added TTS setting
CD-Z Sep 20, 2024
5775151
added repos
CD-Z Sep 20, 2024
f65e640
added Tracking setting
CD-Z Sep 22, 2024
a7ebb64
added InfoItem
CD-Z Sep 22, 2024
175b577
renamed DefaultModal to selectionModal
CD-Z Sep 22, 2024
bc5be6f
reorganization
CD-Z Sep 22, 2024
b2a6892
animated modal placement
CD-Z Oct 24, 2024
4fb6179
added subgroup ids
CD-Z Oct 26, 2024
5c6d40a
new reader bottomsheet
CD-Z Oct 26, 2024
25a7569
fixed dependant issue
CD-Z Oct 26, 2024
d59cc3b
added quickSettings compatibility
CD-Z Oct 26, 2024
2901d99
deleted unused imports
CD-Z Oct 26, 2024
063f5e1
prepare for mass deletion
CD-Z Oct 26, 2024
d71c4ba
deleted old settings files
CD-Z Oct 26, 2024
08fbbeb
removed lint errors
CD-Z Oct 26, 2024
55a37f6
deleted comments
CD-Z Oct 26, 2024
5c06ebd
deleted console.log
CD-Z Oct 26, 2024
b9cfc26
Better modal animation
CD-Z Oct 27, 2024
3b3e039
deleted tracker screen
CD-Z Oct 27, 2024
8b277fa
fix custom js
CD-Z Oct 27, 2024
987d10d
minimum height for reader settings
CD-Z Oct 27, 2024
b9a4a8a
fix lint
CD-Z Oct 27, 2024
6c98f4d
make bigger
CD-Z Oct 27, 2024
fd370a4
switched to react native reanimated animation
CD-Z Oct 29, 2024
c1d7f43
fixed dependents not showing
CD-Z Oct 29, 2024
9bb8c16
fix dependents issue for real
CD-Z Oct 29, 2024
1e1836c
changed animation
CD-Z Oct 29, 2024
a9c341b
changed bottomsheet style
CD-Z Oct 29, 2024
c355862
changed draggable
CD-Z Oct 29, 2024
fb85847
fixed browseTabs redirection
CD-Z Oct 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ import AppErrorBoundary from '@components/AppErrorBoundary/AppErrorBoundary';
import Main from './src/navigators/Main';
import { BottomSheetModalProvider } from '@gorhom/bottom-sheet';

declare global {
interface ObjectConstructor {
typedKeys<T>(obj: T): Array<keyof T>;
}
}
Object.typedKeys = Object.keys as any;

Notifications.setNotificationHandler({
handleNotification: async () => {
return {
Expand Down
7,132 changes: 5,001 additions & 2,131 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"@react-navigation/native": "^6.1.9",
"@react-navigation/stack": "^6.0.11",
"@shopify/flash-list": "^1.4.3",
"cheerio": "^1.0.0-rc.12",
"cheerio": "1.0.0-rc.12",
"color": "^4.2.3",
"dayjs": "^1.11.10",
"expo": "^49.0.23",
Expand Down Expand Up @@ -56,7 +56,7 @@
"react-native-mmkv": "^2.11.0",
"react-native-pager-view": "6.2.0",
"react-native-paper": "^5.12.0",
"react-native-reanimated": "^3.3.0",
"react-native-reanimated": "3.15.0",
"react-native-saf-x": "^2.2.3",
"react-native-safe-area-context": "4.6.3",
"react-native-screens": "^3.22.0",
Expand Down
20 changes: 15 additions & 5 deletions src/components/List/List.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { ReactNode } from 'react';
import { Pressable, StyleSheet, Text, View } from 'react-native';
import { Pressable, StyleSheet, Text, View, ViewStyle } from 'react-native';
import MaterialIcon from 'react-native-vector-icons/MaterialCommunityIcons';

import { List as PaperList, Divider as PaperDivider } from 'react-native-paper';
Expand All @@ -15,8 +15,16 @@ interface ListItemProps {
right?: string;
}

const Section = ({ children }: { children: ReactNode }) => (
<PaperList.Section style={styles.listSection}>{children}</PaperList.Section>
const Section = ({
children,
style,
}: {
style?: ViewStyle;
children: ReactNode;
}) => (
<PaperList.Section style={[styles.listSection, style]}>
{children}
</PaperList.Section>
);

const SubHeader = ({
Expand Down Expand Up @@ -106,7 +114,7 @@ const Icon = ({ icon, theme }: { icon: string; theme: ThemeColors }) => (

interface ColorItemProps {
title: string;
description: string;
description?: string;
theme: ThemeColors;
onPress: () => void;
}
Expand All @@ -124,7 +132,9 @@ const ColorItem = ({ title, description, theme, onPress }: ColorItemProps) => (
>
<View>
<Text style={{ color: theme.onSurface, fontSize: 16 }}>{title}</Text>
<Text style={{ color: theme.onSurfaceVariant }}>{description}</Text>
{description ? (
<Text style={{ color: theme.onSurfaceVariant }}>{description}</Text>
) : null}
</View>
<View
style={{
Expand Down
4 changes: 2 additions & 2 deletions src/components/NovelCover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,15 @@ function NovelCover<TNovel extends CoverItemLibrary | CoverItemPlugin>({
displayMode = DisplayModes.Comfortable,
showDownloadBadges = true,
showUnreadBadges = true,
novelsPerRow = 3,
novelsPerRow = 2,
} = useLibrarySettings();

const window = useWindowDimensions();

const orientation = useDeviceOrientation();

const numColumns = useMemo(
() => (orientation === 'landscape' ? 6 : novelsPerRow),
() => (orientation === 'landscape' ? 6 : novelsPerRow + 1),
[orientation, novelsPerRow],
);

Expand Down
4 changes: 2 additions & 2 deletions src/components/NovelList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ interface NovelListProps extends FlatListProps<LibraryNovelInfo | NovelItem> {
}

const NovelList: React.FC<NovelListProps> = props => {
const { displayMode = DisplayModes.Comfortable, novelsPerRow = 3 } =
const { displayMode = DisplayModes.Comfortable, novelsPerRow = 2 } =
useLibrarySettings();
const orientation = useDeviceOrientation();

Expand All @@ -38,7 +38,7 @@ const NovelList: React.FC<NovelListProps> = props => {
if (orientation === 'landscape') {
return 6;
} else {
return novelsPerRow;
return novelsPerRow + 1;
}
}, [isListView, orientation, novelsPerRow]);

Expand Down
29 changes: 18 additions & 11 deletions src/components/Switch/SwitchItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ interface SwitchItemProps {
theme: ThemeColors;
size?: number;
style?: StyleProp<ViewStyle>;
endOfLine?: () => React.ReactNode;
quickSettingsItem?: boolean;
}

const SwitchItem: React.FC<SwitchItemProps> = ({
Expand All @@ -28,15 +30,24 @@ const SwitchItem: React.FC<SwitchItemProps> = ({
value,
size,
style,
endOfLine,
quickSettingsItem,
}) => (
<Pressable
android_ripple={{ color: theme.rippleColor }}
style={[styles.container, style]}
onPress={onPress}
style={[styles.container, style]}
>
<View style={styles.labelContainer}>
<Text style={[{ color: theme.onSurface }, styles.label]}>{label}</Text>
{description ? (
<Text
style={{
color: quickSettingsItem ? theme.onSurfaceVariant : theme.onSurface,
fontSize: quickSettingsItem ? 14 : 16,
}}
>
{label}
</Text>
{description && !quickSettingsItem ? (
<Text style={[styles.description, { color: theme.onSurfaceVariant }]}>
{description}
</Text>
Expand All @@ -49,6 +60,7 @@ const SwitchItem: React.FC<SwitchItemProps> = ({
style={styles.switch}
size={size}
/>
{endOfLine ? endOfLine() : null}
</Pressable>
);

Expand All @@ -57,22 +69,17 @@ export default SwitchItem;
const styles = StyleSheet.create({
container: {
flexDirection: 'row',
justifyContent: 'space-between',
paddingVertical: 12,
alignItems: 'center',
paddingVertical: 12,
},
labelContainer: {
flex: 1,
justifyContent: 'center',
},
label: {
fontSize: 16,
flexDirection: 'column',
},
description: {
fontSize: 12,
lineHeight: 20,
},
switch: {
marginLeft: 8,
alignSelf: 'center',
},
});
31 changes: 31 additions & 0 deletions src/hooks/common/useKeyboardHeight.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { useEffect, useState } from 'react';
import { Keyboard, KeyboardEvent } from 'react-native';

export const useKeyboardHeight = () => {
const [keyboardHeight, setKeyboardHeight] = useState(0);

useEffect(() => {
function onKeyboardDidShow(e: KeyboardEvent) {
setKeyboardHeight(e.endCoordinates.height);
}

function onKeyboardDidHide() {
setKeyboardHeight(0);
}

const showSubscription = Keyboard.addListener(
'keyboardDidShow',
onKeyboardDidShow,
);
const hideSubscription = Keyboard.addListener(
'keyboardDidHide',
onKeyboardDidHide,
);
return () => {
showSubscription.remove();
hideSubscription.remove();
};
}, []);

return keyboardHeight;
};
19 changes: 6 additions & 13 deletions src/navigators/MoreStack.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,37 +5,30 @@ import { createStackNavigator } from '@react-navigation/stack';
// Screens
import About from '../screens/more/About';
import Settings from '../screens/settings/SettingsScreen';
import TrackerSettings from '../screens/settings/SettingsTrackerScreen';
import ReaderSettings from '../screens/settings/SettingsReaderScreen/SettingsReaderScreen';
import BackupSettings from '../screens/settings/SettingsBackupScreen';
import AdvancedSettings from '../screens/settings/SettingsAdvancedScreen';
import GeneralSettings from '../screens/settings/SettingsGeneralScreen/SettingsGeneralScreen';
import SettingsSubScreen from '../screens/settings/settingsScreens/SettingsSubScreen';
import TaskQueue from '../screens/more/TaskQueueScreen';
import Downloads from '../screens/more/DownloadsScreen';
import AppearanceSettings from '../screens/settings/SettingsAppearanceScreen';

import CategoriesScreen from '@screens/Categories/CategoriesScreen';
import RespositorySettings from '@screens/settings/SettingsRepositoryScreen/SettingsRepositoryScreen';
// import LibrarySettings from '@screens/settings/SettingsLibraryScreen/SettingsLibraryScreen';
import StatsScreen from '@screens/StatsScreen/StatsScreen';
import { MoreStackParamList, SettingsStackParamList } from './types';
import ReaderSettingsSubScreen from '@screens/settings/settingsScreens/ReaderSettingsSubScreen';

const Stack = createStackNavigator<
MoreStackParamList & SettingsStackParamList
SettingsStackParamList & MoreStackParamList
>();

const stackNavigatorConfig = { headerShown: false };

const SettingsStack = () => (
<Stack.Navigator screenOptions={stackNavigatorConfig}>
<Stack.Screen name="Settings" component={Settings} />
<Stack.Screen name="GeneralSettings" component={GeneralSettings} />
<Stack.Screen name="ReaderSettings" component={ReaderSettings} />
<Stack.Screen name="TrackerSettings" component={TrackerSettings} />
<Stack.Screen name="SubScreen" component={SettingsSubScreen} />
<Stack.Screen name="ReaderSettings" component={ReaderSettingsSubScreen} />
<Stack.Screen name="BackupSettings" component={BackupSettings} />
<Stack.Screen name="AppearanceSettings" component={AppearanceSettings} />
<Stack.Screen name="AdvancedSettings" component={AdvancedSettings} />
<Stack.Screen name="RespositorySettings" component={RespositorySettings} />
{/* <Stack.Screen name="LibrarySettings" component={LibrarySettings} /> */}
</Stack.Navigator>
);

Expand Down
24 changes: 12 additions & 12 deletions src/navigators/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
NavigatorScreenParams,
} from '@react-navigation/native';
import { StackScreenProps } from '@react-navigation/stack';
import { Settings } from '@screens/settings/Settings.d';
import { MaterialBottomTabScreenProps } from 'react-native-paper';

export type RootStackParamList = {
Expand Down Expand Up @@ -71,16 +72,19 @@ export type MoreStackParamList = {
Statistics: undefined;
};

type SettingsProps = {
settingsSource: keyof Settings;
};

export type SettingsStackParamList = {
Settings: undefined;
GeneralSettings: undefined;
ReaderSettings: undefined;
TrackerSettings: undefined;
BackupSettings: undefined;
AppearanceSettings: undefined;
AdvancedSettings: undefined;
LibrarySettings: undefined;
RespositorySettings: undefined;
SubScreen: SettingsProps;
ReaderSettings: SettingsProps;
TrackerSettings: SettingsProps;
BackupSettings: SettingsProps;
AdvancedSettings: SettingsProps;
LibrarySettings: SettingsProps;
RespositorySettings: SettingsProps;
};

export type NovelScreenProps = StackScreenProps<RootStackParamList, 'Novel'>;
Expand Down Expand Up @@ -138,10 +142,6 @@ export type SettingsScreenProps = CompositeScreenProps<
StackScreenProps<SettingsStackParamList, 'Settings'>,
StackScreenProps<MoreStackParamList, 'SettingsStack'>
>;
export type AppearanceSettingsScreenProps = StackScreenProps<
SettingsStackParamList,
'AppearanceSettings'
>;
export type TrackerSettingsScreenProps = StackScreenProps<
SettingsStackParamList,
'TrackerSettings'
Expand Down
3 changes: 2 additions & 1 deletion src/screens/browse/components/BrowseTabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,8 @@ export const AvailableTab = memo(({ searchText, theme }: AvailableTabProps) => {
navigation.navigate('MoreStack', {
screen: 'SettingsStack',
params: {
screen: 'RespositorySettings',
screen: 'SubScreen',
params: { settingsSource: 'repo' },
},
}),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const SourceScreenSkeletonLoading: React.FC<Props> = ({
}) => {
const [highlightColor, backgroundColor] = getLoadingColors(theme);

const { displayMode = DisplayModes.Comfortable, novelsPerRow = 3 } =
const { displayMode = DisplayModes.Comfortable, novelsPerRow = 2 } =
useLibrarySettings();

const window = useWindowDimensions();
Expand All @@ -27,7 +27,7 @@ const SourceScreenSkeletonLoading: React.FC<Props> = ({
const orientation = useDeviceOrientation();

const numColumns = useMemo(
() => (orientation === 'landscape' ? 6 : novelsPerRow),
() => (orientation === 'landscape' ? 6 : novelsPerRow + 1),
[orientation, novelsPerRow],
);

Expand Down
Loading
Loading