mathewthe2 / immersion_reader

iOS Reader with Japanese popup dictionary
MIT License
27 stars 1 forks source link

Sorting by recent not working. #1

Open meguminnet opened 1 year ago

meguminnet commented 1 year ago

ttu-ttu default behaviour is to put first the most recently open book in front.

This is not happening either in the home screen of the app, neither inside the ttu-ttu reather.

Current sorting seems to be by order of being added, not even alphabetical. So when you mass add books you get the random sorting sometimes.

mathewthe2 commented 1 year ago

Seems to be a recent addition to ttu.

https://github.com/ttu-ttu/ebook-reader/commit/8fc55ff534832602a74cadd45eb829d6f2edfeec

It might not be straightforward to migrate to the latest version since there could be breaking changes.

To update the local build manually, it would require modifying the indexedb and adding the relevant timestamps. It would be incompatible with the data of current users of Immersion Reader.

meguminnet commented 1 year ago

How about alphabetical order as a stop gap until (if ever) gets updated to the last version of ttu? Is that hard to modify?

I know it's stupid, but the random order is really bothering me.

mathewthe2 commented 1 year ago

Well, we first have to define what alphabetical order means for Japanese book titles. Is it the localeCompare() in Javascript which separates the three writing systems when sorting, or do we sort based on the pronunciation of each mora based on a morphological analyzer like mecab,

Not to mention the sorting might be different for users with different language settings on their phones due to the behavior of localeCompare()

Also keep in mind of the possibility of English titles and "Chinese" titles.

meguminnet commented 1 year ago

I think it doesn't need to be that deep.

Right now I have 3 books with the same title only differentiated by the number and they are sorted like this Vol 3, Vol 1, Vol 2.

I would be fine if the series were together in proper order, even if they were not strictly in "alphabetical" order among them.

image

mathewthe2 commented 1 year ago

Since I plan to remove the ttu menu screen and only keep the custom screen for listing books in the upcoming version, I can save the reading sessions and sort them accordingly.

To give more context, the main menu screen fetches from the IndexedDB that ttu uses.

In the event that the main menu detects that a new book has been added, the new book will given the timestamp of the latest sync time and added to the embedded database. Book deletion will be synced similarly to the database.

mathewthe2 commented 1 year ago

Latest ttu version has been ported. No visible issues so far.

https://github.com/mathewthe2/immersion_reader/commit/d35ea1e034a13b76c2bcb1c4175a8d9e4110b152

mathewthe2 commented 1 year ago

Update: there is a critical image display bug with the latest ttu version on the mobile browser, and I can't locate the core issue.

I've rolled back to an older version that does not feature sorting. I will update this when I re-implement this feature