<commit_before>//
//  KVAppDelegate.m
//  KCTViewer
//
//  Created by <NAME> on 2013-12-27.
//  Copyright (c) 2013 MacaroniCode. All rights reserved.
//

#import "KVAppDelegate.h"
#import "KVHTTPProtocol.h"
#import "NSURL+KVUtil.h"

@interface KVAppDelegate ()

- (void)generateAPILink;
- (void)updateBrowserLink;

@end

@implementation KVAppDelegate

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
	// Register a custom URL Protocol to mess with the responses
	[NSURLProtocol registerClass:[KVHTTPProtocol class]];
	
	// No, we don't want the web view to scroll just a few pixels up and down.
	[self.webView.mainFrame.frameView setAllowsScrolling:NO];
	
	// Needed in Mavericks for Flash to render correctly.
    	[self.webView setLayerUsesCoreImageFilters: YES];
	
	// Treat the web view as a web browser; this makes it cache a whole lot more
	[[WebPreferences standardPreferences] setCacheModel:WebCacheModelPrimaryWebBrowser];
	
	// Set up a cache; without this, loading the game will be slow as hell
	NSString *cachePath = [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) firstObject];
	NSURLCache *cache = [[NSURLCache alloc] initWithMemoryCapacity:20 * 1024 * 1024
													  diskCapacity:100 * 1024 * 1024
														  diskPath:cachePath];
	[NSURLCache setSharedURLCache:cache];
	
	// Attempt to retrieve stored server and API Token
	self.server = [[NSUserDefaults standardUserDefaults] valueForKey:@"server"];
	self.apiToken = [[NSUserDefaults standardUserDefaults] valueForKey:@"apiToken"];
	
	// If we don't have them, ask for a link
	if(!self.server || !self.apiToken)
	{
		[self actionEnterAPILink:nil];
	}
	// Otherwise, generate a link and load it
	else
	{
		[self generateAPILink];
		[self loadBundledIndex];<commit_msg>Just fixing that indentation ^^<commit_after>//
//  KVAppDelegate.m
//  KCTViewer
//
//  Created by <NAME> on 2013-12-27.
//  Copyright (c) 2013 MacaroniCode. All rights reserved.
//

#import "KVAppDelegate.h"
#import "KVHTTPProtocol.h"
#import "NSURL+KVUtil.h"

@interface KVAppDelegate ()

- (void)generateAPILink;
- (void)updateBrowserLink;

@end

@implementation KVAppDelegate

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
	// Register a custom URL Protocol to mess with the responses
	[NSURLProtocol registerClass:[KVHTTPProtocol class]];

	// No, we don't want the web view to scroll just a few pixels up and down.
	[self.webView.mainFrame.frameView setAllowsScrolling:NO];

	// Needed in Mavericks for Flash to render correctly.
	[self.webView setLayerUsesCoreImageFilters:YES];

	// Treat the web view as a web browser; this makes it cache a whole lot more
	[[WebPreferences standardPreferences] setCacheModel:WebCacheModelPrimaryWebBrowser];

	// Set up a cache; without this, loading the game will be slow as hell
	NSString *cachePath = [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) firstObject];
	NSURLCache *cache = [[NSURLCache alloc] initWithMemoryCapacity:20 * 1024 * 1024
													  diskCapacity:100 * 1024 * 1024
														  diskPath:cachePath];
	[NSURLCache setSharedURLCache:cache];
	
	// Attempt to retrieve stored server and API Token
	self.server = [[NSUserDefaults standardUserDefaults] valueForKey:@"server"];
	self.apiToken = [[NSUserDefaults standardUserDefaults] valueForKey:@"apiToken"];
	
	// If we don't have them, ask for a link
	if(!self.server || !self.apiToken)
	{
		[self actionEnterAPILink:nil];
	}
	// Otherwise, generate a link and load it
	else
	{
		[self generateAPILink];
		[self loadBundledIndex];
{'fraction_non_alphanumeric': 0.10097087378640776, 'fraction_numerical': 0.018307905686546465, 'mean_word_length': 4.463636363636364, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '5442667', 'n_tokens_mistral': 1268, 'n_tokens_neox': 1103, 'n_words': 332}