<commit_before>//
//  AppDelegate.swift
//  NetNewsWire
//
//  Created by <NAME> on 6/28/19.
//  Copyright © 2019 Ranchero Software. All rights reserved.
//

import UIKit

class SceneDelegate: UIResponder, UIWindowSceneDelegate {
	
    var window: UIWindow?
	var coordinator = AppCoordinator()
	
    // UIWindowScene delegate
    
    func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {

		window = UIWindow(windowScene: scene as! UIWindowScene)
		window!.tintColor = AppAssets.netNewsWireBlueColor
		window!.rootViewController = coordinator.start()
		window!.makeKeyAndVisible()
		
//        if let userActivity = connectionOptions.userActivities.first ?? session.stateRestorationActivity {
//            if !configure(window: window, with: userActivity) {
//                print("Failed to restore from \(userActivity)")
//            }
//        }

        // If there were no user activities, we don't have to do anything.
        // The `window` property will automatically be loaded with the storyboard's initial view controller.
    }
	
	func scene(_ scene: UIScene, continue userActivity: NSUserActivity) {
		coordinator.handle(userActivity)
	}
	
	func sceneDidEnterBackground(_ scene: UIScene) {
		appDelegate.prepareAccountsForBackground()
	}
	
	func sceneWillEnterForeground(_ scene: UIScene) {
		appDelegate.prepareAccountsForForeground()
	}
	
//    func stateRestorationActivity(for scene: UIScene) -> NSUserActivity? {
//        return scene.userActivity
//    }
//
    // Utilities
    
//    func configure(window: UIWindow?, with activity: NSUserActivity) -> Bool {
//        if activity.title == GalleryOpenDetailPath {
//            if let photoID = activity.userInfo?[GalleryOpenDetailPhotoIdKey] as? String {
//
//                if let photoDetailViewController = PhotoDetailViewController.loadFromStoryboard() {
//                    photoDetailViewController.photo = Photo(name: photoID)
//
//                    if let navigationController = window?.rootViewController as? UINavigationController {
//                        navigationController.pushViewController(photoDetailViewController, animated: false)
//                        return true
//                    }
//                }
//            }
//        }
//        return false
//     }
<commit_msg>Handle user activities on a cold launch<commit_after>//
//  AppDelegate.swift
//  NetNewsWire
//
//  Created by <NAME> on 6/28/19.
//  Copyright © 2019 Ranchero Software. All rights reserved.
//

import UIKit

class SceneDelegate: UIResponder, UIWindowSceneDelegate {
	
    var window: UIWindow?
	var coordinator = AppCoordinator()
	
    // UIWindowScene delegate
    
    func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
		window = UIWindow(windowScene: scene as! UIWindowScene)
		window!.tintColor = AppAssets.netNewsWireBlueColor
		window!.rootViewController = coordinator.start()
		window!.makeKeyAndVisible()

        if let userActivity = connectionOptions.userActivities.first ?? session.stateRestorationActivity {
			DispatchQueue.main.asyncAfter(deadline: .now()) {
				self.coordinator.handle(userActivity)
			}
        }
    }
	
	func scene(_ scene: UIScene, continue userActivity: NSUserActivity) {
		coordinator.handle(userActivity)
	}
	
	func sceneDidEnterBackground(_ scene: UIScene) {
		appDelegate.prepareAccountsForBackground()
	}
	
	func sceneWillEnterForeground(_ scene: UIScene) {
		appDelegate.prepareAccountsForForeground()
	}
	
//    func stateRestorationActivity(for scene: UIScene) -> NSUserActivity? {
//        return scene.userActivity
//    }

{'fraction_non_alphanumeric': 0.09681769147788566, 'fraction_numerical': 0.0048543689320388345, 'mean_word_length': 2.97534833869239, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 8, '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': '202251', 'n_tokens_mistral': 1101, 'n_tokens_neox': 998, 'n_words': 241}