mirror of
https://github.com/wahyd4/Yep.git
synced 2026-08-10 21:36:49 +10:00
add avatarBarButton to ConversationViewController
This commit is contained in:
@@ -152,6 +152,7 @@
|
||||
<outlet property="takePhotoButton" destination="HcA-7v-16m" id="yfB-gA-lxG"/>
|
||||
<segue destination="f92-fs-zdh" kind="presentation" identifier="presentMessageMedia" id="esY-9F-IrH"/>
|
||||
<segue destination="wNI-He-VjY" kind="presentation" identifier="presentPickLocation" id="8Uc-bg-xSe"/>
|
||||
<segue destination="dwP-GL-7hj" kind="show" identifier="showProfile" id="jgY-Rr-bdd"/>
|
||||
</connections>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="chH-Zx-2Ge" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
@@ -1140,5 +1141,6 @@
|
||||
<inferredMetricsTieBreakers>
|
||||
<segue reference="l4P-ds-ihU"/>
|
||||
<segue reference="o3b-2D-AMq"/>
|
||||
<segue reference="jgY-Rr-bdd"/>
|
||||
</inferredMetricsTieBreakers>
|
||||
</document>
|
||||
|
||||
@@ -176,6 +176,20 @@ class ConversationViewController: UIViewController {
|
||||
|
||||
navigationItem.titleView = titleView
|
||||
|
||||
if let withFriend = conversation?.withFriend {
|
||||
AvatarCache.sharedInstance.roundAvatarOfUser(withFriend, withRadius: 22 * 0.5, completion: { image in
|
||||
dispatch_async(dispatch_get_main_queue()) {
|
||||
let button = UIButton(frame: CGRect(origin: CGPointZero, size: CGSize(width: 22, height: 22)))
|
||||
button.addTarget(self, action: "showProfile", forControlEvents: .TouchUpInside)
|
||||
button.setImage(image, forState: .Normal)
|
||||
|
||||
let avatarBarButton = UIBarButtonItem(customView: button)
|
||||
|
||||
self.navigationItem.rightBarButtonItem = avatarBarButton
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
NSNotificationCenter.defaultCenter().addObserver(self, selector: "updateConversationCollectionViewDefault", name: YepNewMessagesReceivedNotification, object: nil)
|
||||
|
||||
YepUserDefaults.avatarURLString.bindListener("ConversationViewController") { _ in
|
||||
@@ -719,6 +733,10 @@ class ConversationViewController: UIViewController {
|
||||
}
|
||||
|
||||
// MARK: Actions
|
||||
|
||||
func showProfile() {
|
||||
performSegueWithIdentifier("showProfile", sender: nil)
|
||||
}
|
||||
|
||||
func updateMoreMessageConversationCollectionView() {
|
||||
let moreMessageViewHeight = moreMessageTypesViewHeightConstraintConstant + CGRectGetHeight(messageToolbar.bounds)
|
||||
@@ -955,6 +973,17 @@ class ConversationViewController: UIViewController {
|
||||
// MARK: Navigation
|
||||
|
||||
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
|
||||
if segue.identifier == "showProfile" {
|
||||
|
||||
let nvc = segue.destinationViewController as! UINavigationController
|
||||
let vc = nvc.topViewController as! ProfileViewController
|
||||
|
||||
if let withFriend = conversation?.withFriend {
|
||||
let profileUser = ProfileUser.UserType(withFriend)
|
||||
|
||||
vc.profileUser = profileUser
|
||||
}
|
||||
}
|
||||
|
||||
if segue.identifier == "presentMessageMedia" {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user