

#import "PointerWetView.h"
#import "StepTapZeroSawCell.h"
#import "UIImageView+WebCache.h"
#import "UIView+WebCache.h"

@interface PointerWetView ()
@property (nonatomic, strong) UIImageView *dayRunSentFunImageView;
@end

@implementation PointerWetView

- (void)showStaleTakeLazyHostLoudModel:(OutBeatFoundInfo *)model {
[self armRingRateZoneReversesMajorListenersModel:model];
    NSMutableArray *inner = [NSMutableArray new];
    for (int i = 0; i<model.tildeEarly; i++) {
        StepTapZeroSawCell *fair = [[StepTapZeroSawCell alloc]init];
        fair.quickZeroArt = model.exceedsAdd;
        fair.channelCount = 1;
        fair.lowBit = 6;
        fair.textHexOffWord = CGFLOAT_MIN;
        CGRect filmRect = [model.authorMostly boundingRectWithSize:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin attributes:[NSDictionary dictionaryWithObject:[UIFont systemFontOfSize:model.factoryNineStateQuarterVortexFlight] forKey:NSFontAttributeName] context:nil];
        fair.persianSize = CGSizeMake(filmRect.size.width+8, filmRect.size.height+4);
        fair.model = model;
        [inner addObject:fair];
    }
    [self doneRunStayArm:inner];
}

- (void)armRingRateZoneReversesMajorListenersModel:(OutBeatFoundInfo *)model {
    NSString *url = model.marginFusionRefinedRedoneIssuePop;

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

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

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

- (void)seeMinBitTalkImageView:(UIImageView *)icy image:(UIImage *)image {
    CGFloat width = self.bounds.size.width;
    CGFloat height = self.bounds.size.height;
    if (image.size.width > 0) {
        CGFloat sixStrong = image.size.height / image.size.width * width;
        
        CGFloat highest = (height - sixStrong) * 0.5;
        icy.frame = CGRectMake(0, highest, width, sixStrong);
    } else {
        icy.frame = self.bounds;
    }
}

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


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

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

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

@end
