<commit_before>//
//  LoginViewController.swift
//  pi-chan
//
//  Created by <NAME> on 2016/03/28.
//  Copyright © 2016年 star__hoshi. All rights reserved.
//

import UIKit
import APIKit

class LoginViewController: UIViewController {
  
  @IBOutlet weak var tokenField: UITextField!
  @IBOutlet weak var teamField: UITextField!
  override func viewDidLoad() {
    super.viewDidLoad()
    tokenField.text = KeychainManager.getToken()
    teamField.text = KeychainManager.getTeamName()
  }
  
  override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
  }
  
  @IBAction func login(sender: AnyObject) {
    
    Esa.sharedInstance.token = tokenField.text!
    Esa.sharedInstance.currentTeam = teamField.text!
    
    Esa.sharedInstance.teams(){ result in
      switch result {
      case .Success(let teams):
        log?.debug("\(teams)")
        KeychainManager.setToken(self.tokenField.text!)
        KeychainManager.setTeamName(self.teamField.text!)
      case .Failure(let error):
        log?.error("\(error)")
      }
    }
  }
  
  @IBAction func close(sender: AnyObject) {
    self.dismissViewControllerAnimated(true, completion: nil)
  }
}<commit_msg>show indicator.<commit_after>//
//  LoginViewController.swift
//  pi-chan
//
//  Created by <NAME> on 2016/03/28.
//  Copyright © 2016年 star__hoshi. All rights reserved.
//

import UIKit
import APIKit
import SVProgressHUD

class LoginViewController: UIViewController {
  
  @IBOutlet weak var tokenField: UITextField!
  @IBOutlet weak var teamField: UITextField!
  override func viewDidLoad() {
    super.viewDidLoad()
    tokenField.text = KeychainManager.getToken()
    teamField.text = KeychainManager.getTeamName()
  }
  
  override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
  }
  
  @IBAction func login(sender: AnyObject) {
    SVProgressHUD.showWithStatus("Loading...")
    Esa.sharedInstance.token = tokenField.text!
    Esa.sharedInstance.currentTeam = teamField.text!
    
    Esa.sharedInstance.teams(){ result in
      switch result {
      case .Success(let teams):
        SVProgressHUD.showSuccessWithStatus("Success!")
        log?.info("\(teams)")
        KeychainManager.setToken(self.tokenField.text!)
        KeychainManager.setTeamName(self.teamField.text!)
      case .Failure(let error):
        SVProgressHUD.showErrorWithStatus("Error!")
        log?.error("\(error)")
      }
    }
  }
  
  @IBAction func close(sender: AnyObject) {
    self.dismissViewControllerAnimated(true, completion: nil)
  }
}
{'fraction_non_alphanumeric': 0.11201235998455002, 'fraction_numerical': 0.009269988412514484, 'mean_word_length': 3.225122349102773, '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': '4226209', 'n_tokens_mistral': 836, 'n_tokens_neox': 794, 'n_words': 162}