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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proj of the day label #205

Merged
merged 13 commits into from
Aug 1, 2017
Merged

Proj of the day label #205

merged 13 commits into from
Aug 1, 2017

Conversation

bormind
Copy link
Contributor

@bormind bormind commented Jul 13, 2017

What

Removing heart icon form the Project of the day label.

Why

Quotation trello card:
"When we add hearts to project cards, we'll have two hearts on a single discovery card.
After discussing with Maggie, we'll just remove the heart from the PotD label for iOS."

How

Set iconImage property while initializing PostcardMetadataData to nil for the PostcardMetadataDataType.potd
After the change realized that we don't have tests for DiscoveryPostCard for featured and potD projects. Implemented DiscoveryPageViewControllerTests.testView_Card_Project_TodaySpecial test. Generated reference images for featured and potD post cards

See 馃憖

Trello

@bormind bormind requested a review from theginbin July 13, 2017 20:25
Copy link
Contributor

@theginbin theginbin left a comment

Choose a reason for hiding this comment

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

Looking good Boris! Thanks for adding tests for the metadata. I noticed that padding is greater on the left of the "Project of the Day" text where the imageView would be. Can you try hiding the imageView in DiscoveryPostcardCell if the image is nil to see if that fixes that extra space?

func testView_Card_Project() {
let projectTemplate = anomalisaNoPhoto
|> Project.lens.dates.deadline .~ (self.dateType.init().timeIntervalSince1970 + 60 * 60 * 24 * 6)
Copy link
Contributor

Choose a reason for hiding this comment

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

is this just deleted because it is unused?

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, this is not used in the test and doesn't change the output screen


FBSnapshotVerifyView(parent.view,
identifier: "\(labeledProj.0)_lang_\(language)_device_\(device)")
}
Copy link
Contributor

Choose a reason for hiding this comment

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

thanks for adding these tests!

@bormind
Copy link
Contributor Author

bormind commented Jul 13, 2017

Removed non used "metadata-podt" icon from assets

@bormind
Copy link
Contributor Author

bormind commented Jul 13, 2017

Gina, great catch with shifted labels!
I fixed it by hiding image ctrl if icon is not present as you suggested.

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.

Just one comment and then also just noticed that one one or two of the french language screenshots padding seems bigger on the right: https://github.com/kickstarter/ios-oss/pull/205/files#diff-55f39769cd8f7cd3f48185dadd94e9b1

Is there perhaps a min-width on that container?

@@ -189,6 +189,7 @@ internal final class DiscoveryPostcardCell: UITableViewCell, ValueCell {
self.viewModel.outputs.metadataData
.observeForUI()
.observeValues { [weak self] data in
self?.metadataIconImageView.isHidden = data.iconImage == nil
Copy link
Contributor

Choose a reason for hiding this comment

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

@theginbin any idea why so many this was originally done with so many side-effects in a single observeValues?. I think if we did this today we'd have had an output for each of those and been more explicit about the logic in the view model.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@justinswart, @theginbin, I noticed it too. I don't see problem with this approach but it is different from our "regular way" of doing things. I would be very interested to have a short discussion on why having only one side-effect per signal is a better approach..

Copy link
Contributor

Choose a reason for hiding this comment

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

@justinswart you're totally right. I have no idea why this wasn't broken out into several outputs. It may have been built very early or done out of time constraint at the time before shipping. @bormind having only one side effect per signal makes it easier to test and understand exactly what is being changed (for example, label text versus just knowing that an entire piece of data changed)

Copy link
Contributor Author

@bormind bormind Jul 14, 2017

Choose a reason for hiding this comment

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

@theginbin this is why I wanted to have conversation about this. I actually disagree that It will be easier to test. I understand that change on any one of the data properties causes signal of entire data change. But because the data unit consist of contextually dependent properties, I believe having one signal for dat unit change will be simpler to describe in the unit test and easier to understand where actual problem is in case the bug happened.

Copy link
Contributor

Choose a reason for hiding this comment

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

I guess by "easer to test and understand", I mean that a unique output tells us exactly what we're expecting to update on the UI specifically. That's why we typically don't have one output to update the entire view because that doesn't tell us what we're doing with individual UI components.

@theginbin
Copy link
Contributor

approving this! but if you feel up for it, it would be good to add a new output for that hidden imageView and a test with it. It's good practice anyway.

@bormind
Copy link
Contributor Author

bormind commented Jul 14, 2017

Thank you @theginbin! I believe that if we decide to create output signal for imageView.isHidden property then should create output signals for all other meta properties:

self?.metadataIconImageView.image = data.iconImage
self?.metadataLabel.text = data.labelText
self?.metadataIconImageView.tintColor = data.iconAndTextColor
self?.metadataLabel.textColor = data.iconAndTextColor

@theginbin
Copy link
Contributor

@bormind so yeah I think you should go ahead and create outputs for all of them. By having separate outputs, we give the view model context about what is happening with the data. With a single output, we lose this context.

@justinswart
Copy link
Contributor

@bormind if you're feeling up to it it might be a useful exercise to break it up into separate outputs and write the corresponding tests! I realize it adds a fair bit of code to what was otherwise a pretty small change but it would be good for consistency with the rest of our code 馃憤

@justinswart
Copy link
Contributor

@bormind hey since your last commit separating out the metadataIconHidden into its own signal, did you not want to remove self?.metadataIconImageView.isHidden = data.iconImage == nil from the observeValues on self.viewModel.outputs.metadataData?

Also, I think the idea was that we would refactor this to be separate outputs for each metadata property.

@justinswart
Copy link
Contributor

@bormind hey just checking if you saw my last comment? Also I think we were still going to split this out into multiple outputs?

You said before on the PR:

Thank you @theginbin! I believe that if we decide to create output signal for imageView.isHidden property then should create output signals for all other meta properties

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.

Thanks for splitting out into separate outputs! Just one or two spelling comments and a question!

@@ -76,8 +76,20 @@ public protocol DiscoveryPostcardViewModelOutputs {
/// Emits a boolean to determine whether or not to display funding progress container view.
var fundingProgressContainerViewHidden: Signal<Bool, NoError> { get }

/// Emits the disparate data to be displayed on the metadata view label.
var metadataData: Signal<PostcardMetadataData, NoError> { get }
/// Emits matadata label text
Copy link
Contributor

Choose a reason for hiding this comment

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

*metadata

/// Emits matadata label text
var metadataLabelText: Signal<String, NoError> { get }

/// Emits metadata icon name
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this should say:

/// Emits metadata icon image

var metadataIcon: Signal<UIImage?, NoError> { get }

/// Emits metadata icon and text color
var metadataIconAndTextColor: Signal<UIColor, NoError> { get }
Copy link
Contributor

Choose a reason for hiding this comment

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

Just checking, this only seems to be used for the textColor, is metadataIconAndTextColor the right name?

@bormind
Copy link
Contributor Author

bormind commented Jul 31, 2017

Thank you @justinswart!

@bormind bormind merged commit 743f999 into master Aug 1, 2017
@bormind
Copy link
Contributor Author

bormind commented Aug 1, 2017

Thank you @justinswart, @theginbin !!

@justinswart justinswart deleted the proj-of-the-day-label branch August 13, 2019 18:18
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.

None yet

3 participants