afterCreatedFeedAction for Audio

This commit is contained in:
nixzhu
2015-11-27 09:17:42 +08:00
parent ac4baafbc6
commit 4cca601ffd
2 changed files with 31 additions and 13 deletions
@@ -435,6 +435,23 @@ class FeedsViewController: BaseViewController {
return
}
let afterCreatedFeedAction: DiscoveredFeed -> Void = { [weak self] feed in
dispatch_async(dispatch_get_main_queue()) {
if let strongSelf = self {
strongSelf.feeds.insert(feed, atIndex: 0)
let indexPath = NSIndexPath(forRow: 0, inSection: Section.Feed.rawValue)
strongSelf.updateFeedsTableViewOrInsertWithIndexPaths([indexPath])
}
}
joinGroup(groupID: feed.groupID, failureHandler: nil, completion: {
})
}
switch identifier {
case "showProfile":
@@ -500,22 +517,19 @@ class FeedsViewController: BaseViewController {
vc.preparedSkill = skill
vc.afterCreatedFeedAction = { [weak self] feed in
vc.afterCreatedFeedAction = afterCreatedFeedAction
dispatch_async(dispatch_get_main_queue()) {
case "presentNewFeedVoiceRecord":
if let strongSelf = self {
strongSelf.feeds.insert(feed, atIndex: 0)
let indexPath = NSIndexPath(forRow: 0, inSection: Section.Feed.rawValue)
strongSelf.updateFeedsTableViewOrInsertWithIndexPaths([indexPath])
}
}
joinGroup(groupID: feed.groupID, failureHandler: nil, completion: {
})
guard let
nvc = segue.destinationViewController as? UINavigationController,
vc = nvc.topViewController as? NewFeedVoiceRecordViewController
else {
return
}
vc.afterCreatedFeedAction = afterCreatedFeedAction
/*
case "showFeedMedia":
@@ -11,6 +11,8 @@ import AVFoundation
class NewFeedVoiceRecordViewController: UIViewController {
var afterCreatedFeedAction: ((feed: DiscoveredFeed) -> Void)?
@IBOutlet weak var nextButton: UIBarButtonItem!
@IBOutlet weak var voiceRecordSampleView: VoiceRecordSampleView!
@@ -270,6 +272,8 @@ class NewFeedVoiceRecordViewController: UIViewController {
let vc = segue.destinationViewController as! NewFeedViewController
vc.attachment = .Voice(feedVoice)
vc.afterCreatedFeedAction = afterCreatedFeedAction
}
default: