tachiyomi icon indicating copy to clipboard operation
tachiyomi copied to clipboard

Enable users to manually set manga status for library manga

Open datreesezcup opened this issue 3 years ago • 1 comments

Partially addresses #4398

The idea with this PR is to let users to have slightly more control over their library (and solving a couple of problems) by manually specifying the status that should be taken into account wherever the app queries the status of a manga (Eg. The "Completed" library filter, the "Only Update Ongoing Manga" setting, etc).

Implementation

Since status field in the database is a (presumably) 1 byte integer, I have elected to use this value to store both what the actual status of the manga is and what the user set the status to by dedicating 4 bits of the byte to each.

  • The lower 4 bits store the status of the manga (as reported by the source)
  • The upper 4 bits store the status of the manga as set by the user

Using 4 bits to track the status; there can be up to 16 different statuses for a manga. At least for now, I think this is an acceptable limit, as there are currently only 4 different statuses. Though while working on this, I did notice that it looks like the 5th and 6th options have been designated already.

Code that needs to get the status of a manga (through the Manga interface) can use a new getter, publicationStatus, which returns the status the user set, or what the actual status is if there is no user-set status. There are also getters and setters for the real status and user-set status. All of these getters and setters just perform bitwise-logic on the parent-interface SManga's status field.

Extension Compatibility

If I've done everything right, extensions need no changes at all, as extensions are passed the actual status of the manga, not the user-set status. I chose this to remove any possible side-effects of extensions having a different status than expected.

UI

On the UI side of things, to change the manga status I have made it so that clicking on the status text of a library manga will bring up a dialog of status options (From Source, Ongoing, Completed, Licensed), that the user can use to select. The "From Source" option means no user-set source. Additionally, when removing a manga from the library, the user status is cleared,

To indicate to the user that a custom status is applied, the status text becomes italic when there is a custom value set.

Preview
status_sample

P.S

I apologize for the wall-of-text PR, I just wanted to make sure I covered everything important, since this is the biggest and most complex PR I have created for Tachiyomi so far.

datreesezcup avatar Jul 02 '21 03:07 datreesezcup