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

Sharing in discovery card #152

Merged
merged 13 commits into from
May 10, 2017
Merged

Sharing in discovery card #152

merged 13 commits into from
May 10, 2017

Conversation

cdolm92
Copy link
Contributor

@cdolm92 cdolm92 commented May 9, 2017

WHAT

User can now share a project from the DiscoveryPostcardCell. In order to make that possible we implemented the discoveryPostcardTappedShared(shareContext:) delegate method. The DiscoveryPageViewController adheres to this method, presenting the share sheet.

simulator screen shot may 9 2017 11 44 24 am

Copy link
Contributor

@mbrandonw mbrandonw left a comment

Choose a reason for hiding this comment

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

amazing! just a few small comments but overall it looks great!

10219230-116640902_19-s4-v1

internal final class DiscoveryPostcardCell: UITableViewCell, ValueCell {
internal weak var delegate: DiscoveryPostcardCellDelegate? {
didSet {
self.viewModel.inputs.delegateDidSet()
Copy link
Contributor

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?

Copy link
Contributor Author

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)
Copy link
Contributor

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!
Copy link
Contributor

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)
Copy link
Contributor

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
// }
Copy link
Contributor

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?

Copy link
Contributor

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.

extension ShareContext: Equatable {
}

public func == (lhs: ShareContext, rhs: ShareContext) -> Bool {
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 the modern swift way of conforming to equatable is to put the func == inside the extension as a static func ==

return lhs == rhs
case let (.update(lhs), .update(rhs)):
return lhs == rhs
default:
Copy link
Contributor

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 defaults 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 =
Copy link
Contributor

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()
Copy link
Contributor

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.
Copy link
Contributor

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..."

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.

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
Copy link
Contributor

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!

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!

// controller.modalPresentationStyle = .popover
// let popover = controller.popoverPresentationController
// popover?.sourceView = self.shareButton
// }
Copy link
Contributor

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) }
Copy link
Contributor

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

Copy link
Contributor Author

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 = ()
}
Copy link
Contributor

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)
}
Copy link
Contributor

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.

Copy link
Contributor

@mbrandonw mbrandonw left a 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!

@cdolm92
Copy link
Contributor Author

cdolm92 commented May 10, 2017

bitmoji

@cdolm92 cdolm92 merged commit c1bf34b into master May 10, 2017
@cdolm92 cdolm92 deleted the sharing-in-discovery-card branch May 10, 2017 18:45
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