

#import "GuideSenseView.h"
#import "SodiumSignRedoCell.h"
#import "UIImageView+WebCache.h"
#import "UIView+WebCache.h"

@interface GuideSenseView ()
@property (nonatomic, strong) UIImageView *relayReplacedImageView;
@end

@implementation GuideSenseView

- (void)growTripleTelephonyTypeDesktopIndigoModel:(DashAbortSunInfo *)model {

    NSMutableArray *fiber = [NSMutableArray new];
    for (int i = 0; i<model.lookFlight; i++) {
        SodiumSignRedoCell *dash = [[SodiumSignRedoCell alloc]init];
        dash.monthFailing = model.gaelicFont;
        dash.channelCount = 1;
        dash.watery = 6;
        dash.shadowLoopRace = CGFLOAT_MIN;
        CGRect endsRect = [model.theTreeCache boundingRectWithSize:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin attributes:[NSDictionary dictionaryWithObject:[UIFont systemFontOfSize:model.animateBrotherCreatePlusEllipsisFor] forKey:NSFontAttributeName] context:nil];
        dash.retriedSize = CGSizeMake(endsRect.size.width+8, endsRect.size.height+4);
        dash.model = model;
        [fiber addObject:dash];
    }
    [self effectReverses:fiber];
}

- (void)impactMathBypassedConcertIntroSpaQuotesModel:(DashAbortSunInfo *)model {
    NSString *url = model.digitalCalendarWhoSampleTempSphere;

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

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

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

- (void)rotationNorthImageView:(UIImageView *)wax image:(UIImage *)image {
    CGFloat width = self.bounds.size.width;
    CGFloat height = self.bounds.size.height;
    if (image.size.width > 0) {
        CGFloat springAny = image.size.height / image.size.width * width;
        
        CGFloat mayMany = (height - springAny) * 0.5;
        wax.frame = CGRectMake(0, mayMany, width, springAny);
    } else {
        wax.frame = self.bounds;
    }
}

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


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

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

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

@end
