-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Conversation
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.
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) |
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.
is this just deleted because it is unused?
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.
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)") | ||
} |
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.
thanks for adding these tests!
Removed non used "metadata-podt" icon from assets |
Gina, great catch with shifted labels! |
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.
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 |
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.
@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.
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.
@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..
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.
@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)
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.
@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.
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.
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.
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. |
Thank you @theginbin! I believe that if we decide to create output signal for
|
@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. |
@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 馃憤 |
@bormind hey since your last commit separating out the Also, I think the idea was that we would refactor this to be separate outputs for each metadata property. |
@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:
|
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.
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 |
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.
*metadata
/// Emits matadata label text | ||
var metadataLabelText: Signal<String, NoError> { get } | ||
|
||
/// Emits metadata icon name |
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.
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 } |
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.
Just checking, this only seems to be used for the textColor
, is metadataIconAndTextColor
the right name?
Thank you @justinswart! |
Thank you @justinswart, @theginbin !! |
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 initializingPostcardMetadataData
to nil for thePostcardMetadataDataType.potd
After the change realized that we don't have tests for
DiscoveryPostCard
for featured and potD projects. ImplementedDiscoveryPageViewControllerTests.testView_Card_Project_TodaySpecial
test. Generated reference images for featured and potD post cardsSee 馃憖
Trello