diff --git a/Yep/Images.xcassets/icon_play.imageset/Contents.json b/Yep/Images.xcassets/icon_play.imageset/Contents.json new file mode 100644 index 00000000..6ef428d5 --- /dev/null +++ b/Yep/Images.xcassets/icon_play.imageset/Contents.json @@ -0,0 +1,13 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "icon_play.pdf" + } + ], + "info" : { + "version" : 1, + "author" : "xcode", + "template-rendering-intent" : "template" + } +} \ No newline at end of file diff --git a/Yep/Images.xcassets/icon_play.imageset/icon_play.pdf b/Yep/Images.xcassets/icon_play.imageset/icon_play.pdf new file mode 100644 index 00000000..5d017163 Binary files /dev/null and b/Yep/Images.xcassets/icon_play.imageset/icon_play.pdf differ diff --git a/Yep/ViewControllers/Conversation/ConversationViewController.swift b/Yep/ViewControllers/Conversation/ConversationViewController.swift index 142d1fb3..0a66db7a 100644 --- a/Yep/ViewControllers/Conversation/ConversationViewController.swift +++ b/Yep/ViewControllers/Conversation/ConversationViewController.swift @@ -298,6 +298,9 @@ class ConversationViewController: UIViewController { case MessageMediaType.Image.rawValue: return messageImageHeight + 10 + 10 + case MessageMediaType.Audio.rawValue: + return 50 + default: let rect = message.textContent.boundingRectWithSize(CGSize(width: messageTextLabelMaxWidth, height: CGFloat(FLT_MAX)), options: .UsesLineFragmentOrigin | .UsesFontLeading, attributes: messageTextAttributes, context: nil) @@ -549,6 +552,17 @@ extension ConversationViewController: UICollectionViewDataSource, UICollectionVi return cell + case MessageMediaType.Audio.rawValue: + let cell = collectionView.dequeueReusableCellWithReuseIdentifier(chatLeftAudioCellIdentifier, forIndexPath: indexPath) as! ChatLeftAudioCell + + AvatarCache.sharedInstance.roundAvatarOfUser(sender, withRadius: YepConfig.chatCellAvatarSize() * 0.5) { roundImage in + dispatch_async(dispatch_get_main_queue()) { + cell.avatarImageView.image = roundImage + } + } + + return cell + default: let cell = collectionView.dequeueReusableCellWithReuseIdentifier(chatLeftTextCellIdentifier, forIndexPath: indexPath) as! ChatLeftTextCell @@ -593,6 +607,16 @@ extension ConversationViewController: UICollectionViewDataSource, UICollectionVi return cell + case MessageMediaType.Audio.rawValue: + let cell = collectionView.dequeueReusableCellWithReuseIdentifier(chatRightAudioCellIdentifier, forIndexPath: indexPath) as! ChatRightAudioCell + + AvatarCache.sharedInstance.roundAvatarOfUser(sender, withRadius: YepConfig.chatCellAvatarSize() * 0.5) { roundImage in + dispatch_async(dispatch_get_main_queue()) { + cell.avatarImageView.image = roundImage + } + } + + return cell default: let cell = collectionView.dequeueReusableCellWithReuseIdentifier(chatRightTextCellIdentifier, forIndexPath: indexPath) as! ChatRightTextCell diff --git a/Yep/Views/Cells/ChatLeftAudio/ChatLeftAudioCell.swift b/Yep/Views/Cells/ChatLeftAudio/ChatLeftAudioCell.swift index 46b251ac..a00e8b08 100644 --- a/Yep/Views/Cells/ChatLeftAudio/ChatLeftAudioCell.swift +++ b/Yep/Views/Cells/ChatLeftAudio/ChatLeftAudioCell.swift @@ -10,6 +10,8 @@ import UIKit class ChatLeftAudioCell: UICollectionViewCell { + @IBOutlet weak var avatarImageView: UIImageView! + override func awakeFromNib() { super.awakeFromNib() // Initialization code diff --git a/Yep/Views/Cells/ChatLeftAudio/ChatLeftAudioCell.xib b/Yep/Views/Cells/ChatLeftAudio/ChatLeftAudioCell.xib index b13ac370..e457edd8 100644 --- a/Yep/Views/Cells/ChatLeftAudio/ChatLeftAudioCell.xib +++ b/Yep/Views/Cells/ChatLeftAudio/ChatLeftAudioCell.xib @@ -2,17 +2,89 @@ + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Yep/Views/Cells/ChatRightAudio/ChatRightAudioCell.swift b/Yep/Views/Cells/ChatRightAudio/ChatRightAudioCell.swift index c942dcfc..b34bb4f7 100644 --- a/Yep/Views/Cells/ChatRightAudio/ChatRightAudioCell.swift +++ b/Yep/Views/Cells/ChatRightAudio/ChatRightAudioCell.swift @@ -10,6 +10,8 @@ import UIKit class ChatRightAudioCell: UICollectionViewCell { + @IBOutlet weak var avatarImageView: UIImageView! + override func awakeFromNib() { super.awakeFromNib() // Initialization code diff --git a/Yep/Views/Cells/ChatRightAudio/ChatRightAudioCell.xib b/Yep/Views/Cells/ChatRightAudio/ChatRightAudioCell.xib index a15878ae..2f2c93c8 100644 --- a/Yep/Views/Cells/ChatRightAudio/ChatRightAudioCell.xib +++ b/Yep/Views/Cells/ChatRightAudio/ChatRightAudioCell.xib @@ -2,17 +2,89 @@ + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +