mirror of
https://github.com/wahyd4/Yep.git
synced 2026-08-23 11:45:58 +10:00
Merge branch 'develop' of https://github.com/CatchChat/Yep into develop
This commit is contained in:
+1
-1
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user