AppDelegate.m 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. #import <FBSDKCoreKit/FBSDKCoreKit.h>
  13. #import <RNGoogleSignin/RNGoogleSignin.h>
  14. @implementation AppDelegate
  15. - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
  16. {
  17. RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
  18. RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
  19. moduleName:@"emptyapp"
  20. initialProperties:nil];
  21. rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];
  22. self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
  23. UIViewController *rootViewController = [UIViewController new];
  24. rootViewController.view = rootView;
  25. self.window.rootViewController = rootViewController;
  26. [self.window makeKeyAndVisible];
  27. return YES;
  28. }
  29. - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url
  30. sourceApplication:(NSString *)sourceApplication
  31. annotation:(id)annotation {
  32. if ([KOSession isKakaoAccountLoginCallback:url]) {
  33. return [KOSession handleOpenURL:url];
  34. }
  35. return false;
  36. }
  37. - (BOOL)application:(UIApplication *)application openURL:(nonnull NSURL *)url options:(nonnull NSDictionary<NSString *,id> *)options {
  38. NSString *strscheme = [url scheme];
  39. NSString *naver = @"naver";
  40. NSString *fb = @"fb";
  41. NSString *google = @"com.googleusercontent";
  42. if ([KOSession isKakaoAccountLoginCallback:url]) {
  43. return [KOSession handleOpenURL:url];
  44. }
  45. if([strscheme containsString:fb]) {
  46. return [[FBSDKApplicationDelegate sharedInstance]
  47. application:application
  48. openURL:url
  49. sourceApplication:options[UIApplicationOpenURLOptionsSourceApplicationKey]
  50. annotation:options[UIApplicationOpenURLOptionsAnnotationKey]];
  51. }
  52. if([strscheme containsString:google]) {
  53. return [RNGoogleSignin application:application
  54. openURL:url
  55. sourceApplication:options[UIApplicationOpenURLOptionsSourceApplicationKey]
  56. annotation:options[UIApplicationOpenURLOptionsAnnotationKey]];
  57. }
  58. return false;
  59. }
  60. - (void)applicationDidBecomeActive:(UIApplication *)application
  61. {
  62. [KOSession handleDidBecomeActive];
  63. }
  64. - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
  65. {
  66. #if DEBUG
  67. return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
  68. #else
  69. return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
  70. #endif
  71. }
  72. @end