agilgur5 / react-native-manga-reader-app

[Alpha] A React Native / Expo app for cross-platform manga reading
https://expo.io/@agilgur5/react-native-manga-reader-app
Other
16 stars 4 forks source link

Support other sites / providers #6

Open agilgur5 opened 5 years ago

agilgur5 commented 5 years ago

Currently only 1 site is supported. There should be a way to switch providers and support for at least a few.

Ideally a handful would be supported out-of-the-box and others available via plugins. Tachiyomi has various providers available via separate repos and APK downloads. I think the latest release is a "clean" version with no providers available out-of-the-box. Would be cool if provider plugins could be added via something similar to Code Push, that doesn't require a new install. Obviously warnings need to be given up-front about potentially hazardous code distributed by others (alternatively keep a safe list?).

See also #1 - provider plugins are not currently public - Tachiyomi's are though

agilgur5 commented 4 years ago

So I gave this a go trying to implement one more provider (probably not the easiest one) and this is definitely going to require some refactoring.

The api.js file will almost certainly have to change as some providers may require multiple fetches to get certain data or might require the current URL or might require Cookies etc etc to retrieve their data. We may need to change some of the UI code as well around page vs. image, as not all providers seem to be formatted as such.

Another big detail is that the persisted mangas don't currently list their provider. They do have a link, so provider can probably be inferred from that though (so long as like domain is included in the link). It might be wise to add a provider field to all manga. Similarly might have to refactor some code to account for which provider to use.


I think it would be wise to re-write the tachiyomi-extensions scraping code in JS as they've probably gone through a lot of iterations to get to a more ideal design, so can follow their lead instead of running into the same bugs they might once have run into. Tachiyomi also has a lot more usage, so they're likely quicker to update scrapers and that means we can likely base fixes off of theirs. While Tachiyomi is all Kotlin and requires rewriting in JS, it is also Apache licensed, so compatible in any case.

For some providers, Tachiyomi has some more complicated logic, so I'm also guessing we'll run into the same issues here, and those will likely require even more refactoring to handle.


Another relevant note is that most errors seem to be swallowed by MST, possibly by the async flow handling, and this may or may not be on purpose (so that reactions etc don't just break based on some potentially related issues I was reading). This also explains why I wasn't getting errors when chapters / pages / images sometimes fail to fetch (usually because the list is empty on the provider). Might need to move error handling temporarily or permanently into actions and might want to file an issue / ask a question at MST about this as nothing pops up on the topic of "swallowing" errors.