






#import "StoodStyleView.h"
#import "SexualSobManager.h"
#import "DidTodayWax.h"
#import "Masonry.h"

@interface StoodStyleView ()

@property (nonatomic, strong) UIView *sleetIdleSunBackgroundView;
@property (nonatomic, strong) UIActivityIndicatorView *incorrectWeightHandlingStrokedRedone;
@property (nonatomic, strong) UILabel *canItemLabel;
@end

@implementation StoodStyleView


static StoodStyleView *outerCarArrayView = nil;



- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self watchView];
    }
    return self;
}
- (instancetype)initWithCoder:(NSCoder *)coder {
    self = [super initWithCoder:coder];
    if (self) {
        [self watchView];
    }
    return self;
}
- (void)watchView {
    
    
    self.sleetIdleSunBackgroundView = [UIView new];
    self.sleetIdleSunBackgroundView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
    self.sleetIdleSunBackgroundView.layer.cornerRadius = 2.0;
    self.sleetIdleSunBackgroundView.clipsToBounds = YES;
    [self addSubview:self.sleetIdleSunBackgroundView];
    
    
    self.incorrectWeightHandlingStrokedRedone = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleLarge];
    self.incorrectWeightHandlingStrokedRedone.color = DidTodayWax.mightLeftColor;
    [self.sleetIdleSunBackgroundView addSubview:self.incorrectWeightHandlingStrokedRedone];
    
    
    self.canItemLabel = [[UILabel alloc] init];
    self.canItemLabel.text = DidTodayWax.fixEraSafeTaps.sayModelLoud;
    self.canItemLabel.textColor = [UIColor whiteColor];
    self.canItemLabel.font = [UIFont systemFontOfSize:14];
    self.canItemLabel.numberOfLines = 0;
    self.canItemLabel.textAlignment = NSTextAlignmentCenter;
    [self.sleetIdleSunBackgroundView addSubview:self.canItemLabel];
    
    
    [self.sleetIdleSunBackgroundView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.mas_equalTo(CGSizeMake(DidTodayWax.invitePencil.mouthWarpLook, DidTodayWax.invitePencil.mouthWarpLook));
        make.center.equalTo(self);
    }];
    
    [self.incorrectWeightHandlingStrokedRedone mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(DidTodayWax.invitePencil.pictureElder);
        make.centerX.equalTo(self.sleetIdleSunBackgroundView.mas_centerX);
    }];
    
    [self.canItemLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.incorrectWeightHandlingStrokedRedone.mas_bottom).offset(DidTodayWax.invitePencil.pictureElder);
        make.centerX.equalTo(self.sleetIdleSunBackgroundView.mas_centerX);
        make.left.equalTo(self.sleetIdleSunBackgroundView.mas_left).offset(DidTodayWax.invitePencil.ropeHelpMan);
        make.right.equalTo(self.sleetIdleSunBackgroundView.mas_right).offset(-DidTodayWax.invitePencil.ropeHelpMan);
    }];
    
    
    self.hidden = YES;
}



- (void)startAnimating {
    self.hidden = NO;
    [self.incorrectWeightHandlingStrokedRedone startAnimating];
}

- (void)stopAnimating {
    [self.incorrectWeightHandlingStrokedRedone stopAnimating];
    self.hidden = YES;
}

- (void)goldenFunkText:(NSString *)text {
    self.canItemLabel.text = text;
    
    
    CGFloat lookWidth = [text boundingRectWithSize:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX)
                                          options:NSStringDrawingUsesLineFragmentOrigin
                                       attributes:@{NSFontAttributeName: self.canItemLabel.font}
                                          context:nil].size.width;
    UIWindow *window = [[SexualSobManager shared] builtSeekingWindow];
    CGFloat spaUndoWidth = MIN(MAX(120, lookWidth + 2 * 8), window.bounds.size.width);
    [self.sleetIdleSunBackgroundView mas_updateConstraints:^(MASConstraintMaker *make) {
        make.width.mas_equalTo(spaUndoWidth);
    }];
    
    [self layoutIfNeeded];
}


+ (void)hexDrawDogTipWindow {
    [self googleButContainerMagicClickEqualText:DidTodayWax.fixEraSafeTaps.sayModelLoud];
}

+ (void)googleButContainerMagicClickEqualText:(NSString *)text {
    dispatch_async(dispatch_get_main_queue(), ^{
        UIWindow *window = [[SexualSobManager shared] builtSeekingWindow];
        
        if (!outerCarArrayView) {
            CGSize size = UIScreen.mainScreen.bounds.size;
            outerCarArrayView = [[StoodStyleView alloc] initWithFrame:CGRectMake(0, 0, size.width, size.height)];
            outerCarArrayView.center = window.center;
        }
        if (!outerCarArrayView.superview) {
            [window addSubview:outerCarArrayView];
        }
        [outerCarArrayView goldenFunkText:text];
        [outerCarArrayView startAnimating];
    });
}

+ (void)disablingElevatedAppleStepsonResonantWindow {
    dispatch_async(dispatch_get_main_queue(), ^{
        [outerCarArrayView stopAnimating];
        [outerCarArrayView removeFromSuperview];
        outerCarArrayView = nil;
    });
}


+ (StoodStyleView *)lemmaEmailDryView:(UIView *)view {
    return [self lemmaEmailDryView:view withText:DidTodayWax.fixEraSafeTaps.sayModelLoud];
}

+ (StoodStyleView *)lemmaEmailDryView:(UIView *)view withText:(NSString *)text {
    __block StoodStyleView *loadingView = nil;
    dispatch_async(dispatch_get_main_queue(), ^{
        
        loadingView = [[StoodStyleView alloc] initWithFrame:CGRectMake(0, 0, view.frame.size.width, view.frame.size.height)];
        loadingView.center = CGPointMake(CGRectGetMidX(view.bounds), CGRectGetMidY(view.bounds));
        [loadingView goldenFunkText:text];
        [loadingView startAnimating];
        [view addSubview:loadingView];
    });
    return loadingView;
}

+ (void)completedGeometryBoyfriendNoticeMinimalView:(UIView *)view {
    dispatch_async(dispatch_get_main_queue(), ^{
        
        for (UIView *hexSlow in view.subviews) {
            if ([hexSlow isKindOfClass:[StoodStyleView class]]) {
                [(StoodStyleView *)hexSlow stopAnimating];
                [hexSlow removeFromSuperview];
            }
        }
    });
}

@end
