Repository navigation
Move the autosave logic from Controller into AutosaveController - #228
Merged
Merged
Conversation
Like the other controller collaborators, AutosaveController gets what it acts on (Model, DialogService, the recent folders, the store) plus an Operations interface for the view, the restore import and the JavaFX thread. The 5 s delay is a Timer that unit tests replace, so the autosave behavior is now covered by unit tests with a mocked DialogService.
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #228 +/- ##
============================================
+ Coverage 90.05% 90.23% +0.17%
- Complexity 2374 2398 +24
============================================
Files 135 136 +1
Lines 8901 8939 +38
Branches 865 866 +1
============================================
+ Hits 8016 8066 +50
+ Misses 462 455 -7
+ Partials 423 418 -5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Moves the autosave logic (#226) out of
Controllerinto a package-privateAutosaveController, following the pattern of the other controller collaborators (ImageFolderController,AnnotationIoController, …). Behavior is unchanged.Structure
AutosaveControllergets what it acts on:Model,DialogService, the stage,RecentImageFoldersand theAutosaveStore. It builds itsAutosaveWriterfrom an executor.Operationsinterface covers what stays inController: storing the view's shapes in the model, checking whether a shape is being drawn, starting the restore import, opening a folder, running on the JavaFX thread, and the status bar (autosave time, failure message).Timerinterface. The app uses aPauseTransition, and the unit tests use a fake one they fire by hand, so no JavaFX toolkit is needed.Controllercalls it at each point where autosave is involved: after edit checkpoints, when a folder is opened or closed, after the restore import, on exit, and when the window is hidden.Controllergoes from 1,733 to 1,558 lines.Tests
AutosaveControllerTest(15 unit tests, realModel, mockedDialogService):AutosaveTests(UI) now go throughcontroller.getAutosaveController().