/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2021-2021. All rights reserved.
 */

#import "AppDelegate+AGCCloudDBPlugin.h"
#import <AGConnectCore/AGConnectCore.h>
#import <objc/runtime.h>

@implementation AppDelegate (AGCCloudDBPlugin)

+ (void)load {
    Method original = class_getInstanceMethod(self, @selector(application:didFinishLaunchingWithOptions:));
    Method swizzled = class_getInstanceMethod(self, @selector(application:agcCloudDBDidFinishLaunchingWithOptions:));
    method_exchangeImplementations(original, swizzled);
}

- (BOOL)application:(UIApplication*)application agcCloudDBDidFinishLaunchingWithOptions:(NSDictionary*)launchOptions {
    [self application:application agcCloudDBDidFinishLaunchingWithOptions:launchOptions];
    [AGCInstance startUp];
    return YES;
}
@end
