Skip to content

Feature: Track entries privately if supported by the tracker#1736

Merged
AntsyLich merged 31 commits intomihonapp:mainfrom
NarwhalHorns:main
Feb 25, 2025
Merged

Feature: Track entries privately if supported by the tracker#1736
AntsyLich merged 31 commits intomihonapp:mainfrom
NarwhalHorns:main

Conversation

@NarwhalHorns
Copy link
Copy Markdown
Contributor

@NarwhalHorns NarwhalHorns commented Feb 16, 2025

Features in #1735

This will include only the tracker abstraction and AniList implementation

  • Add a private tracking setting toggle to allow private tracking.
  • Add supportsPrivateTracking to Trackers
  • if tracking is enabled and supported, can choose between private or public tracking when adding a track on the search screen
  • Add a toggle to the track info screen to toggle between private and public tracking on entries if enabled and supported
Public Private
image image
Search with private enabled and supported Search without private
image image
Settings option
image

@NarwhalHorns NarwhalHorns changed the title Track entries privately if supported by the tracker Feature: Track entries privately if supported by the tracker Feb 16, 2025
@MajorTanya
Copy link
Copy Markdown
Member

MajorTanya commented Feb 16, 2025

I'm currently trying to find prior art on properly keeping track of private/not private with AL.

Edit: I think I've found something but if I'm right we might have to replace the entire query with a different one 🤔

Edit 2: Or maybe not...

Edit 3: I'll clone this and see if I can figure out why it's not handling properly

@NarwhalHorns
Copy link
Copy Markdown
Contributor Author

Good luck, I'll keep digging too

Comment thread app/src/main/java/eu/kanade/tachiyomi/data/track/anilist/dto/ALManga.kt Outdated
…LManga.kt

Co-authored-by: MajorTanya <39014446+MajorTanya@users.noreply.github.com>
Comment thread app/src/main/java/eu/kanade/presentation/track/TrackerSearch.kt Outdated
@MajorTanya
Copy link
Copy Markdown
Member

The Row should look pretty much identical but now it's the normal Row scope used in other places. FlowRow, according to its docs, would also start overflowing if the content didn't fit and make another row (not desirable here right now).

Haven't taken a super detailed look at everything but considering it worked perfectly fine once we found that sneaky little thing, it seems to be good work.

Specifically, I checked an entry that I had already added as private through the AL website and then connected that to Mihon, which got kept correctly now. (Mihon show "Private" and AL still has the checkbox ticked).
Also added an entirely new entry from within Mihon that didn't exist on my AL yet, and that also worked correctly when I selected the private tracking option. AL showed the checkbox ticked and Mihon showed "Private".

Others may have other suggestions but the feature itself appears to be working. Nice job! 👍

@NarwhalHorns NarwhalHorns marked this pull request as ready for review February 16, 2025 15:28
@AntsyLich
Copy link
Copy Markdown
Member

I don't quite like the UI. Are you able to provide any alternative designs?

@NarwhalHorns
Copy link
Copy Markdown
Contributor Author

I don't quite like the UI. Are you able to provide any alternative designs?

Mmm, I wasn't really sure what to go with and just winged what came to me first. what aspects of it don't you like or any suggestions?

@AntsyLich
Copy link
Copy Markdown
Member

In the tracker sheet the private toggle has more visual space given it's likely a one time toggle. And there being 2 type of track button in search

@NarwhalHorns
Copy link
Copy Markdown
Contributor Author

yeah, on the 2 buttons I'm not sure what would be good. Like we could have the track button as is but have a private toggle checkbox or something on there somewhere, but it's just adding more steps. whereas 2 buttons keep both to a one step interaction.

on the setting toggle, not sure what you mean. I could move it to the bottom of the screen? or perhaps put it in advanced settings and just stick it in a tracking section?

@Animeboynz
Copy link
Copy Markdown
Contributor

Just my personal opinion but the selector feels overkill for just 2 options.
I feel like it would probably be cleaner to just switch it on click
Screenshot_20250217_203250_Chrome

