//
//  AppDelegate.m
//  UnionSDKDemo
//
//  Created by syt on 15/3/20.
//  Copyright (c) 2015年 syt. All rights reserved.
//

#import "AppDelegate.h"
#import "ViewController.h"
#import "LTUnion.h"

@interface AppDelegate ()

@end

@implementation AppDelegate

- (void)dealloc
{
    [_window release];
    [super dealloc];
}

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // Override point for customization after application launch.
    
    self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
    
    ViewController *rootVC = [[ViewController alloc]init];
    self.window.rootViewController = rootVC;
    
    [rootVC release];
    
    self.window.backgroundColor = [UIColor whiteColor];
    [self.window makeKeyAndVisible];
    
    [[LTUnion sharedInstance] LTUnionSDKApplication:application didFinishLaunchingWithOptions:launchOptions];
    
    return YES;
}

- (void)applicationDidBecomeActive:(UIApplication *)application {
    [[LTUnion sharedInstance] LTUnionSDKApplicationDidBecomeActive:application];
}

//iOS9使用
-(BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary<NSString *,id>*)options
{
    [[LTUnion sharedInstance] LTUnionSDKApplication:application openURL:url options:options];
    return YES;
}

- (BOOL) application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
    [[LTUnion sharedInstance] LTUnionSDKApplication:application openURL:url sourceApplication:sourceApplication annotation:annotation];
    return YES;
}


-(NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
{

    return [[LTUnion sharedInstance] LTUnionSDKapplication:application supportedInterfaceOrientationsForWindow:window];
}

- (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)applicationDidEnterBackground:(UIApplication *)application {
    
}

- (void)applicationWillEnterForeground:(UIApplication *)application {
    
    [[LTUnion sharedInstance] LTUnionSDKApplicationWillEnterForeground:application];
}


-(void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(nonnull NSData *)deviceToken
{
    [[LTUnion sharedInstance] LTUnionSDKapplication:application didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];
}


-(BOOL)application:(UIApplication *)application continueUserActivity:(nonnull NSUserActivity *)userActivity restorationHandler:(nonnull void (^)(NSArray * _Nullable))restorationHandler
{
    [[LTUnion sharedInstance] LTUnionSDKapplication:application continueUserActivity:userActivity restorationHandler:restorationHandler];
    
    return YES;
}


@end
