Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Undo/Redo Feature for Mantis (#379)
* Undo/Redo Feature for Mantis * Addressing comments in PR * Add MantisExampleTests target back to project - somehow got deleted. * Adressing Comments in Chante List: - added "enableUndo" flag in Config - undo/redo/reset logic checks the "enableUndo" flag in cropViewController to enable functionality - abstracted the TransformRecord logic into the CropViewController class - removed UIButtons from TransformDelegate - moved TransformDelegate in to new file in the Protocols folder * added logic to validate the Catalyst menus (disable undo menus when "enableUndo" is false in Config file. * Address latest round of comments - More private variables. - Embedded controller uses proxy functions to communicate with CropViewController state. - Defaults function implementations in delegate methods. * Rename some delegate methods: cropViewControllerDidEnableUndo -> cropViewControllerDidUpdateEnableStateForUndo cropViewControllerDidEnableRedo -> cropViewControllerDidUpdateEnableStateForRedo cropViewControllerDidEnableReset -> cropViewControllerDidUpdateEnableStateForReset * TransformStack private now * changed actionString declaration. * removed unwanted space * Removed some old code, that was not needed anymore when the function signature changed. * removed func cropViewControllerDidImageTransformed(_ cropViewController: CropViewController) from CropViewControllerDelegate * Remove spaces * removed public from some data types: TransformType TransformRecord TransformStack * TransformDelegate methods no longer public * moved opening brackets up to end of function declarations * removed public modifier in all variables and function signatures in TransformRecord * removed public modifier from all variables and function signatures in TransformStack * Placeholder localization strings for "Change Crop" and "Reset Changes" * Localized "Change Crop" and "Reset Changes" using Google Translate. * updated the README.md file to describe Undo/Redo support. * Changed Chinese language localization strings * Refactoring work: - rename TransformDelegate methods - make TransformStack init a private method * - Fixed a localization bug - Removed a dead deprecation directive * cleaned up property list for TransformRecord * made dictionary passed to TransformRecord have strong type in value field * changed transformDelegate to an optional * made private some variables in TransformStack * Add new files to Mantis.xcodeproj: - TransformStack.swift - TransformRecord.swift - TransformDelegate.swift * remove dead code * Rename delegate methods in CropViewControllerDelegate: - cropViewControllerDidUpdateEnableStateForUndo(_ enable: Bool) -> cropViewController(_ cropViewController: CropViewController, didUpdateEnableStateForUndo enable: Bool) - cropViewControllerDidUpdateEnableStateForRedo(_ enable: Bool) -> cropViewController(_ cropViewController: CropViewController, didUpdateEnableStateForRedo enable: Bool) - cropViewControllerDidUpdateEnableStateForReset(_ enable: Bool) -> cropViewController(_ cropViewController: CropViewController, didUpdateEnableStateForReset enable: Bool) * Remove blanl line * Simplify an optional value boolean test * Remove three unused variables from TransformStack * Address a SwiftLint warning in TransformRecord * Address a SwiftLint warning in TransformRecord * Fixed Unit Tests in Mantis.xcodeproj related to new API for undo/redo feature. * remove first call to transform() in applyCropState() and just set the viewModel's cropBoxFrame to the transform.maskFrame * moved function "pushTransformRecordOntoStack" out of CropViewController and in to TransformStack class * added bounds check in TransformStack.popTransformStack() * added Unit Test for TransformStack * Updated TransformStack Unit Test.
- Loading branch information