<commit_before>//
//  ACAlertAction.swift
//  ACAlertControllerDemo
//
//  Created by Yury on 21/09/16.
//  Copyright © 2016 Avtolic. All rights reserved.
//

import UIKit

public protocol ACAlertActionProtocolBase {
    
    var alertView: UIView { get }
    var enabled: Bool { get }
    func highlight(_ isHighlited: Bool)
    func call() -> Void
}

extension ACAlertActionProtocolBase {
    
    public var enabled: Bool { return true }
    public func highlight(_ isHighlited: Bool) { }
}

public protocol ACAlertActionProtocol: ACAlertActionProtocolBase {
    
    func alertView(_ tintColor: UIColor) -> UIView
}

extension ACAlertActionProtocol {
    func alertView(_ tintColor: UIColor) -> UIView {
        return self.alertView
    }
}
// MARK: -

open class ACAlertAction: ACAlertActionProtocolBase {
    
    open let alertView: UIView
    open let handler: ((ACAlertAction) -> Void)?
    
    public init(view: UIView, handler: ((ACAlertAction) -> Void)?) {
        self.alertView = view
        self.handler = handler
    }
    
//    open func alertView(_ tintColor: UIColor) -> UIView {
//        return alertView
//    }
    
    open func call() {
        handler?(self)
    }
}

open class ACAlertActionNative: ACAlertActionProtocolBase {
    
    open let handler: ((ACAlertActionNative) -> Void)?
    
    open let title: String?
    open let style: UIAlertActionStyle
    open var enabled: Bool = true
    
    public init(title: String?, style: UIAlertActionStyle, handler: ((ACAlertActionNative) -> Void)?) {
        self.title = title
        self.style = style
        self.handler = handler
    }
    
    lazy open var alertView: UIView = {
        let label = UILabel()
        
        let fontSize: CGFloat = 17
        label.font = self.style == .cancel ? UIFont.boldSystemFont(ofSize: fontSize) :  UIFont.systemFont(ofSize: fontSize)
        label.minimumScaleFactor = 0.5
        
        let normalColor = self.enabled ? label.tintColor : UIColor.gray
        label.textColor = self.style == .destructive ? UIColor.red : normalColor
        
        label.text = self.title
        
        return label
    }()

    open func call() {
        handler?(self)
    }
}
<commit_msg>Changed "native" colors to defaults of WawiBox<commit_after>//
//  ACAlertAction.swift
//  ACAlertControllerDemo
//
//  Created by Yury on 21/09/16.
//  Copyright © 2016 Avtolic. All rights reserved.
//

import UIKit

public protocol ACAlertActionProtocolBase {
    
    var alertView: UIView { get }
    var enabled: Bool { get }
    func highlight(_ isHighlited: Bool)
    func call() -> Void
}

extension ACAlertActionProtocolBase {
    
    public var enabled: Bool { return true }
    public func highlight(_ isHighlited: Bool) { }
}

public protocol ACAlertActionProtocol: ACAlertActionProtocolBase {
    
    func alertView(_ tintColor: UIColor) -> UIView
}

extension ACAlertActionProtocol {
    func alertView(_ tintColor: UIColor) -> UIView {
        return self.alertView
    }
}
// MARK: -

open class ACAlertAction: ACAlertActionProtocolBase {
    
    open let alertView: UIView
    open let handler: ((ACAlertAction) -> Void)?
    
    public init(view: UIView, handler: ((ACAlertAction) -> Void)?) {
        self.alertView = view
        self.handler = handler
    }
    
//    open func alertView(_ tintColor: UIColor) -> UIView {
//        return alertView
//    }
    
    open func call() {
        handler?(self)
    }
}

open class ACAlertActionNative: ACAlertActionProtocolBase {
    
    open let handler: ((ACAlertActionNative) -> Void)?
    
    open let title: String?
    open let style: UIAlertActionStyle
    open var enabled: Bool = true
    
    public init(title: String?, style: UIAlertActionStyle, handler: ((ACAlertActionNative) -> Void)?) {
        self.title = title
        self.style = style
        self.handler = handler
    }
    
    lazy open var alertView: UIView = {
        let label = UILabel()
        let blueColor = UIColor(red:0.31, green:0.75, blue:0.87, alpha:1.0)
        let redColor = UIColor(red:0.82, green:0.01, blue:0.11, alpha:1.0)
        
        let fontSize: CGFloat = 17
        label.font = self.style == .cancel ? UIFont.boldSystemFont(ofSize: fontSize) :  UIFont.systemFont(ofSize: fontSize)
        label.minimumScaleFactor = 0.5
        
        let normalColor = self.enabled ? blueColor : UIColor.gray
        label.textColor = self.style == .destructive ? redColor : normalColor
        
        label.text = self.title
        
        return label
    }()

    open func call() {
        handler?(self)
    }
}

{'fraction_non_alphanumeric': 0.09950032587442972, 'fraction_numerical': 0.010862480990658266, 'mean_word_length': 2.3977859778597788, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 19, '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': '4537724', 'n_tokens_mistral': 1434, 'n_tokens_neox': 1390, 'n_words': 372}