123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- /**
- * Copyright (c) Facebook, Inc. and its affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
- #import "AppDelegate.h"
- #import <React/RCTBridge.h>
- #import <React/RCTBundleURLProvider.h>
- #import <React/RCTRootView.h>
- #import <KakaoOpenSDK/KakaoOpenSDK.h>
- #import <FBSDKCoreKit/FBSDKCoreKit.h>
- #import <RNGoogleSignin/RNGoogleSignin.h>
- #import <NaverThirdPartyLogin/NaverThirdPartyLogin.h>
- @implementation AppDelegate
- - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
- {
-
- NaverThirdPartyLoginConnection *thirdConn = [NaverThirdPartyLoginConnection getSharedInstance];
- // [thirdConn setOnlyPortraitSupportInIphone:YES];
-
- [thirdConn setServiceUrlScheme:kServiceAppUrlScheme];
- [thirdConn setConsumerKey:kConsumerKey];
- [thirdConn setConsumerSecret:kConsumerSecret];
- [thirdConn setAppName:kServiceAppName];
-
- RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
- RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
- moduleName:@"emptyapp"
- initialProperties:nil];
- rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];
- self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
- UIViewController *rootViewController = [UIViewController new];
- rootViewController.view = rootView;
- self.window.rootViewController = rootViewController;
- [self.window makeKeyAndVisible];
- return YES;
- }
- - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url
- sourceApplication:(NSString *)sourceApplication
- annotation:(id)annotation {
- if ([KOSession isKakaoAccountLoginCallback:url]) {
- return [KOSession handleOpenURL:url];
- }
- return false;
- }
- - (BOOL)application:(UIApplication *)application openURL:(nonnull NSURL *)url options:(nonnull NSDictionary<NSString *,id> *)options {
-
- NSString *strscheme = [url scheme];
- NSString *naver = @"naver";
- NSString *fb = @"fb";
- NSString *google = @"com.googleusercontent";
-
- if ([KOSession isKakaoAccountLoginCallback:url]) {
- return [KOSession handleOpenURL:url];
- }
-
- if([strscheme containsString:naver]) {
- return [[NaverThirdPartyLoginConnection getSharedInstance] application:application openURL:url options:options];
- }
-
- if([strscheme containsString:fb]) {
- return [[FBSDKApplicationDelegate sharedInstance]
- application:application
- openURL:url
- sourceApplication:options[UIApplicationOpenURLOptionsSourceApplicationKey]
- annotation:options[UIApplicationOpenURLOptionsAnnotationKey]];
- }
-
- if([strscheme containsString:google]) {
- return [RNGoogleSignin application:application
- openURL:url
- sourceApplication:options[UIApplicationOpenURLOptionsSourceApplicationKey]
- annotation:options[UIApplicationOpenURLOptionsAnnotationKey]];
- }
-
- return false;
- }
- - (void)applicationDidBecomeActive:(UIApplication *)application
- {
- [KOSession handleDidBecomeActive];
- }
- - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
- {
- #if DEBUG
- return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
- #else
- return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
- #endif
- }
- @end
|