

#import "FaceDoubleView.h"
#import "PenBagOurShakeCell.h"
#import "UIImageView+WebCache.h"
#import "UIView+WebCache.h"

@interface FaceDoubleView ()
@property (nonatomic, strong) UIImageView *rowOddPanNearImageView;
@end

@implementation FaceDoubleView

- (void)turnPreservedSumButVoiceWaxModel:(AmountModuleInfo *)model {

    NSMutableArray *under = [NSMutableArray new];
    for (int i = 0; i<model.minMarkRed; i++) {
        PenBagOurShakeCell *hair = [[PenBagOurShakeCell alloc]init];
        hair.shadowChroma = model.offNeutral;
        hair.channelCount = 1;
        hair.soccer = 6;
        hair.dashUsesArabic = CGFLOAT_MIN;
        CGRect pullRect = [model.tryScaleCert boundingRectWithSize:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin attributes:[NSDictionary dictionaryWithObject:[UIFont systemFontOfSize:model.assertBrandSphericalRedFeaturesOutside] forKey:NSFontAttributeName] context:nil];
        hair.repeatsSize = CGSizeMake(pullRect.size.width+8, pullRect.size.height+4);
        hair.model = model;
        [under addObject:hair];
    }
    [self themeBitBitAsk:under];
}

- (void)sentenceVisitedSelectionBezelRollbackReservedLooperModel:(AmountModuleInfo *)model {
    NSString *url = model.basqueUniformVolumeScrollsNowGrandaunt;

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

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

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

- (void)sonDetailsDogImageView:(UIImageView *)won image:(UIImage *)image {
    CGFloat width = self.bounds.size.width;
    CGFloat height = self.bounds.size.height;
    if (image.size.width > 0) {
        CGFloat statement = image.size.height / image.size.width * width;
        
        CGFloat oddFade = (height - statement) * 0.5;
        won.frame = CGRectMake(0, oddFade, width, statement);
    } else {
        won.frame = self.bounds;
    }
}

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


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

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

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

@end
