<commit_before>//
//  AppDelegate.swift
//  sway
//
//  Created by <NAME> on 10/15/15.
//  Copyright © 2015 VCH. All rights reserved.
//

import UIKit
import CoreData

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
    
    var window: UIWindow?

    var sharedCache: NSURLCache?
    
    let parseCredentials = Credentials.parseCredentials
    let twitterCredentials = Credentials.twitterCredentials
    
    struct Credentials {
        static let parseCredentialsFile = "ParseCredentials"
        static let parseCredentials     = Credentials.loadFromPropertyListNamed(parseCredentialsFile)
        static let twitterCredentialsFile = "TwitterCredentials"
        static let twitterCredentials     = Credentials.loadFromPropertyListNamed(twitterCredentialsFile)
        
        let consumerKey: String
        let consumerSecret: String
        
        private static func loadFromPropertyListNamed(name: String) -> Credentials {
            let path           = NSBundle.mainBundle().pathForResource(name, ofType: "plist")!
            let dictionary     = NSDictionary(contentsOfFile: path)!
            let consumerKey    = dictionary["Key"] as! String
            let consumerSecret = dictionary["Secret"] as! String
            
            return Credentials(consumerKey: consumerKey, consumerSecret: consumerSecret)
        }
    }
    
    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
        //set colors
        UINavigationBar.appearance().barTintColor = UIColor(hue: 0.5556, saturation: 0.18, brightness: 0.92, alpha: 1.0) /* #bfdceb */
        UITabBar.appearance().barTintColor = UIColor(hue: 0.5556, saturation: 0.18, brightness: 0.92, alpha: 1.0) /* #bfdceb */

        //color: http://design-seeds.com/home/entry/color-view31
        UITabBarItem.appearance().setTitleTextAttributes([NSForegroundColorAttributeName:UIColor.blackColor()], forState: UIControlState.Normal)


        Parse.setApplicationId(parseCredentials.consumerKey, clientKey: parseCredentials.consumerSecret)
        PFTwitterUtils.initializeWithConsumerKey(twitterCredentials.consumerKey, consumerSecret: twitterCredentials.consumerSecret)
        
        // initialze shared cache with 2 MB mem and 100 MB disk space
        sharedCache = NSURLCache(memoryCapacity: 2 * 1024 * 1024, diskCapacity: 100 * 1024 * 1024, diskPath: nil)
        NSURLCache.setSharedURLCache(sharedCache!)
        
        
        return true
    }
    
    func applicationWillResignActive(application: UIApplication) {
        // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
        // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
    }
    <commit_msg>Allow Audio when app is launched<commit_after>//
//  AppDelegate.swift
//  sway
//
//  Created by <NAME> on 10/15/15.
//  Copyright © 2015 VCH. All rights reserved.
//

import UIKit
import CoreData

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
    
    var window: UIWindow?

    var sharedCache: NSURLCache?
    
    let parseCredentials = Credentials.parseCredentials
    let twitterCredentials = Credentials.twitterCredentials
    
    struct Credentials {
        static let parseCredentialsFile = "ParseCredentials"
        static let parseCredentials     = Credentials.loadFromPropertyListNamed(parseCredentialsFile)
        static let twitterCredentialsFile = "TwitterCredentials"
        static let twitterCredentials     = Credentials.loadFromPropertyListNamed(twitterCredentialsFile)
        
        let consumerKey: String
        let consumerSecret: String
        
        private static func loadFromPropertyListNamed(name: String) -> Credentials {
            let path           = NSBundle.mainBundle().pathForResource(name, ofType: "plist")!
            let dictionary     = NSDictionary(contentsOfFile: path)!
            let consumerKey    = dictionary["Key"] as! String
            let consumerSecret = dictionary["Secret"] as! String
            
            return Credentials(consumerKey: consumerKey, consumerSecret: consumerSecret)
        }
    }
    
    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
        //set colors
        UINavigationBar.appearance().barTintColor = UIColor(hue: 0.5556, saturation: 0.18, brightness: 0.92, alpha: 1.0) /* #bfdceb */
        UITabBar.appearance().barTintColor = UIColor(hue: 0.5556, saturation: 0.18, brightness: 0.92, alpha: 1.0) /* #bfdceb */

        //color: http://design-seeds.com/home/entry/color-view31
        UITabBarItem.appearance().setTitleTextAttributes([NSForegroundColorAttributeName:UIColor.blackColor()], forState: UIControlState.Normal)


        Parse.setApplicationId(parseCredentials.consumerKey, clientKey: parseCredentials.consumerSecret)
        PFTwitterUtils.initializeWithConsumerKey(twitterCredentials.consumerKey, consumerSecret: twitterCredentials.consumerSecret)
        
        // initialze shared cache with 2 MB mem and 100 MB disk space
        sharedCache = NSURLCache(memoryCapacity: 2 * 1024 * 1024, diskCapacity: 100 * 1024 * 1024, diskPath: nil)
        NSURLCache.setSharedURLCache(sharedCache!)
        
        _ = AVFoundationHelper.init(completion: { (allowed) -> () in
            if allowed {
                print("Audio recording is allowed")
            } else {
                print("Audio recording is NOT allowed")
            }
        })
        
        return true
    }
    
    func applicationWillResignActive(application: UIApplication) {
        // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
        // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
    }
    
{'fraction_non_alphanumeric': 0.07711559518223056, 'fraction_numerical': 0.01939621460972939, 'mean_word_length': 3.0037570444583594, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 10, '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': '3182572', 'n_tokens_mistral': 1771, 'n_tokens_neox': 1639, 'n_words': 484}