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

Use DTOs to parse tracking API responses #1103

Merged
merged 9 commits into from
Sep 2, 2024

Commits on Sep 2, 2024

  1. Migrate tracking APIs to DTOs

    Changes the handling of tracker API responses to be parsed to DTOs
    instead of doing so "manually" by use of `jsonPrimitive`s and/or
    `Json.decodeFromString` invocations.
    
    This greatly simplifies the API response handling.
    
    Renamed constants to SCREAMING_SNAKE_CASE.
    
    Largely tried to name the DTOs in a uniform pattern, with the
    tracker's (short) name at the beginning of file and data class names
    (ALOAuth instead of OAuth, etc).
    
    With these changes, no area of the code base should be using
    `jsonPrimitive` and/or `Json.decodeFromString` anymore.
    MajorTanya committed Sep 2, 2024
    Configuration menu
    Copy the full SHA
    fc93c30 View commit details
    Browse the repository at this point in the history
  2. Fix wrong types in KitsuAlgoliaSearchItem

    This API returns start and end dates as Long and the score as Double.
    
    Kitsu's docs claim they're strings (and they are, when requesting
    manga details from Kitsu directly) but the Algolia search results
    return Longs and Double, respectively.
    MajorTanya committed Sep 2, 2024
    Configuration menu
    Copy the full SHA
    cf38769 View commit details
    Browse the repository at this point in the history
  3. Apply review changes

    - Renamed `BangumiX` classes to `BGMX` classes.
    - Renamed `toXStatus` and `toXScore` to `toApiStatus` and `toApiScore`
    MajorTanya committed Sep 2, 2024
    Configuration menu
    Copy the full SHA
    ee041be View commit details
    Browse the repository at this point in the history
  4. Handle migration from detekt to spotless

    Removed Suppressions added for detekt.
    
    Specifically removed:
    - `SwallowedException` where an exception ends as a default value
    - `MagicNumber`
    - `CyclomaticComplexMethod`
    - `TooGenericExceptionThrown`
    
    Also ran spotlessApply which changed SMAddMangaResponse
    MajorTanya committed Sep 2, 2024
    Configuration menu
    Copy the full SHA
    f8ece5f View commit details
    Browse the repository at this point in the history
  5. Fix Kitsu failing to add series

    The `included` attribute seems to only appear when the user already
    has the entry in their Kitsu list.
    
    Since both `data` and `included` are required for `firstToTrack`, a
    guard clause has been added before all its calls.
    MajorTanya committed Sep 2, 2024
    Configuration menu
    Copy the full SHA
    b923fe9 View commit details
    Browse the repository at this point in the history
  6. Fix empty Bangumi error when entry doesn't exist

    Previously, the non-null assertion (!!) would cause a
    NullPointerException and a Toast with
    "Bangumi error: " (no message) when the user had removed their list
    entry from Bangumi through other means like the website.
    
    Now it will show "Bangumi error: Could not find manga".
    
    This is analogous to the error shown by Kitsu under these
    circumstances.
    MajorTanya committed Sep 2, 2024
    Configuration menu
    Copy the full SHA
    ebccea3 View commit details
    Browse the repository at this point in the history
  7. Fix Shikimori ignoring missing remote entry

    The user would see no indication that Shikimori could not properly
    refresh the track from the remote. This change causes the error Toast
    notification to pop up with the following message
    "Shikimori error: Could not find manga".
    
    This is analogous to Kitsu and Bangumi.
    MajorTanya committed Sep 2, 2024
    Configuration menu
    Copy the full SHA
    07e9b0e View commit details
    Browse the repository at this point in the history
  8. Remove usage of let where not needed

    These particular occurrences weren't needed because properties are
    directly accessible to further act upon. This neatly simplifies these
    clauses.
    MajorTanya committed Sep 2, 2024
    Configuration menu
    Copy the full SHA
    418b299 View commit details
    Browse the repository at this point in the history
  9. Remove missed let

    MajorTanya committed Sep 2, 2024
    Configuration menu
    Copy the full SHA
    657ced5 View commit details
    Browse the repository at this point in the history