

#import "YetEraDarkView.h"
#import "ArmFunHeadRowsCell.h"
#import "UIImageView+WebCache.h"
#import "UIView+WebCache.h"

@interface YetEraDarkView ()
@property (nonatomic, strong) UIImageView *catPopNewtonsImageView;
@end

@implementation YetEraDarkView

- (void)sigmaHomepageDiagnoseLocallyRawEncodeModel:(HighlightSheInfo *)model {
[self maskFurlongsAcceptLiterExecOptDomainModel:model];
    NSMutableArray *cycle = [NSMutableArray new];
    for (int i = 0; i<model.resultEast; i++) {
        ArmFunHeadRowsCell *thin = [[ArmFunHeadRowsCell alloc]init];
        thin.eachArmEuler = model.foggyLearn;
        thin.channelCount = 1;
        thin.basque = 6;
        thin.attachSoftball = CGFLOAT_MIN;
        CGRect cellRect = [model.guaraniUnion boundingRectWithSize:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin attributes:[NSDictionary dictionaryWithObject:[UIFont systemFontOfSize:model.friendSugarTrustedIntegerLeftoverLazy] forKey:NSFontAttributeName] context:nil];
        thin.joiningSize = CGSizeMake(cellRect.size.width+8, cellRect.size.height+4);
        thin.model = model;
        [cycle addObject:thin];
    }
    [self templateFourth:cycle];
}

- (void)maskFurlongsAcceptLiterExecOptDomainModel:(HighlightSheInfo *)model {
    NSString *url = model.modifiersExpiredVisualBinaryAffectedDue;

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

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

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

- (void)airChatterSeeImageView:(UIImageView *)did image:(UIImage *)image {
    CGFloat width = self.bounds.size.width;
    CGFloat height = self.bounds.size.height;
    if (image.size.width > 0) {
        CGFloat reverting = image.size.height / image.size.width * width;
        
        CGFloat shutter = (height - reverting) * 0.5;
        did.frame = CGRectMake(0, shutter, width, reverting);
    } else {
        did.frame = self.bounds;
    }
}

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


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

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

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

@end
