Skip to content

Commit

Permalink
merging master with cleanup2
Browse files Browse the repository at this point in the history
  • Loading branch information
stoicdavid committed May 4, 2012
2 parents 0eb71be + d491de2 commit ea29f57
Show file tree
Hide file tree
Showing 484 changed files with 8,210 additions and 17,342 deletions.
Binary file modified .DS_Store
Binary file not shown.
Binary file added Default-Landscape~ipad.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
336 changes: 129 additions & 207 deletions Humalog.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
Expand Up @@ -2,19 +2,4 @@
<Bucket
type = "1"
version = "1.0">
<FileBreakpoints>
<FileBreakpoint
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Humalog/Views/AnnotationView.m"
timestampString = "357112043.794263"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "213"
endingLineNumber = "213"
landmarkName = "-touchesBegan:withEvent:"
landmarkType = "5">
</FileBreakpoint>
</FileBreakpoints>
</Bucket>
Binary file renamed Humalog/Resources/slides/slide1/.DS_Store → Humalog/.DS_Store 100755 → 100644
Binary file not shown.
4 changes: 3 additions & 1 deletion Humalog/AppDelegate.h
Expand Up @@ -7,9 +7,11 @@
//

#import <UIKit/UIKit.h>
#import "DownloadControlDelegate.h"

@interface AppDelegate : UIResponder <UIApplicationDelegate>
@interface AppDelegate : UIResponder <UIApplicationDelegate,DownloadControlDelegate>

@property (strong, nonatomic) UIWindow *window;


@end
118 changes: 113 additions & 5 deletions Humalog/AppDelegate.m
Expand Up @@ -8,25 +8,131 @@

#import "AppDelegate.h"
#import "MasterController.h"
#import "Downloader.h"
#import "Brand.h"
#import "SplashscreenViewController.h"
#import "GANTracker.h"

static const NSInteger kGANDispatchPeriodSec = 10;

@interface AppDelegate() {
SplashscreenViewController *splashController;
Downloader *download;
BOOL flag;
BOOL flag2;
}
@end

@implementation AppDelegate

@synthesize window = _window;

- (void)loadMasterController
{
[self.window setRootViewController:[[MasterController alloc] init]];
}

- (void)settingsChanged:(NSNotification *)paramNotification
{
NSLog(@"Settings changed");
NSLog(@"Notification Object = %@", [paramNotification object]);
}

- (void)setDefaults
{

[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(settingsChanged:)
name:NSUserDefaultsDidChangeNotification
object:nil];

if (![[NSUserDefaults standardUserDefaults] stringForKey:@"brand_preference"]) {

NSString *mainBundlePath = [[NSBundle mainBundle] bundlePath];
NSString *settingsPropertyListPath = [mainBundlePath
stringByAppendingPathComponent:@"Settings.bundle/Root.plist"];

NSDictionary *settingsPropertyList = [NSDictionary
dictionaryWithContentsOfFile:settingsPropertyListPath];

NSMutableArray *preferenceArray = [settingsPropertyList objectForKey:@"PreferenceSpecifiers"];
NSMutableDictionary *registerableDictionary = [NSMutableDictionary dictionary];

for (int i = 0; i < [preferenceArray count]; ++i) {
NSString *key = [[preferenceArray objectAtIndex:i] objectForKey:@"Key"];

if (key) {
id value = [[preferenceArray objectAtIndex:i] objectForKey:@"DefaultValue"];
[registerableDictionary setObject:value forKey:key];
}
}

[[NSUserDefaults standardUserDefaults] registerDefaults:registerableDictionary];
[[NSUserDefaults standardUserDefaults] synchronize];
}
}

- (void)downloadContent
{
flag = [[NSUserDefaults standardUserDefaults] boolForKey:@"update_interface_preference"];
flag2 = [[NSUserDefaults standardUserDefaults] boolForKey:@"update_slides_preference"];

if (flag || flag2) {
NSString *brandId = [[NSUserDefaults standardUserDefaults] stringForKey:@"brand_preference"];
download = [[Downloader alloc] init];
download.delegate = self;
[download parseJSON:brandId];

NSUserDefaults *defaults = [[NSUserDefaults alloc] init];
[defaults setBool:NO forKey:@"update_interface_preference"];
[defaults setBool:NO forKey:@"update_slides_preference"];
[[NSUserDefaults standardUserDefaults] synchronize];
}

// Updates the singleton
[Brand updateElementsFromDefaults];
}

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[[GANTracker sharedTracker] startTrackerWithAccountID:@"UA-31202291-1"
dispatchPeriod:kGANDispatchPeriodSec
delegate:nil];

NSError *error;
if (![[GANTracker sharedTracker] setCustomVariableAtIndex:1
name:@"iPad3"
value:@"ip1"
withError:&error]) {
// Handle error here
}

self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
self.window.backgroundColor = [UIColor blackColor];
splashController = [[SplashscreenViewController alloc] init];
[self.window setRootViewController:splashController];
[self.window makeKeyAndVisible];

// Instance the master controller
UIViewController *masterController = [[MasterController alloc] init];
[self.window setRootViewController:masterController];
[self setDefaults];
[self downloadContent];

[self.window makeKeyAndVisible];
// Instance the master controller
if (!(flag && flag2))
[self loadMasterController];

return YES;
}

- (void)downloaderDidFinish
{
[self loadMasterController];
}

- (void)downloaderIsDownloading
{
splashController.progress.progress = download.advance;
}

- (void)applicationWillResignActive:(UIApplication *)application
{
/*
Expand Down Expand Up @@ -64,6 +170,8 @@ - (void)applicationWillTerminate:(UIApplication *)application
Save data if appropriate.
See also applicationDidEnterBackground:.
*/
[[NSNotificationCenter defaultCenter] removeObserver:self];
[[GANTracker sharedTracker] stopTracker];
}

@end
Expand Up @@ -12,6 +12,6 @@
#import "InterfaceControlDelegate.h"
#import "SlideProvider.h"

@interface SlideController : UIViewController<iCarouselDataSource, iCarouselDelegate, UIGestureRecognizerDelegate, ContentDisplayDelegate, InterfaceControlDelegate>
@interface ContentController : UIViewController<iCarouselDataSource, iCarouselDelegate, UIGestureRecognizerDelegate, ContentDisplayDelegate, InterfaceControlDelegate>

@end

0 comments on commit ea29f57

Please sign in to comment.