

#import "ValuePhaseView.h"
#import "PagerEmbeddingCell.h"
#import "UIImageView+WebCache.h"
#import "UIView+WebCache.h"

@interface ValuePhaseView ()
@property (nonatomic, strong) UIImageView *realmWhoDigitImageView;
@end

@implementation ValuePhaseView

- (void)versionRelationsShakeOffComposerOddModel:(SinDidSocketInfo *)model {

    NSMutableArray *pulse = [NSMutableArray new];
    for (int i = 0; i<model.albumOwner; i++) {
        PagerEmbeddingCell *golf = [[PagerEmbeddingCell alloc]init];
        golf.getModeDaily = model.streetZero;
        golf.channelCount = 1;
        golf.indigo = 6;
        golf.cutEntryPinNot = CGFLOAT_MIN;
        CGRect tagsRect = [model.looperBridge boundingRectWithSize:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin attributes:[NSDictionary dictionaryWithObject:[UIFont systemFontOfSize:model.cervicalDownhillCutToolDaughtersSex] forKey:NSFontAttributeName] context:nil];
        golf.reverseSize = CGSizeMake(tagsRect.size.width+8, tagsRect.size.height+4);
        golf.model = model;
        [pulse addObject:golf];
    }
    [self pinchGeometric:pulse];
}

- (void)stableLowerBarsDensitySessionsNominallyMightModel:(SinDidSocketInfo *)model {
    NSString *url = model.writingCanadianFloatingPossibleSameLoose;

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

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

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

- (void)muteBitsPolarImageView:(UIImageView *)his image:(UIImage *)image {
    CGFloat width = self.bounds.size.width;
    CGFloat height = self.bounds.size.height;
    if (image.size.width > 0) {
        CGFloat getOrange = image.size.height / image.size.width * width;
        
        CGFloat usesFor = (height - getOrange) * 0.5;
        his.frame = CGRectMake(0, usesFor, width, getOrange);
    } else {
        his.frame = self.bounds;
    }
}

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


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

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

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

@end
