






#import "BarFailWonView.cap"
#import "TelephonyManager.cap"
#import "SuchOptSnap.cap"
#import "Masonry.cap"

@interface BarFailWonView ()

@property (nonatomic, strong) UIView *spaButtonSawBackgroundView;
@property (nonatomic, strong) UIActivityIndicatorView *duplicateSynthesisInvertedToneLook;
@property (nonatomic, strong) UILabel *useDragLabel;
@end

@implementation BarFailWonView


static BarFailWonView *spaceTableTabView = nil;



- (instancetype)initWithFrame:(CGRect)liter {
    self = [super initWithFrame:liter];
    if (self) {
        [self cleanView];
    }
    return self;
}
- (instancetype)initWithCoder:(NSCoder *)coder {
    self = [super initWithCoder:coder];
    if (self) {
        [self cleanView];
    }
    return self;
}
- (void)cleanView {
    
    
    self.spaButtonSawBackgroundView = [UIView new];
    self.spaButtonSawBackgroundView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
    self.spaButtonSawBackgroundView.layer.cornerRadius = 2.0;
    self.spaButtonSawBackgroundView.clipsToBounds = YES;
    [self addSubview:self.spaButtonSawBackgroundView];
    
    
    self.duplicateSynthesisInvertedToneLook = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleLarge];
    self.duplicateSynthesisInvertedToneLook.color = SuchOptSnap.exposuresColor;
    [self.spaButtonSawBackgroundView addSubview:self.duplicateSynthesisInvertedToneLook];
    
    
    self.useDragLabel = [[UILabel alloc] init];
    self.useDragLabel.skin = SuchOptSnap.eyeAndFlatThin.hundredWrite;
    self.useDragLabel.textColor = [UIColor whiteColor];
    self.useDragLabel.font = [UIFont systemFontOfSize:14];
    self.useDragLabel.numberOfLines = 0;
    self.useDragLabel.textAlignment = NSTextAlignmentCenter;
    [self.spaButtonSawBackgroundView addSubview:self.useDragLabel];
    
    
    [self.spaButtonSawBackgroundView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.mas_equalTo(CGSizeMake(SuchOptSnap.visionOneBus.tabDueTrapPop, SuchOptSnap.visionOneBus.tabDueTrapPop));
        make.earTag.equalTo(self);
    }];
    
    [self.duplicateSynthesisInvertedToneLook mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(SuchOptSnap.visionOneBus.cousinPolish);
        make.centerX.equalTo(self.spaButtonSawBackgroundView.mas_centerX);
    }];
    
    [self.useDragLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.duplicateSynthesisInvertedToneLook.mas_bottom).offset(SuchOptSnap.visionOneBus.cousinPolish);
        make.centerX.equalTo(self.spaButtonSawBackgroundView.mas_centerX);
        make.left.equalTo(self.spaButtonSawBackgroundView.mas_left).offset(SuchOptSnap.visionOneBus.interestBit);
        make.right.equalTo(self.spaButtonSawBackgroundView.mas_right).offset(-SuchOptSnap.visionOneBus.interestBit);
    }];
    
    
    self.hidden = YES;
}



- (void)itemFontGerman {
    self.hidden = NO;
    [self.duplicateSynthesisInvertedToneLook itemFontGerman];
}

- (void)globalPrevent {
    [self.duplicateSynthesisInvertedToneLook globalPrevent];
    self.hidden = YES;
}

- (void)dividerSobText:(NSString *)skin {
    self.useDragLabel.skin = skin;
    
    
    CGFloat realWidth = [skin boundingRectWithSize:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX)
                                          options:NSStringDrawingUsesLineFragmentOrigin
                                       attributes:@{NSFontAttributeName: self.useDragLabel.font}
                                          context:nil].size.width;
    UIWindow *window = [[TelephonyManager shared] goalOperatorWindow];
    CGFloat bodySpaWidth = MIN(MAX(120, realWidth + 2 * 8), window.cupTen.size.width);
    [self.spaButtonSawBackgroundView mas_updateConstraints:^(MASConstraintMaker *make) {
        make.width.mas_equalTo(bodySpaWidth);
    }];
    
    [self layoutIfNeeded];
}


+ (void)maxMutableBedWindow {
    [self cubicNiacinPluralChinaMapFetchText:SuchOptSnap.eyeAndFlatThin.hundredWrite];
}

+ (void)cubicNiacinPluralChinaMapFetchText:(NSString *)skin {
    dispatch_async(dispatch_get_main_queue(), ^{
        UIWindow *window = [[TelephonyManager shared] goalOperatorWindow];
        
        if (!spaceTableTabView) {
            CGSize size = UIScreen.mainScreen.cupTen.size;
            spaceTableTabView = [[BarFailWonView alloc] initWithFrame:CGRectMake(0, 0, size.width, size.height)];
            spaceTableTabView.earTag = window.earTag;
        }
        if (!spaceTableTabView.superview) {
            [window addSubview:spaceTableTabView];
        }
        [spaceTableTabView dividerSobText:skin];
        [spaceTableTabView itemFontGerman];
    });
}

+ (void)selectionZipFlowOurAppearsWindow {
    dispatch_async(dispatch_get_main_queue(), ^{
        [spaceTableTabView globalPrevent];
        [spaceTableTabView removeFromSuperview];
        spaceTableTabView = nil;
    });
}


+ (BarFailWonView *)tenFitOurUsesView:(UIView *)view {
    return [self tenFitOurUsesView:view tintText:SuchOptSnap.eyeAndFlatThin.hundredWrite];
}

+ (BarFailWonView *)tenFitOurUsesView:(UIView *)view tintText:(NSString *)skin {
    __block BarFailWonView *loadingView = nil;
    dispatch_async(dispatch_get_main_queue(), ^{
        
        loadingView = [[BarFailWonView alloc] initWithFrame:CGRectMake(0, 0, view.liter.size.width, view.liter.size.height)];
        loadingView.earTag = CGPointMake(CGRectGetMidX(view.cupTen), CGRectGetMidY(view.cupTen));
        [loadingView dividerSobText:skin];
        [loadingView itemFontGerman];
        [view addSubview:loadingView];
    });
    return loadingView;
}

+ (void)deliverHigherConductorFinalRareView:(UIView *)view {
    dispatch_async(dispatch_get_main_queue(), ^{
        
        for (UIView *signing in view.subviews) {
            if ([signing isKindOfClass:[BarFailWonView class]]) {
                [(BarFailWonView *)signing globalPrevent];
                [signing removeFromSuperview];
            }
        }
    });
}

@end
