<commit_before>//
//  NewsTableViewCell.swift
//  TOZ_iOS
//
//  Copyright © 2017 intive. All rights reserved.
//

import UIKit

class NewsTableViewCell: UITableViewCell {

    @IBOutlet weak var titleLabel: UILabel!
    @IBOutlet weak var datePublishedLabel: UILabel!
    @IBOutlet weak var photoView: ProfilePhotoView!
    @IBOutlet weak var photoViewHeight: NSLayoutConstraint!
    @IBOutlet weak var contentLabel: UILabel!
    override func awakeFromNib() {
        super.awakeFromNib()
        self.backgroundColor = Color.Cell.Background.primary
        self.titleLabel.textColor = Color.Cell.Font.title
        self.datePublishedLabel.textColor = Color.Cell.Font.date
        self.contentLabel.textColor = Color.Cell.Font.content
    }

    func configure(with news: NewsItem) {

        titleLabel.text = news.title
        contentLabel.text = news.contents
        let dateToString = DateFormatter()
        dateToString.dateFormat = "yyyy-MM-dd"
        if let published = news.published {
            datePublishedLabel.text = dateToString.string(from: published)
        }
        self.photoView.photo = nil
        let photoURL: URL? = news.photoUrl
        if let photoURL = photoURL {
            PhotoManager.shared.getPhoto(from: photoURL, completion: {(image) -> (Void) in
                self.photoView.photo = image
            })<commit_msg>Minor fix for loading images in cells.<commit_after>//
//  NewsTableViewCell.swift
//  TOZ_iOS
//
//  Copyright © 2017 intive. All rights reserved.
//

import UIKit

class NewsTableViewCell: UITableViewCell {

    @IBOutlet weak var titleLabel: UILabel!
    @IBOutlet weak var datePublishedLabel: UILabel!
    @IBOutlet weak var photoView: ProfilePhotoView!
    @IBOutlet weak var photoViewHeight: NSLayoutConstraint!
    @IBOutlet weak var contentLabel: UILabel!
    override func awakeFromNib() {
        super.awakeFromNib()
        self.backgroundColor = Color.Cell.Background.primary
        self.titleLabel.textColor = Color.Cell.Font.title
        self.datePublishedLabel.textColor = Color.Cell.Font.date
        self.contentLabel.textColor = Color.Cell.Font.content
    }

    func configure(with news: NewsItem) {

        titleLabel.text = news.title
        contentLabel.text = news.contents
        let dateToString = DateFormatter()
        dateToString.dateFormat = "yyyy-MM-dd"
        if let published = news.published {
            datePublishedLabel.text = dateToString.string(from: published)
        }
        self.photoView.photo = nil
        let photoURL: URL? = news.photoUrl
        if let photoURL = photoURL {
            PhotoManager.shared.getPhoto(from: photoURL, completion: {(image) -> (Void) in
                if photoURL == news.photoUrl {
                    self.photoView.photo = image
                }
            })
{'fraction_non_alphanumeric': 0.0887154009936125, 'fraction_numerical': 0.0028388928317956, 'mean_word_length': 2.528160200250313, 'pattern_counts': {'":': 0, '<': 3, '<?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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '101356', 'n_tokens_mistral': 822, 'n_tokens_neox': 787, 'n_words': 189}