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

[NT-889] (1/3) Landing page ui #1080

Merged
merged 11 commits into from
Feb 28, 2020
Merged

Conversation

Scollaco
Copy link
Contributor

@Scollaco Scollaco commented Feb 24, 2020

📲 What

. This is the first of a 3 parts work to create our new LandingPage.

🤔 Why

We want to tell new users a little more about Kickstarter during their first session.
JIRA ticket

🛠 How

  • Added LandingPageViewController
  • Added LandingPageViewModel and its tests (empty for now)

Note: There's no logic to present the viewController yet. This will be done in a different PR. So, for now, the viewController will be presented every time the app launches.

👀 See

♿️ Accessibility

  • Tap targets use minimum of 44x44 pts dimensions
  • Works with VoiceOver
  • Supports Dynamic Type

✅ Acceptance criteria

  • The layout matches the design from Figma (without scrollView).

)
.observeForUI()
.map {
LandingPageViewController()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is temporary and will be changed once the experiment and the "first session" logic are implemented (in a different PR).

Copy link
Contributor

@justinswart justinswart left a comment

Choose a reason for hiding this comment

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

I think as far as possible we shouldn't emit UI objects from our view models. I know this has been done previously in this VM and elsewhere but it seems like the wrong approach to me and has the potential to leak VCs and views in memory. For example, some time ago, I refactored this in RootViewModel to emit an enum instead of the actual VC - #623.

@@ -134,6 +134,9 @@ public protocol AppDelegateViewModelOutputs {
/// Emits when the root view controller should navigate to the creator dashboard.
var goToDiscovery: Signal<DiscoveryParams?, Never> { get }

/// Emits when the root view controller should present the Landing Page for new users.
var goToLandingPage: Signal<LandingPageViewController, Never> { get }
Copy link
Contributor

Choose a reason for hiding this comment

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

This can just be a Void or () signal and we can instantiate the VC outside of the VM.

|> \.textColor .~ UIColor.ksr_text_dark_grey_500
|> \.font .~ UIFont.ksr_callout()
|> \.textAlignment .~ .center
|> \.text %~ { _ in Strings.Pledge_to_projects_and_view_all_your_saved_and_backed_projects_in_one_place()
Copy link
Contributor

Choose a reason for hiding this comment

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

Can move Strings.Pledge... onto the next line to match the braces.

internal final class LandingPageViewModelTests: TestCase {
fileprivate let vm: LandingPageViewModelType = LandingPageViewModel()

fileprivate let landingPageCards = TestObserver<[UIView], Never>()
Copy link
Contributor

Choose a reason for hiding this comment

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

I also don't think we should emit actual UIViews here, rather the data that will be used to configure the views or an enum type representing them.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. sorry, I forgot to mention that this was also temporary. On the second PR (containing the cards, the signal emits [LandingPageCardType]). So for now, I will delete the property from the view model test 👍

self.labelsStackView,
self.cardsStackView,
spacer2,
spacer3,
Copy link
Contributor

Choose a reason for hiding this comment

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

Why the two spacers after each other? Are these just views that need to stretch?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The distribution of views of this layout is a bit different of what we usually do in the app (extra spacing on top and bigger space between cards and the button). I tried configuring the views in different ways, but the result was never satisfactory. I'm open to retry if you have strong feelings about it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh I guess I'm just not sure what the two spacers adjacent to each other would do that a single spacer view can't do? How are the spacers receiving their height?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Without the other spacer, the top view would be too low on iPhone 5s. The heights are being calculated by the stackView

self.viewModel.outputs.goToLandingPage
.observeForUI()
.observeValues { [weak self] landingPage in
self?.rootTabBarController?.present(landingPage, animated: true)
Copy link
Contributor

Choose a reason for hiding this comment

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

@Scollaco I think for the landing page we want it to be presented as a full screen modal - on iOS 13 the automatic modalPresentationStyle is pageSheet, so you'll want to be specific and set it to fullScreen so that it presents as full screen on iOS 13.

@nativeksr
Copy link
Collaborator

nativeksr commented Feb 25, 2020

1 Warning
⚠️ Big PR

Generated by 🚫 Danger

Copy link
Contributor

@ifbarrera ifbarrera left a comment

Choose a reason for hiding this comment

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

Can we disable landscape mode for this VC?


private enum Layout {
enum Button {
static let height: CGFloat = 54
Copy link
Contributor

Choose a reason for hiding this comment

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

Any reason we're not using our Styles.minTouchSize.height for buttons here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh good catch!

}

public final class LandingPageViewController: UIViewController {
// Properties
Copy link
Contributor

Choose a reason for hiding this comment

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

MARK?

])
}

@objc private func ctaBUttonTapped() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Typo here, should be ctaButtonTapped

label
|> \.text %~ { _ in Strings.Bring_creative_projects_to_life() }
|> \.font .~ UIFont.ksr_title3().bolded
|> \.textAlignment .~ .center
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we want to this to wrap with larger font sizes? Right now it's truncating.

Simulator Screen Shot - iPhone X - 2020-02-26 at 13 14 47

@Scollaco Scollaco merged commit e3d8906 into feature-landing-page Feb 28, 2020
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.

4 participants