Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MangaThemesia] Option to hide paid chapters #6598

Merged
merged 7 commits into from
Dec 24, 2024

Conversation

lord-ne
Copy link
Contributor

@lord-ne lord-ne commented Dec 13, 2024

Two of the sources using the MangaThemesiaAlt theme, NightScans and ThunderScans, have paid chapters which cannot be viewed in Mihon without purchasing (attempting to click them results in an error). This PR hides those chapters from the chapter list. It also adds a setting to go back to the old behavior of not hiding them (a user might want to use this, for example, to be notified when there are new paid chapters so that they can go and purchase them on the scanlator's website), but the default setting is to hide them.

Closes #5908

Checklist:

  • N/A Updated extVersionCode value in build.gradle for individual extensions
  • Updated overrideVersionCode or baseVersionCode as needed for all multisrc extensions
    • Updated overrideVersionCode for extensions that we added functionality to. The baseVersionCode does not need to be updated since we only added a new file to the multisource library, we didn't do anything that would affect existing extensions using the library.
  • Referenced all related issues in the PR body (e.g. "Closes #xyz")
  • N/A Added the isNsfw = true flag in build.gradle when appropriate
  • Have not changed source names
  • N/A Have explicitly kept the id if a source's name or language were changed
  • Have tested the modifications by compiling and running the extension through Android Studio
  • N/A Have removed web_hi_res_512.png when adding a new extension

The new setting option:

Screenshot from 2024-12-13 12-41-48

With hiding enabled:

Screenshot from 2024-12-13 12-41-18

With hiding disabled:

Screenshot from 2024-12-13 12-42-13

(Also confirmed that after logging in with web view and purchasing chapters, they do show up even if hiding is enabled)

@AwkwardPeak7
Copy link
Contributor

I don't think this needs to be in MangaThemesiaAlt, maybe in the base class, but imo just update selector in affected sources.
afaik lock system isn't part of the base wordpress theme, it comes with some addon, so different sources can have different selectors

@lord-ne
Copy link
Contributor Author

lord-ne commented Dec 14, 2024

Two out of the three sources using the MangaThemesiaAlt base class (NightScans and ThunderScans) have this lock system, whereas none of the ones I checked using the regular MangaThemesia base class had it (I checked like 20), so I assumed it was related to the theme. Do you know what addon it comes from?

To be honest I still don't fully understand what MangaThemesiaAlt is, like why is there an Alt version? Is there a second version of the Manga theme on Themesia or something? We should really have documentation

@AwkwardPeak7
Copy link
Contributor

Alt version have additional logic for dynamic urls (random part in manga url which changes every so often)

@lord-ne
Copy link
Contributor Author

lord-ne commented Dec 18, 2024

I see a few ways forward here, so I'm writing them out here to get your thoughts:

  1. Manually implement this for Night Scans and Thunder Scans.
    a. This is simple, but we'd be duplicating a lot of code. It would get pretty annoying if any more sources needed this, we'd be copying the code everywhere.
  2. Create some helper methods in the mangathemesia lib to help implement this
    a. Basically all the sources would have to do is call the helper methods inside their setupPreferenceScreen and chapterListSelector functions. But I'm not sure if creating helper methods like that is really something we do in this codebase.
  3. Keep the functionality in the MangaThemesiaAlt class
    a. This is pretty simple. We should probably have a boolean to enable/disable it even if we do keep it here; we don't want the preference showing up for sources that actually don't need it.
  4. Put the functionality in the MangaThemesia class
    a. This makes more sense conceptually than (3), but if it's tricky if we won't want the preference option to show up for sources that don't support it (which is most of them, so we probably do want to ensure it doesn't show up) because MangaThemesia doesn't currently have any preferences or inherit from ConfigurableSource, and we wouldn't want to have a blank preference screen show up.

I'm leaning towards (2), I'll throw together an implementation and see how it looks.

@lord-ne lord-ne changed the title Hide paid chapters in MangaThemesiaAlt [MangaThemesia] Option to hide paid chapters Dec 18, 2024
@lord-ne
Copy link
Contributor Author

lord-ne commented Dec 18, 2024

Updated and bench tested. How does this implementation look @AwkwardPeak7 ?

@AwkwardPeak7
Copy link
Contributor

honestly just change selector in those sources to block paid chapters without any preference to toggle it.... that is what we usually do for most of such sources and only add preference if users ask for it.

@lord-ne
Copy link
Contributor Author

lord-ne commented Dec 19, 2024

I've actually been finding the toggle useful, some of these sites have decent coin rates where it's only like 10 cents per chapter, so on some of them I actually do want to leave the toggle off and buy the chapters.

@lord-ne lord-ne requested a review from AwkwardPeak7 December 22, 2024 15:30
@AwkwardPeak7 AwkwardPeak7 merged commit b389786 into keiyoushi:main Dec 24, 2024
23 checks passed
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Thunder Scans: Premium/Paid Chapters Auto detect
2 participants