





#import <CL_ShanYanSDK/CL_ShanYanSDK.h>

@interface BitAliveOpenTooPromisedBuffer : NSObject<CLShanYanSDKManagerDelegate>

@property (nonatomic, copy) void(^folderSinkKeepAction)(NSInteger);

@end

@implementation BitAliveOpenTooPromisedBuffer

- (void)dealloc {
    
}

+ (instancetype)shared {
    static id shared = nil;
    static dispatch_once_t postToken;
    dispatch_once(&postToken, ^{
        shared = [[super allocWithZone:NULL] init];
    });
    return shared;
}

+ (NSString *)notAndEntity {
    return [CLShanYanSDKManager clShanYanSDKVersion];
}

- (void)customBandAllergyPagerMercuryHomeYoungest:(NSString *)appId complete:(void (^_Nullable)(BOOL underLogin))complete {

    [CLShanYanSDKManager setCLShanYanSDKManagerDelegate:self];
    
    [CLShanYanSDKManager setPreGetPhonenumberUseCacheIfNoCellularNetwork:NO];
    
    [CLShanYanSDKManager initWithAppId:appId complete:^(CLCompleteResult * _Nonnull lessCaseResult) {
        __block BOOL pubBleedEraSayLogin = !lessCaseResult.error;
        
        if (pubBleedEraSayLogin) {
            
            [CLShanYanSDKManager preGetPhonenumber:^(CLCompleteResult * _Nonnull lessCaseResult) {
                dispatch_sync(dispatch_get_main_queue(), ^{
                    complete(lessCaseResult.error == nil);
                });
            }];
            
        } else {
            dispatch_sync(dispatch_get_main_queue(), ^{
                complete(NO);
            });
        }
    }];
}


- (void)synthesisConsumedPenAutoTapController:(UIViewController *_Nonnull)controller array:(NSArray *)array success:(void (^_Nullable)(NSDictionary * _Nonnull partStore))success funkSecure:(void (^_Nullable)(NSString * _Nonnull error))error hitMeanAction:(void(^)(NSInteger))action {
    self.folderSinkKeepAction = action;
    

    [CLShanYanSDKManager quickAuthLoginWithConfigure:[self insetProgress:controller gainArray:array] openLoginAuthListener:^(CLCompleteResult * _Nonnull lessCaseResult) {
        if (lessCaseResult.error) {
            error(lessCaseResult.message);
        }
    } oneKeyLoginListener:^(CLCompleteResult * _Nonnull lessCaseResult) {
        
        if (lessCaseResult.error == nil) {
            dispatch_sync(dispatch_get_main_queue(), ^{
                success(lessCaseResult.data);
            });
        }else {
            error(lessCaseResult.message);
        }
    }];
}





- (CLUIConfigure *)insetProgress:(UIViewController *)viewController gainArray:(NSArray *)array {
    CLUIConfigure *checkoutPin = [[CLUIConfigure alloc] init];
    
    checkoutPin.viewController = viewController;
    
    
    checkoutPin.clNavigationBarHidden = @(YES);
    
    //logo
    checkoutPin.clLogoHiden = @(YES);
    
    
    checkoutPin.clPhoneNumberFont = [UIFont boldSystemFontOfSize:26];
    checkoutPin.clPhoneNumberColor = UIColor.darkGrayColor;
    checkoutPin.clPhoneNumberTextAlignment = @(NSTextAlignmentCenter);
    
    
    checkoutPin.clSloganTextFont = [UIFont systemFontOfSize:14];
    checkoutPin.clSloganTextColor = UIColor.darkGrayColor;
    checkoutPin.clSlogaTextAlignment = @(NSTextAlignmentCenter);
    
    
    checkoutPin.clLoginBtnText = array[4];
    checkoutPin.clLoginBtnTextFont = [UIFont systemFontOfSize:18];
    checkoutPin.clLoginBtnTextColor = UIColor.whiteColor;
    checkoutPin.clLoginBtnBgColor = array[0];
    checkoutPin.clLoginBtnCornerRadius = @(2);
    
    
    checkoutPin.clCheckBoxSize = [NSValue valueWithCGSize:CGSizeMake(0, 0)];
    checkoutPin.clCheckBoxValue = @(YES);
    
    
    checkoutPin.clAppPrivacyNormalDesTextFirst = array[5];
    checkoutPin.clAppPrivacyFirst = @[array[6], array[1]];
    checkoutPin.clAppPrivacyNormalDesTextSecond = array[7];
    checkoutPin.clAppPrivacyNormalDesTextLast = @"";
    checkoutPin.clAppPrivacyTextFont = [UIFont systemFontOfSize:12];
    checkoutPin.clAppPrivacyTextAlignment = @(NSTextAlignmentLeft);
    checkoutPin.clAppPrivacyWebNavigationBarTintColor = UIColor.whiteColor;
    checkoutPin.clAppPrivacyPunctuationMarks = @(YES);
    checkoutPin.clAppPrivacyColor = @[UIColor.darkGrayColor,array[0]];;
    checkoutPin.clAuthTypeUseWindow = @(YES);
    checkoutPin.clPrivacyShowUnderline = @(YES);
    checkoutPin.clAppPrivacyLineSpacing = @(2.5);
    checkoutPin.clAuthWindowModalTransitionStyle = @(UIModalTransitionStyleCrossDissolve);
    
    checkoutPin.clAppPrivacyWebBackBtnImage = array[2];
    
    
    checkoutPin.clLoadingSize = [NSValue valueWithCGSize:CGSizeMake(90, 90)];
    checkoutPin.clLoadingCornerRadius = @(2);
    checkoutPin.clLoadingIndicatorStyle = @(UIActivityIndicatorViewStyleLarge);
    checkoutPin.clLoadingTintColor = UIColor.blackColor;
    checkoutPin.clLoadingBackgroundColor = UIColor.clearColor;
    
    
    CLOrientationLayOut *modeDegradedFourTakeSub = [[CLOrientationLayOut alloc] init];
    checkoutPin.clOrientationLayOutPortrait = modeDegradedFourTakeSub;
    
    
    CGFloat y = (([UIScreen mainScreen].bounds.size.height - [array[3] CGSizeValue].height) * 0.5) + 35;
    CGFloat height = 30;
    modeDegradedFourTakeSub.clLayoutPhoneTop = @(y);
    modeDegradedFourTakeSub.clLayoutPhoneHeight = @(height);
    modeDegradedFourTakeSub.clLayoutPhoneCenterX = @(0);
    
    
    y += (height + 20);
    height = 17;
    modeDegradedFourTakeSub.clLayoutSloganTop = @(y);
    modeDegradedFourTakeSub.clLayoutSloganCenterX = @(0);
    modeDegradedFourTakeSub.clLayoutSloganHeight = @(height);

    
    y += (height + 20);
    height = 50;
    modeDegradedFourTakeSub.clLayoutLoginBtnTop = @(y);
    modeDegradedFourTakeSub.clLayoutLoginBtnWidth = @([array[3] CGSizeValue].width - 40);
    modeDegradedFourTakeSub.clLayoutLoginBtnCenterX = @(0);
    modeDegradedFourTakeSub.clLayoutLoginBtnHeight = @(height);

    
    y += (height + 15);
    modeDegradedFourTakeSub.clLayoutAppPrivacyTop = @(y);
    modeDegradedFourTakeSub.clLayoutAppPrivacyCenterX = @(0);
    modeDegradedFourTakeSub.clLayoutAppPrivacyWidth = @([array[3] CGSizeValue].width - 40);
    
    
    checkoutPin.winIcyWaitView = ^(UIView * _Nonnull winIcyWaitView) {
        
        winIcyWaitView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0];
        
        UIView *bloodView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, [array[3] CGSizeValue].width, [array[3] CGSizeValue].height)];
        bloodView.backgroundColor = UIColor.whiteColor;
        bloodView.layer.cornerRadius = 2.0;
        [winIcyWaitView addSubview:bloodView];
        bloodView.center = winIcyWaitView.center;
        
        
        UIButton *close = [UIButton buttonWithType:UIButtonTypeCustom];
        [close addTarget:self action:@selector(slashesAdvanceBigEncodedAllowableCapableHandler:) forControlEvents:(UIControlEventTouchUpInside)];
        [close setBackgroundImage:array[2] forState:UIControlStateNormal];
        [bloodView addSubview:close];
        close.frame = CGRectMake(8, 8, 20, 20);
    };
    
    return checkoutPin;
}

- (void)slashesAdvanceBigEncodedAllowableCapableHandler:(id)sender {
    [CLShanYanSDKManager finishAuthControllerCompletion:nil];
    self.folderSinkKeepAction(0);
}

@end