@Animeboynz
Copy link
Copy Markdown
Contributor

In the tracker sheet the private toggle has more visual space given it's likely a one time toggle.

I guess it can also be moved to the overflow/kebab menu thing right? And show like the incognito icon as a badge on the tracker logo or next to the name

@NarwhalHorns
Copy link
Copy Markdown
Contributor Author

ohhhh i see what you mean now right. yeah good idea

@MajorTanya
Copy link
Copy Markdown
Member

MajorTanya commented Feb 17, 2025

This will include only the tracker abstraction and AniList implementation

I've checked the other non-enhanced trackers:
Has no support:

  • MAL
  • Shikimori
  • MangaUpdates*

Has support:

  • Kitsu
  • Bangumi

Whether these supporting trackers have a (good) way to do this via API, I have no clue. I just checked whether they have any sort of title-level privacy.

*MangaUpdates only has private/public lists, not a per-title way to set things to private.

@MajorTanya
Copy link
Copy Markdown
Member

MajorTanya commented Feb 17, 2025

Checking Kitsu Docs, the change for it could be extremely simple, just adding the private: true attribute to the request we send to them.

In KitsuApi.kt, in updateLibManga and addLibManga, you should be able to just add the private attribute to the JSON object being built.
Although you should still check Kitsu's DTOs for needed adjustments of course.

@MajorTanya
Copy link
Copy Markdown
Member

MajorTanya commented Feb 17, 2025

And Bangumi is looking similarly simple. But their docs are not only incomplete and in Chinese, they also contradict themselves and are out of date in places, so no links there. Aside from DTO changes, just adding the private attribute to the add and update lib manga method "should be it".

Edit: Wait no, BGM is not working with us here, I'll see how to actually do it.

@NarwhalHorns
Copy link
Copy Markdown
Contributor Author

NarwhalHorns commented Feb 17, 2025

I guess it can also be moved to the overflow/kebab menu thing right? And show like the incognito icon as a badge on the tracker logo or next to the name

How's this?

Privately tracked Publicly tracked
image image

tho I'm thinkin it would be better suited between remove and copy

@NarwhalHorns
Copy link
Copy Markdown
Contributor Author

if we can think of way to make the search private as unintrusive as this we probably don't need the full setting toggle tbh but i feel like that will be a harder task

@NarwhalHorns
Copy link
Copy Markdown
Contributor Author

NarwhalHorns commented Feb 17, 2025

how about this for the search?

image

@MajorTanya
Copy link
Copy Markdown
Member

The merge of #1748 means you could add Bangumi support with this too, as that has added a "private" attribute to the relevant DTO. If you don't wanna do that (which, fair enough), just give me a heads up and I'll do it once this PR goes through👍

I don't use it so wouldn't really be able to test it properly, but if it's as simple as adding a couple lines yeah sure

It's done using the same add/update methods currently used for adding/updating a library entry. Should just be one copy of put("private", track.private) or whatever in each of the BangumiApi.kt methods, and then handing that value over as is appropriate by your process.

@NarwhalHorns
Copy link
Copy Markdown
Contributor Author

It's done using the same add/update methods currently used for adding/updating a library entry. Should just be one copy of put("private", track.private) or whatever in each of the BangumiApi.kt methods, and then handing that value over as is appropriate by your process.

I think that should do it, i'm not 100% tho. Been a week since my brain ejected the finer details of this. Can you give it a quick test if you have bangumi?

@MajorTanya
Copy link
Copy Markdown
Member

MajorTanya commented Feb 25, 2025

Okay, so it works fine for newly added entries, and switching between public/private in linked entries also works. What doesn't work right now is tracking something as private if it's already in the user's list as a public entry. (i.e. I have EntryA in my list as public already but when I search it in Mihon, I select private tracking. This is not reflected on Bangumi's website until I switch to public tracking, then back to private tracking.)

That's because we don't update Bangumi at all if we find remote data for a track:

