This time, the Kitsu API docs are silent on whether this field (or
any other field) can be null/undefined/etc, but it can happen and
caused an error during search and update. This change just ensures the
attribute is nullable and is set to an empty String when it is null.
The API docs and the responses type `ratingTwenty` as a "number" (Int
in Kotlin, it's divided by 2 for a .5 step scale 0-10). It's nullable
because an entry without a user rating returns `null` in that field.
* Track when marked as read
* Add dismiss to snack bar
* i18n & ignore decimal chapters
* Detekt would have caught that 🤣
* `Ok` > `Yes`
* Dont prompt if untracked or current > new
* Move to MangaScreenModel
* Suggestions
Co-Authored-By: AntsyLich <59261191+AntsyLich@users.noreply.github.com>
* Review 2
* toggleAllSelections first
---------
Co-authored-by: AntsyLich <59261191+AntsyLich@users.noreply.github.com>
* 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.
* 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.
* Apply review changes
- Renamed `BangumiX` classes to `BGMX` classes.
- Renamed `toXStatus` and `toXScore` to `toApiStatus` and `toApiScore`
* 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
* 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.
* 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.
* 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.
* 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.
* Remove missed let
* Add query to get chapter count by manga and chapter number
* Add functions to get chapter count by manga and chapter number
* Only count read chapters
* Add interactor
* Savepoint
* Extract new chapter logic to separate function
* Update javadocs
* Add preference to toggle new functionality
* Add todo
* Add debug logcat
* Use string resource instead of hardcoding title
* Add temporary logcat for debugging
* Fix detekt issues
* Update javadocs
* Update download unread chapters preference
* Remove debug logcat calls
* Update javadocs
* Resolve issue where read chapters were still being downloaded during manual manga fetch
* Apply code review changes
* Apply code review changes
* Revert "Apply code review changes"
This reverts commit 1a2dce78acc66a7c529ce5b572bdaf94804b1a30.
* Revert "Apply code review changes"
This reverts commit ac2a77829313967ad39ce3cb0c0231083b9d640d.
* Group download chapter logic inside the interactor GetChaptersToDownload
* Update javadocs
* Apply code review
* Apply code review
* Apply code review
* Update CHANGELOG.md to include the new feature
* Run spotless
* Update domain/src/main/java/mihon/domain/chapter/interactor/FilterChaptersForDownload.kt
---------
Co-authored-by: AntsyLich <59261191+AntsyLich@users.noreply.github.com>
Both `SetupBackupCreateMigration` and `SetupLibraryUpdateMigration` were
trying to get the `App` class from Injekt which is never provided via
the `AppModule`. Using `Application` instead works since the
`workManager` property used by the respective `setupTask` functions is
an extension property on `Context`.
Co-authored-by: AntsyLich <59261191+AntsyLich@users.noreply.github.com>
* Add an "open in browser" button to reader menu
Signed-off-by: Catting <5874051+mm12@users.noreply.github.com>
* fixup! Add an "open in browser" button to reader menu
Signed-off-by: Catting <5874051+mm12@users.noreply.github.com>
---------
Signed-off-by: Catting <5874051+mm12@users.noreply.github.com>
The previous approach would always throw an Exception because
`SimpleDateFormat.format()` expects the input to be of type `Date` or
`Number`, not `String`.
* Backup/Restore Extension Repos
* Refactor
* Moving to Under App Settings
* Sort by URL, Check existing by SHA and Error Logging
Untested. Currently in a lecture and can't test if the changes really work.
* Changes to logic
* Don't ask me what's happening here
* Renaming Variables
* Fixing restoreAmount & changes to logic
Co-Authored-By: AntsyLich <59261191+AntsyLich@users.noreply.github.com>
---------
Co-authored-by: AntsyLich <59261191+AntsyLich@users.noreply.github.com>
* Don't use animateItem's fade-in/fade-out in FastScrollLazyColumn
* Move to extension function
Avoid using animateItemPlacement name since it's shadowed by compose-bom's deprecated one
* Fixes#1029
* Max Line Length Fix
* Update SettingsLibraryScreen.kt
No idea how this works.
Co-authored-by: Foolbar <118464521+Foolbar@users.noreply.github.com>
---------
Co-authored-by: Foolbar <118464521+Foolbar@users.noreply.github.com>
* Fix unsupported mime type error when saving images
Avoid using platform mime type map to get extensions as it may not have
all mime types we support.
* Fix jxl images downloading/reading
* Recommit for e-ink pref changes
* Fixed state holder for flash interval
* Detekt
* Refactor suggested by Antsy
* inverted currentDisplayRefresh check for early exit
* Refactor archive support with libarchive
* Revert string resource changs
* Only mark archive formats as supported
Comic book archives should not be compressed.
* Fixup
* Remove epub from archive format list
* Move to mihon package
* Format
* Cleanup
* Fix MigratorTest after update to io.mockk v1.13.11
Causing error: io.mockk.MockKException: was not can only be called on a mocked object
* remove import
- Extension being marked as not installed instead of untrusted after updating with private installer
- Extension update counter not updating due to extension being marked as untrusted
- Minimize `Key "extension-XXX-YYY" was already used` crash
While most Android skins are seemingly able to handle the millisecond
format, the documentation technically specifies seconds. This seems to
be causing issues on Samsung devices using the Samsung Gallery app,
which renders the millisecond timestamps as if they were second ones,
causing the dates to be set at some point in the year 56189.
This change should fix that issue on Samsung devices and have no real
impact on the rest.
* Fixed extra header introduced in 7ff95e2
* Removed parentheses to make detekt happy
* Updated relative date display for dates in the future
* Small cleanup for header creation logic
* replaced "and" with "&&" for better formatting
* Fix DelayedTrackingUpdateJob spam on update errors
DelayedTrackingUpdateJob would start spamming when it encountered an
error (e.g. a tracker has an issue) and never stop.
This seems to stem from a circular dependency between the Job's
`doWork` and TrackChapter's `await`.
TrackChapter sets up a completely new instance of the
DelayedTrackingUpdateJob if any Exception was thrown during the track
update.
This causes the Job to get replaced (as per the WorkManager's set
ExistingWorkPolicy).
Because of this, the guard clause at the start of doWork would never
trigger, as all instances of the Job would report being the 0th try
(because they were completely new instances).
This simple fix introduces a boolean `isRetry` parameter to
TrackChapter's await method, which is set to `false` by default.
DelayedTrackingUpdateJob however sets this parameter to `true`, which
means TrackChapter won't try to set up the Job again.
* Rename isRetry parameter to setupJobOnFailure
This also inverts the logic, so true & false were swapped.
* Add support for localdate based relative times
* Update History Screen to use new localdate based relative times
* Update Updates Screen to use new localdate based relative times
* Cleaned up date util classes
* Updated build time display
* Code cleanup
* Fixed crash in settings
* Updated Preferences item
* Worker Info works
* Fixed Tracker date display
* Code changes to pass detekt