diff --git a/src/Navigators/Main.js b/src/Navigators/Main.js
index 32fc970d..67ebea0a 100644
--- a/src/Navigators/Main.js
+++ b/src/Navigators/Main.js
@@ -21,6 +21,7 @@ import { githubUpdateChecker } from "../Hooks/githubUpdateChecker";
import NewUpdateDialog from "../Components/NewUpdateDialog";
import { NavigationContainer } from "@react-navigation/native";
import BrowseNovelUpdates from "../Screens/Browse/discover/BrowseNovelUpdates";
+import BrowseSettings from "../Screens/Browse/BrowseSettings";
const Stack = createStackNavigator();
@@ -49,6 +50,10 @@ const MainNavigator = () => {
+
{
const [searchText, setSearchText] = useState("");
// const [globalSearch, setGlobalSearch] = useState(false);
// const [searchResult, setSearchResults] = useState();
- const { sources, search, loading, pinned } = useSelector(
- (state) => state.sourceReducer
- );
+ let {
+ sources,
+ search,
+ loading,
+ pinned,
+ filters,
+ showNovelUpdates,
+ showMyAnimeList,
+ } = useSelector((state) => state.sourceReducer);
const theme = useTheme();
const dispatch = useDispatch();
const isPinned = (sourceId) =>
pinned.indexOf(sourceId) === -1 ? false : true;
+ sources = sources.filter((source) => filters.indexOf(source.lang) === -1);
+
useEffect(() => {
dispatch(getSourcesAction());
}, [getSourcesAction]);
@@ -88,6 +96,10 @@ const Browse = ({ navigation }) => {
icon: "swap-vertical-variant",
onPress: () => navigation.navigate("Migration"),
},
+ {
+ icon: "cog-outline",
+ onPress: () => navigation.navigate("BrowseSettings"),
+ },
]}
/>
@@ -99,17 +111,23 @@ const Browse = ({ navigation }) => {
extraData={pinned}
ListHeaderComponent={
-
- Discover
-
-
-
+ {(showNovelUpdates || showMyAnimeList) && (
+ <>
+
+ Discover
+
+ {showNovelUpdates && (
+
+ )}
+ {showMyAnimeList && }
+ >
+ )}
{pinned.length > 0 && (
{
+ const theme = useTheme();
+ const dispatch = useDispatch();
+ const { filters, showNovelUpdates, showMyAnimeList } = useSelector(
+ (state) => state.sourceReducer
+ );
+ const languages = ["English", "Spanish"];
+
+ const renderItem = ({ item }) => {
+ return (
+ dispatch(filterLanguage(item))}
+ >
+ {item}
+ dispatch(filterLanguage(item))}
+ />
+
+ );
+ };
+
+ return (
+
+
+
+ Discover
+ dispatch(enableDiscover("showNovelUpdates"))}
+ >
+
+ Novel Updates
+
+
+ dispatch(enableDiscover("showNovelUpdates"))
+ }
+ />
+
+ dispatch(enableDiscover("showMyAnimeList"))}
+ >
+
+ MyAnimeList
+
+
+ dispatch(enableDiscover("showMyAnimeList"))
+ }
+ />
+
+ Languages
+ item}
+ renderItem={renderItem}
+ />
+
+
+ );
+};
+
+export default BrowseSettings;
diff --git a/src/Screens/Browse/discover/NovelUpdatesBottomsheet.js b/src/Screens/Browse/discover/NovelUpdatesBottomsheet.js
new file mode 100644
index 00000000..9b0870f5
--- /dev/null
+++ b/src/Screens/Browse/discover/NovelUpdatesBottomsheet.js
@@ -0,0 +1,5 @@
+import React from "react";
+
+const NovelUpdatesBottomSheet = () => {};
+
+export default NovelUpdatesBottomSheet;
diff --git a/src/Screens/Chapter/components/VerticalScrollbar.js b/src/Screens/Chapter/components/VerticalScrollbar.js
index 672e480d..6f6ccb4f 100644
--- a/src/Screens/Chapter/components/VerticalScrollbar.js
+++ b/src/Screens/Chapter/components/VerticalScrollbar.js
@@ -1,7 +1,8 @@
import React from "react";
+import { Dimensions, View, Text, StyleSheet } from "react-native";
import Slider from "@react-native-community/slider";
-import { Dimensions, View, Text } from "react-native";
+import { getDeviceOrientation } from "../../../Services/utils/helpers";
const VerticalScrollbar = ({
theme,
@@ -12,28 +13,22 @@ const VerticalScrollbar = ({
scrollViewRef,
setScrollPercentage,
}) => {
+ const onSlidingComplete = (value) => {
+ setLoading(true);
+ setScrollPercentage(value);
+ scrollViewRef.current.scrollTo({
+ x: 0,
+ y: Math.round((value * contentSize) / 100),
+ animated: false,
+ });
+ setLoading(false);
+ };
+
if (hide) {
return null;
- } else {
+ } else if (getDeviceOrientation() === "potrait") {
return (
-
+
{
- setLoading(true);
- setScrollPercentage(value);
- scrollViewRef.current.scrollTo({
- x: 0,
- y: Math.round((value * contentSize) / 100),
- animated: false,
- });
- setLoading(false);
- }}
+ onSlidingComplete={onSlidingComplete}
thumbTintColor={theme.colorAccent}
minimumTrackTintColor={theme.colorAccent}
- maximumTrackTintColor="#000000"
+ maximumTrackTintColor={theme.textColorPrimary}
/>
);
+ } else {
+ return (
+
+
+ {scrollPercentage}
+
+
+
+ 100
+
+
+ );
}
};
export default VerticalScrollbar;
+
+const styles = StyleSheet.create({
+ verticalSliderContainer: {
+ position: "absolute",
+ zIndex: 2,
+ right: -(Dimensions.get("window").width / 2) + 40,
+ bottom: 300,
+ backgroundColor: "rgba(0,0,0,0.7)",
+ flexDirection: "row",
+ justifyContent: "flex-end",
+ alignItems: "center",
+ borderRadius: 50,
+ marginHorizontal: 8,
+ transform: [{ rotate: "90deg" }],
+ },
+ horizontalSliderContainer: {
+ position: "absolute",
+ zIndex: 2,
+ bottom: 100,
+ backgroundColor: "rgba(0,0,0,0.7)",
+ flexDirection: "row",
+ justifyContent: "flex-end",
+ alignItems: "center",
+ borderRadius: 50,
+ marginHorizontal: 8,
+ },
+});
diff --git a/src/redux/source/source.actions.js b/src/redux/source/source.actions.js
index 8014503d..201a472c 100644
--- a/src/redux/source/source.actions.js
+++ b/src/redux/source/source.actions.js
@@ -1,5 +1,10 @@
-import { GET_SOURCES, PIN_SOURCES, SEARCH_SOURCES } from "./source.types";
-import { fetchSources } from "../../Services/Source/source";
+import {
+ ENABLE_DISCOVER,
+ FILTER_LANGUAGE,
+ GET_SOURCES,
+ PIN_SOURCES,
+ SEARCH_SOURCES,
+} from "./source.types";
import { showToast } from "../../Hooks/showToast";
import { sources } from "../../sources/sources";
@@ -26,3 +31,17 @@ export const pinSourceAction = (sourceId) => async (dispatch) => {
payload: sourceId,
});
};
+
+export const filterLanguage = (language) => async (dispatch) => {
+ dispatch({
+ type: FILTER_LANGUAGE,
+ payload: language,
+ });
+};
+
+export const enableDiscover = (key) => async (dispatch) => {
+ dispatch({
+ type: ENABLE_DISCOVER,
+ payload: key,
+ });
+};
diff --git a/src/redux/source/source.reducers.js b/src/redux/source/source.reducers.js
index e680145b..58e45560 100644
--- a/src/redux/source/source.reducers.js
+++ b/src/redux/source/source.reducers.js
@@ -1,10 +1,19 @@
-import { GET_SOURCES, SEARCH_SOURCES, PIN_SOURCES } from "./source.types";
+import {
+ GET_SOURCES,
+ SEARCH_SOURCES,
+ PIN_SOURCES,
+ FILTER_LANGUAGE,
+ ENABLE_DISCOVER,
+} from "./source.types";
const initialState = {
sources: [],
pinnedSources: [],
search: [],
pinned: [],
+ filters: [],
+ showNovelUpdates: true,
+ showMyAnimeList: true,
loading: true,
};
@@ -30,6 +39,22 @@ const sourceReducer = (state = initialState, action) => {
source.sourceName.toLowerCase().includes(payload)
),
};
+
+ case FILTER_LANGUAGE:
+ return {
+ ...state,
+ filters:
+ state.filters.indexOf(payload) === -1
+ ? [...state.filters, payload]
+ : state.filters.filter(
+ (language) => language !== payload
+ ),
+ };
+ case ENABLE_DISCOVER:
+ return {
+ ...state,
+ [payload]: !state[payload],
+ };
default:
return state;
}
diff --git a/src/redux/source/source.types.js b/src/redux/source/source.types.js
index a4d91920..ebaf7aca 100644
--- a/src/redux/source/source.types.js
+++ b/src/redux/source/source.types.js
@@ -1,3 +1,5 @@
export const GET_SOURCES = "GET_SOURCES";
export const SEARCH_SOURCES = "SEARCH_SOURCES";
export const PIN_SOURCES = "PIN_SOURCES";
+export const FILTER_LANGUAGE = "FILTER_LANGUAGE";
+export const ENABLE_DISCOVER = "ENABLE_DISCOVER";