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

#253 | Enable and update Empty State views for Sayings & Categories #491

Merged
merged 3 commits into from
Mar 24, 2022

Conversation

moyerr
Copy link
Collaborator

@moyerr moyerr commented Mar 22, 2022

Closes #253


Description of Work

This PR had two main goals:

  1. Remove the feature flag that was preventing the Empty State from appearing on non-Development builds.
  2. Update the styling of the EmptyStateView to better reflect what is captured in the designs.

Screenshots

Orientation iPhone 13 iPad Mini
Portrait
Landscape

Copy link
Collaborator

@Clstroud Clstroud left a comment

Choose a reason for hiding this comment

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

Leaving a few notes to chat about, but this is a solid first PR! Leavings things tidier than you found them and that's awesome 🎉

Comment on lines +31 to +41
static func uniform(_ inset: CGFloat) -> UIEdgeInsets {
.init(top: inset, left: inset, bottom: inset, right: inset)
}

static func vertical(_ verticalInset: CGFloat) -> UIEdgeInsets {
.init(top: verticalInset, left: 0, bottom: verticalInset, right: 0)
}

static func horizontal(_ horizontalInset: CGFloat) -> UIEdgeInsets {
.init(top: 0, left: horizontalInset, bottom: 0, right: horizontalInset)
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Probably not a blocker, but something to consider: horizontal and vertical threw me for a loop up above because I couldn't tell if the inset was being uniformly applied to each edge, or if the total inset was being divided among each edge along that axis. APIs like this one on CGRect are probably what make me overthink things like this, but alas.

Having them be static functions is not bad, but I'm almost wondering if we would get more call site clarity out of following the SwiftUI-ish pattern of having UIEdgeInsets(top: CGFloat = .zero, left: CGFloat = .zero, bottom: CGFloat = .zero, right: CGFloat = .zero)?

Also: I know they're existing code but the operators also threw me off, so maybe I'm just having a case of EOD.

Comment on lines 11 to 29
extension StringProtocol {
/// The range spanning the full length of the String
var fullRange: Range<Index> {
startIndex ..< endIndex
}

/// The range spanning the full length of the String, represented as an `NSRange`
var fullNSRange: NSRange {
nsRange(from: fullRange)
}

/// Converts a range of Indices to its `NSRange` representation.
///
/// - Parameter rangeExpression: The range of string indices
/// - Returns: The `NSRange` representation of the `rangeExpression`
func nsRange<R: RangeExpression>(from rangeExpression: R) -> NSRange where R.Bound == Index {
NSRange(rangeExpression, in: self)
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm definitely into the idea of having the range of indices available in a more convenient way, but if we're extending something as generalized as StringProtocol I would love to see something that feels more like it's part of Foundation if that makes sense? Something like indexRange or rangeOfIndices? Just typing out loud here 🤔

I'm not personally in love with StringProtocol being able to produce NSRange values, in part because it feels like we're overloading that type unnecessarily when NSRange gives us a really clear initializer... but also ns being lowercased just feels wrong. Especially when you consider line 19 where it reads like an NSRange initializer but in SpONgeBob case 😛

I know we want to shift more in the direction of attributed strings for text styling going forward, and I wonder if there's anything we can do to extend attributed string to be more amenable to Swift strings as opposed to shoving that responsibility downward into StringProtocol 🤔 A discussion for another day!

@SashankPatel
Copy link
Contributor

SashankPatel commented Mar 23, 2022

Test Notes 2/23:
-Verified on Iphone 14.4 and 15.4 and iPad 15.4

  • Verified empty state on main screen for My Sayings
  • Verified layout with different orientations.
  • Verified empty state in My Saying Settings category with various orientations.
  • Verified empty state with new custom category in settings and main screen.
  • Verified empty state is replaced by phrase, when adding via main screen or settings.
  • Verified empty state is visible when deleting the only phrase in the category.
  • Verified feature flag is removed by running the adhoc build.
  • Noticed a bug related to Vocable iOS - Custom Category tile highlighting on Home screen. #463, when a phrase is added but that will be captured in a separate issue.
    • [from Rudy Salas - 3/23/22] Expanding on this bug related to 463: on this PR branch I am seeing the captured behavior but also that a new category does not automatically get selected when scrolling to it on an iPhone (via simulator). I will add a recording of this behavior to the bug ticket.
  • Empty state text does not match designs, but that will be covered in bug ticket: Vocable iOS - Empty State text mismatch #481

Copy link
Contributor

@SashankPatel SashankPatel left a comment

Choose a reason for hiding this comment

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

Good to go from Test.

@rhsalas3
Copy link
Contributor

rhsalas3 commented Mar 23, 2022

@moyerr and @sgordon1024

Are we removing the pagination from the screen when it's in an empty state? The Figma designs show the pagination elements. I have not looked at the work on this PR branch, I am just going off of the screenshots shared in the description of this PR.

I just want to make sure because I was actually just working on the existing pagination tests, and will make adjustments for this.

Update:
Left the same comment in Figma and Steve is content to have the buttons removed. He has since updated the designs in Figma to reflect this.

CC: @SashankPatel @rowildcard @CananArikan

@SashankPatel
Copy link
Contributor

This is still looking good after the latest commit: 🚢

Noticed an UI issue with orientation but that is not related and will be captured as a separate bug.

@moyerr moyerr merged commit 64cd705 into develop Mar 24, 2022
@moyerr moyerr deleted the feature/253/categories-sayings-empty-state branch March 24, 2022 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Empty states for My Sayings and Custom Categories
4 participants