<commit_before>//
//  MDAlertController.swift
//  miDrive Insurance
//
//  Created by <NAME> on 08/06/2016.
//  Copyright © 2016 miDrive. All rights reserved.
//

import UIKit

open class MDAlertController: NSObject {
    
    fileprivate var alertViewController: MDAlertView!

    open var alertBackgroundColour: UIColor = MDAlertViewDefaults.alertBackgroundColour
    open var alertCornerRadius: CGFloat = MDAlertViewDefaults.alertCornerRadius

    open var titleFont: UIFont = MDAlertViewDefaults.titleFont
    open var bodyFont: UIFont = MDAlertViewDefaults.bodyFont

    open var titleColour: UIColor = MDAlertViewDefaults.titleColour
    open var bodyColour: UIColor = MDAlertViewDefaults.bodyColour

    open var actionHeight: CGFloat = MDAlertViewDefaults.alertButtonHeight

    open var actionDefaultBackgroundColour: UIColor = MDAlertViewDefaults.actionDefaultBackgroundColour
    open var actionCancelBackgroundColour: UIColor = MDAlertViewDefaults.actionCancelBackgroundColour
    open var actionDestructiveBackgroundColour: UIColor = MDAlertViewDefaults.actionDestructiveBackgroundColour

    open var actionDefaultTitleColour: UIColor = MDAlertViewDefaults.actionDefaultTitleColour
    open var actionCancelTitleColour: UIColor = MDAlertViewDefaults.actionCancelTitleColour
    open var actionDestructiveTitleColour: UIColor = MDAlertViewDefaults.actionDestructiveTitleColour

    open var actionTitleFont: UIFont = MDAlertViewDefaults.actionTitleFont
    
    public init(title: String, message: String, customView: UIView? = nil, showsCancel: Bool = true) {
        super.init()
        
        let podBundle = Bundle(for: self.classForCoder)
        if let bundleURL = podBundle.url(forResource: "MDAlert", withExtension: "bundle"), let bundle = Bundle(url: bundleURL) {
            let storyboard = UIStoryboard(name: "MDAlert", bundle: bundle)
            let alertView = storyboard.instantiateViewController(withIdentifier: "MDAlert") as! MDAlertView
            alertView.controller = self
            self.alertViewController = alertView
        
            self.alertViewController.titleMessage = title
            self.alertViewController.bodyMessage = message
            alertViewController.customView = customView
            alertViewController.showsCancel = showsCancel
        }
    }

    public init(image: UIImage, title: String, message: String, customView: UIView? = nil, showsCancel: Bool = true) {
        super.init()

        let podBundle = Bundle(for: self.classForCoder)
        if let bundleURL = podBundle.url(forResource: "MDAlert", withExtension: "bundle"), let bundle = Bundle(url: bundleURL) {
            let storyboard = UIStoryboard(name: "MDAlert", bundle: bundle)
            let alertView = storyboard.instantiateViewController(withIdentifier: "MDAlert") as! MDAlertView
            alertView.controller = self

            alertViewController = alertView

            alertViewController.image = image
            alertViewController.titleMessage = title
            alertViewController.bodyMessage = message
            alertViewController.customView = customView
            alertViewController.showsCancel = showsCancel
        }
    }
    
    open func addAction(_ action: MDAlertAction) {<commit_msg>Allow message to be nil<commit_after>//
//  MDAlertController.swift
//  miDrive Insurance
//
//  Created by <NAME> on 08/06/2016.
//  Copyright © 2016 miDrive. All rights reserved.
//

import UIKit

open class MDAlertController: NSObject {
    
    fileprivate var alertViewController: MDAlertView!

    open var alertBackgroundColour: UIColor = MDAlertViewDefaults.alertBackgroundColour
    open var alertCornerRadius: CGFloat = MDAlertViewDefaults.alertCornerRadius

    open var titleFont: UIFont = MDAlertViewDefaults.titleFont
    open var bodyFont: UIFont = MDAlertViewDefaults.bodyFont

    open var titleColour: UIColor = MDAlertViewDefaults.titleColour
    open var bodyColour: UIColor = MDAlertViewDefaults.bodyColour

    open var actionHeight: CGFloat = MDAlertViewDefaults.alertButtonHeight

    open var actionDefaultBackgroundColour: UIColor = MDAlertViewDefaults.actionDefaultBackgroundColour
    open var actionCancelBackgroundColour: UIColor = MDAlertViewDefaults.actionCancelBackgroundColour
    open var actionDestructiveBackgroundColour: UIColor = MDAlertViewDefaults.actionDestructiveBackgroundColour

    open var actionDefaultTitleColour: UIColor = MDAlertViewDefaults.actionDefaultTitleColour
    open var actionCancelTitleColour: UIColor = MDAlertViewDefaults.actionCancelTitleColour
    open var actionDestructiveTitleColour: UIColor = MDAlertViewDefaults.actionDestructiveTitleColour

    open var actionTitleFont: UIFont = MDAlertViewDefaults.actionTitleFont
    
    public init(title: String, message: String? = nil, customView: UIView? = nil, showsCancel: Bool = true) {
        super.init()
        
        let podBundle = Bundle(for: self.classForCoder)
        if let bundleURL = podBundle.url(forResource: "MDAlert", withExtension: "bundle"), let bundle = Bundle(url: bundleURL) {
            let storyboard = UIStoryboard(name: "MDAlert", bundle: bundle)
            let alertView = storyboard.instantiateViewController(withIdentifier: "MDAlert") as! MDAlertView
            alertView.controller = self
            self.alertViewController = alertView
        
            self.alertViewController.titleMessage = title
            self.alertViewController.bodyMessage = message
            alertViewController.customView = customView
            alertViewController.showsCancel = showsCancel
        }
    }

    public init(image: UIImage, title: String, message: String? = nil, customView: UIView? = nil, showsCancel: Bool = true) {
        super.init()

        let podBundle = Bundle(for: self.classForCoder)
        if let bundleURL = podBundle.url(forResource: "MDAlert", withExtension: "bundle"), let bundle = Bundle(url: bundleURL) {
            let storyboard = UIStoryboard(name: "MDAlert", bundle: bundle)
            let alertView = storyboard.instantiateViewController(withIdentifier: "MDAlert") as! MDAlertView
            alertView.controller = self

            alertViewController = alertView

            alertViewController.image = image
            alertViewController.titleMessage = title
            alertViewController.bodyMessage = message
            alertViewController.customView = customView
            alertViewController.showsCancel = showsCancel
        }
    }
    
    open func addAction(_ action: MDAlertAction) {
{'fraction_non_alphanumeric': 0.06687022900763359, 'fraction_numerical': 0.00366412213740458, 'mean_word_length': 3.53984753984754, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4611830', 'n_tokens_mistral': 1767, 'n_tokens_neox': 1660, 'n_words': 420}