<commit_before>//
//  AppDelegate.swift
//  Spotijack
//
//  Created by <NAME> on 24/07/2017.
//  Copyright © 2017 <NAME>. All rights reserved.
//

import Cocoa
import LibSpotijack

@NSApplicationMain
class AppDelegate: NSObject {
    private lazy var mainWindowController: MainWindowController = MainWindowController(windowNibName: NSNib.Name("MainWindow"))
    private lazy var prefencesWindowController: PreferencesWindowController = PreferencesWindowController()
}

//MARK: NSApplicationDelegate Methods
extension AppDelegate: NSApplicationDelegate {
    func applicationDidFinishLaunching(_ notification: Notification) {
        // Display the main window
        let _ = applicationShouldHandleReopen(NSApplication.shared, hasVisibleWindows: false)
    }

    func applicationShouldHandleReopen(_ sender: NSApplication, hasVisibleWindows flag: Bool) -> Bool {
        if !flag {
            mainWindowController.showWindow(self)
            return false
        }

        return true
    }

    func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
        if SpotijackSessionManager.shared.isSpotijacking {
            return false<commit_msg>Register app defaults on launch<commit_after>//
//  AppDelegate.swift
//  Spotijack
//
//  Created by <NAME> on 24/07/2017.
//  Copyright © 2017 <NAME>. All rights reserved.
//

import Cocoa
import LibSpotijack

@NSApplicationMain
class AppDelegate: NSObject {
    private lazy var mainWindowController: MainWindowController = MainWindowController(windowNibName: NSNib.Name("MainWindow"))
    private lazy var prefencesWindowController: PreferencesWindowController = PreferencesWindowController()
}

//MARK: NSApplicationDelegate Methods
extension AppDelegate: NSApplicationDelegate {
    func applicationDidFinishLaunching(_ notification: Notification) {
        Preferences.shared.registerDefaultValues()

        // Display the main window
        let _ = applicationShouldHandleReopen(NSApplication.shared, hasVisibleWindows: false)
    }

    func applicationShouldHandleReopen(_ sender: NSApplication, hasVisibleWindows flag: Bool) -> Bool {
        if !flag {
            mainWindowController.showWindow(self)
            return false
        }

        return true
    }

    func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
        if SpotijackSessionManager.shared.isSpotijacking {
            return false
{'fraction_non_alphanumeric': 0.07377049180327869, 'fraction_numerical': 0.009836065573770493, 'mean_word_length': 3.6495238095238096, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, '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': '2331219', 'n_tokens_mistral': 647, 'n_tokens_neox': 598, 'n_words': 160}