-
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sharing in discovery card #152
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.
internal final class DiscoveryPostcardCell: UITableViewCell, ValueCell { | ||
internal weak var delegate: DiscoveryPostcardCellDelegate? { | ||
didSet { | ||
self.viewModel.inputs.delegateDidSet() |
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 doesn't seem to be used. is it needed?
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.
Nope! thanks
@@ -4,7 +4,16 @@ import Library | |||
import Prelude | |||
import UIKit | |||
|
|||
internal protocol DiscoveryPostcardCellDelegate: class { | |||
func discoveryPostcardTappedShared(shareContext: ShareContext) |
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.
could we add a lil comment to this to the effect of "Called when the share button is tapped"
.
@IBOutlet fileprivate weak var socialAvatarImageView: UIImageView! | ||
@IBOutlet fileprivate weak var socialLabel: UILabel! | ||
@IBOutlet fileprivate weak var socialStackView: UIStackView! | ||
@IBOutlet fileprivate weak var starButton: UIButton! | ||
@IBOutlet fileprivate weak var backgroundGradientView: GradientView! |
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.
could we alphabetize this?
super.awakeFromNib() | ||
|
||
self.starButton.addTarget(self, action: #selector(starButtonTapped), | ||
for: .touchUpInside) |
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.
would this fit on one line?
// controller.modalPresentationStyle = .popover | ||
// let popover = controller.popoverPresentationController | ||
// popover?.sourceView = self.shareButton | ||
// } |
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.
could we get rid of this commented code?
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.
@cdolm92 have you tested on ipad? this needs to be presented as a popover or it will error.
Library/ShareContext.swift
Outdated
extension ShareContext: Equatable { | ||
} | ||
|
||
public func == (lhs: ShareContext, rhs: ShareContext) -> Bool { |
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 the modern swift way of conforming to equatable is to put the func ==
inside the extension as a static func ==
Library/ShareContext.swift
Outdated
return lhs == rhs | ||
case let (.update(lhs), .update(rhs)): | ||
return lhs == rhs | ||
default: |
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 it possible to get rid of the default? we wanna shy away from default
s so that this will trigger a compile error when new cases are added to the enum
@@ -101,6 +101,20 @@ public let navyButtonStyle = | |||
<> UIButton.lens.layer.borderColor .~ UIColor.ksr_navy_900.cgColor | |||
<> UIButton.lens.layer.borderWidth .~ 1.0 | |||
|
|||
public let saveButtonStyle = |
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 and shareButtonStyle
are some great shared styles!
whatdya think about using these in the project nav bar view too so that we have a single place we are stylin?
|
||
func shareButtonTapped() | ||
|
||
func starButtonTapped() |
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.
doc these up?
@@ -76,6 +82,9 @@ public protocol DiscoveryPostcardViewModelOutputs { | |||
/// Emits a boolean to determine whether or not the metadata view should be hidden. | |||
var metadataViewHidden: Signal<Bool, NoError> { get } | |||
|
|||
/// Emits when we notify the delegate that the share button was tapped. |
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.
the wording on this could be more "Emits when we should notify the delegate..."
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.
Great job! Cool little thing to add to the cards. I just mention teeny things. The main issue would be making sure that this works as expected on iPad.
|
||
_ = self.starButton | ||
|> saveButtonStyle | ||
|> UIButton.lens.hidden .~ true |
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.
assuming this hidden
value is just here because the star hasn't been implemented yet, but just leaving a note to make sure it doesn't end up in bindStyles
later!
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!
// controller.modalPresentationStyle = .popover | ||
// let popover = controller.popoverPresentationController | ||
// popover?.sourceView = self.shareButton | ||
// } |
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.
@cdolm92 have you tested on ipad? this needs to be presented as a popover or it will error.
|
||
self.shareViewModel.outputs.showShareCompose | ||
.observeForControllerAction() | ||
.observeValues { [weak self] in self?.showShareCompose($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.
Can you explain why this was removed? I am forgetting the difference b/w the shareSheet and shareCompose
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.
We only want to use shareCompose in the ThanksViewController
.
fileprivate let delegateDidSetProperty = MutableProperty() | ||
public func delegateDidSet() { | ||
self.delegateDidSetProperty.value = () | ||
} |
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 brando already pointed out you aren't using this property in another place, but just marking this bit of code to eliminate as well.
self.vm.inputs.configureWith(shareContext: .discovery(newProject)) | ||
|
||
self.showShareSheet.assertValueCount(1) | ||
} |
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.
you could also assert that the new share context tracking string you added is being passed here.
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.
if tests pass I think we got it! great work!
WHAT
User can now share a project from the
DiscoveryPostcardCell
. In order to make that possible we implemented thediscoveryPostcardTappedShared(shareContext:)
delegate method. TheDiscoveryPageViewController
adheres to this method, presenting the share sheet.