This repository has been archived by the owner on Dec 15, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 63
Ensure crop points are current #50
Closed
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -260,8 +260,7 @@ class TrialDetailViewController: MaterialHeaderViewController, | |
self.preferenceManager = preferenceManager | ||
self.sensorDataManager = sensorDataManager | ||
cropValidator = CropValidator(trialRecordingRange: trial.recordingRange) | ||
cropRangeController = CropRangeViewController(trialCropRange: trial.cropRange, | ||
trialRecordingRange: trial.recordingRange) | ||
cropRangeController = CropRangeViewController(trialRecordingRange: trial.recordingRange) | ||
|
||
// MDCCollectionViewFlowLayout currently has a bug that breaks sectionHeadersPinToVisibleBounds | ||
// so we need to use a UICollectionViewFlowLayout instead until it's fixed. See issue: | ||
|
@@ -1128,8 +1127,6 @@ class TrialDetailViewController: MaterialHeaderViewController, | |
recordingRange: trial.recordingRange) | ||
} | ||
} | ||
|
||
cropRangeController.trialCropRange = editingCropRange | ||
} | ||
|
||
private func endCropping() { | ||
|
@@ -1296,17 +1293,25 @@ class TrialDetailViewController: MaterialHeaderViewController, | |
|
||
// Edit start time. | ||
actions.append(PopUpMenuAction(title: String.editCropStartTime, isEnabled: true) { _ in | ||
self.cropRangeController.showTimestampEditAlert(forCropMarkerType: .start) | ||
self.showTimestampEditAlert(for: .start) | ||
}) | ||
|
||
// Edit end time. | ||
actions.append(PopUpMenuAction(title: String.editCropEndTime, isEnabled: true) { _ in | ||
self.cropRangeController.showTimestampEditAlert(forCropMarkerType: .end) | ||
self.showTimestampEditAlert(for: .end) | ||
}) | ||
|
||
return actions | ||
} | ||
|
||
private func showTimestampEditAlert(for cropMarkerType: CropOverlayView.MarkerType) { | ||
guard let trialCropRange = self.currentPlaybackViewController?.1.cropRange else { | ||
return | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think this should ever be possible. I considered doing a |
||
} | ||
self.cropRangeController.showTimestampEditAlert(for: cropMarkerType, | ||
trialCropRange: trialCropRange) | ||
} | ||
|
||
/// Creates trial data for export. | ||
/// | ||
/// - Parameter completion: Called when complete with a Bool indicating success, and the trial | ||
|
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Setting this here feels a little weird to me, but I can't think of a better way to do it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not for this CL but: CropRangeViewController is very odd. Looking at this again it, it should ideally have one instance per presentation of the crop so you could just initialize and present at once, rather than initializing and calling the
show
methods repeatedly. It doesn't even have it's own view. Makes me think it should just be a coordinator object or combine with the EditTimestampViewController class which already fits the "one instance per action" pattern.