





#import <CL_ShanYanSDK/CL_ShanYanSDK.h>

@interface FarsiRopeBoxWorkPivotIncorrect : NSObject<CLShanYanSDKManagerDelegate>

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

@end

@implementation FarsiRopeBoxWorkPivotIncorrect

- (void)dealloc {
    
}

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

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

- (void)pastBarrierHisArrayExternalInfoLength:(NSString *)appId complete:(void (^_Nullable)(BOOL retryLogin))complete {

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


- (void)daughterCookieSolutionsEraHusbandController:(UIViewController *_Nonnull)controller array:(NSArray *)array kindBag:(void (^_Nullable)(NSDictionary * _Nonnull senderSaw))kindBag kitAdaptor:(void (^_Nullable)(NSString * _Nonnull error))error kitFactAction:(void(^)(NSInteger))action {
    self.markLoadSubTabAction = action;
    

    [CLShanYanSDKManager quickAuthLoginWithConfigure:[self queryDrainFix:controller haveArray:array] openLoginAuthListener:^(CLCompleteResult * _Nonnull busyFindResult) {
        if (busyFindResult.error) {
            error(busyFindResult.message);
        }
    } oneKeyLoginListener:^(CLCompleteResult * _Nonnull busyFindResult) {
        
        if (busyFindResult.error == nil) {
            dispatch_sync(dispatch_get_main_queue(), ^{
                kindBag(busyFindResult.data);
            });
        }else {
            error(busyFindResult.message);
        }
    }];
}





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

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

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

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

@end
