<commit_before>//
//  InternalProfileHeaderView.swift
//  Podcast
//
//  Created by <NAME> on 3/7/17.
//  Copyright © 2017 Cornell App Development. All rights reserved.
//

import UIKit

protocol InternalProfileHeaderViewDelegate {
    func internalProfileHeaderViewDidPressViewProfile(internalProfileHeaderView: InternalProfileHeaderView)
}

class InternalProfileHeaderView: UIView {
    
    static let height: CGFloat = 96
    
    let height: CGFloat = InternalProfileHeaderView.height
    let profileImageSideLength: CGFloat = 60
    let profileImageX: CGFloat = 18
    let padding: CGFloat = 12
    let nameLabelY: CGFloat = 31
    let nameLabelHeight: CGFloat = 17
    let viewProfileLabelY: CGFloat = 51
    let viewProfileLabelHeight: CGFloat = 14.5
    let separatorHeight: CGFloat = 1
    
    var viewProfileButton: UIButton!
    var profileImage: ImageView!
    var nameLabel: UILabel!
    var viewProfileLabel: UILabel!
    var separator: UIView!
    
    var delegate: InternalProfileHeaderViewDelegate?

    override init(frame: CGRect) {
        super.init(frame: frame)
        
        backgroundColor = .podcastWhite
        
        profileImage = ImageView(frame: .zero)
        profileImage.layer.cornerRadius = profileImageSideLength / 2
        profileImage.clipsToBounds = true
        profileImage.backgroundColor = .podcastWhiteDark
        addSubview(profileImage)
        
        nameLabel = UILabel(frame: .zero)
        nameLabel.font = .systemFont(ofSize: 14, weight: UIFontWeightSemibold)
        nameLabel.textColor = .podcastBlack
        nameLabel.textAlignment = .left
        addSubview(nameLabel)
        
        viewProfileLabel = UILabel(frame: .zero)
        viewProfileLabel.font = .systemFont(ofSize: 12, weight: UIFontWeightRegular)
        viewProfileLabel.textColor = .podcastTealBackground
        viewProfileLabel.textAlignment = .left
        viewProfileLabel.text = "View your profile"
        addSubview(viewProfileLabel)
        
        separator = UIView(frame: .zero)
        separator.backgroundColor = .podcastGray
        addSubview(separator)
        
        viewProfileButton = UIButton(type: .custom)
        viewProfileButton.backgroundColor = .clear
        viewProfileButton.addTarget(self, action: #selector(viewProfilePressed), for: .touchUpInside)
        addSubview(viewProfileButton)
        
    }
    
    override func layoutSubviews() {
        profileImage.frame = CGRect(x: profileImageX, y: (height - profileImageSideLength) / 2, width: profileImageSideLength, height: profileImageSideLength)
        profileImage.layer.cornerRadius = profileImageSideLength / 2
        nameLabel.frame = CGRect(x: profileImageX + profileImageSideLength + padding, y: nameLabelY, width: frame.width - (profileImageX + profileImageSideLength + 2 * padding), height: nameLabelHeight)
        viewProfileLabel.frame = CGRect(x: profileImageX + profileImageSideLength + padding, y: viewProfileLabelY, width: frame.width - (profileImageX + profileImageSideLength + 2 * padding), height: viewProfileLabelHeight)
        viewProfileButton.frame = CGRect(x: 0, y: 0, width: frame.width, height: frame.height)
        separator.frame = CGRect(x: 0, y: frame.height - separatorHeight, width: frame.width, height: separatorHeight)
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    func viewProfilePressed() {
        delegate?.internalProfileHeaderViewDidPressViewProfile(internalProfileHeaderView: self)
    }
    
    func setUser(_ user: User) {
        nameLabel.text = user.fullName()
        
        if let url = user.imageURL {
            profileImage.setImageAsynchronously(url: url, completion: nil)
        } else {
            profileImage.image = #imageLiteral(resourceName: "sample_profile_pic")
        }
    }

}
<commit_msg>fixing profile image bug<commit_after>//
//  InternalProfileHeaderView.swift
//  Podcast
//
//  Created by <NAME> on 3/7/17.
//  Copyright © 2017 Cornell App Development. All rights reserved.
//

import UIKit

protocol InternalProfileHeaderViewDelegate {
    func internalProfileHeaderViewDidPressViewProfile(internalProfileHeaderView: InternalProfileHeaderView)
}

class InternalProfileHeaderView: UIView {
    
    static let height: CGFloat = 96
    
    let height: CGFloat = InternalProfileHeaderView.height
    let profileImageSideLength: CGFloat = 60
    let profileImageX: CGFloat = 18
    let padding: CGFloat = 12
    let nameLabelY: CGFloat = 31
    let nameLabelHeight: CGFloat = 17
    let viewProfileLabelY: CGFloat = 51
    let viewProfileLabelHeight: CGFloat = 14.5
    let separatorHeight: CGFloat = 1
    
    var viewProfileButton: UIButton!
    var profileImage: ImageView!
    var nameLabel: UILabel!
    var viewProfileLabel: UILabel!
    var separator: UIView!
    
    var delegate: InternalProfileHeaderViewDelegate?

    override init(frame: CGRect) {
        super.init(frame: frame)
        
        backgroundColor = .podcastWhite
        
        profileImage = ImageView(frame: CGRect(x: profileImageX, y: (height - profileImageSideLength) / 2, width: profileImageSideLength, height: profileImageSideLength))
        profileImage.layer.cornerRadius = profileImageSideLength / 2
        profileImage.clipsToBounds = true
        profileImage.backgroundColor = .podcastWhiteDark
        addSubview(profileImage)
        
        nameLabel = UILabel(frame: .zero)
        nameLabel.font = .systemFont(ofSize: 14, weight: UIFontWeightSemibold)
        nameLabel.textColor = .podcastBlack
        nameLabel.textAlignment = .left
        addSubview(nameLabel)
        
        viewProfileLabel = UILabel(frame: .zero)
        viewProfileLabel.font = .systemFont(ofSize: 12, weight: UIFontWeightRegular)
        viewProfileLabel.textColor = .podcastTealBackground
        viewProfileLabel.textAlignment = .left
        viewProfileLabel.text = "View your profile"
        addSubview(viewProfileLabel)
        
        separator = UIView(frame: .zero)
        separator.backgroundColor = .podcastGray
        addSubview(separator)
        
        viewProfileButton = UIButton(type: .custom)
        viewProfileButton.backgroundColor = .clear
        viewProfileButton.addTarget(self, action: #selector(viewProfilePressed), for: .touchUpInside)
        addSubview(viewProfileButton)
        
    }
    
    override func layoutSubviews() {
        profileImage.frame = CGRect(x: profileImageX, y: (height - profileImageSideLength) / 2, width: profileImageSideLength, height: profileImageSideLength)
        profileImage.layer.cornerRadius = profileImageSideLength / 2
        nameLabel.frame = CGRect(x: profileImageX + profileImageSideLength + padding, y: nameLabelY, width: frame.width - (profileImageX + profileImageSideLength + 2 * padding), height: nameLabelHeight)
        viewProfileLabel.frame = CGRect(x: profileImageX + profileImageSideLength + padding, y: viewProfileLabelY, width: frame.width - (profileImageX + profileImageSideLength + 2 * padding), height: viewProfileLabelHeight)
        viewProfileButton.frame = CGRect(x: 0, y: 0, width: frame.width, height: frame.height)
        separator.frame = CGRect(x: 0, y: frame.height - separatorHeight, width: frame.width, height: separatorHeight)
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    func viewProfilePressed() {
        delegate?.internalProfileHeaderViewDidPressViewProfile(internalProfileHeaderView: self)
    }
    
    func setUser(_ user: User) {
        nameLabel.text = user.fullName()
        
        if let url = user.imageURL {
            profileImage.setImageAsynchronously(url: url, completion: nil)
        } else {
            profileImage.image = #imageLiteral(resourceName: "sample_profile_pic")
        }
    }

}

{'fraction_non_alphanumeric': 0.08112561794904297, 'fraction_numerical': 0.009760425909494233, 'mean_word_length': 3.100831600831601, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5381154', 'n_tokens_mistral': 2298, 'n_tokens_neox': 2181, 'n_words': 508}