diff --git a/Yep/ViewControllers/Conversation/ConversationViewController.swift b/Yep/ViewControllers/Conversation/ConversationViewController.swift index 227659bb..5075db30 100644 --- a/Yep/ViewControllers/Conversation/ConversationViewController.swift +++ b/Yep/ViewControllers/Conversation/ConversationViewController.swift @@ -2455,6 +2455,17 @@ class ConversationViewController: BaseViewController { vc.setBackButtonWithTitle() + case "presentNewFeed": + + guard let + nvc = segue.destinationViewController as? UINavigationController, + vc = nvc.topViewController as? NewFeedViewController + else { + return + } + + vc.socialWork = sender as? MessageSocialWork + /* case "showFeedMedia": @@ -3251,9 +3262,9 @@ extension ConversationViewController: UICollectionViewDataSource, UICollectionVi if let cell = cell as? ChatLeftSocialWorkCell { cell.configureWithMessage(message) - cell.createFeedAction = { [weak self] in + cell.createFeedAction = { [weak self] socialWork in - self?.performSegueWithIdentifier("presentNewFeed", sender: nil) + self?.performSegueWithIdentifier("presentNewFeed", sender: socialWork) } } diff --git a/Yep/ViewControllers/NewFeed/NewFeedViewController.swift b/Yep/ViewControllers/NewFeed/NewFeedViewController.swift index 6e1bd875..08d753cf 100644 --- a/Yep/ViewControllers/NewFeed/NewFeedViewController.swift +++ b/Yep/ViewControllers/NewFeed/NewFeedViewController.swift @@ -16,7 +16,9 @@ import Crashlytics let genrealSkill = Skill(category: nil, id: "", name: "general", localName: NSLocalizedString("Choose...", comment: ""), coverURLString: nil) class NewFeedViewController: UIViewController { - + + var socialWork: MessageSocialWork? + var afterCreatedFeedAction: ((feed: DiscoveredFeed) -> Void)? @IBOutlet weak var feedWhiteBGView: UIView! @@ -179,6 +181,10 @@ class NewFeedViewController: UIViewController { }, rejected: { }) } + + let hasSocialWork = (socialWork != nil) + mediaCollectionView.hidden = hasSocialWork + socialWorkContainerView.hidden = !hasSocialWork } override func viewDidAppear(animated: Bool) { diff --git a/Yep/Views/Cells/ChatLeftSocialWork/ChatLeftSocialWorkCell.swift b/Yep/Views/Cells/ChatLeftSocialWork/ChatLeftSocialWorkCell.swift index 95959f3a..0df88106 100644 --- a/Yep/Views/Cells/ChatLeftSocialWork/ChatLeftSocialWorkCell.swift +++ b/Yep/Views/Cells/ChatLeftSocialWork/ChatLeftSocialWorkCell.swift @@ -30,7 +30,8 @@ class ChatLeftSocialWorkCell: UICollectionViewCell { return imageView }() - var createFeedAction: (() -> Void)? + var socialWork: MessageSocialWork? + var createFeedAction: ((socialWork: MessageSocialWork) -> Void)? override func awakeFromNib() { super.awakeFromNib() @@ -52,6 +53,7 @@ class ChatLeftSocialWorkCell: UICollectionViewCell { super.prepareForReuse() socialWorkImageView.image = nil + socialWork = nil } func configureWithMessage(message: Message) { @@ -63,6 +65,8 @@ class ChatLeftSocialWorkCell: UICollectionViewCell { if let socialWork = message.socialWork { + self.socialWork = socialWork + var socialWorkImageURL: NSURL? guard let @@ -116,7 +120,12 @@ class ChatLeftSocialWorkCell: UICollectionViewCell { } @IBAction func sync(sender: BorderButton) { - createFeedAction?() + + guard let socialWork = socialWork else { + return + } + + createFeedAction?(socialWork: socialWork) } }