Reset progress if marked read

This commit is contained in:
Rajarshee Chatterjee
2021-05-16 16:36:42 +05:30
parent 1f87a50762
commit a280fc95e1
5 changed files with 25 additions and 6 deletions
+2 -2
View File
@@ -112,11 +112,11 @@ const Chapter = ({ route, navigation }) => {
const scrollToInitialPosition = () => {
if (position && firstLayout) {
position.percentage < 95 &&
position.percentage < 100 &&
scrollViewRef.getNode().scrollTo({
x: 0,
y: position.position,
animated: true,
animated: false,
});
setFirstLayout(false);
}
@@ -251,8 +251,6 @@ const ReaderSheet = ({ theme, reader, dispatch, bottomSheetRef }) => {
);
};
const mapStateToProps = (state) => ({});
export default ReaderSheet;
const styles = StyleSheet.create({
+3 -1
View File
@@ -173,7 +173,9 @@ const ChapterItem = ({
!chapter.read &&
position[chapter.chapterId] &&
position[chapter.chapterId].percentage <
95 && (
100 &&
position[chapter.chapterId].percentage >
0 && (
<Text
style={[
{
+6 -1
View File
@@ -26,6 +26,11 @@ export const saveScrollPosition =
(position, percentage, chapterId, novelId) => async (dispatch) => {
dispatch({
type: SAVE_SCROLL_POSITION,
payload: { position, percentage, chapterId, novelId },
payload: {
position,
percentage,
chapterId,
novelId,
},
});
};
+14
View File
@@ -39,6 +39,7 @@ import {
} from "../../Database/queries/ChapterQueries";
import { deleteNovelUpdates } from "../../Database/queries/UpdateQueries";
import {
SAVE_SCROLL_POSITION,
SET_CHAPTER_LIST_PREF,
SET_LAST_READ,
} from "../preferences/preference.types";
@@ -168,6 +169,19 @@ export const markChapterReadAction =
type: SET_LAST_READ,
payload: { novelId, chapterId: chapterId + 1 },
});
/**
* Reset progress on marked read
*/
dispatch({
type: SAVE_SCROLL_POSITION,
payload: {
position: 0,
percentage: 0,
chapterId,
novelId,
},
});
};
export const markPreviousChaptersReadAction =