-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[NT-644] See all project category fix #1061
Conversation
…NT-644-thanks-button-fix
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 I think it's good that the cell is backed with a VM now and tested. I just think it would be good if we could align the naming conventions for the buttons and inputs, there are several variations in different places.
@@ -3,14 +3,48 @@ import Library | |||
import Prelude | |||
import UIKit | |||
|
|||
internal protocol ThanksCategoryCellDelegate: AnyObject { | |||
func thanksSeeAllProjectsTapped(_ cell: ThanksCategoryCell, category: KsApi.Category) |
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.
How about:
func thanksCategoryCell(_ cell: ThanksCategoryCell, didTapSeeAllProjectsWith category: KsApi.Category)
internal weak var delegate: ThanksCategoryCellDelegate? | ||
fileprivate let viewModel: ThanksCategoryCellViewModelType = ThanksCategoryCellViewModel() | ||
|
||
@IBOutlet fileprivate var seeAllProjectCategoryButton: UIButton! |
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.
Some places in this file we use (see all) project
singular and other places projects
plural. Would be nice to just have one convention.
Also is the name seeAllProjectsButton
not more accurate here? Or perhaps seeAllProjectsInCategoryButton
(feels a bit long)?
} | ||
|
||
@objc fileprivate func seeAllProjectCategoryTapped() { | ||
self.viewModel.inputs.allProjectCategoryButtonTapped() |
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.
Here there is just an inconsistency between the function name and the input name, so if you could align those to match with all other places that would be cool.
|
||
extension ThanksViewController: ThanksCategoryCellDelegate { | ||
func thanksSeeAllProjectsTapped(_: ThanksCategoryCell, category: KsApi.Category) { | ||
self.viewModel.inputs.categoryCellTapped(category) |
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 know this is an existing input but could also be good to align this naming with the delegate method naming once that's updated 🤷♂
import ReactiveSwift | ||
|
||
public protocol ThanksCategoryCellViewModelInputs { | ||
func allProjectCategoryButtonTapped() |
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.
This can also update once the button naming is update to match.
} | ||
|
||
public protocol ThanksCategoryCellViewModelOutputs { | ||
var notifyToGoToDiscovery: Signal<KsApi.Category, Never> { 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.
Can this be notifyDelegateToGoToDiscovery
?
@@ -3,14 +3,48 @@ import Library | |||
import Prelude | |||
import UIKit | |||
|
|||
internal protocol ThanksCategoryCellDelegate: AnyObject { | |||
func thanksSeeAllProjectsTapped(_ cell: ThanksCategoryCell, category: KsApi.Category) |
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 delegate method names usually follow the convention of starting the delegate name with the name of the class that's sending the message:
func thanksCategoryCell(_ cell: ThanksCategoryCell, didTapSeeAllProjectsWith category: KsApi.Category)
.observeForControllerAction() | ||
.observeValues { [weak self] in | ||
guard let _self = self else { return } | ||
self?.delegate?.thanksSeeAllProjectsTapped(_self, category: $0) |
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.
Here you could just call _self.delegate?.thanksSeeAllProjectsTapped(_self: category: $0)
since you unwrap self
in the previous line.
} | ||
|
||
public protocol ThanksCategoryCellViewModelOutputs { | ||
var notifyToGoToDiscovery: Signal<KsApi.Category, Never> { 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.
I wonder if this could be notifyDelegateGoToDiscovery
so we're specific about what object is being notified.
@@ -35,7 +35,7 @@ | |||
<edgeInsets key="layoutMargins" top="16" left="16" bottom="16" right="16"/> | |||
<viewLayoutGuide key="safeArea" id="njF-e1-oar"/> | |||
<connections> | |||
<outlet property="seeAllProjectsButton" destination="hbb-GW-PrV" id="Sfl-8U-s0p"/> | |||
<outlet property="seeAllProjectCategoryButton" destination="hbb-GW-PrV" id="RPG-Zr-HaH"/> |
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.
Should this be projects
plural? seeAllProjectsCategoryButton
🤔
…NT-644-thanks-button-fix
self.viewModel.outputs.notifyDelegateToGoToDiscovery | ||
.observeForControllerAction() | ||
.observeValues { [weak self] in | ||
guard let _self = self else { return } |
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.
By the way, Swift now lets us do guard let self = self else { ... }
for this sort of thing.
📲 What
See all [Category] projects
button does not work on Thanks Page, this PR fixes that issue.🤔 Why
Used
ThanksCategoryCellDelegate
so thatThanksViewController
dismisses and user sees all projects in a category whenSee all [Category] projects
button is tapped.🛠 How
More in-depth discussion of the change or implementation.
👀 See
Trello, screenshots, external resources?
✅ Acceptance criteria
See all [Category] projects
. Thanks Screen dismisses you should be at the category explore screen.