AppDelegate.m 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /**
  2. * Copyright (c) Facebook, Inc. and its affiliates.
  3. *
  4. * This source code is licensed under the MIT license found in the
  5. * LICENSE file in the root directory of this source tree.
  6. */
  7. #import "AppDelegate.h"
  8. #import <React/RCTBridge.h>
  9. #import <React/RCTBundleURLProvider.h>
  10. #import <React/RCTRootView.h>
  11. #import <KakaoOpenSDK/KakaoOpenSDK.h>
  12. @implementation AppDelegate
  13. - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
  14. {
  15. RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
  16. RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
  17. moduleName:@"emptyapp"
  18. initialProperties:nil];
  19. rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];
  20. self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
  21. UIViewController *rootViewController = [UIViewController new];
  22. rootViewController.view = rootView;
  23. self.window.rootViewController = rootViewController;
  24. [self.window makeKeyAndVisible];
  25. return YES;
  26. }
  27. - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url
  28. sourceApplication:(NSString *)sourceApplication
  29. annotation:(id)annotation {
  30. if ([KOSession isKakaoAccountLoginCallback:url]) {
  31. return [KOSession handleOpenURL:url];
  32. }
  33. return false;
  34. }
  35. - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url
  36. options:(NSDictionary<NSString *,id> *)options {
  37. if ([KOSession isKakaoAccountLoginCallback:url]) {
  38. return [KOSession handleOpenURL:url];
  39. }
  40. return false;
  41. }
  42. - (void)applicationDidBecomeActive:(UIApplication *)application
  43. {
  44. [KOSession handleDidBecomeActive];
  45. }
  46. - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
  47. {
  48. #if DEBUG
  49. return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
  50. #else
  51. return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
  52. #endif
  53. }
  54. @end