<commit_before>//
//  LiveCourseDetailLecturerCell.swift
//  mala-ios
//
//  Created by 王新宇 on 16/10/20.
//  Copyright © 2016年 Mala Online. All rights reserved.
//

import UIKit

class LiveCourseDetailLecturerCell: MalaBaseLiveCourseCell {
    
    // MARK: - Property
    /// 课程模型
    var model: LiveClassModel? {
        didSet{
            guard let model = model else { return }
            lecturerNameLabel.text = model.lecturerName
            lecturerBioView.text = model.lecturerBio?.trim().replacingOccurrences(of: ";", with: "\n")
            lecturerAvatar.setImage(withURL: model.lecturerAvatar)
        }
    }
    
    
    // MARK: - Components
    /// 讲师姓名
    private lazy var lecturerNameLabel: UILabel = {
        let label = UILabel(
            text: "老师姓名",
            font: FontFamily.PingFangSC.Light.font(15),
            textColor: UIColor(named: .ArticleTitle)
        )
        return label
    }()
    /// 主讲资历
    private lazy var lecturerBioView: UILabel = {
        let label = UILabel(
            text: "",
            font: FontFamily.HeitiSC.Light.font(14),
            textColor: UIColor(named: .ArticleText)
        )
        label.numberOfLines = 0
        return label
    }()
    /// 老师头像
    private lazy var lecturerAvatar: UIImageView = {
        let imageView = UIImageView(
            frame: CGRect(x: 0, y: 0, width: 56, height: 56),
            cornerRadius: 28,
            image: "avatar_placeholder"
        )
        return imageView
    }()
    
    
    // MARK: - Instance Method
    override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        
        setupUserInterface()
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    
    // MARK: - Private Method
    private func setupUserInterface() {
        // Style
        
        // SubViews
        content.addSubview(lecturerNameLabel)
        content.addSubview(lecturerBioView)<commit_msg>IOS-547: Allow one tap to launch photo-browser on lecture avatar in LiveCourseDetailView.<commit_after>//
//  LiveCourseDetailLecturerCell.swift
//  mala-ios
//
//  Created by 王新宇 on 16/10/20.
//  Copyright © 2016年 Mala Online. All rights reserved.
//

import UIKit

class LiveCourseDetailLecturerCell: MalaBaseLiveCourseCell {
    
    // MARK: - Property
    /// 课程模型
    var model: LiveClassModel? {
        didSet{
            guard let model = model else { return }
            lecturerNameLabel.text = model.lecturerName
            lecturerBioView.text = model.lecturerBio?.trim().replacingOccurrences(of: ";", with: "\n")
            lecturerAvatar.setImage(withURL: model.lecturerAvatar)
        }
    }
    
    
    // MARK: - Components
    /// 讲师姓名
    private lazy var lecturerNameLabel: UILabel = {
        let label = UILabel(
            text: "老师姓名",
            font: FontFamily.PingFangSC.Light.font(15),
            textColor: UIColor(named: .ArticleTitle)
        )
        return label
    }()
    /// 主讲资历
    private lazy var lecturerBioView: UILabel = {
        let label = UILabel(
            text: "",
            font: FontFamily.HeitiSC.Light.font(14),
            textColor: UIColor(named: .ArticleText)
        )
        label.numberOfLines = 0
        return label
    }()
    /// 老师头像
    private lazy var lecturerAvatar: UIImageView = {
        let imageView = UIImageView(
            frame: CGRect(x: 0, y: 0, width: 56, height: 56),
            cornerRadius: 28,
            image: "avatar_placeholder"
        )
        imageView.enableOneTapToLaunchPhotoBrowser()
        return imageView
    }()
    
    
    // MARK: - Instance Method
    override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        
        setupUserInterface()
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    
    // MARK: - Private Method
    private func setupUserInterface() {
        // Style
        
        // SubViews
        content.addSubview(lecturerNameLabel)
        content.addSubview(lecturerBioView)
{'fraction_non_alphanumeric': 0.10011723329425556, 'fraction_numerical': 0.011488862837045722, 'mean_word_length': 1.9359944941500344, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '138282', 'n_tokens_mistral': 1367, 'n_tokens_neox': 1315, 'n_words': 285}