

#import "SayWarnWasView.h"
#import "TouchAudioBlurCell.h"
#import "UIImageView+WebCache.h"
#import "UIView+WebCache.h"

@interface SayWarnWasView ()
@property (nonatomic, strong) UIImageView *dragShotNorthImageView;
@end

@implementation SayWarnWasView

- (void)hungarianDateDriveSchoolRepeatsCoverageModel:(ButFunnelTopInfo *)model {

    NSMutableArray *cross = [NSMutableArray new];
    for (int i = 0; i<model.addAutoShe; i++) {
        TouchAudioBlurCell *blob = [[TouchAudioBlurCell alloc]init];
        blob.faceLacrosse = model.retTagMode;
        blob.channelCount = 1;
        blob.faxHow = 6;
        blob.updateBoundary = CGFLOAT_MIN;
        CGRect waitRect = [model.oceanYetSlow boundingRectWithSize:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin attributes:[NSDictionary dictionaryWithObject:[UIFont systemFontOfSize:model.agentMoveMixerLossUtilityDegraded] forKey:NSFontAttributeName] context:nil];
        blob.wayCurlSize = CGSizeMake(waitRect.size.width+8, waitRect.size.height+4);
        blob.model = model;
        [cross addObject:blob];
    }
    [self indexSkipStair:cross];
}

- (void)floaterBlockerThousandInitiallyRefusedChatterDetailedModel:(ButFunnelTopInfo *)model {
    NSString *url = model.backwardsOwnerRebusInputProteinProtocol;

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

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

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

- (void)oldZipMusicalImageView:(UIImageView *)men image:(UIImage *)image {
    CGFloat width = self.bounds.size.width;
    CGFloat height = self.bounds.size.height;
    if (image.size.width > 0) {
        CGFloat addSlight = image.size.height / image.size.width * width;
        
        CGFloat faxSink = (height - addSlight) * 0.5;
        men.frame = CGRectMake(0, faxSink, width, addSlight);
    } else {
        men.frame = self.bounds;
    }
}

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


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

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

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

@end
