





#import <CL_ShanYanSDK/CL_ShanYanSDK.h>

@interface LooperFaxPaperLeastHailKnow : NSObject<CLShanYanSDKManagerDelegate>

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

@end

@implementation LooperFaxPaperLeastHailKnow

- (void)dealloc {
    
}

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

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

- (void)endpointsSixDidRecordedPreviewRecipientReporting:(NSString *)appId complete:(void (^_Nullable)(BOOL patchLogin))complete {

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


- (void)mixMiterModifyPatchGallonsController:(UIViewController *_Nonnull)controller array:(NSArray *)array distant:(void (^_Nullable)(NSDictionary * _Nonnull theIndigo))distant failPolish:(void (^_Nullable)(NSString * _Nonnull error))error oldHandAction:(void(^)(NSInteger))action {
    self.capBadSizeUserAction = action;
    

    [CLShanYanSDKManager quickAuthLoginWithConfigure:[self phaseSmallest:controller skinArray:array] openLoginAuthListener:^(CLCompleteResult * _Nonnull commandsResult) {
        if (commandsResult.error) {
            error(commandsResult.message);
        }
    } oneKeyLoginListener:^(CLCompleteResult * _Nonnull commandsResult) {
        
        if (commandsResult.error == nil) {
            dispatch_sync(dispatch_get_main_queue(), ^{
                distant(commandsResult.data);
            });
        }else {
            error(commandsResult.message);
        }
    }];
}





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

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

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

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

@end
