socialWork in NewFeed

This commit is contained in:
nixzhu
2015-11-19 15:29:26 +08:00
parent c52d53b451
commit fc424aab49
3 changed files with 31 additions and 5 deletions
@@ -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)
}
}
@@ -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) {
@@ -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)
}
}