Merge branch 'develop' of https://github.com/CatchChat/Yep into develop

This commit is contained in:
kevinzhow
2015-10-23 13:58:12 +08:00
5 changed files with 43 additions and 24 deletions
+1 -1
View File
@@ -77,4 +77,4 @@ SPEC CHECKSUMS:
SocketRocket: ee0b5c34182d37bb4f1f8d628bbe737718126daa
TPKeyboardAvoiding: 614ebec846ec28b83d548769297fa5fb56468904
COCOAPODS: 0.39.0
COCOAPODS: 0.38.2
@@ -888,7 +888,7 @@ class ConversationViewController: BaseViewController {
}
}
private func batchMarkMessagesAsReaded(updateOlderMessagesIfNeeded updateOlderMessagesIfNeeded: Bool = false) {
private func batchMarkMessagesAsReaded(updateOlderMessagesIfNeeded updateOlderMessagesIfNeeded: Bool = true) {
if let recipient = conversation.recipient, latestMessage = messages.last {
@@ -896,15 +896,6 @@ class ConversationViewController: BaseViewController {
if updateOlderMessagesIfNeeded {
// var x = 0
// messages.forEach { message in
// if !message.readed {
// x++
// }
// }
//
// println("x: \(x)")
var predicate = NSPredicate(format: "readed = false", argumentArray: nil)
if case .OneToOne = recipient.type {
@@ -28,6 +28,11 @@ class FeedConversationsViewController: UIViewController {
let feedConversationCellID = "FeedConversationCell"
deinit {
NSNotificationCenter.defaultCenter().removeObserver(self)
}
override func viewDidLoad() {
super.viewDidLoad()
@@ -48,6 +53,8 @@ class FeedConversationsViewController: UIViewController {
}
}
}
NSNotificationCenter.defaultCenter().addObserver(self, selector: "reloadFeedConversationsTableView", name: YepNewMessagesReceivedNotification, object: nil)
}
var isFirstAppear = true
@@ -344,17 +344,26 @@ extension FeedsViewController: UITableViewDataSource, UITableViewDelegate {
}
// simulate select effects when tap on messageTextView or cell.mediaCollectionView's space part
cell.touchesBeganAction = { [weak self] in
// indexPath indexPath cell cell
cell.touchesBeganAction = { [weak self] cell in
guard let indexPath = tableView.indexPathForCell(cell) else {
return
}
self?.tableView(tableView, willSelectRowAtIndexPath: indexPath)
tableView.selectRowAtIndexPath(indexPath, animated: false, scrollPosition: .None)
}
cell.touchesEndedAction = { [weak self] in
cell.touchesEndedAction = { [weak self] cell in
guard let indexPath = tableView.indexPathForCell(cell) else {
return
}
delay(0.03) {
self?.tableView(tableView, didSelectRowAtIndexPath: indexPath)
}
}
cell.touchesCancelledAction = {
cell.touchesCancelledAction = { cell in
guard let indexPath = tableView.indexPathForCell(cell) else {
return
}
tableView.deselectRowAtIndexPath(indexPath, animated: true)
}
+21 -9
View File
@@ -31,9 +31,9 @@ class FeedCell: UITableViewCell {
var tapAvatarAction: (() -> Void)?
var tapMediaAction: ((transitionView: UIView, imageURL: NSURL) -> Void)?
var touchesBeganAction: (() -> Void)?
var touchesEndedAction: (() -> Void)?
var touchesCancelledAction: (() -> Void)?
var touchesBeganAction: (UITableViewCell -> Void)?
var touchesEndedAction: (UITableViewCell -> Void)?
var touchesCancelledAction: (UITableViewCell -> Void)?
var attachmentURLs = [NSURL]() {
didSet {
@@ -99,24 +99,36 @@ class FeedCell: UITableViewCell {
avatarImageView.addGestureRecognizer(tapAvatar)
messageTextView.touchesBeganAction = { [weak self] in
self?.touchesBeganAction?()
if let strongSelf = self {
strongSelf.touchesBeganAction?(strongSelf)
}
}
messageTextView.touchesEndedAction = { [weak self] in
self?.touchesEndedAction?()
if let strongSelf = self {
strongSelf.touchesEndedAction?(strongSelf)
}
}
messageTextView.touchesCancelledAction = { [weak self] in
self?.touchesCancelledAction?()
if let strongSelf = self {
strongSelf.touchesCancelledAction?(strongSelf)
}
}
let backgroundView = TouchClosuresView(frame: mediaCollectionView.bounds)
backgroundView.touchesBeganAction = { [weak self] in
self?.touchesBeganAction?()
if let strongSelf = self {
strongSelf.touchesBeganAction?(strongSelf)
}
}
backgroundView.touchesEndedAction = { [weak self] in
self?.touchesEndedAction?()
if let strongSelf = self {
strongSelf.touchesEndedAction?(strongSelf)
}
}
backgroundView.touchesCancelledAction = { [weak self] in
self?.touchesCancelledAction?()
if let strongSelf = self {
strongSelf.touchesCancelledAction?(strongSelf)
}
}
mediaCollectionView.backgroundView = backgroundView
}