return if (statusTrack != null) {
track.copyPersonalFrom(statusTrack)
track.library_id = statusTrack.library_id
track.score = statusTrack.score
track.last_chapter_read = statusTrack.last_chapter_read
track.total_chapters = statusTrack.total_chapters
if (track.status != COMPLETED) {
track.status = if (hasReadChapters) READING else statusTrack.status
}
track
} else {

Not sure what the best approach would be here. When I removed the update call here, it made sense to me but apparently it wasn't that smart. Maybe I should hijack my emergeny linking fix #1770 or maybe I should make one update call anyway. Yeah I'm gonna make another PR for this, all the other trackers call update here too...

Edit: Filed #1771 which "fixes" this situation. Already tried it out by adding that patch to your PR locally and yeah, it works properly now, as far as I can tell. 👍 These issues are all on me, apologies.

MajorTanya added a commit to MajorTanya/mihon that referenced this pull request Feb 25, 2025
Most if not all other trackers do this too. Technically this causes
some request duplication (since things like the BaseTracker's
setRemoteLastChapterRead fire anyway due to the tracker sheet being
open. But considering the reduced number of requests in other places,
I think this is still acceptable.

This change will allow mihonapp#1736 to proceed, hopefully.
MajorTanya added a commit to MajorTanya/mihon that referenced this pull request Feb 25, 2025
Most if not all other trackers do this too. Technically this causes
some request duplication (since things like the BaseTracker's
setRemoteLastChapterRead fire anyway due to the tracker sheet being
open. But considering the reduced number of requests in other places,
I think this is still acceptable.

This change will allow mihonapp#1736 to proceed, hopefully.
AntsyLich pushed a commit that referenced this pull request Feb 25, 2025
Most if not all other trackers do this too. Technically this causes
some request duplication (since things like the BaseTracker's
setRemoteLastChapterRead fire anyway due to the tracker sheet being
open. But considering the reduced number of requests in other places,
I think this is still acceptable.

This change will allow #1736 to proceed, hopefully.
Comment thread CHANGELOG.md Outdated
Comment thread app/src/main/java/eu/kanade/tachiyomi/data/database/models/Track.kt Outdated
Comment thread app/src/main/java/eu/kanade/tachiyomi/data/database/models/Track.kt Outdated
Comment thread app/src/main/java/eu/kanade/tachiyomi/data/track/anilist/Anilist.kt Outdated
Comment thread app/src/main/java/eu/kanade/tachiyomi/data/track/bangumi/Bangumi.kt Outdated
Co-authored-by: AntsyLich <59261191+AntsyLich@users.noreply.github.com>
@AntsyLich
Copy link
Copy Markdown
Member

Can you also add kitsu support?

@NarwhalHorns
Copy link
Copy Markdown
Contributor Author

NarwhalHorns commented Feb 25, 2025

Can you also add kitsu support?

no idea, can look into it but i only use anilist so can't test it and would be going in blind

wtf are these API docs o.O

would probably be best to leave kitsu to someone else that knows it better tbh. Should be simple once this framework is in tho

@MajorTanya
Copy link
Copy Markdown
Member

Kitsu's docs are probably the best ones we have 😅 but I've heard the call, I'll make a separate one for Kitsu.

cuong-tran added a commit to komikku-app/komikku that referenced this pull request Feb 25, 2025
This comes with many benefits:
- Starting dates are now available and shown to users
- Lays groundwork to add private tracking for Bangumi, e.g. in mihonapp/mihon#1736
- Mihon makes approximately 2-4 times fewer calls to Bangumi's API
- Simplified interceptor for the access token addition
  - v0 does not allow access tokens in the query string
- There is actively maintained documentation for it

Also shrunk the DTOs for Bangumi by removing attributes we have no
use for either now or in the foreseeable future. Volume data remains
in case Mihon wants to ever support volumes. But attributes such as
user avatars, nicknames, data relating to Bangumi's tag & meta-tag
systems, etc. have been removed or just not added to the DTOs.

Co-authored-by: cuong-tran <cuongtran.tm@gmail.com>
(cherry picked from commit a96fbba)
cuong-tran pushed a commit to komikku-app/komikku that referenced this pull request Feb 25, 2025
Most if not all other trackers do this too. Technically this causes
some request duplication (since things like the BaseTracker's
setRemoteLastChapterRead fire anyway due to the tracker sheet being
open. But considering the reduced number of requests in other places,
I think this is still acceptable.

This change will allow mihonapp/mihon#1736 to proceed, hopefully.

(cherry picked from commit 277d8ba)
@AntsyLich AntsyLich enabled auto-merge (squash) February 25, 2025 10:43
@AntsyLich AntsyLich merged commit 49b2b34 into mihonapp:main Feb 25, 2025
cuong-tran added a commit to komikku-app/komikku that referenced this pull request Feb 26, 2025
This comes with many benefits:
- Starting dates are now available and shown to users
- Lays groundwork to add private tracking for Bangumi, e.g. in mihonapp/mihon#1736
- Mihon makes approximately 2-4 times fewer calls to Bangumi's API
- Simplified interceptor for the access token addition
  - v0 does not allow access tokens in the query string
- There is actively maintained documentation for it

Also shrunk the DTOs for Bangumi by removing attributes we have no
use for either now or in the foreseeable future. Volume data remains
in case Mihon wants to ever support volumes. But attributes such as
user avatars, nicknames, data relating to Bangumi's tag & meta-tag
systems, etc. have been removed or just not added to the DTOs.

Co-authored-by: cuong-tran <cuongtran.tm@gmail.com>
(cherry picked from commit a96fbba)
cuong-tran pushed a commit to komikku-app/komikku that referenced this pull request Feb 26, 2025
Most if not all other trackers do this too. Technically this causes
some request duplication (since things like the BaseTracker's
setRemoteLastChapterRead fire anyway due to the tracker sheet being
open. But considering the reduced number of requests in other places,
I think this is still acceptable.

This change will allow mihonapp/mihon#1736 to proceed, hopefully.

(cherry picked from commit 277d8ba)
cuong-tran pushed a commit to komikku-app/komikku that referenced this pull request Feb 26, 2025
…#1736)

Co-authored-by: MajorTanya <39014446+MajorTanya@users.noreply.github.com>
Co-authored-by: AntsyLich <59261191+AntsyLich@users.noreply.github.com>
(cherry picked from commit 49b2b34)
@NarwhalHorns NarwhalHorns deleted the main branch February 26, 2025 08:50
cuong-tran added a commit to komikku-app/komikku that referenced this pull request Feb 26, 2025
This comes with many benefits:
- Starting dates are now available and shown to users
- Lays groundwork to add private tracking for Bangumi, e.g. in mihonapp/mihon#1736
- Mihon makes approximately 2-4 times fewer calls to Bangumi's API
- Simplified interceptor for the access token addition
  - v0 does not allow access tokens in the query string
- There is actively maintained documentation for it

Also shrunk the DTOs for Bangumi by removing attributes we have no
use for either now or in the foreseeable future. Volume data remains
in case Mihon wants to ever support volumes. But attributes such as
user avatars, nicknames, data relating to Bangumi's tag & meta-tag
systems, etc. have been removed or just not added to the DTOs.

Co-authored-by: cuong-tran <cuongtran.tm@gmail.com>
(cherry picked from commit a96fbba)
cuong-tran pushed a commit to komikku-app/komikku that referenced this pull request Feb 26, 2025
Most if not all other trackers do this too. Technically this causes
some request duplication (since things like the BaseTracker's
setRemoteLastChapterRead fire anyway due to the tracker sheet being
open. But considering the reduced number of requests in other places,
I think this is still acceptable.

This change will allow mihonapp/mihon#1736 to proceed, hopefully.

(cherry picked from commit 277d8ba)
cuong-tran pushed a commit to komikku-app/komikku that referenced this pull request Feb 26, 2025
…#1736)

Co-authored-by: MajorTanya <39014446+MajorTanya@users.noreply.github.com>
Co-authored-by: AntsyLich <59261191+AntsyLich@users.noreply.github.com>
(cherry picked from commit 49b2b34)
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Mar 1, 2025
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.

4 participants