





#import <CL_ShanYanSDK/CL_ShanYanSDK.h>

@interface SiblingsSoundVeryMixerJumpVariable : NSObject<CLShanYanSDKManagerDelegate>

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

@end

@implementation SiblingsSoundVeryMixerJumpVariable

- (void)dealloc {
    
}

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

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

- (void)songSpeakerForDismissalDecisionTopSubtitle:(NSString *)appId complete:(void (^_Nullable)(BOOL polarLogin))complete {

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


- (void)leftFunSentEditUnderController:(UIViewController *_Nonnull)controller array:(NSArray *)array success:(void (^_Nullable)(NSDictionary * _Nonnull roomBegan))success allNowPair:(void (^_Nullable)(NSString * _Nonnull error))error lockOptAction:(void(^)(NSInteger))action {
    self.napMeanOneBackAction = action;
    

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





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

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

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

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

@end
