Reset progress if marked read
This commit is contained in:
@@ -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({
|
||||
|
||||
@@ -173,7 +173,9 @@ const ChapterItem = ({
|
||||
!chapter.read &&
|
||||
position[chapter.chapterId] &&
|
||||
position[chapter.chapterId].percentage <
|
||||
95 && (
|
||||
100 &&
|
||||
position[chapter.chapterId].percentage >
|
||||
0 && (
|
||||
<Text
|
||||
style={[
|
||||
{
|
||||
|
||||
@@ -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,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
@@ -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 =
|
||||
|
||||
Reference in New Issue
Block a user