<commit_before>import UIKit
import Accounts
import Social
import EventBox
import TwitterAPI

class ViewController: UIViewController {
    
    // MARK: Properties
    
    @IBOutlet weak var logoImageView: UIImageView!
    @IBOutlet weak var containerView: UIView!
    @IBOutlet weak var signInView: UIView!
    @IBOutlet weak var signInButton: UIButton!
    
    var timelineViewController: TimelineViewController?
    
    // MARK: - View Life Cycle
    
    override func viewDidLoad() {
        super.viewDidLoad()
        configureView()
    }
    
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
    }
    
    override func viewWillAppear(animated: Bool) {
        super.viewWillAppear(animated)
        configureEvent()
        if AccountSettingsStore.get() != nil {
            logoImageView.hidden = true
            showView()
        }
    }
    
    override func viewDidDisappear(animated: Bool) {
        super.viewDidDisappear(animated)
        EventBox.off(self)
    }
    
    // MARK: - Configuration
    
    func configureView() {
        let longPress = UILongPressGestureRecognizer(target: self, action: "signInMenu")
        longPress.minimumPressDuration = 2.0;
        signInButton.addGestureRecognizer(longPress)
    }
    
    func toggleView() {
        logoImageView.hidden = true
        if AccountSettingsStore.get() != nil {
            showView()
        } else {
            timelineViewController?.view.hidden = true
            signInView.hidden = false
            signInButton.hidden = false
            signInButton.enabled = true
        }
    }
    
    func showView() {
        if timelineViewController == nil {
            timelineViewController = TimelineViewController()
            ViewTools.addSubviewWithEqual(containerView, view: timelineViewController!.view)
        }
        timelineViewController?.view.hidden = false
        signInView.hidden = true
        signInButton.hidden = true
        signInButton.enabled = false
    }
    
    func configureEvent() {
        EventBox.onMainThread(self, name: TwitterAuthorizeNotification, handler: { _ in
            self.toggleView()
        })
    }
    
    // MARK: - Actions
    
    func signInMenu() {
        AddAccountAlert.show(signInButton)
    }
    
    @IBAction func signInButtonClick(sender: UIButton) {
        Twitter.addACAccount(false)
    }
    
    @IBAction func terms(sender: UIButton) {
        Safari.openURL("http://justaway.info/iOS/terms.html")
    }
    
    @IBAction func privacy(sender: UIButton) {
        Safari.openURL("http://justaway.info/iOS/privacy.html")
    }
}

<commit_msg>Fix which is already presenting<commit_after>import UIKit
import Accounts
import Social
import EventBox
import TwitterAPI

class ViewController: UIViewController {
    
    // MARK: Properties
    
    @IBOutlet weak var logoImageView: UIImageView!
    @IBOutlet weak var containerView: UIView!
    @IBOutlet weak var signInView: UIView!
    @IBOutlet weak var signInButton: UIButton!
    
    var timelineViewController: TimelineViewController?
    
    // MARK: - View Life Cycle
    
    override func viewDidLoad() {
        super.viewDidLoad()
        configureView()
    }
    
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
    }
    
    override func viewWillAppear(animated: Bool) {
        super.viewWillAppear(animated)
        configureEvent()
        if AccountSettingsStore.get() != nil {
            logoImageView.hidden = true
            showView()
        }
    }
    
    override func viewDidDisappear(animated: Bool) {
        super.viewDidDisappear(animated)
        EventBox.off(self)
    }
    
    // MARK: - Configuration
    
    func configureView() {
        let longPress = UILongPressGestureRecognizer(target: self, action: "signInMenu:")
        longPress.minimumPressDuration = 2.0;
        signInButton.addGestureRecognizer(longPress)
    }
    
    func toggleView() {
        logoImageView.hidden = true
        if AccountSettingsStore.get() != nil {
            showView()
        } else {
            timelineViewController?.view.hidden = true
            signInView.hidden = false
            signInButton.hidden = false
            signInButton.enabled = true
        }
    }
    
    func showView() {
        if timelineViewController == nil {
            timelineViewController = TimelineViewController()
            ViewTools.addSubviewWithEqual(containerView, view: timelineViewController!.view)
        }
        timelineViewController?.view.hidden = false
        signInView.hidden = true
        signInButton.hidden = true
        signInButton.enabled = false
    }
    
    func configureEvent() {
        EventBox.onMainThread(self, name: TwitterAuthorizeNotification, handler: { _ in
            self.toggleView()
        })
    }
    
    // MARK: - Actions
    
    func signInMenu(sender: UILongPressGestureRecognizer) {
        if sender.state == UIGestureRecognizerState.Ended {
            AddAccountAlert.show(signInButton)
        }
    }
    
    @IBAction func signInButtonClick(sender: UIButton) {
        Twitter.addACAccount(false)
    }
    
    @IBAction func terms(sender: UIButton) {
        Safari.openURL("http://justaway.info/iOS/terms.html")
    }
    
    @IBAction func privacy(sender: UIButton) {
        Safari.openURL("http://justaway.info/iOS/privacy.html")
    }
}


{'fraction_non_alphanumeric': 0.08417570299577283, 'fraction_numerical': 0.0007351589781290203, 'mean_word_length': 2.227758007117438, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5297902', 'n_tokens_mistral': 1575, 'n_tokens_neox': 1503, 'n_words': 298}