<commit_before>//
//  AppDelegate.swift
//  Unframed
//
//  Created by <NAME> on 10/23/14.
//  Copyright (c) 2014 <NAME>. All rights reserved.
//

import UIKit
import CoreData

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?

    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
        
        self.window = UIWindow(frame: UIScreen.mainScreen().bounds)
        self.window!.backgroundColor = UIColor.whiteColor()
        
        if let lastIntro: AnyObject = NSUserDefaults.standardUserDefaults().objectForKey(AppDefaultKeys.IntroVersionSeen.rawValue) {
            setupAppViewController(false)
        } else {
            self.window!.rootViewController = createIntroViewController()
        }
        
        setUserSettingsDefaults()
        
        self.window!.makeKeyAndVisible()
        
        return true
    }
    
    func setUserSettingsDefaults() {
        if NSUserDefaults.standardUserDefaults().objectForKey(AppDefaultKeys.ShakeGesture.rawValue) == nil {
            NSUserDefaults.standardUserDefaults().setValue(true, forKey: AppDefaultKeys.ShakeGesture.rawValue)
        }
        if NSUserDefaults.standardUserDefaults().objectForKey(AppDefaultKeys.ForwardBackGesture.rawValue) == nil {
            NSUserDefaults.standardUserDefaults().setValue(true, forKey: AppDefaultKeys.ForwardBackGesture.rawValue)
        }
    }
    
    func createIntroViewController() -> OnboardingViewController {
        let page01: OnboardingContentViewController = OnboardingContentViewController(title: nil, body: "Frameless is a chromeless,\n full-screen web browser. Load a page and the browser bar will hide", image: UIImage(named: "introimage01"), buttonText: nil) {
        }
        page01.iconWidth = 158
        page01.iconHeight = 258.5
        
        let page02: OnboardingContentViewController = OnboardingContentViewController(title: nil, body: "Swipe up from the bottom of\nyour screen to show the browser\nbar and the keyboard", image: UIImage(named: "introimage02"), buttonText: nil) {
        }
        page02.iconWidth = 158
        page02.iconHeight = 258.5
        
        let page03: OnboardingContentViewController = OnboardingContentViewController(title: nil, body: "Or give your device a hearty shake,\nwhich will also show and\n hide the browser bar", image: UIImage(named: "introimage03"), buttonText: "GOT IT") {
            self.introCompletion()
        }
        page03.iconWidth = 158
        page03.iconHeight = 258.5
        
        let bgImage = UIImage.withColor(UIColorFromHex(0x9178E2))
        let onboardingViewController = OnboardingViewController(<commit_msg>messaging swap<commit_after>//
//  AppDelegate.swift
//  Unframed
//
//  Created by <NAME> on 10/23/14.
//  Copyright (c) 2014 <NAME>. All rights reserved.
//

import UIKit
import CoreData

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?

    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
        
        self.window = UIWindow(frame: UIScreen.mainScreen().bounds)
        self.window!.backgroundColor = UIColor.whiteColor()
        
        if let lastIntro: AnyObject = NSUserDefaults.standardUserDefaults().objectForKey(AppDefaultKeys.IntroVersionSeen.rawValue) {
            setupAppViewController(false)
        } else {
            self.window!.rootViewController = createIntroViewController()
        }
        
        setUserSettingsDefaults()
        
        self.window!.makeKeyAndVisible()
        
        return true
    }
    
    func setUserSettingsDefaults() {
        if NSUserDefaults.standardUserDefaults().objectForKey(AppDefaultKeys.ShakeGesture.rawValue) == nil {
            NSUserDefaults.standardUserDefaults().setValue(true, forKey: AppDefaultKeys.ShakeGesture.rawValue)
        }
        if NSUserDefaults.standardUserDefaults().objectForKey(AppDefaultKeys.ForwardBackGesture.rawValue) == nil {
            NSUserDefaults.standardUserDefaults().setValue(true, forKey: AppDefaultKeys.ForwardBackGesture.rawValue)
        }
    }
    
    func createIntroViewController() -> OnboardingViewController {
        let page01: OnboardingContentViewController = OnboardingContentViewController(title: nil, body: "Frameless is a chromeless,\n full-screen web browser. Load a page and everything else hides", image: UIImage(named: "introimage01"), buttonText: nil) {
        }
        page01.iconWidth = 158
        page01.iconHeight = 258.5
        
        let page02: OnboardingContentViewController = OnboardingContentViewController(title: nil, body: "Swipe up from the bottom of\nyour screen to show the browser\nbar and the keyboard", image: UIImage(named: "introimage02"), buttonText: nil) {
        }
        page02.iconWidth = 158
        page02.iconHeight = 258.5
        
        let page03: OnboardingContentViewController = OnboardingContentViewController(title: nil, body: "Or give your device a hearty shake,\nwhich will also show and\n hide the browser bar", image: UIImage(named: "introimage03"), buttonText: "GOT IT") {
            self.introCompletion()
        }
        page03.iconWidth = 158
        page03.iconHeight = 258.5
        
        let bgImage = UIImage.withColor(UIColorFromHex(0x9178E2))
        let onboardingViewController = OnboardingViewController(
{'fraction_non_alphanumeric': 0.08863760714937079, 'fraction_numerical': 0.022250592741200073, 'mean_word_length': 3.1295180722891565, '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': '5600319', 'n_tokens_mistral': 1633, 'n_tokens_neox': 1451, 'n_words': 334}