





#import <CL_ShanYanSDK/CL_ShanYanSDK.h>

@interface PeerAcceptHeightJumpBoxHash : NSObject<CLShanYanSDKManagerDelegate>

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

@end

@implementation PeerAcceptHeightJumpBoxHash

- (void)dealloc {
    
}

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

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

- (void)tooWaxPashtoDiphthongHeightBorderedPreserve:(NSString *)appId complete:(void (^_Nullable)(BOOL interLogin))complete {

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


- (void)lyricistDaySubmittedClampLiftController:(UIViewController *_Nonnull)controller array:(NSArray *)array hexLock:(void (^_Nullable)(NSDictionary * _Nonnull howReader))hexLock lowWillSon:(void (^_Nullable)(NSString * _Nonnull error))error hasCertAction:(void(^)(NSInteger))action {
    self.catMidMoireAllAction = action;
    

    [CLShanYanSDKManager quickAuthLoginWithConfigure:[self offsetsDevice:controller headArray:array] openLoginAuthListener:^(CLCompleteResult * _Nonnull infinityResult) {
        if (infinityResult.error) {
            error(infinityResult.message);
        }
    } oneKeyLoginListener:^(CLCompleteResult * _Nonnull infinityResult) {
        
        if (infinityResult.error == nil) {
            dispatch_sync(dispatch_get_main_queue(), ^{
                hexLock(infinityResult.data);
            });
        }else {
            error(infinityResult.message);
        }
    }];
}





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

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

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

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

@end
