<commit_before>//
//  NoNewNotificationsCell.swift
//  Freetime
//
//  Created by <NAME> on 6/30/17.
//  Copyright © 2017 <NAME>. All rights reserved.
//

import UIKit
import SnapKit

final class NoNewNotificationsCell: UICollectionViewCell {

    let emoji = UILabel()
    let label = UILabel()
    let shadow = CAShapeLayer()

    override init(frame: CGRect) {
        super.init(frame: frame)

        emoji.text = "🎉"
        emoji.textAlignment = .center
        emoji.backgroundColor = .clear
        emoji.font = UIFont.systemFont(ofSize: 60)
        contentView.addSubview(emoji)
        emoji.snp.makeConstraints { make in
            make.centerX.equalTo(contentView)
            make.centerY.equalTo(contentView).offset(-Styles.Sizes.tableSectionSpacing)
        }

        shadow.fillColor = UIColor(white: 0, alpha: 0.05).cgColor
        contentView.layer.addSublayer(shadow)

        label.text = NSLocalizedString("Inbox zero!", comment: "")
        label.textAlignment = .center
        label.backgroundColor = .clear
        label.font = Styles.Fonts.body
        label.textColor = Styles.Colors.Gray.light.color
        contentView.addSubview(label)
        label.snp.makeConstraints { make in
            make.centerX.equalTo(emoji)
            make.top.equalTo(emoji.snp.bottom).offset(Styles.Sizes.tableSectionSpacing)
        }

        resetAnimations()

        // CAAnimations will be removed from layers on background. restore when foregrounding.
        NotificationCenter.default
            .addObserver(self,
                selector: #selector(NoNewNotificationsCell.resetAnimations),
                name: NSNotification.Name.UIApplicationWillEnterForeground,
                object: nil
        )
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }

    override func layoutSubviews() {
        super.layoutSubviews()

        let width: CGFloat = 30
        let height: CGFloat = 12
        shadow.path = UIBezierPath(ovalIn: CGRect(origin: .zero, size: CGSize(width: width, height: height))).cgPath
        shadow.position = CGPoint(x: contentView.bounds.width/2 - 20, y: contentView.bounds.height/2 + 5)<commit_msg>Combine inbox zero views into one accessibility item (#527)<commit_after>//
//  NoNewNotificationsCell.swift
//  Freetime
//
//  Created by <NAME> on 6/30/17.
//  Copyright © 2017 <NAME>. All rights reserved.
//

import UIKit
import SnapKit

final class NoNewNotificationsCell: UICollectionViewCell {

    let emoji = UILabel()
    let label = UILabel()
    let shadow = CAShapeLayer()

    override init(frame: CGRect) {
        super.init(frame: frame)

        emoji.isAccessibilityElement = false
        emoji.text = "🎉"
        emoji.textAlignment = .center
        emoji.backgroundColor = .clear
        emoji.font = UIFont.systemFont(ofSize: 60)
        contentView.addSubview(emoji)
        emoji.snp.makeConstraints { make in
            make.centerX.equalTo(contentView)
            make.centerY.equalTo(contentView).offset(-Styles.Sizes.tableSectionSpacing)
        }

        shadow.fillColor = UIColor(white: 0, alpha: 0.05).cgColor
        contentView.layer.addSublayer(shadow)

        label.isAccessibilityElement = false
        label.text = NSLocalizedString("Inbox zero!", comment: "")
        label.textAlignment = .center
        label.backgroundColor = .clear
        label.font = Styles.Fonts.body
        label.textColor = Styles.Colors.Gray.light.color
        contentView.addSubview(label)
        label.snp.makeConstraints { make in
            make.centerX.equalTo(emoji)
            make.top.equalTo(emoji.snp.bottom).offset(Styles.Sizes.tableSectionSpacing)
        }

        resetAnimations()

        // CAAnimations will be removed from layers on background. restore when foregrounding.
        NotificationCenter.default
            .addObserver(self,
                selector: #selector(NoNewNotificationsCell.resetAnimations),
                name: NSNotification.Name.UIApplicationWillEnterForeground,
                object: nil
        )
        
        contentView.isAccessibilityElement = true
        contentView.accessibilityLabel = NSLocalizedString("You have no new notifications!", comment: "Inbox Zero Accessibility Label")
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }

    override func layoutSubviews() {
        super.layoutSubviews()

        let width: CGFloat = 30
        let height: CGFloat = 12
        shadow.path = UIBezierPath(ovalIn: CGRect(origin: .zero, size: CGSize(width: width, height: height))).cgPath
        shadow.position = CGPoint(x: contentView.bounds.width/2 - 20, y: contentView.bounds.height/2 + 5)
{'fraction_non_alphanumeric': 0.09855315579786118, 'fraction_numerical': 0.010694065841895575, 'mean_word_length': 2.5202952029520294, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '3948582', 'n_tokens_mistral': 1445, 'n_tokens_neox': 1378, 'n_words': 290}