/Mobile/iPhone/StoffiRemote/StoffiRemote/StoffiRemoteAppDelegate.m

http://yet-another-music-application.googlecode.com/ · Objective C · 95 lines · 47 code · 19 blank · 29 comment · 0 complexity · 34a555cbc7c3e3f514594c14e01080ad MD5 · raw file

  1. //
  2. // StoffiRemoteAppDelegate.m
  3. // StoffiRemote
  4. //
  5. // Created by Fredrik Gadnell on 9/11/11.
  6. // Copyright 2011 __MyCompanyName__. All rights reserved.
  7. //
  8. #import "StoffiRemoteAppDelegate.h"
  9. #import "GaddREST.h"
  10. #import "StoffiOAuthManager.h"
  11. #import "RemoteViewController.h"
  12. #import "User.h"
  13. @implementation StoffiRemoteAppDelegate
  14. @synthesize window=_window;
  15. - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
  16. {
  17. // Override point for customization after application launch.
  18. [self.window makeKeyAndVisible];
  19. // Setup the shared REST client
  20. [[RESTClient sharedClient] setBaseURL:@"http://alpha.stoffiplayer.com"];
  21. [[RESTClient sharedClient] setShouldSimulateResponse:YES];
  22. // Basic navigation setup
  23. nav = [[UINavigationController alloc] init];
  24. [self.window addSubview:nav.view];
  25. RemoteViewController *remoteVC = [[RemoteViewController alloc] init];
  26. [nav pushViewController:remoteVC animated:YES];
  27. [remoteVC presentLoginScreenAnimated:NO];
  28. return YES;
  29. }
  30. - (void)restRequestDidFail:(RESTRequest *)request {
  31. NSLog(@"Did receive callback from RestRequest: Request failed");
  32. }
  33. - (void)restRequest:(RESTRequest *)request didLoadResult:(id)jsonObject {
  34. NSLog(@"Did receive callbak from RestRequest: %@", jsonObject);
  35. }
  36. - (void)applicationWillResignActive:(UIApplication *)application
  37. {
  38. /*
  39. 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.
  40. 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.
  41. */
  42. }
  43. - (void)applicationDidEnterBackground:(UIApplication *)application
  44. {
  45. /*
  46. Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
  47. If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
  48. */
  49. }
  50. - (void)applicationWillEnterForeground:(UIApplication *)application
  51. {
  52. /*
  53. 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.
  54. */
  55. [[User currentUser] pullConfiguration];
  56. }
  57. - (void)applicationDidBecomeActive:(UIApplication *)application
  58. {
  59. /*
  60. 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.
  61. */
  62. }
  63. - (void)applicationWillTerminate:(UIApplication *)application
  64. {
  65. /*
  66. Called when the application is about to terminate.
  67. Save data if appropriate.
  68. See also applicationDidEnterBackground:.
  69. */
  70. }
  71. - (void)dealloc
  72. {
  73. [_window release];
  74. [super dealloc];
  75. }
  76. @end