Revert dependency updates

This commit is contained in:
Rajarshee Chatterjee
2021-03-16 11:56:44 +05:30
parent 37f531dd93
commit fa4d810ccb
10 changed files with 1325 additions and 2039 deletions
+1 -1
View File
@@ -27,7 +27,7 @@
"androidNavigationBar": {
"barStyle": "light-content",
"backgroundColor": "#242529"
"backgroundColor": "#000000"
},
"web": {
"favicon": "./assets/favicon.png"
+1130 -1816
View File
File diff suppressed because it is too large Load Diff
@@ -12,7 +12,10 @@ const HistoryCard = ({ item, deleteHistory, navigation }) => {
return (
<TouchableRipple
style={styles.historyCard}
style={[
styles.historyCard,
// { backgroundColor: theme.colorDarkPrimary },
]}
rippleColor={theme.rippleColorDark}
borderless
onPress={() =>
@@ -28,9 +31,20 @@ const HistoryCard = ({ item, deleteHistory, navigation }) => {
<>
<Image
source={{ uri: item.novelCover }}
style={styles.historyCover}
style={{
height: 80,
width: 57,
borderRadius: 4,
}}
/>
<View style={styles.historyText}>
<View
style={{
marginLeft: 15,
flex: 1,
flexDirection: "row",
justifyContent: "space-between",
}}
>
<View style={{ flex: 0.9 }}>
<Text
style={{
@@ -96,20 +110,13 @@ export default HistoryCard;
const styles = StyleSheet.create({
historyCard: {
// backgroundColor: theme.colorDarkPrimary,
// paddingVertical: 10,
// marginVertical: 5,
// paddingHorizontal: 20,
marginBottom: 15,
borderRadius: 4,
flexDirection: "row",
alignItems: "center",
},
historyCover: {
height: 80,
width: 57,
borderRadius: 4,
},
historyText: {
marginLeft: 15,
flex: 1,
flexDirection: "row",
justifyContent: "space-between",
},
});
+14 -1
View File
@@ -80,7 +80,20 @@ const BottomNavigator = () => {
),
}}
/>
{/*
<Tab.Screen
name="Updates"
component={Updates}
options={{
tabBarIcon: ({ color }) => (
<MaterialCommunityIcons
name="alert-decagram-outline"
color={color}
size={24}
/>
),
}}
/> */}
<Tab.Screen
name="History"
component={History}
+47 -13
View File
@@ -10,16 +10,15 @@ import {
} from "react-native";
import { CustomAppbar } from "../../components/common/Appbar";
import HistoryCard from "./components/HistoryCard";
import HistoryCard from "../../components/history/HistoryCard";
import { getHistoryFromDb, deleteChapterHistory } from "../../services/db";
import { useSelector } from "react-redux";
import EmptyView from "./components/EmptyView";
const History = ({ navigation }) => {
const [loading, setLoading] = useState(true);
const [history, setHistory] = useState([]);
const [history, setHistory] = useState();
const theme = useSelector((state) => state.themeReducer.theme);
@@ -39,14 +38,6 @@ const History = ({ navigation }) => {
}, [])
);
const renderHistoryCard = ({ item }) => (
<HistoryCard
item={item}
deleteHistory={deleteHistory}
navigation={navigation}
/>
);
return (
<>
<CustomAppbar title="History" />
@@ -60,7 +51,13 @@ const History = ({ navigation }) => {
contentContainerStyle={{ flex: 1 }}
data={history}
keyExtractor={(item) => item.historyId.toString()}
renderItem={renderHistoryCard}
renderItem={({ item }) => (
<HistoryCard
item={item}
deleteHistory={deleteHistory}
navigation={navigation}
/>
)}
ListFooterComponent={
loading && (
<ActivityIndicator
@@ -69,7 +66,38 @@ const History = ({ navigation }) => {
/>
)
}
ListEmptyComponent={!loading && <EmptyView />}
ListEmptyComponent={
!loading && (
<View
style={{
flex: 1,
justifyContent: "center",
alignItems: "center",
}}
>
<Text
style={{
color: theme.textColorSecondaryDark,
fontSize: 45,
fontWeight: "bold",
}}
>
(˘・_・˘)
</Text>
<Text
style={{
color: theme.textColorSecondaryDark,
fontWeight: "bold",
marginTop: 10,
textAlign: "center",
paddingHorizontal: 30,
}}
>
Nothing read recently.
</Text>
</View>
)
}
/>
</View>
</>
@@ -83,4 +111,10 @@ const styles = StyleSheet.create({
flex: 1,
padding: 10,
},
historyCard: {
marginTop: 10,
borderRadius: 4,
flexDirection: "row",
alignItems: "center",
},
});
@@ -1,52 +0,0 @@
import React from "react";
import { StyleSheet, Text, View } from "react-native";
import { useSelector } from "react-redux";
const EmptyView = () => {
const theme = useSelector((state) => state.themeReducer.theme);
return (
<View style={styles.emptyViewContainer}>
<Text
style={[
styles.emptyViewIcon,
{
color: theme.textColorSecondaryDark,
},
]}
>
(˘・_・˘)
</Text>
<Text
style={[
styles.emptyViewText,
{
color: theme.textColorSecondaryDark,
},
]}
>
Nothing read recently.
</Text>
</View>
);
};
export default EmptyView;
const styles = StyleSheet.create({
emptyViewContainer: {
flex: 1,
justifyContent: "center",
alignItems: "center",
},
emptyViewIcon: {
fontSize: 45,
fontWeight: "bold",
},
emptyViewText: {
fontWeight: "bold",
marginTop: 10,
textAlign: "center",
paddingHorizontal: 30,
},
});
+94 -67
View File
@@ -9,11 +9,13 @@ import {
} from "react-native";
import { FlatList } from "react-native-gesture-handler";
import { useFocusEffect } from "@react-navigation/native";
import { connect } from "react-redux";
import Appbar from "./components/Appbar";
import NovelCover from "../../components/common/NovelCover";
import EmptyView from "./components/EmptyView";
import { connect } from "react-redux";
import { useSelector } from "react-redux";
import {
getLibraryNovels,
@@ -22,28 +24,27 @@ import {
const LibraryScreen = ({
navigation,
theme,
novels,
loading,
getLibraryNovels,
searchLibraryNovels,
}) => {
const theme = useSelector((state) => state.themeReducer.theme);
// const itemsPerRow = useSelector((state) => state.settingsReducer.itemsPerRow);
const [refreshing, setRefreshing] = useState(false);
const [search, setSearch] = useState({ searching: false, searchText: "" });
const resetSearch = () => setSearch({ searching: false, searchText: "" });
const [searchBar, setSearchBar] = useState(false);
const [searchText, setSearchText] = useState("");
useFocusEffect(
useCallback(() => {
resetSearch();
setSearchBar(false);
getLibraryNovels();
}, [])
);
/**
* TODO: fix refreshing
*/
const onRefresh = () => {
ToastAndroid.show("Updating library", ToastAndroid.SHORT);
setRefreshing(true);
@@ -51,17 +52,13 @@ const LibraryScreen = ({
setRefreshing(false);
};
const redirectToNovel = (item) =>
navigation.navigate("NovelItem", {
...item,
navigatingFrom: 1,
});
return (
<>
<Appbar
search={search}
setSearch={setSearch}
searchBar={searchBar}
setSearchBar={setSearchBar}
searchText={searchText}
setSearchText={setSearchText}
getLibraryNovels={getLibraryNovels}
searchLibraryNovels={searchLibraryNovels}
/>
@@ -71,57 +68,93 @@ const LibraryScreen = ({
{ backgroundColor: theme.colorDarkPrimaryDark },
]}
>
{loading ? (
<ActivityIndicator
size="small"
color={theme.colorAccentDark}
/>
) : (
<>
<FlatList
numColumns={3}
data={novels}
keyExtractor={(item) => item.novelUrl}
renderItem={({ item }) => (
<NovelCover
item={item}
onPress={() => redirectToNovel(item)}
/>
)}
refreshControl={
<RefreshControl
refreshing={refreshing}
onRefresh={onRefresh}
colors={["white"]}
progressBackgroundColor={
theme.colorAccentDark
}
/>
}
ListEmptyComponent={
search.searchText === "" ? (
<EmptyView />
) : (
<Text
style={[
styles.emptySearch,
{ color: theme.colorAccentDark },
]}
>
{`"${search.searchText}" not in library`}
</Text>
)
<FlatList
contentContainerStyle={{ flex: 1 }}
numColumns={3}
data={novels}
showsVerticalScrollIndicator={false}
keyExtractor={(item) => item.novelUrl}
renderItem={({ item }) => (
<NovelCover
item={item}
onPress={() =>
navigation.navigate("NovelItem", {
...item,
navigatingFrom: 1,
})
}
/>
</>
)}
)}
refreshControl={
<RefreshControl
refreshing={refreshing}
onRefresh={onRefresh}
colors={["white"]}
progressBackgroundColor={theme.colorAccentDark}
/>
}
ListEmptyComponent={
!loading ? (
!searchBar ? (
<View
style={{
flex: 1,
justifyContent: "center",
alignItems: "center",
}}
>
<Text
style={{
color: theme.textColorSecondaryDark,
fontSize: 45,
fontWeight: "bold",
}}
>
Σ(ಠ_ಠ)
</Text>
<Text
style={{
color: theme.textColorSecondaryDark,
fontWeight: "bold",
marginTop: 10,
textAlign: "center",
paddingHorizontal: 30,
}}
>
Your library is empty. Add series to
your library from Browse.
</Text>
</View>
) : (
searchBar &&
searchText !== "" && (
<Text
style={{
color: theme.colorAccentDark,
fontWeight: "bold",
marginTop: 10,
textAlign: "center",
paddingHorizontal: 30,
}}
>
{`"${searchText}" not in library`}
</Text>
)
)
) : (
<ActivityIndicator
size="small"
color={theme.colorAccentDark}
/>
)
}
/>
</View>
</>
);
};
const mapStateToProps = (state) => ({
theme: state.themeReducer.theme,
novels: state.libraryReducer.novels,
loading: state.libraryReducer.loading,
});
@@ -136,10 +169,4 @@ const styles = StyleSheet.create({
flex: 1,
padding: 4,
},
emptySearch: {
fontWeight: "bold",
marginTop: 10,
textAlign: "center",
paddingHorizontal: 30,
},
});
+17 -22
View File
@@ -1,22 +1,22 @@
import React from "react";
import { StyleSheet, TextInput } from "react-native";
import { TextInput } from "react-native";
import { Appbar } from "react-native-paper";
import { useSelector } from "react-redux";
const LibraryAppbar = ({
search,
setSearch,
searchBar,
setSearchBar,
searchText,
setSearchText,
getLibraryNovels,
searchLibraryNovels,
}) => {
const theme = useSelector((state) => state.themeReducer.theme);
const { searching, searchText } = search;
return (
<Appbar.Header style={{ backgroundColor: theme.colorDarkPrimary }}>
{!searching ? (
{!searchBar ? (
<>
<Appbar.Content
title="Library"
@@ -24,9 +24,7 @@ const LibraryAppbar = ({
/>
<Appbar.Action
icon="magnify"
onPress={() =>
setSearch({ ...search, searching: true })
}
onPress={() => setSearchBar(true)}
color={theme.textColorPrimaryDark}
/>
<Appbar.Action
@@ -40,7 +38,8 @@ const LibraryAppbar = ({
<>
<Appbar.BackAction
onPress={() => {
setSearch({ searching: false, searchText: "" });
setSearchBar(false);
setSearchText("");
getLibraryNovels();
}}
color={theme.textColorPrimaryDark}
@@ -49,17 +48,17 @@ const LibraryAppbar = ({
<TextInput
placeholder="Search..."
defaultValue={searchText}
style={[
styles.searchBar,
{
color: theme.textColorPrimaryDark,
},
]}
style={{
fontSize: 18,
flex: 1,
color: theme.textColorPrimaryDark,
marginLeft: 15,
}}
autoFocus
placeholderTextColor={theme.textColorHintDark}
blurOnSubmit={true}
onChangeText={(text) => {
setSearch({ ...search, searchText: text });
setSearchText(text);
searchLibraryNovels(text);
}}
/>
@@ -67,7 +66,7 @@ const LibraryAppbar = ({
<Appbar.Action
icon="close"
onPress={() => {
setSearch({ ...search, searchText: "" });
setSearchText("");
getLibraryNovels();
}}
color={theme.textColorPrimaryDark}
@@ -80,7 +79,3 @@ const LibraryAppbar = ({
};
export default LibraryAppbar;
const styles = StyleSheet.create({
searchBar: { fontSize: 18, flex: 1, marginLeft: 15 },
});
@@ -1,52 +0,0 @@
import React from "react";
import { StyleSheet, Text, View } from "react-native";
import { useSelector } from "react-redux";
const EmptyView = () => {
const theme = useSelector((state) => state.themeReducer.theme);
return (
<View style={styles.emptyViewContainer}>
<Text
style={[
styles.emptyViewIcon,
{
color: theme.textColorSecondaryDark,
},
]}
>
Σ(ಠ_ಠ)
</Text>
<Text
style={[
styles.emptyViewText,
{
color: theme.textColorSecondaryDark,
},
]}
>
Your library is empty. Add series to your library from Browse.
</Text>
</View>
);
};
export default EmptyView;
const styles = StyleSheet.create({
emptyViewContainer: {
flex: 1,
justifyContent: "center",
alignItems: "center",
},
emptyViewIcon: {
fontSize: 45,
fontWeight: "bold",
},
emptyViewText: {
fontWeight: "bold",
marginTop: 10,
textAlign: "center",
paddingHorizontal: 30,
},
});
+1 -1
View File
@@ -27,7 +27,7 @@ const AboutScreen = ({ navigation }) => {
titleStyle={{ color: theme.textColorPrimaryDark }}
title="Version"
descriptionStyle={{ color: theme.textColorSecondaryDark }}
description="Stable 1.0.2"
description="Stable 1.0.1"
/>
<List.Item
titleStyle={{ color: theme.textColorPrimaryDark }}