Ignore/remove eslint errors
This commit is contained in:
@@ -1,2 +0,0 @@
|
||||
import {NativeModules} from 'react-native';
|
||||
module.exports = NativeModules.FullScreen;
|
||||
@@ -37,6 +37,7 @@ const NovelCover = ({
|
||||
|
||||
const getHeight = useCallback(
|
||||
() => (window.width / getNovelsPerRow()) * (4 / 3),
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
[],
|
||||
);
|
||||
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
import React from 'react';
|
||||
import {StyleSheet, View, Text} from 'react-native';
|
||||
import {RadioButton as MaterialRadioButton} from 'react-native-paper';
|
||||
|
||||
export const RadioButtonGroup = ({children, value, onValueChange}) => (
|
||||
<MaterialRadioButton.Group onValueChange={onValueChange} value={value}>
|
||||
{children}
|
||||
</MaterialRadioButton.Group>
|
||||
);
|
||||
|
||||
export const RadioButton = ({value, label, theme, labelStyle}) => (
|
||||
<View style={styles.radioButtonContainer}>
|
||||
<MaterialRadioButton
|
||||
value={value}
|
||||
color={theme.colorAccent}
|
||||
uncheckedColor={theme.textColorSecondary}
|
||||
/>
|
||||
<Text
|
||||
style={[
|
||||
styles.radioButtonLabel,
|
||||
{color: theme.textColorPrimary},
|
||||
labelStyle,
|
||||
]}
|
||||
>
|
||||
{label}
|
||||
</Text>
|
||||
</View>
|
||||
);
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
radioButtonContainer: {
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
paddingVertical: 8,
|
||||
},
|
||||
radioButtonLabel: {
|
||||
marginLeft: 16,
|
||||
fontSize: 16,
|
||||
},
|
||||
});
|
||||
@@ -60,7 +60,7 @@ export const Searchbar = ({
|
||||
color={action.color ?? theme.textColorPrimary}
|
||||
onPress={action.onPress}
|
||||
theme={theme}
|
||||
containerStyle={{marginRight: 0}}
|
||||
containerStyle={{marginRight: 0, marginLeft: 6}}
|
||||
/>
|
||||
))}
|
||||
</Pressable>
|
||||
|
||||
@@ -29,9 +29,11 @@ export const insertChapters = async (novelId, chapters) => {
|
||||
// )
|
||||
),
|
||||
(txObj, res) => {
|
||||
console.log('Success');
|
||||
// console.log('Success');
|
||||
},
|
||||
(txObj, error) => {
|
||||
// console.log('Error ', error)
|
||||
},
|
||||
(txObj, error) => console.log('Error ', error),
|
||||
);
|
||||
});
|
||||
};
|
||||
@@ -48,7 +50,9 @@ export const getChapters = (novelId, sort, filter) => {
|
||||
(txObj, {rows: {_array}}) => {
|
||||
resolve(_array);
|
||||
},
|
||||
(txObj, error) => console.log('Error ', error),
|
||||
(txObj, error) => {
|
||||
// console.log('Error ', error)
|
||||
},
|
||||
);
|
||||
}),
|
||||
);
|
||||
@@ -65,7 +69,9 @@ export const getChapterFromDB = async chapterId => {
|
||||
(txObj, results) => {
|
||||
resolve(results.rows.item(0));
|
||||
},
|
||||
(txObj, error) => console.log('Error ', error),
|
||||
(txObj, error) => {
|
||||
// console.log('Error ', error)
|
||||
},
|
||||
);
|
||||
}),
|
||||
);
|
||||
@@ -80,7 +86,9 @@ export const getNextChapterFromDB = async (novelId, chapterId) => {
|
||||
(txObj, results) => {
|
||||
resolve(results.rows.item(0));
|
||||
},
|
||||
(txObj, error) => console.log('Error ', error),
|
||||
(txObj, error) => {
|
||||
// console.log('Error ', error)
|
||||
},
|
||||
);
|
||||
}),
|
||||
);
|
||||
@@ -95,7 +103,9 @@ export const getPrevChapterFromDB = async (novelId, chapterId) => {
|
||||
(txObj, results) => {
|
||||
resolve(results.rows.item(results.rows.length - 1));
|
||||
},
|
||||
(txObj, error) => console.log('Error ', error),
|
||||
(txObj, error) => {
|
||||
// console.log('Error ', error)
|
||||
},
|
||||
);
|
||||
}),
|
||||
);
|
||||
@@ -110,7 +120,9 @@ export const markChapterRead = async chapterId => {
|
||||
markChapterReadQuery,
|
||||
[chapterId],
|
||||
(txObj, res) => {},
|
||||
(txObj, error) => console.log(error),
|
||||
(txObj, error) => {
|
||||
// console.log(error)
|
||||
},
|
||||
);
|
||||
});
|
||||
};
|
||||
@@ -124,7 +136,9 @@ export const markChapterUnread = async chapterId => {
|
||||
markChapterUnreadQuery,
|
||||
[chapterId],
|
||||
(txObj, res) => {},
|
||||
(txObj, error) => console.log(error),
|
||||
(txObj, error) => {
|
||||
// console.log(error)
|
||||
},
|
||||
);
|
||||
});
|
||||
};
|
||||
@@ -138,7 +152,9 @@ export const markAllChaptersRead = async novelId => {
|
||||
markAllChaptersReadQuery,
|
||||
[novelId],
|
||||
(txObj, res) => {},
|
||||
(txObj, error) => console.log(error),
|
||||
(txObj, error) => {
|
||||
// console.log(error)
|
||||
},
|
||||
);
|
||||
});
|
||||
};
|
||||
@@ -152,7 +168,9 @@ export const markAllChaptersUnread = async novelId => {
|
||||
markAllChaptersUnreadQuery,
|
||||
[novelId],
|
||||
(txObj, res) => {},
|
||||
(txObj, error) => console.log(error),
|
||||
(txObj, error) => {
|
||||
// console.log(error)
|
||||
},
|
||||
);
|
||||
});
|
||||
};
|
||||
@@ -173,7 +191,9 @@ export const isChapterDownloaded = async chapterId => {
|
||||
resolve(false);
|
||||
}
|
||||
},
|
||||
(txObj, error) => console.log('Error ', error),
|
||||
(txObj, error) => {
|
||||
// console.log('Error ', error)
|
||||
},
|
||||
);
|
||||
}),
|
||||
);
|
||||
@@ -202,7 +222,9 @@ export const downloadChapter = async (
|
||||
(txObj, res) => {
|
||||
// console.log(`Downloaded Chapter ${chapter.chapterUrl}`);
|
||||
},
|
||||
(txObj, error) => console.log('Error ', error),
|
||||
(txObj, error) => {
|
||||
// console.log('Error ', error)
|
||||
},
|
||||
);
|
||||
});
|
||||
};
|
||||
@@ -217,13 +239,19 @@ export const deleteChapter = async chapterId => {
|
||||
updateIsDownloadedQuery,
|
||||
[chapterId],
|
||||
(txObj, res) => {},
|
||||
(txObj, error) => console.log('Error ', error),
|
||||
(txObj, error) => {
|
||||
// console.log('Error ', error)
|
||||
},
|
||||
);
|
||||
tx.executeSql(
|
||||
deleteChapterQuery,
|
||||
[chapterId],
|
||||
(txObj, res) => console.log('Chapter deleted'),
|
||||
(txObj, error) => console.log('Error ', error),
|
||||
(txObj, res) => {
|
||||
// console.log('Chapter deleted');
|
||||
},
|
||||
(txObj, error) => {
|
||||
// console.log('Error ', error)
|
||||
},
|
||||
);
|
||||
});
|
||||
};
|
||||
@@ -243,7 +271,9 @@ export const getLastReadChapter = async novelId => {
|
||||
getLastReadChapterQuery,
|
||||
[novelId],
|
||||
(txObj, {rows}) => resolve(rows.item(0)),
|
||||
(txObj, error) => console.log('Error ', error),
|
||||
(txObj, error) => {
|
||||
// console.log('Error ', error)
|
||||
},
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -258,7 +288,9 @@ export const bookmarkChapter = async (bookmark, chapterId) => {
|
||||
bookmarkChapterQuery,
|
||||
[!bookmark, chapterId],
|
||||
(txObj, res) => {},
|
||||
(txObj, error) => console.log('Error ', error),
|
||||
(txObj, error) => {
|
||||
// console.log('Error ', error)
|
||||
},
|
||||
);
|
||||
});
|
||||
};
|
||||
@@ -272,7 +304,9 @@ export const markPreviuschaptersRead = async (chapterId, novelId) => {
|
||||
markPreviuschaptersReadQuery,
|
||||
[chapterId, novelId],
|
||||
(txObj, res) => {},
|
||||
(txObj, error) => console.log(error),
|
||||
(txObj, error) => {
|
||||
// console.log(error)
|
||||
},
|
||||
);
|
||||
});
|
||||
};
|
||||
@@ -286,7 +320,9 @@ export const markPreviousChaptersUnread = async (chapterId, novelId) => {
|
||||
markPreviousChaptersUnreadQuery,
|
||||
[chapterId, novelId],
|
||||
(txObj, res) => {},
|
||||
(txObj, error) => console.log(error),
|
||||
(txObj, error) => {
|
||||
// console.log(error)
|
||||
},
|
||||
);
|
||||
});
|
||||
};
|
||||
@@ -307,7 +343,9 @@ export const getDownloadedChapters = () => {
|
||||
(txObj, {rows: {_array}}) => {
|
||||
resolve(_array);
|
||||
},
|
||||
(txObj, error) => console.log('Error ', error),
|
||||
(txObj, error) => {
|
||||
// console.log('Error ', error)
|
||||
},
|
||||
);
|
||||
}),
|
||||
);
|
||||
|
||||
@@ -24,7 +24,9 @@ export const getHistoryFromDb = async () => {
|
||||
(txObj, {rows: {_array}}) => {
|
||||
resolve(_array);
|
||||
},
|
||||
(txObj, error) => console.log('Error ', error),
|
||||
(txObj, error) => {
|
||||
// console.log('Error ', error)
|
||||
},
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -38,7 +40,9 @@ export const insertHistory = async (novelId, chapterId) => {
|
||||
"INSERT OR REPLACE INTO history (historyNovelId, historyChapterId, historyTimeRead) VALUES (?, ?, (datetime('now','localtime')))",
|
||||
[novelId, chapterId],
|
||||
(txObj, res) => {},
|
||||
(txObj, error) => console.log('Error ', error),
|
||||
(txObj, error) => {
|
||||
// console.log('Error ', error)
|
||||
},
|
||||
);
|
||||
tx.executeSql('UPDATE novels SET unread = 0 WHERE novelId = ?', [novelId]);
|
||||
});
|
||||
@@ -50,7 +54,9 @@ export const deleteHistory = async historyId => {
|
||||
'DELETE FROM history WHERE historyId = ?',
|
||||
[historyId],
|
||||
(txObj, res) => {},
|
||||
(txObj, error) => console.log('Error ', error),
|
||||
(txObj, error) => {
|
||||
// console.log('Error ', error)
|
||||
},
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
@@ -32,7 +32,9 @@ export const getLibrary = (sort, filter) => {
|
||||
// console.log(_array);
|
||||
resolve(_array);
|
||||
},
|
||||
(txObj, error) => console.log('Error ', error),
|
||||
(txObj, error) => {
|
||||
// console.log('Error ', error);
|
||||
},
|
||||
);
|
||||
}),
|
||||
);
|
||||
@@ -68,7 +70,9 @@ export const searchLibrary = (searchText, sort, filter) => {
|
||||
searchLibraryQuery(searchText, sort, filter),
|
||||
null,
|
||||
(txObj, {rows: {_array}}) => resolve(_array),
|
||||
(txObj, error) => console.log('Error ', error),
|
||||
(txObj, error) => {
|
||||
// console.log('Error ', error);
|
||||
},
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -31,7 +31,9 @@ export const insertNovel = async novel => {
|
||||
novel.genre,
|
||||
],
|
||||
(txObj, {insertId}) => resolve(insertId),
|
||||
(txObj, error) => console.log('Error ', error),
|
||||
(txObj, error) => {
|
||||
// console.log('Error ', error)
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -43,7 +45,9 @@ export const followNovel = async (followed, novelId) => {
|
||||
'UPDATE novels SET followed = ? WHERE novelId = ?',
|
||||
[!followed, novelId],
|
||||
(txo, res) => {},
|
||||
(txObj, error) => console.log('Error ', error),
|
||||
(txObj, error) => {
|
||||
// console.log('Error ', error)
|
||||
},
|
||||
);
|
||||
});
|
||||
};
|
||||
@@ -54,7 +58,9 @@ export const unfollowNovel = async novelId => {
|
||||
'UPDATE novels SET followed = 0 WHERE novelId = ?',
|
||||
[novelId],
|
||||
(txo, res) => {},
|
||||
(txObj, error) => console.log('Error ', error),
|
||||
(txObj, error) => {
|
||||
// console.log('Error ', error)
|
||||
},
|
||||
);
|
||||
});
|
||||
};
|
||||
@@ -74,7 +80,9 @@ export const checkNovelInCache = novelUrl => {
|
||||
resolve(false);
|
||||
}
|
||||
},
|
||||
(txObj, error) => console.log('Error ', error),
|
||||
(txObj, error) => {
|
||||
// console.log('Error ', error)
|
||||
},
|
||||
);
|
||||
}),
|
||||
);
|
||||
@@ -87,7 +95,9 @@ export const getNovel = async (sourceId, novelUrl) => {
|
||||
'SELECT * FROM novels WHERE novelUrl = ? AND sourceId = ?',
|
||||
[novelUrl, sourceId],
|
||||
(txObj, {rows}) => resolve(rows.item(0)),
|
||||
(txObj, error) => console.log('Error ', error),
|
||||
(txObj, error) => {
|
||||
// console.log('Error ', error)
|
||||
},
|
||||
);
|
||||
}),
|
||||
);
|
||||
@@ -99,7 +109,9 @@ export const deleteNovelCache = () => {
|
||||
'DELETE FROM novels WHERE followed = 0',
|
||||
null,
|
||||
(txObj, res) => showToast('Entries deleted'),
|
||||
(txObj, error) => console.log('Error ', error),
|
||||
(txObj, error) => {
|
||||
// console.log('Error ', error)
|
||||
},
|
||||
);
|
||||
});
|
||||
};
|
||||
@@ -131,7 +143,9 @@ export const restoreLibrary = async novel => {
|
||||
const chapters = await fetchChapters(novel.sourceId, novel.novelUrl);
|
||||
await insertChapters(insertId, chapters);
|
||||
},
|
||||
(txObj, error) => console.log('Error ', error),
|
||||
(txObj, error) => {
|
||||
// console.log('Error ', error)
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -190,7 +204,9 @@ export const migrateNovel = async (sourceId, novelUrl) => {
|
||||
await insertChapters(insertId, chapters);
|
||||
resolve();
|
||||
},
|
||||
(txObj, error) => console.log('Error ', error),
|
||||
(txObj, error) => {
|
||||
// console.log('Error ', error)
|
||||
},
|
||||
),
|
||||
);
|
||||
});
|
||||
@@ -218,7 +234,9 @@ export const updateNovelInfo = async (info, novelId) => {
|
||||
novelId,
|
||||
],
|
||||
(txObj, res) => {},
|
||||
(txObj, error) => console.log('Error ', error),
|
||||
(txObj, error) => {
|
||||
// console.log('Error ', error)
|
||||
},
|
||||
);
|
||||
});
|
||||
};
|
||||
@@ -232,7 +250,9 @@ export const pickCustomNovelCover = async novelId => {
|
||||
'UPDATE novels SET novelCover = ? WHERE novelId = ?',
|
||||
[image.uri, novelId],
|
||||
(txObj, res) => {},
|
||||
(txObj, error) => console.log('Error ', error),
|
||||
(txObj, error) => {
|
||||
// console.log('Error ', error)
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -22,7 +22,9 @@ export const getUpdates = async () => {
|
||||
(txObj, {rows: {_array}}) => {
|
||||
resolve(_array);
|
||||
},
|
||||
(txObj, error) => console.log('Error ', error),
|
||||
(txObj, error) => {
|
||||
// console.log('Error ', error)
|
||||
},
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -34,7 +36,9 @@ export const deleteNovelUpdates = novelId => {
|
||||
'DELETE FROM updates WHERE novelId = ?',
|
||||
[novelId],
|
||||
(txObj, res) => {},
|
||||
(txObj, error) => console.log('Error ', error),
|
||||
(txObj, error) => {
|
||||
// console.log('Error ', error);
|
||||
},
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
@@ -49,6 +49,7 @@ const Browse = ({navigation}) => {
|
||||
|
||||
useEffect(() => {
|
||||
dispatch(getSourcesAction());
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, []);
|
||||
|
||||
const onRefresh = () => {
|
||||
|
||||
@@ -15,6 +15,7 @@ const SourceItem = ({item, theme, isPinned, dispatch, navigation}) => {
|
||||
sourceName: item.sourceName,
|
||||
url: item.url,
|
||||
}),
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
[],
|
||||
);
|
||||
|
||||
|
||||
@@ -62,6 +62,7 @@ const BrowseMalScreen = ({navigation, route}) => {
|
||||
|
||||
useEffect(() => {
|
||||
getNovels();
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, []);
|
||||
|
||||
const renderItem = ({item}) => (
|
||||
|
||||
@@ -47,6 +47,7 @@ const GlobalSearch = ({route, navigation}) => {
|
||||
|
||||
useEffect(() => {
|
||||
novelName && onSubmitEditing();
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, []);
|
||||
|
||||
const clearSearchbar = () => setSearchText('');
|
||||
|
||||
@@ -79,6 +79,7 @@ const MigrationNovels = ({navigation, route}) => {
|
||||
|
||||
useEffect(() => {
|
||||
getSearchResults();
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, []);
|
||||
|
||||
const renderItem = ({item}) => (
|
||||
|
||||
@@ -29,6 +29,7 @@ const HistoryItem = ({history, theme, dispatch, navigation, deleteHistory}) => {
|
||||
`Chapter ${parseChapterNumber(chapterName)} • ${moment(historyTimeRead)
|
||||
.format('h:mm a')
|
||||
.toUpperCase()}`,
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
[],
|
||||
);
|
||||
|
||||
|
||||
@@ -60,11 +60,13 @@ const LibraryScreen = ({navigation}) => {
|
||||
useCallback(() => {
|
||||
setSearchText('');
|
||||
dispatch(getLibraryAction(sort, filter));
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [getLibraryAction, sort, filter]),
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
updateLibraryOnLaunch && dispatch(updateLibraryAction());
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, []);
|
||||
|
||||
const onRefresh = () => {
|
||||
|
||||
@@ -65,6 +65,7 @@ const Downloads = ({navigation}) => {
|
||||
novelName: item.novelName,
|
||||
bookmark: item.bookmark,
|
||||
}),
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
[],
|
||||
);
|
||||
|
||||
@@ -76,6 +77,7 @@ const Downloads = ({navigation}) => {
|
||||
novelName: item.novelName,
|
||||
novelCover: item.novelCover,
|
||||
}),
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
[],
|
||||
);
|
||||
|
||||
|
||||
@@ -90,6 +90,7 @@ const Novel = ({route, navigation}) => {
|
||||
dispatch(
|
||||
getNovelAction(followed, sourceId, novelUrl, novelId, sort, filter),
|
||||
);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [getNovelAction]);
|
||||
|
||||
const onRefresh = () => {
|
||||
|
||||
@@ -32,6 +32,7 @@ const TrackSearchDialog = ({
|
||||
|
||||
useEffect(() => {
|
||||
trackSearchDialog && getSearchresults();
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [trackSearchDialog]);
|
||||
|
||||
const renderSearchResultCard = item => (
|
||||
|
||||
@@ -109,9 +109,7 @@ const Chapter = ({route, navigation}) => {
|
||||
const [contentSize, setContentSize] = useState(0);
|
||||
|
||||
const [textToSpeech, setTextToSpeech] = useState();
|
||||
const [textToSpeechPosition, setTextToSpeechPosition] = useState({
|
||||
end: 0,
|
||||
});
|
||||
const [textToSpeechPosition, setTextToSpeechPosition] = useState({end: 0});
|
||||
|
||||
useEffect(() => {
|
||||
Tts.addEventListener('tts-start', () => setTextToSpeech('start'));
|
||||
@@ -241,28 +239,33 @@ const Chapter = ({route, navigation}) => {
|
||||
setPrevChapter(prevChap);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
setImmersiveMode();
|
||||
getChapter(chapterId);
|
||||
useEffect(
|
||||
() => {
|
||||
setImmersiveMode();
|
||||
getChapter(chapterId);
|
||||
|
||||
if (!incognitoMode) {
|
||||
insertHistory(novelId, chapterId);
|
||||
dispatch({
|
||||
type: SET_LAST_READ,
|
||||
payload: {novelId, chapterId},
|
||||
});
|
||||
}
|
||||
}, []);
|
||||
if (!incognitoMode) {
|
||||
insertHistory(novelId, chapterId);
|
||||
dispatch({
|
||||
type: SET_LAST_READ,
|
||||
payload: {novelId, chapterId},
|
||||
});
|
||||
}
|
||||
}, // eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
[],
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
navigation.addListener('beforeRemove', e => {
|
||||
StatusBar.setHidden(false);
|
||||
showNavigationBar();
|
||||
});
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
setPrevAndNextChap();
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [chapter]);
|
||||
|
||||
const [currentTime, setCurrentTime] = useState();
|
||||
@@ -279,6 +282,7 @@ const Chapter = ({route, navigation}) => {
|
||||
|
||||
useEffect(() => {
|
||||
if (!useWebViewForChapter && scrollPercentage !== 100 && autoScroll) {
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
scrollTimeout = setTimeout(() => {
|
||||
scrollViewRef.current.scrollTo({
|
||||
x: 0,
|
||||
@@ -334,6 +338,7 @@ const Chapter = ({route, navigation}) => {
|
||||
dispatch(markChapterReadAction(chapterId, novelId));
|
||||
updateTracker();
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, []);
|
||||
|
||||
const setImmersiveMode = () => {
|
||||
@@ -346,17 +351,20 @@ const Chapter = ({route, navigation}) => {
|
||||
}
|
||||
};
|
||||
|
||||
const scrollToSavedProgress = useCallback(event => {
|
||||
if (position && firstLayout) {
|
||||
position.percentage < 100 &&
|
||||
scrollViewRef.current.scrollTo({
|
||||
x: 0,
|
||||
y: position.position,
|
||||
animated: false,
|
||||
});
|
||||
setFirstLayout(false);
|
||||
}
|
||||
}, []);
|
||||
const scrollToSavedProgress = useCallback(
|
||||
event => {
|
||||
if (position && firstLayout) {
|
||||
position.percentage < 100 &&
|
||||
scrollViewRef.current.scrollTo({
|
||||
x: 0,
|
||||
y: position.position,
|
||||
animated: false,
|
||||
});
|
||||
setFirstLayout(false);
|
||||
}
|
||||
}, // eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
[],
|
||||
);
|
||||
|
||||
const hideHeader = () => {
|
||||
if (!hidden) {
|
||||
|
||||
@@ -75,11 +75,14 @@ const SourceScreen = ({navigation, route}) => {
|
||||
}
|
||||
};
|
||||
|
||||
const checkIFInLibrary = (sourceId, novelUrl) =>
|
||||
library.some(obj => obj.novelUrl === novelUrl && obj.sourceId === sourceId);
|
||||
const checkIFInLibrary = (novelSourceId, novelUrl) =>
|
||||
library.some(
|
||||
obj => obj.novelUrl === novelUrl && obj.sourceId === novelSourceId,
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
getNovels();
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [page]);
|
||||
|
||||
const getNextPage = () => {
|
||||
|
||||
@@ -24,7 +24,6 @@ import {
|
||||
deleteChapterAction,
|
||||
downloadChapterAction,
|
||||
} from '../../redux/novel/novel.actions';
|
||||
import {showToast} from '../../hooks/showToast';
|
||||
|
||||
const Updates = ({navigation}) => {
|
||||
const theme = useTheme();
|
||||
@@ -43,11 +42,7 @@ const Updates = ({navigation}) => {
|
||||
|
||||
let sectionedUpdates = [];
|
||||
|
||||
if (updates.length && updates[0].data !== undefined) {
|
||||
sectionedUpdates = updates;
|
||||
} else {
|
||||
showToast('Update your library to show updates.');
|
||||
}
|
||||
sectionedUpdates = updates.length && updates[0].data !== undefined && updates;
|
||||
|
||||
useFocusEffect(
|
||||
useCallback(() => {
|
||||
|
||||
@@ -10,7 +10,9 @@ const getLibraryNovels = () => {
|
||||
getLibraryNovelsQuery,
|
||||
null,
|
||||
(txObj, {rows: {_array}}) => resolve(_array),
|
||||
(txObj, error) => console.log('Error ', error),
|
||||
(txObj, error) => {
|
||||
// console.log('Error ', error)
|
||||
},
|
||||
);
|
||||
}),
|
||||
);
|
||||
@@ -26,7 +28,9 @@ const getLibraryChapters = () => {
|
||||
getLibraryChaptersQuery,
|
||||
null,
|
||||
(txObj, {rows: {_array}}) => resolve(_array),
|
||||
(txObj, error) => console.log('Error ', error),
|
||||
(txObj, error) => {
|
||||
// console.log('Error ', error)
|
||||
},
|
||||
);
|
||||
}),
|
||||
);
|
||||
@@ -42,7 +46,9 @@ const getLibraryDownloads = () => {
|
||||
getLibraryDownloadsQuery,
|
||||
null,
|
||||
(txObj, {rows: {_array}}) => resolve(_array),
|
||||
(txObj, error) => console.log('Error ', error),
|
||||
(txObj, error) => {
|
||||
// console.log('Error ', error)
|
||||
},
|
||||
);
|
||||
}),
|
||||
);
|
||||
@@ -72,7 +78,9 @@ const restoreNovels = async novel => {
|
||||
novel.unread,
|
||||
],
|
||||
(txObj, res) => {},
|
||||
(txObj, error) => console.log('Error ', error),
|
||||
(txObj, error) => {
|
||||
// console.log('Error ', error)
|
||||
},
|
||||
),
|
||||
);
|
||||
};
|
||||
@@ -106,7 +114,9 @@ const restoreChapters = async chapter => {
|
||||
downloaded,
|
||||
],
|
||||
(txObj, res) => {},
|
||||
(txObj, error) => console.log('Error ', error),
|
||||
(txObj, error) => {
|
||||
// console.log('Error ', error)
|
||||
},
|
||||
),
|
||||
);
|
||||
};
|
||||
@@ -122,7 +132,9 @@ const restoreDownloads = async chapter => {
|
||||
restoreDownloadsQuery,
|
||||
[downloadChapterId, chapterName, chapterText],
|
||||
(txObj, res) => {},
|
||||
(txObj, error) => console.log('Error ', error),
|
||||
(txObj, error) => {
|
||||
// console.log('Error ', error)
|
||||
},
|
||||
),
|
||||
);
|
||||
};
|
||||
|
||||
+17
-6
@@ -34,7 +34,9 @@ const updateNovelDetails = async (novel, novelId) => {
|
||||
novelId,
|
||||
],
|
||||
(txObj, res) => {},
|
||||
(txObj, error) => console.log('Error ', error),
|
||||
(txObj, error) => {
|
||||
// console.log('Error ', error)
|
||||
},
|
||||
);
|
||||
});
|
||||
};
|
||||
@@ -62,11 +64,15 @@ export const updateNovel = async (sourceId, novelUrl, novelId) => {
|
||||
// novelId
|
||||
// );
|
||||
},
|
||||
(txOBJ, error) => console.log('Error ', error),
|
||||
(txOBJ, error) => {
|
||||
// console.log('Error ', error)
|
||||
},
|
||||
);
|
||||
}
|
||||
},
|
||||
(txObj, error) => console.log('Error ', error),
|
||||
(txObj, error) => {
|
||||
// console.log('Error ', error)
|
||||
},
|
||||
),
|
||||
);
|
||||
});
|
||||
@@ -89,18 +95,23 @@ export const updateNovelChapters = async (
|
||||
[chapter.chapterUrl, chapter.chapterName, chapter.releaseDate, novelId],
|
||||
(txObj, {insertId}) => {
|
||||
if (insertId !== -1) {
|
||||
downloadNewChapters &&
|
||||
if (downloadNewChapters) {
|
||||
downloadChapter(sourceId, novelUrl, chapter.chapterUrl, insertId);
|
||||
}
|
||||
|
||||
tx.executeSql(
|
||||
"INSERT OR IGNORE INTO updates (chapterId, novelId, updateTime) values (?, ?, (datetime('now','localtime')))",
|
||||
[insertId, novelId],
|
||||
(txOBJ, res) => {},
|
||||
(txOBJ, error) => console.log('Error ', error),
|
||||
(txOBJ, error) => {
|
||||
// console.log('Error ', error)
|
||||
},
|
||||
);
|
||||
}
|
||||
},
|
||||
(txObj, error) => console.log('Error ', error),
|
||||
(txObj, error) => {
|
||||
// console.log('Error ', error)
|
||||
},
|
||||
),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -147,7 +147,7 @@ const parseNovelAndChapters = async novelUrl => {
|
||||
};
|
||||
|
||||
const parseChapter = async (novelUrl, chapterUrl) => {
|
||||
const url = `${baseUrl}${year}/${month}/${chapterUrl}`;
|
||||
const url = `${baseUrl}${novelUrl}/${chapterUrl}`;
|
||||
|
||||
const result = await fetch(url);
|
||||
const body = await result.text();
|
||||
|
||||
Reference in New Issue
Block a user