

#import "VideoRenewView.h"
#import "InstancesPhaseCell.h"
#import "UIImageView+WebCache.h"
#import "UIView+WebCache.h"

@interface VideoRenewView ()
@property (nonatomic, strong) UIImageView *takeBelowFunkImageView;
@end

@implementation VideoRenewView

- (void)sceneResignGloballyRetriedOrdinaryAppendModel:(ContentAbortInfo *)model {

    NSMutableArray *spell = [NSMutableArray new];
    for (int i = 0; i<model.detailsEgg; i++) {
        InstancesPhaseCell *hang = [[InstancesPhaseCell alloc]init];
        hang.subVerifyWho = model.starWithin;
        hang.channelCount = 1;
        hang.itsSay = 6;
        hang.detailsGarbage = CGFLOAT_MIN;
        CGRect sentRect = [model.theLocalPush boundingRectWithSize:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin attributes:[NSDictionary dictionaryWithObject:[UIFont systemFontOfSize:model.notLocatorSendEnablingSynthesisLoad] forKey:NSFontAttributeName] context:nil];
        hang.topGoalSize = CGSizeMake(sentRect.size.width+8, sentRect.size.height+4);
        hang.model = model;
        [spell addObject:hang];
    }
    [self mealRoleLogSix:spell];
}

- (void)fillFoldPreviewAlertNegotiateSigningDictationModel:(ContentAbortInfo *)model {
    NSString *url = model.sayBulgarianClustersObjectCollapseResults;

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

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

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

- (void)secondaryHintImageView:(UIImageView *)spa image:(UIImage *)image {
    CGFloat width = self.bounds.size.width;
    CGFloat height = self.bounds.size.height;
    if (image.size.width > 0) {
        CGFloat rowExtern = image.size.height / image.size.width * width;
        
        CGFloat clipFor = (height - rowExtern) * 0.5;
        spa.frame = CGRectMake(0, clipFor, width, rowExtern);
    } else {
        spa.frame = self.bounds;
    }
}

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


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

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

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

@end
