Nextrek
@ 831
Nextrek / iOS / SafariArte / trunk / SafariArte / AppDelegate.m
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 |
// // AppDelegate.m // SafariArte // // Created by Fabrizio on 27/04/15. // Copyright (c) 2015 Nextrek. All rights reserved. // #import "AppDelegate.h" #import "SFAUser.h" #import "LoginVC.h" #import "MenuVC.h" #import "RoutesVC.h" #import "HomeVC.h" #import <FBSDKCoreKit/FBSDKCoreKit.h> #import <FBSDKLoginKit/FBSDKLoginKit.h> #import "RFRateMe.h" #import "TutorialViewController.h" #import <Fabric/Fabric.h> #import <Crashlytics/Crashlytics.h> @interface AppDelegate () @end @implementation AppDelegate @synthesize viewController = _viewController; - (void) initUser { DATAMANAGER.user = [[SFAUser alloc] init]; DATAMANAGER.user.percorsi = [NSMutableDictionary dictionary]; DATAMANAGER.user.poiForRoute = [NSMutableDictionary dictionary]; DATAMANAGER.user.pointsForRoute = [NSMutableDictionary dictionary]; DATAMANAGER.user.scoreRoute = [NSMutableDictionary dictionary]; DATAMANAGER.user.timeForRoute = [NSMutableDictionary dictionary]; DATAMANAGER.user.credits = [NSNumber numberWithInt:0]; DATAMANAGER.user.cluesForRoute = [NSMutableDictionary dictionary]; [DATAMANAGER saveUser]; } - (void) setupNavigationBar:(UINavigationController*)nc { nc.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"" style:UIBarButtonItemStylePlain target:nil action:nil]; [nc.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault]; nc.navigationBar.shadowImage = [UIImage new]; nc.navigationBar.translucent = YES; nc.view.backgroundColor = [UIColor clearColor]; nc.navigationBar.backgroundColor = [UIColor clearColor]; nc.navigationBar.tintColor = [UIColor whiteColor]; [nc.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor whiteColor]}]; nc.navigationBar.barStyle = UIBarStyleBlack; } - (void) initWithMenu { HomeVC *viewController = [[HomeVC alloc] init]; MenuVC *viewController2 = [[MenuVC alloc] init]; self.nc = [[UINavigationController alloc] initWithRootViewController:viewController]; [self setupNavigationBar:self.nc]; SWRevealViewController *revealController = [[SWRevealViewController alloc] initWithRearViewController:viewController2 frontViewController:self.nc]; // [revealController setRearViewRevealWidth:[[UIScreen mainScreen] bounds].size.width]; self.viewController = revealController; [self.window setRootViewController:self.viewController]; [self.window makeKeyAndVisible]; } - (void) initWithLogin { LoginVC *viewController = [[LoginVC alloc] init]; self.nc = [[UINavigationController alloc] initWithRootViewController:viewController]; [self setupNavigationBar:self.nc]; self.window.rootViewController = self.nc; [self.window makeKeyAndVisible]; } - (void) initWithTutorial { TutorialViewController *viewController = [[TutorialViewController alloc] init]; self.nc = [[UINavigationController alloc] initWithRootViewController:viewController]; [self setupNavigationBar:self.nc]; self.window.rootViewController = self.nc; [self.window makeKeyAndVisible]; } - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization after application launch. self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; NSURLCache *URLCache = [[NSURLCache alloc] initWithMemoryCapacity:2 * 1024 * 1024 diskCapacity:150 * 1024 * 1024 diskPath:nil]; [NSURLCache setSharedURLCache:URLCache]; NSString *language = [[NSLocale preferredLanguages] objectAtIndex:0]; [application setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone]; [[NSUserDefaults standardUserDefaults] setObject:language forKey:@"lang"]; [[NSUserDefaults standardUserDefaults] synchronize]; if(![[NSUserDefaults standardUserDefaults] objectForKey:@"uuid"]) { NSString *uuid = [[UIDevice currentDevice] identifierForVendor].UUIDString; NSLog(@"UUID: %@", uuid); [[NSUserDefaults standardUserDefaults] setObject:uuid forKey:@"uuid"]; [[NSUserDefaults standardUserDefaults] synchronize]; } [DATAMANAGER loadUser]; NSLog(@"USER LANG: %@", DATAMANAGER.user.language ? DATAMANAGER.user.language : @"nil"); NSLog(@"DEVICE LANG: %@", [[NSUserDefaults standardUserDefaults] objectForKey:@"lang"]); if(!DATAMANAGER.user) { [self initUser]; } [DATAMANAGER defineLanguage]; BOOL sameLang; if(DATAMANAGER.user.language) { NSString *devLanguage = [[NSUserDefaults standardUserDefaults] objectForKey:@"lang"]; NSString *userLanguage = DATAMANAGER.user.language; devLanguage=[[devLanguage stringByReplacingOccurrencesOfString:@"-" withString:@""]stringByReplacingOccurrencesOfString:@"_" withString:@""] ; userLanguage=[[userLanguage stringByReplacingOccurrencesOfString:@"-" withString:@""]stringByReplacingOccurrencesOfString:@"_" withString:@""] ; sameLang = [userLanguage containsString:devLanguage]; } else { sameLang = NO; } if ([[NSUserDefaults standardUserDefaults] boolForKey:@"isLogged"] && sameLang) { [self initWithMenu]; } else { [self initWithLogin]; } [RFRateMe showRateAlertAfterTimesOpened:3]; [Fabric with:@[CrashlyticsKit]]; return YES; } - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation { return [[FBSDKApplicationDelegate sharedInstance] application:application openURL:url sourceApplication:sourceApplication annotation:annotation]; } - (void)applicationWillResignActive:(UIApplication *)application { // 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. } - (void)applicationWillEnterForeground:(UIApplication *)application { // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. } - (void)applicationDidBecomeActive:(UIApplication *)application { // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. } - (void)applicationDidEnterBackground:(UIApplication *)application { } - (void)applicationWillTerminate:(UIApplication *)application { } @end |
Commits for Nextrek/iOS/SafariArte/trunk/SafariArte/AppDelegate.m
Revision | Author | Commited | Message |
---|---|---|---|
831 Diff | FPompili | Sat 24 Oct, 2015 07:24:22 +0000 | final |
801 Diff | FPompili | Thu 15 Oct, 2015 17:42:20 +0000 | release 0.39 |
722 Diff | PBonamassa | Tue 08 Sep, 2015 13:42:51 +0000 | fixed sent score route |
648 Diff | PBonamassa | Wed 02 Sep, 2015 08:43:35 +0000 | |
573 Diff | FAquili | Wed 26 Aug, 2015 14:27:40 +0000 | AGGIUNTO PARSER PER AVERE ETICHETTE PERCORSI UGUALI SIA UN PERCORSI GRATUITI CHE IN I MIEI PERCORSI |
556 Diff | FAquili | Tue 25 Aug, 2015 10:35:23 +0000 | last update |
502 Diff | FPompili | Thu 13 Aug, 2015 13:53:08 +0000 | aggiunto salavataggio img offline con la routebyID |
446 Diff | PBonamassa | Wed 29 Jul, 2015 14:07:14 +0000 | added tutorial VC |
385 Diff | FPompili | Fri 17 Jul, 2015 14:45:51 +0000 | added auto conversion km->mile |
369 | FPompili | Thu 16 Jul, 2015 16:57:38 +0000 | added cluesdictionary , fixed something |