<commit_before>//
//  ATMViewController.swift
//  UFP
//
//  Created by <NAME> on 26/03/17.
//  Copyright © 2017 <NAME>. All rights reserved.
//

import UIKit
import SwiftyJSON

class ATMViewController: UIViewController {
    
    @IBOutlet weak var activityIndicator: UIActivityIndicatorView!
    @IBOutlet weak var noPaymentInfo: UILabel!
    @IBOutlet weak var paymentInfoView: UIView!
    @IBOutlet weak var paymentInfoToolbar: UIToolbar!
    @IBOutlet weak var atmEntityLabel: UILabel!
    @IBOutlet weak var atmReferenceLabel: UILabel!
    @IBOutlet weak var atmValueLabel: UILabel!
    @IBOutlet weak var atmPaymentDates: UILabel!
    
    let apiController = APIController()
    
    var jsonData = [String: JSON]()
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        apiController.getUserPaymentDetails(token: APICredentials.sharedInstance.apiToken!, completionHandler: { (json, error) in
            self.activityIndicator.stopAnimating()
            if(json["status"] == "Ok") {
                self.paymentInfoToolbar.isHidden = false
                self.paymentInfoView.isHidden = false
                let atmDetails = json["message"]
                self.atmEntityLabel.text = atmDetails["Entidade"].stringValue
                self.atmReferenceLabel.text = atmDetails["Referencia"].stringValue
                self.atmValueLabel.text = atmDetails["Total"].stringValue + "€"
                self.atmPaymentDates.text = "Pagável entre \(self.dateFormatter.string(from: self.dateFormatterFromString.date(from: atmDetails["Inicio"].stringValue)!)) e \(self.dateFormatter.string(from: self.dateFormatterFromString.date(from: atmDetails["Termo"].stringValue)!))"
            } else {
                self.paymentInfoToolbar.isHidden = true
                self.paymentInfoView.isHidden = true
                self.noPaymentInfo.isHidden = false
            }
        })
        
    }
    
    @IBAction func sharePaymentDetails(_ sender: Any) {
        if let entity = self.atmEntityLabel.text, let reference = self.atmReferenceLabel.text, let value = self.atmValueLabel.text, let duration = self.atmPaymentDates.text {
            let textToShare = [ "Universidade Fernando Pessoa - Dados para pagamento por Multibanco\n\n\nEntidade: \(entity)\nReferência: \(reference)\nValor: \(value)\n\n\(duration)" ]
            let activityViewController = UIActivityViewController(activityItems: textToShare, applicationActivities: nil)
            
            activityViewController.excludedActivityTypes = [ UIActivityType.airDrop, UIActivityType.postToFacebook ]
            
            self.present(activityViewController, animated: true, completion: nil)
        }
    }
    
    fileprivate lazy var dateFormatter: DateFormatter = {
        let formatter = DateFormatter()
        formatter.dateFormat = "dd-MM-yyyy"
        return formatter
    }()
    
    fileprivate lazy var dateFormatterFromString: DateFormatter = {
        let formatter = DateFormatter()
        formatter.dateFormat = "yyyy-MM-dd"
        return formatter
    }()
    
}
<commit_msg>Fix incorrect var name<commit_after>//
//  ATMViewController.swift
//  UFP
//
//  Created by <NAME> on 26/03/17.
//  Copyright © 2017 <NAME>. All rights reserved.
//

import UIKit
import SwiftyJSON

class ATMViewController: UIViewController {
    
    @IBOutlet weak var activityIndicator: UIActivityIndicatorView!
    @IBOutlet weak var noPaymentInfo: UILabel!
    @IBOutlet weak var paymentInfoView: UIView!
    @IBOutlet weak var paymentInfoToolbar: UIToolbar!
    @IBOutlet weak var atmEntityLabel: UILabel!
    @IBOutlet weak var atmReferenceLabel: UILabel!
    @IBOutlet weak var atmValueLabel: UILabel!
    @IBOutlet weak var atmPaymentDates: UILabel!
    
    let apiController = APIController()
    
    var jsonData = [String: JSON]()
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        apiController.getUserPaymentDetails(token: APICredentials.sharedInstance.apiToken!, completionHandler: { (json, error) in
            self.activityIndicator.stopAnimating()
            if(json["status"] == "Ok") {
                self.paymentInfoToolbar.isHidden = false
                self.paymentInfoView.isHidden = false
                let atmDetails = json["message"]
                self.atmEntityLabel.text = atmDetails["Entidade"].stringValue
                self.atmReferenceLabel.text = atmDetails["Referencia"].stringValue
                self.atmValueLabel.text = atmDetails["Total"].stringValue + "€"
                self.atmPaymentDates.text = "Pagável entre \(self.dateFormatter.string(from: self.dateFormatterToString.date(from: atmDetails["Inicio"].stringValue)!)) e \(self.dateFormatter.string(from: self.dateFormatterToString.date(from: atmDetails["Termo"].stringValue)!))"
            } else {
                self.paymentInfoToolbar.isHidden = true
                self.paymentInfoView.isHidden = true
                self.noPaymentInfo.isHidden = false
            }
        })
        
    }
    
    @IBAction func sharePaymentDetails(_ sender: Any) {
        if let entity = self.atmEntityLabel.text, let reference = self.atmReferenceLabel.text, let value = self.atmValueLabel.text, let duration = self.atmPaymentDates.text {
            let textToShare = [ "Universidade Fernando Pessoa - Dados para pagamento por Multibanco\n\n\nEntidade: \(entity)\nReferência: \(reference)\nValor: \(value)\n\n\(duration)" ]
            let activityViewController = UIActivityViewController(activityItems: textToShare, applicationActivities: nil)
            
            activityViewController.excludedActivityTypes = [ UIActivityType.airDrop, UIActivityType.postToFacebook ]
            
            self.present(activityViewController, animated: true, completion: nil)
        }
    }
    
    fileprivate lazy var dateFormatter: DateFormatter = {
        let formatter = DateFormatter()
        formatter.dateFormat = "dd-MM-yyyy"
        return formatter
    }()
    
    fileprivate lazy var dateFormatterToString: DateFormatter = {
        let formatter = DateFormatter()
        formatter.dateFormat = "yyyy-MM-dd"
        return formatter
    }()
    
}

{'fraction_non_alphanumeric': 0.09505397132270017, 'fraction_numerical': 0.003222168519413565, 'mean_word_length': 2.717365269461078, '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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6589169', 'n_tokens_mistral': 1755, 'n_tokens_neox': 1729, 'n_words': 367}