Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved Camera Button UI #39

Merged
merged 7 commits into from
Jul 23, 2021
Merged

Improved Camera Button UI #39

merged 7 commits into from
Jul 23, 2021

Conversation

jbrophy17
Copy link
Contributor

  • Updates camera buttons to be more similar to the Dress Code style
  • Adds option to skip optional photos without having to load the camera first
  • Fixes issue where landscape photos weren't getting displayed correctly in the preview

Pivotal Tracker tickets

https://www.pivotaltracker.com/story/show/177689520

Screenshots

Landscape
New UI Description
IMG_0587 Pre-Capture
IMG_0588 Required next photo
IMG_0590 Optional next photo
Portrait
New UI Description
IMG_0585 Pre-Capture
IMG_0586 Required next photo
IMG_0589 Optional next photo

- Move flash button next to camera button
- Move cancel button to top left
- Move finish button next to camera button
@jbrophy17 jbrophy17 requested a review from litso July 20, 2021 19:59
Copy link
Contributor

@MichaelM1177 MichaelM1177 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌

@@ -133,26 +141,29 @@ final class CameraOverlayView: UIView {
label.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
label.centerXAnchor.constraint(equalTo: self.centerXAnchor),
label.centerYAnchor.constraint(equalTo: flashButton.centerYAnchor)
label.centerYAnchor.constraint(equalTo: cancelButton.centerYAnchor)
])

return label
}()

private lazy var doneButton: UIButton = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit, could rename this button

@@ -299,10 +299,19 @@ private extension CameraViewModel {
resetFocus()

if let photoCapture = photoCaptureDelegate.photoCapture {
var remainingPhotoType: CameraOverlayView.RemainingPhotoType = .none
if photos.count + 2 <= settings.numberOfPhotos.upperBound {
Copy link
Contributor

@MichaelM1177 MichaelM1177 Jul 23, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice cleanup with this new enum

nit, maybe naming these in some way would be better since it is kinda confusing that 2 is being added because the current photo isn't in the photo count yet, something like:

let photoCountIncludingCurrentPhoto = photos.count + 1
if photoCountIncludingCurrentPhoto + 1 <= settings.numberOfPhotos.upperBound
if photoCountIncludingCurrentPhoto >= settings.numberOfPhotos.lowerBound

or

let nextPhotoWouldBeBelowMaxPhotoLimit = photos.count + 2 <= settings.numberOfPhotos.upperBound
let currentPhotoIsAboveMinimumPhotoRequirement = photos.count + 1 >= settings.numberOfPhotos.lowerBound

or both/something else

switch remainingPhotoType {
case .none:
saveAndContinueButton.setTitle("Finish", for: .normal)
finishReviewButton.isHidden = true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit, these two I wasn't sure which was which, I wasn't sure if meant finishing or confirming the photo after reviewing, maybe just finishButton or saveAndFinish to match saveAndContinue

it's a little tricky either way since the continue one can also be finish, but don't have a better name off the top of my head

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I couldn't come up with good names either :/

updated them to be saveAndCaptureMoreButton and saveAndEndCaptureButton. Really the first one should be like saveAndCaptureMoreIfPossibleButton but that's a little excessive I think

private func styleButton(_ button: UIButton, outline: Bool, color: UIColor) {
let backgroundColor: UIColor = color
let textColor: UIColor = .white

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit, think rather than assigning backgroundColor to the text and vice versa in the outline case it would be clearer to just set them directly

button.backgroundColor = outline ? .white : color
button.setTitleColor(outline ? color : .white, for: .normal)
button.layer.borderColor = outline ? color : .white

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why I tried to semi-preserve the logic from dress code. good call

if photos.count + 2 <= settings.numberOfPhotos.upperBound {
if photos.count + 1 >= settings.numberOfPhotos.lowerBound {
let photoCountIncludingCurrentPhoto = photos.count + 1
if photoCountIncludingCurrentPhoto < settings.numberOfPhotos.upperBound {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice catch on the <=, has that always been wrong then?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well it used to be +2 <= but I figured it would make more sense to just use the same +1 variable everywhere and change it to <

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wait that's the same logic right or am I trippin

Copy link
Contributor

@MichaelM1177 MichaelM1177 Jul 23, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the one you have now seems the correct one to me, but I think the logic changed because if you had:

upperBound: 1
photosCount: 0

then you would get:

photos.count + 1 < upperBound is true
photos.count + 2 <= upperBound is false

so I guess maybe it made sense the way it was handled before when it was canContinue because you would want false but now that you have .none you would want true

Copy link
Contributor

@MichaelM1177 MichaelM1177 Jul 23, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nvm, 1 is not less than 1, so they are both false, carry on lol 🤦‍♂️

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😁 It's okay my brain was having trouble too

John Brophy added 6 commits July 23, 2021 15:04
- Moves the label for the photo to the top of the screen when reviewing
  a photo to give us more room
- Preview after the photo was cropping landscape photos because it tried
  to display them in a portrait-oriented view
- Fix is to create the preview image with the portrait orientation (even
  if it is landscape) so that the image doesn't get rotated within our
  portrait-frame
@jbrophy17 jbrophy17 merged commit cede231 into master Jul 23, 2021
@jbrophy17 jbrophy17 deleted the camera-ui branch July 23, 2021 23:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants