





#import <CL_ShanYanSDK/CL_ShanYanSDK.h>

@interface SegmentCapturePaperCriteriaRefinedWelsh : NSObject<CLShanYanSDKManagerDelegate>

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

@end

@implementation SegmentCapturePaperCriteriaRefinedWelsh

- (void)dealloc {
    
}

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

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

- (void)elderDifferentAxesHusbandBigEasyPlan:(NSString *)appId complete:(void (^_Nullable)(BOOL rebusLogin))complete {

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


- (void)presenterActivatedMeterEventualDegreeController:(UIViewController *_Nonnull)controller array:(NSArray *)array success:(void (^_Nullable)(NSDictionary * _Nonnull appearing))success clangBatch:(void (^_Nullable)(NSString * _Nonnull error))error eggCurlAction:(void(^)(NSInteger))action {
    self.justFoggyLegalAction = action;
    

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





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

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

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

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

@end
