Commit Graph
100 Commits
Author SHA1 Message Date
schroda a423d11442 Prevent reader pages from getting cut off on small screens
In case the pages were larger in width then the screen, they got cut off and were not fully viewable.
2025-01-09 21:41:38 +01:00
schroda 288fee590d Extract "apply reader width" check into function 2025-01-09 02:11:44 +01:00
schroda 28eb18f88c Prevent custom scrollbar on iOS
While iOS does not support customizing the scrollbar, it seems there is a bug when the width and/or height gets set.

(see MediaQuery#getScrollbarSize) When inserting an empty div with forced scrollbars and calculating the scrollbar size, for some reason on iOS it has a scrollbar that affects the available size, which is not possible.
2025-01-09 00:46:25 +01:00
schroda 6bbaee6d8d Replace deprecated "apple-mobile-web-app-capable" meta tag 2025-01-09 00:28:19 +01:00
schroda 11765c021a Use new icon 2025-01-09 00:27:28 +01:00
schroda d66b3eb38d Handle main content screen right safe area 2025-01-08 23:59:26 +01:00
schroda 33162e70b0 Center delete icon in mutable list setting 2025-01-08 00:34:51 +01:00
schroda 054e837139 Move "readerType" "Webtoon" value migration to 3rd migration
Does not matter since it will only affect stable users which haven't had these migrations applied yet anyway
2025-01-06 12:51:43 +01:00
schroda feebd93555 Properly delete metadata during key deletion migration 2025-01-06 12:39:39 +01:00
schroda 6e0d1cfd3d Simplify metadata app key prefix migration 2025-01-06 12:23:41 +01:00
schroda 3d7a4146e4 Handle metadata key deletion early exit
In case no keys had to be deleted it always returned an empty object which broke the whole metadata migration and resulted in the final metadata to always fall back to the default values
2025-01-06 01:58:49 +01:00
schroda 9f42b75eee Prevent applying already applied metadata migrations again
The "appliedMigrationId" was converted to it's index of the "METADATA_MIGRATIONS" and then was compared to the "migration id" which starts at 1 instead of 0
2025-01-06 01:45:46 +01:00
schroda 724319b6c5 Only commit metadata migration changes of newly applied migration
Changes got commited everytime regardless off if the migration had already been applied
2025-01-06 01:42:42 +01:00
schroda d87fa3721e Migrate old reader settings II 2025-01-05 15:29:56 +01:00
schroda 05ce572c67 Add logic to delete metadata on migration 2025-01-05 15:29:56 +01:00
schroda bb473276a7 Handle multiple prefixes in metadata key migration
Was never updated after the change that made it possible that metadata can have multiple prefixes (e.g. device names)
2025-01-05 15:29:55 +01:00
schroda ab2b1b2218 Handle multiple prefixes in metadata value migration
Was never updated after the change that made it possible that metadata can have multiple prefixes (e.g. device names)
2025-01-05 15:29:54 +01:00
schroda d657ad3999 Commit new metadata after migration 2025-01-05 15:29:51 +01:00
schroda 040584989e Migrate metadata once instead of when reading a value 2025-01-05 14:54:37 +01:00
schroda 258b26f837 Remove unnecessary function exports 2025-01-05 14:54:20 +01:00
schroda 65da9db123 Correctly read last applied migration id from metadata 2025-01-05 14:53:52 +01:00
schroda 1533e37623 Add "migration" to global metadata keys 2025-01-04 21:31:47 +01:00
schroda a51d81d267 Extract "MetadataReader" functions 2025-01-04 21:28:26 +01:00
schroda b7971f5183 Move "getAppMetadataFrom" to "MetadataMigrations" 2025-01-04 21:27:51 +01:00
schroda 3782091601 Remove metadata "applyMigration" option 2025-01-04 21:23:05 +01:00
schroda 8ae8cfa140 Fix tsc issues 2025-01-04 20:59:18 +01:00
schroda 1b1ddeb334 Show "info" toast severity by default
The default severity of MUI is "success"
2025-01-04 16:28:16 +01:00
schroda afeb0f9aca Correctly check if chapter exists
The wrong chapter list was used.
"chapters" is the filtered list of chapters, which e.g. doesn't contain duplicated chapters.
This caused the "chapter source order" to potentially be higher than the total chapters of the manga.

The end result of this was that the fetched state of the pages wasn't properly detected causing errors due to rendering the reader before it was in the correct state
2025-01-04 15:58:33 +01:00
schroda 62155005ab Apply auto vertical progress bar for BOTTOM position only
In case "auto vertical position" is not "OFF" but the main position is not "BOTTOM", the auto mode still should be considered to be "OFF"
2025-01-02 22:22:31 +01:00
schroda 52f5415c9f Memoize mobile progress bar position related styling
Only really relevant for the "progress bar slot" prop to prevent the slots from unnecessary re-rendering, since depending on the total pages, this can impact the render performance on page changes heavily
2025-01-02 22:22:30 +01:00
schroda b5a0ec7371 Ignore reading direction for vertical progress bar
The page change handling of the progress bar was inverted while RTL was the set readers reading direction.
However, this is only relevant for the horizontal progress bar
2025-01-02 21:48:23 +01:00
schroda f90e4597f8 Make mobile progress bar position changeable 2025-01-02 21:48:02 +01:00
schroda 92892e6604 Optionally adjust progress bar position based on available size 2025-01-02 21:26:19 +01:00
schroda 4aa144cb25 Make minimized standard progress bar gaps transparent 2025-01-02 14:43:01 +01:00
schroda 87a1a67880 Use static hide timeout for all reader setting previews
The default timeout of "notistack" is 5s by default, however, this makes it more clear and also prevents any behaviour changes in the future, in case the default timeout gets changed
2025-01-02 03:22:25 +01:00
schroda af8ada9a62 Always add close button to snackbars 2025-01-02 03:04:14 +01:00
schroda ed992046cb Remove unintentional touch bindings
Caused double clicks
2025-01-02 02:41:42 +01:00
schroda 2944252d91 Make chapter transition warnings optional 2025-01-01 17:24:36 +01:00
schroda e199b75756 Show correct download queue removal failure 2025-01-01 16:44:18 +01:00
schroda f13e8eb412 Fix converting pages to double page mode 2024-12-31 17:17:54 +01:00
schroda f3792edac0 Ignore visible transition pages on page change in continuous pager 2024-12-31 17:03:42 +01:00
schroda 886cc469bc Fix TypeError when reaching scroll end in continuous pager
When the end of the scrollable element is reached in the continuous reader, the last image is not visible anymore.
Thus, the "firstVisibleImageIndex" is invalid and gets incorrectly used for the "isEndReached" case which results in an TypeError when trying to use the actual page via the index
2024-12-31 16:54:21 +01:00
schroda 8c147b797a Properly detect if image fills whole viewport
The thresholds are only for detecting if a specific side of the image is in the viewport.

For the check if the image fills the whole viewport, the thresholds incorrectly detect this depending on the readers reading direction.

E.g. in the continuous horizontal pager with theme direction LTR and reader reading direction RTL, the left threshold will be the total width of the viewport plus one which will lead to out of view images to be detected as completely filling the viewport
2024-12-31 16:51:28 +01:00
schroda d6a3d02189 Fix page jumping when scrolling continuous pagers
Both hardcoded thresholds (MIN_VISIBLE_PX 0 or 1) break the "first visible image" detection in different kind of ways.

With 1 it always incorrectly jumps to the next page when resuming a chapter, since the page to resume will bet at 0px.

With 0 it fails to detect the correct first visible image when scrolling (automatically not via wheel or touch) to another page.
This happens when there is no gap between the pages because in this case the start of the current image and the end of the previous image are at the same coordinate.
Thus, the previous image is still incorrectly detected as visible since the end still aligns with the viewports start/end
2024-12-31 16:43:46 +01:00
schroda c2c4115c9c Reset reader settings state on exit 2024-12-31 14:52:50 +01:00
schroda 7f04f1c860 Consider unset reader chapter as still loading
In case the "currentChapter" is undefined, it means that the state has not been set yet.
In case the "currentChapter" does not exist, it would be set to "null".
2024-12-31 14:52:49 +01:00
schroda 83e8a5fec1 Correctly check if reader chapter exists
As explained in c70287363a8e9308fc294baf83c5656a21a479b1, the "chapterSourceOrder" does not start at 0, thus, in case it's the last known chapter, "doesChapterExist" was always false due to subtracting 1 of the total chapters
2024-12-31 14:52:48 +01:00
schroda 899364ac85 Use proper name for reader url chapter "index" param
It's not the index of the chapter but the source order, which is starting at 1 and not 0
2024-12-31 14:52:47 +01:00
schroda 17cf8ec9d0 Update "pagesToSpreadState" during render
Gets rid of an unnecessary rendering
2024-12-31 13:25:37 +01:00
schroda 3bab657c52 Update "actualPages" immediately
Instead of immediately updating the value once the page count changed, it got updated after "pagesToSpreadState" changed, which was after the rendering finished.

This was the actual root cause of what was tried to be fixed with 9ab6ec89c7
2024-12-31 13:24:29 +01:00
schroda 36ae02d2bd Revert "Fix page resume in continuous pagers"
This reverts commit 9ab6ec89c7.
2024-12-31 12:46:25 +01:00
schroda 8594a7b178 Increase reserved "current page" text for double pager
For the double pager the current page text needs more reserved space since two pages are displayed at once which changes the current page text to "<page1>-<page2>" instead of just "<page1>"
2024-12-31 04:38:11 +01:00
schroda a0df80f60a Fix opening previous/next page via user action
Regression 55dc9471d9
2024-12-31 04:24:47 +01:00
schroda 9ab6ec89c7 Fix page resume in continuous pagers
The image refs weren't always set by the time the last read page got resumed.
Thus, the last read page never got scrolled into view
2024-12-31 04:05:53 +01:00
schroda f808614e6c Prevent layout shifts in continuous pagers
I was unable to find a fix for this problem, thus, the only solution I see is disabling this functionality for the continuous readers.

Due to preloading leading pages, the layout got shifted once the pages got loaded.
This messed with the scroll position which caused the top of the scrolled into views pages to not be at the top of the viewport anymore.
2024-12-31 02:51:20 +01:00
schroda 1d955257dd Prevent page jump on scroll to page
When an unloaded page got scrolled into view, the current page got incorrectly set to the next page once the page got loaded
2024-12-31 02:46:07 +01:00
schroda d885b4904e Render pages only once reader settings have been set
For the reader to be ready it's necessary that the settings not only have been loaded but also that the settings context is properly set
2024-12-31 02:46:04 +01:00
schroda 283bc1f706 Wait till reader setting are set to show previews
Sometimes the reader settings state took too long to get set and the previews were shown using the default settings first, since they are set as the default values of the reader settings context, and then again for the final settings
2024-12-31 02:45:12 +01:00
schroda 14044af1cd Reset "transition page mode" on reader exit 2024-12-31 02:21:36 +01:00
schroda 740acf63fc Show default "reading mode" setting
Regression 6ca6864035
2024-12-31 01:08:13 +01:00
schroda 9b706d0c82 Delay "reading mode" and "tap zone" preview until reader is ready 2024-12-30 21:23:39 +01:00
schroda f8d3be3911 Do not check for state change before set state call
Due to not including the states in the dependency array (to improve render performance), they do not include updated data and might cause an incorrect early exit.

E.g. in case a load error happened for a page whose loaded flag was already set to true, the pages load state never got updated again
2024-12-30 21:21:09 +01:00
schroda 95f95e770f Prevent TypeError and incorrect state updates for "pagesSpreadState"
Page spread state updates of an already closed chapter caused TypeErrors or incorrect state updates.
2024-12-30 21:03:13 +01:00
schroda 7c98bab43b Prevent TypeError and incorrect state updates for "pageLoadStates"
Page load state updates of an already closed chapter caused TypeErrors or incorrect state updates.
2024-12-30 21:03:10 +01:00
schroda 55dc9471d9 Hide chapter transition page in single/double pagers
Transition page got opened and never closed again due to not correctly detecting that a transition page is currently visible
2024-12-30 19:57:18 +01:00
schroda 1f3a3b6c39 Auto hide "tap zone layout" preview when opening reader 2024-12-30 19:41:49 +01:00
schroda fa868ea222 Properly detect "reading mode" and "tap zone" changes for preview 2024-12-30 19:33:37 +01:00
schroda 45f46a05d0 Optionally show preview or "reading mode" and "tap zone overlay"
Shows a preview when opening the reader or when the values change
2024-12-30 16:51:39 +01:00
schroda f3962646e6 Hide "tap zone overlay" on user action 2024-12-30 16:50:54 +01:00
schroda 6a32395234 Always show "tap zone layout" preview when necessary
In case the "tap zone layout" setting value got changed from or to the same value as the default value, the preview was never shown due to the canvas being reused and therefore not triggering the useEffect
2024-12-30 16:32:30 +01:00
schroda 6ca6864035 Make active reading mode default settings editable in reader 2024-12-30 14:52:09 +01:00
schroda 6bf3e297ef Open previous/next chapter at end of continuous pager via hotkey
For continuous pagers the chapter transition page is always visible regardless of the current "transitionPageMode".
However, this was not properly checked and thus, it wasn't considered to be visible and instead of opening the previous/next chapter, the transition page got set to be visible first and only with the second hotkey press did the chapter get opened
2024-12-30 14:12:11 +01:00
schroda 4fc4a8d9b3 Move library display options to global metadata
- showContinueReadingButton
- showDownloadBadge
- showUnreadBadge
2024-12-30 03:49:39 +01:00
schroda 8dc5ec339c Decrease "MIN_SCROLL_AMOUNT_PX" to 1px
Got removed from 00170c8e4a due to rebasing and squashing...
2024-12-30 02:19:17 +01:00
schroda 00170c8e4a Properly calculate auto scroll px amount
"scrollBy" and "scrollTo" require a change of at least 1px, otherwise, nothing will happen
2024-12-30 02:13:57 +01:00
schroda ce49084a89 Auto open next page after first change in single/double pager 2024-12-30 02:13:57 +01:00
schroda e2dd5ad211 Use animation frames for auto scrolling continuous pagers 2024-12-30 02:13:56 +01:00
schroda 8eae025d8f Use "coerceIn" util function 2024-12-29 23:41:27 +01:00
schroda 530ae1578f Prevent invalid values for "auto scroll speed"
The min/max limit was only acknowledged when the value was changed via MUIs step logic.
In case the number got inputted via keystrokes the limits did not get applied
2024-12-29 23:41:26 +01:00
schroda 06d0f7147a Update auto scroll direction on reader reading direction change 2024-12-29 23:41:25 +01:00
schroda d90767c71c Add "increase/decrease auto scroll speed" hotkeys 2024-12-29 23:41:24 +01:00
schroda 3238103ca0 Fix "rtl" detection in "useMouseDragScroll"
"isRTL" was set to the direction value instead of correctly to the boolean flag indicating if it is the actual rtl direction value.

This didn't cause any issues because for ltr because for ltr the result of "scrollAtT0.current[X] - delta[X])" was never less than "-maxScrollPos[X]" and for rtl it always used the expected value since "isRTL" was truthy.
2024-12-29 22:14:44 +01:00
schroda e459e94b71 Properly invert scroll direction in "useAutomaticScrolling" 2024-12-29 22:04:46 +01:00
schroda 732f27f319 Fix "rtl" detection in "useAutomaticScrolling" 2024-12-29 22:04:21 +01:00
schroda 74d9e21c76 Abort auto scroll interval for callback mode 2024-12-29 21:42:00 +01:00
schroda a943d2f2bc Extract logic from "ReaderViewer" into functions and hooks 2024-12-29 21:38:31 +01:00
schroda 9438a2f626 Unmount "ReaderNavBarDesktop" on exit
Re-rendering the component isn't too expensive and unmounting it improves the re-rendering caused by page changes since it doesn't get updated.

This removes ~7ms on a "current page" state update and ~25ms caused by the chapter update due to the "last read page" change
2024-12-29 21:38:31 +01:00
schroda 94ee7d4958 Improve "page spread page state" updates
Since "pagesToSpreadState" isn't part of the dependency array and also would decrease the render performance if it was (see reasoning of c79f7cc874), the array reference might be out of date and thus, the guard might not work correctly
2024-12-29 21:38:24 +01:00
schroda c79f7cc874 Improve "page load state" updates
Changes of d6ff85fdd3 decreased the render performance due to the "onLoad" function changing and causing all pages to re-render.
2024-12-29 17:21:37 +01:00
schroda aee42d7bb1 Adjust "MobileReaderProgressBar" active dragging styling 2024-12-28 04:06:03 +01:00
schroda 3185449816 Improve "MobileReaderProgressBar" progress bar click/drag handling
Convert clicks on the progress bar in such a way, that there is a "padding" around the page "dots".
Thus, e.g. even if the click was actually for page 1, if it is inside page 2 padding, it will behave like it was a click for page 2
2024-12-28 04:05:29 +01:00
schroda bc14b68507 Cleanup progress bar interaction handling 2024-12-28 02:33:33 +01:00
schroda 6bae3aaf3a Improve progress bar dragging detection 2024-12-28 02:33:06 +01:00
schroda 0c6872edb3 Improve progress bar rendering while dragging 2024-12-28 02:00:13 +01:00
schroda 347c88f240 Correctly check "page load state" before state update 2024-12-28 01:59:07 +01:00
schroda c5630ca5ce Reset "pageToScrollToIndex" after page selection
In case the current page changed after selecting a page, the previously selected page couldn't be selected again since the "pageToScrollToIndex" was still set to this page
2024-12-28 01:28:12 +01:00
schroda a69447384b Always open next page for auto scroll in single/double page mode
Depending on the reading direction, the previous page got opened instead of the next one.
2024-12-27 21:38:55 +01:00
schroda 3c57011f0c Fix margin of double pages with set reader width
Depending on the set reader width, the auto margin of the images took effect and separated the double pages.
However, for double pages, only the margin left/right depending on the page should be set, to properly center the pages without a gap between them
2024-12-27 21:00:02 +01:00
schroda 89138fadde Reserve only necessary space for "current page" text 2024-12-27 18:26:20 +01:00
schroda d6ff85fdd3 Prevent unnecessary "page load state" updates
Only update state in case it has changed
2024-12-27 18:26:19 +01:00