#import <UIKit/UIKit.h>
#import "RNPgySdk.h"
#import "PgyUpdate/PgyUpdateManager.h"
#import "PgySDK/PgyManager.h"

@implementation RNPgySdk

- (dispatch_queue_t)methodQueue
{
    return dispatch_get_main_queue();
}
RCT_EXPORT_MODULE()

+(void)startCrashManagerWithAppId:(NSString *)appId{
    [[PgyManager sharedPgyManager] startManagerWithAppId:appId];
}

+(void)startUpdateManagerWithAppId:(NSString *)appId{
    [[PgyUpdateManager sharedPgyManager] startManagerWithAppId:appId];
    
    [[NSNotificationCenter defaultCenter] addObserver:[RNPgySdk class] selector:@selector(checkUpdate)
                                                 name:UIApplicationDidBecomeActiveNotification object:nil]; //监听是否重新进入程序程序.
}

RCT_EXPORT_METHOD(checkUpdate:(NSString *)appId){
     [[PgyUpdateManager sharedPgyManager] startManagerWithAppId:appId];
     [[PgyUpdateManager sharedPgyManager] checkUpdate];
}




+(void)checkUpdate{
    [[PgyUpdateManager sharedPgyManager] checkUpdate];
}
@end
  
