<commit_before>//
//  HomeViewController.swift
//  RhythmTap
//
//  Created by <NAME> on 2016-02-22.
//  Copyright © 2016 <NAME>. All rights reserved.
//

import UIKit

class HomeViewController: UIViewController {

    // MARK: Properties
    @IBOutlet weak var startButton: UIButton!
    @IBOutlet weak var levelButton: UIButton!
    @IBOutlet weak var rhythmTap: UILabel!
    @IBOutlet weak var difficultyButton: UIButton!
    
    let transitionManager = TransitionManager()
    let loadingViewSegueIdentifier = "loadingViewSegue"
    let chooseLevelSegueIdentifier = "levelViewSegue"
    let chooseDifficultySegueIdentifier = "difficultyViewSegue"

    var difficulty: Difficulty!

    // MARK: View handling
    override func viewDidLoad() {
        super.viewDidLoad()
        decorateButtons()
        loadDefaultDifficulty()
    }


    // MARK: User actions
    @IBAction func startGame(sender: AnyObject) {
        let segueName = loadingViewSegueIdentifier
        animateSegueTransition(segueName, sender: sender as! UIButton)
    }
    
    @IBAction func chooseLevel(sender: AnyObject) {
        let segueName = chooseLevelSegueIdentifier
        animateSegueTransition(segueName, sender: sender as! UIButton)
    }
    
    @IBAction func chooseDifficulty(sender: AnyObject) {
        let segueName = chooseDifficultySegueIdentifier
        animateSegueTransition(segueName, sender: sender as! UIButton)
    }
    

    // MARK: Navigation
    override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
        self.transitionManager.presenting = false
        if segue.identifier == loadingViewSegueIdentifier {
            if let loadingViewController = segue.destinationViewController as? LoadingViewController {
                loadingViewController.difficulty = difficulty
                loadingViewController.transitioningDelegate = self.transitionManager
                return
            }
        }
        let toViewController = segue.destinationViewController as UIViewController
        toViewController.transitioningDelegate = self.transitionManager
    }


    // MARK: Private Interface
    private func decorateButtons() {
        startButton.layer.cornerRadius = 5
        levelButton.layer.cornerRadius = 5
        difficultyButton.layer.cornerRadius = 5
    }<commit_msg>Update to home view controller<commit_after>//
//  HomeViewController.swift
//  RhythmTap
//
//  Created by <NAME> on 2016-02-22.
//  Copyright © 2016 <NAME>. All rights reserved.
//

import UIKit

class HomeViewController: UIViewController {

    // MARK: Properties
    @IBOutlet weak var startButton: UIButton!
    @IBOutlet weak var levelButton: UIButton!
    @IBOutlet weak var rhythmTap: UILabel!
    @IBOutlet weak var difficultyButton: UIButton!
    
    let transitionManager = TransitionManager()
    let loadingViewSegueIdentifier = "loadingViewSegue"
    let chooseLevelSegueIdentifier = "levelViewSegue"
    let chooseDifficultySegueIdentifier = "difficultyViewSegue"

    var difficulty: Difficulty!

    // MARK: View handling
    override func viewDidLoad() {
        super.viewDidLoad()
        decorateButtons()
        loadDefaultDifficulty()
    }


    // MARK: User actions
    @IBAction func startGame(sender: AnyObject) {
        let segueName = loadingViewSegueIdentifier
        animateSegueTransition(segueName, sender: sender as! UIButton)
    }
    
    @IBAction func chooseLevel(sender: AnyObject) {
        let segueName = chooseLevelSegueIdentifier
        animateSegueTransition(segueName, sender: sender as! UIButton)
    }
    
    @IBAction func chooseDifficulty(sender: AnyObject) {
        let segueName = chooseDifficultySegueIdentifier
        animateSegueTransition(segueName, sender: sender as! UIButton)
    }
    

    // MARK: Navigation
    override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
        self.transitionManager.presenting = false
        if segue.identifier == loadingViewSegueIdentifier {
            if let loadingViewController = segue.destinationViewController as? LoadingViewController {
                loadingViewController.difficulty = difficulty
                loadingViewController.transitioningDelegate = self.transitionManager
            }
            return
        }
        let toViewController = segue.destinationViewController as UIViewController
        toViewController.transitioningDelegate = self.transitionManager
    }


    // MARK: Private Interface
    private func decorateButtons() {
        startButton.layer.cornerRadius = 5
        levelButton.layer.cornerRadius = 5
        difficultyButton.layer.cornerRadius = 5
    }
{'fraction_non_alphanumeric': 0.06945337620578779, 'fraction_numerical': 0.006430868167202572, 'mean_word_length': 2.9846285226302305, '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': '1191629', 'n_tokens_mistral': 1296, 'n_tokens_neox': 1191, 'n_words': 300}