+
+
+
+
@@ -233,7 +186,29 @@ const WebViewReader: React.FC = props => {
: ''
}
${html}
+
+
+
+
+ ${getString(
+ 'readerScreen.finished',
+ )}: ${chapterName?.trim()}
+
+ ${
+ nextChapter
+ ? `
`
+ : `
${getString(
+ 'readerScreen.noNextChapter',
+ )}
`
+ }
+
+
-
- ${getString(
- 'readerScreen.finished',
- )}: ${chapterName?.trim()}
-
- ${
- nextChapter
- ? `
`
- : `
${getString(
- 'readerScreen.noNextChapter',
- )}
`
- }
- ${
- swipeGestures
- ? `
- `
- : ''
- }
-
+
+ ${swipeGestures ? createSwipeGestures() : ''}
@@ -328,5 +268,4 @@ const WebViewReader: React.FC
= props => {
/>
);
};
-
export default React.memo(WebViewReader, isEqual);
diff --git a/src/screens/reader/components/stringCreators/createStyle.ts b/src/screens/reader/components/stringCreators/createStyle.ts
new file mode 100644
index 000000000..3783cdf04
--- /dev/null
+++ b/src/screens/reader/components/stringCreators/createStyle.ts
@@ -0,0 +1,167 @@
+import { ThemeColors } from '@theme/types';
+
+export const createStyles = (
+ currentHeight: number,
+ readerSettings: {
+ theme: string;
+ textColor: string;
+ textSize: number;
+ textAlign: string;
+ padding: number;
+ fontFamily: string;
+ lineHeight: number;
+ customCSS: string;
+ customJS: string;
+ },
+ theme: ThemeColors,
+ layoutHeight: number,
+ readerPages: boolean,
+) => `
+`;
diff --git a/src/screens/reader/components/stringCreators/createSwipeGestures.ts b/src/screens/reader/components/stringCreators/createSwipeGestures.ts
new file mode 100644
index 000000000..cd9d2c3ba
--- /dev/null
+++ b/src/screens/reader/components/stringCreators/createSwipeGestures.ts
@@ -0,0 +1,18 @@
+export function createSwipeGestures() {
+ return ``;
+}
diff --git a/src/screens/reader/components/stringCreators/horizontalReaderPages.ts b/src/screens/reader/components/stringCreators/horizontalReaderPages.ts
new file mode 100644
index 000000000..e34ebb9b3
--- /dev/null
+++ b/src/screens/reader/components/stringCreators/horizontalReaderPages.ts
@@ -0,0 +1,71 @@
+export const createHorizontalReaderPages = () => {
+ return `
+const id = (key) => {
+ return document.getElementById(key)
+}
+const select = (key) => {
+ return document.querySelector(key)
+}
+
+const chapter = select("chapter");
+const clientWidth = document.documentElement.clientWidth;
+const textWidth = chapter.scrollWidth;
+const navLeft = id("left");
+const navRight = id("right");
+const infoBox = id("infoContainer");
+infoBox.classList.add("hidden");
+id("spacer").style.height = infoBox.scrollHeight + 'px';
+
+const pages = (Math.ceil(textWidth / clientWidth) - 1);
+let page = 0;
+
+
+navRight.addEventListener("click", () => {
+ page = select("chapter").getAttribute('data-page');
+ if (isNaN(page)) {
+ page = 0;
+ }
+ if (page < pages ) {
+ page++;
+ movePage();
+ if (page === pages){
+ infoBox.classList.add("show")
+ }
+ }
+});
+navLeft.addEventListener("click", () => {
+ page = select("chapter").getAttribute('data-page');
+ if (page > 0) {
+ infoBox.classList.remove("show")
+ page--;
+ movePage();
+ }
+})
+function movePage(){
+ chapter.style.transform = 'translate(-'+page*100+'%)';
+ select('chapter').setAttribute('data-page',
+ page
+ );
+ window.ReactNativeWebView.postMessage(
+ JSON.stringify(
+ {
+ type:"scrollend",
+ data:{
+ offSetY: page * 100, percentage: page === 0 ? 1 : page / pages * 100,
+ }
+ }
+ )
+ );
+}
+let sendWidthTimeout;
+const sendPages = (timeOut) => {
+ clearTimeout(sendHeightTimeout);
+ sendHeightTimeout = setTimeout(
+ window.ReactNativeWebView.postMessage(
+ JSON.stringify({type:"pages",data: pages})
+ ), timeOut
+ );
+}
+sendPages(200);
+;`;
+};
diff --git a/src/screens/settings/SettingsAdvancedScreen.js b/src/screens/settings/SettingsAdvancedScreen.js
index 9fb20952e..172a7eda1 100644
--- a/src/screens/settings/SettingsAdvancedScreen.js
+++ b/src/screens/settings/SettingsAdvancedScreen.js
@@ -16,11 +16,14 @@ import { openDirectory } from '../../native/epubParser';
import { Appbar, Button, List } from '@components';
import { ScreenContainer } from '@components/Common';
-import useSourceStorage from '@hooks/useSourceStorage';
+import CookieManager from '@react-native-cookies/cookies';
const AdvancedSettings = ({ navigation }) => {
const theme = useTheme();
- const { clearCookies } = useSourceStorage({});
+ const clearCookies = () => {
+ CookieManager.clearAll();
+ showToast('Cookies cleared');
+ };
/**
* Confirm Clear Database Dialog
diff --git a/src/screens/settings/SettingsReaderScreen/Settings/GeneralSettings.tsx b/src/screens/settings/SettingsReaderScreen/Settings/GeneralSettings.tsx
index c49650e99..a6b2e8ada 100644
--- a/src/screens/settings/SettingsReaderScreen/Settings/GeneralSettings.tsx
+++ b/src/screens/settings/SettingsReaderScreen/Settings/GeneralSettings.tsx
@@ -24,6 +24,7 @@ const GeneralSettings: React.FC = () => {
useVolumeButtons = false,
verticalSeekbar = true,
swipeGestures = false,
+ readerPages = false,
autoScroll = false,
autoScrollInterval = 10,
autoScrollOffset = null,
@@ -76,6 +77,12 @@ const GeneralSettings: React.FC = () => {
}
theme={theme}
/>
+ dispatch(setAppSettings('readerPages', !readerPages))}
+ theme={theme}
+ />
void;
sourceId: number;
}) => {
- const { cookies = '' } = getSourceStorage(sourceId);
return (
diff --git a/src/sources/helpers/cloudflareImagesBypass.ts b/src/sources/helpers/cloudflareImagesBypass.ts
index b382153fa..97342fb31 100644
--- a/src/sources/helpers/cloudflareImagesBypass.ts
+++ b/src/sources/helpers/cloudflareImagesBypass.ts
@@ -1,13 +1,10 @@
-import { getSourceStorage } from '@hooks/useSourceStorage';
import { defaultUserAgentString, fetchApi } from '@utils/fetch/fetch';
import { Cheerio, CheerioAPI, Element } from 'cheerio';
export const bypassImages = async (
loadedCheerio: CheerioAPI,
element: Cheerio,
- sourceId: number,
): Promise => {
- const { cookies = '' } = getSourceStorage(sourceId);
let promises: Promise[] = [];
element.find('noscript').each(function () {
@@ -28,7 +25,7 @@ export const bypassImages = async (
const response = await fetchApi({
url: attr.value,
init: {
- headers: { Cookie: cookies, 'User-Agent': defaultUserAgentString },
+ headers: { 'User-Agent': defaultUserAgentString },
},
});
diff --git a/src/utils/fetch/fetch.ts b/src/utils/fetch/fetch.ts
index fa24ada92..ec470c528 100644
--- a/src/utils/fetch/fetch.ts
+++ b/src/utils/fetch/fetch.ts
@@ -1,12 +1,9 @@
-import { getSourceStorage } from '@hooks/useSourceStorage';
-
export const defaultUserAgentString =
'Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Mobile Safari/537.36';
interface FetchParams {
url: string; // URL of request
init?: RequestInit; // Variable for passing headers and other information
- sourceId?: number; // ID number of source for cookies
}
// Checks if we bypassed cloudflare. If we failed to bypass, throw error.
@@ -27,7 +24,6 @@ export const cloudflareCheck = (text: string) => {
export const fetchApi = async ({
url,
init,
- sourceId,
}: FetchParams): Promise => {
let headers = new Headers({
'User-Agent': defaultUserAgentString,
@@ -38,14 +34,6 @@ export const fetchApi = async ({
// You can have NO user agent by doing this:
// init: { headers: { 'User-Agent': undefined } },
- if (sourceId) {
- const { cookies = '' } = getSourceStorage(sourceId);
-
- if (cookies) {
- headers.append('cookie', cookies);
- }
- }
-
return fetch(url, { ...init, headers });
};
diff --git a/strings/languages/en/strings.json b/strings/languages/en/strings.json
index 39f1bdf4d..ddffe85cd 100644
--- a/strings/languages/en/strings.json
+++ b/strings/languages/en/strings.json
@@ -95,6 +95,7 @@
"showBatteryAndTime": "Show battery and time",
"showProgressPercentage": "Show progress percentage",
"swipeGestures": "Swipe left or right to navigate between chapters",
+ "readerPages": "Tap left or right to navigate through pages in the reader (Experimental)",
"allowTextSelection": "Allow text selection",
"useChapterDrawerSwipeNavigation": "Swipe right to open drawer",
"removeExtraSpacing": "Remove extra paragraph spacing",
diff --git a/strings/types/index.ts b/strings/types/index.ts
index 44f0f924f..e656abb5c 100644
--- a/strings/types/index.ts
+++ b/strings/types/index.ts
@@ -79,6 +79,7 @@ export interface StringMap {
'readerScreen.bottomSheet.showBatteryAndTime': 'string';
'readerScreen.bottomSheet.showProgressPercentage': 'string';
'readerScreen.bottomSheet.swipeGestures': 'string';
+ 'readerScreen.bottomSheet.readerPages': 'string';
'readerScreen.bottomSheet.allowTextSelection': 'string';
'readerScreen.bottomSheet.useChapterDrawerSwipeNavigation': 'string';
'readerScreen.bottomSheet.removeExtraSpacing': 'string';