     }
 
     @IBAction func changeAvatar(sender: UITapGestureRecognizer) {
-
 
         let alertController = UIAlertController(title: nil, message: nil, preferredStyle: .ActionSheet)
 


                            NSNotificationCenter.defaultCenter().postNotificationName(YepUpdatedProfileAvatarNotification, object: nil)
                        }
                    }
                }
            })
        }
        
        dismissViewControllerAnimated(true, completion: nil)
    }


extension EditProfileViewController: UIImagePickerControllerDelegate, UINavigationControllerDelegate {
    func imagePickerController(picker: UIImagePickerController, didFinishPickingImage image: UIImage!, editingInfo: [NSObject : AnyObject]!) {

        YepHUD.showActivityIndicator()

        s3PublicUploadParams(failureHandler: { (reason, errorMessage) in
            defaultFailureHandler(reason, errorMessage)

            YepHUD.hideActivityIndicator()

        }, completion: { s3UploadParams in

            let image = image.largestCenteredSquareImage().resizeToTargetSize(YepConfig.avatarMaxSize())

            var imageData = UIImageJPEGRepresentation(image, YepConfig.avatarCompressionQuality())

            uploadFileToS3(inFilePath: nil, orFileData: imageData, mimeType: "image/jpeg", s3UploadParams: s3UploadParams, completion: { (success, error) in
                println("upload avatar to s3 result: \(success), error: \(error)")

                if (success) {
                    let newAvatarURLString = "\(s3UploadParams.url)\(s3UploadParams.key)"

                    updateMyselfWithInfo(["avatar_url": newAvatarURLString], failureHandler: { (reason, errorMessage) in
                        defaultFailureHandler(reason, errorMessage)
                        
                        YepHUD.hideActivityIndicator()

                    }, completion: { success in
                        dispatch_async(dispatch_get_main_queue()) {
                            YepUserDefaults.setAvatarURLString(newAvatarURLString)

                            self.updateAvatar() {
                                YepHUD.hideActivityIndicator()
                            }

                            if
                                let myUserID = YepUserDefaults.userID(),
