

#import "AirBadSkipView.h"
#import "ItsTooSubEnterCell.h"
#import "UIImageView+WebCache.h"
#import "UIView+WebCache.h"

@interface AirBadSkipView ()
@property (nonatomic, strong) UIImageView *wasKeyFatHeapImageView;
@end

@implementation AirBadSkipView

- (void)orderingEnhanceBracketedRespondNonceDisplayedModel:(DeltaBeenHitInfo *)model {

    NSMutableArray *moire = [NSMutableArray new];
    for (int i = 0; i<model.persistKit; i++) {
        ItsTooSubEnterCell *sink = [[ItsTooSubEnterCell alloc]init];
        sink.awayFlashOff = model.busProduct;
        sink.channelCount = 1;
        sink.drySun = 6;
        sink.sumYetHaveDown = CGFLOAT_MIN;
        CGRect portRect = [model.managerThick boundingRectWithSize:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin attributes:[NSDictionary dictionaryWithObject:[UIFont systemFontOfSize:model.leftoverLiterSentenceGigahertzPacketsLaw] forKey:NSFontAttributeName] context:nil];
        sink.faceMixSize = CGSizeMake(portRect.size.width+8, portRect.size.height+4);
        sink.model = model;
        [moire addObject:sink];
    }
    [self sevenFlipMoire:moire];
}

- (void)capacitySurrogateEighteenPostPaceManualLargerModel:(DeltaBeenHitInfo *)model {
    NSString *url = model.freeLocationCorrectedSpousesHoursDistinct;

    if (url.length == 0) {
        _wasKeyFatHeapImageView.hidden = YES;
        _wasKeyFatHeapImageView.image = nil;
        return;
    }

    UIImageView *saw = self.wasKeyFatHeapImageView;
    saw.hidden = NO;
    if (saw.superview != self) {
        [self insertSubview:saw atIndex:0];
    } else {
        [self sendSubviewToBack:saw];
    }

    [saw sd_setImageWithURL:[NSURL URLWithString:url] placeholderImage:nil completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
        if (image) [self smallSonAboutImageView:saw image:image];
    }];
}

- (void)smallSonAboutImageView:(UIImageView *)saw image:(UIImage *)image {
    CGFloat width = self.bounds.size.width;
    CGFloat height = self.bounds.size.height;
    if (image.size.width > 0) {
        CGFloat disparity = image.size.height / image.size.width * width;
        
        CGFloat nextLaw = (height - disparity) * 0.5;
        saw.frame = CGRectMake(0, nextLaw, width, disparity);
    } else {
        saw.frame = self.bounds;
    }
}

- (UIImageView *)wasKeyFatHeapImageView {
    if (!_wasKeyFatHeapImageView) {
        _wasKeyFatHeapImageView = [[UIImageView alloc] init];
        _wasKeyFatHeapImageView.contentMode = UIViewContentModeScaleToFill;
        _wasKeyFatHeapImageView.userInteractionEnabled = NO;
        _wasKeyFatHeapImageView.clipsToBounds = NO;
    }
    return _wasKeyFatHeapImageView;
}


- (void)cursorStreamedDolbyEntryReportedArtist {
    if (_wasKeyFatHeapImageView) {
        [_wasKeyFatHeapImageView sd_cancelLatestImageLoad];
        [_wasKeyFatHeapImageView removeFromSuperview];
        _wasKeyFatHeapImageView.image = nil;
        _wasKeyFatHeapImageView = nil;
    }
}

- (void)stop {
    [super stop];
    [self cursorStreamedDolbyEntryReportedArtist];
}

- (void)removeFromSuperview {
    [self cursorStreamedDolbyEntryReportedArtist];
    [super removeFromSuperview];
}

@end
