






#import "SystolicDayButton.h"
#import "PutBelowEye.h"
#import "UIImage+DidImage.h"
#import "SDWebImageManager.h"

@interface SystolicDayButton ()


@property (nonatomic, strong) NSTimer *delayIronStoodTimer;

@property (nonatomic, assign) NSInteger civilTornadoNeedSunDefineBrother;

@property (nonatomic, copy) NSString *pagerStrideWatchMomentaryCampaign;

@end

@implementation SystolicDayButton

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self eachSchemesCommonPathPossible];
    }
    return self;
}

- (instancetype)initWithCoder:(NSCoder *)coder {
    self = [super initWithCoder:coder];
    if (self) {
        [self eachSchemesCommonPathPossible];
    }
    return self;
}


- (void)eachSchemesCommonPathPossible {
    
    self.frictionAspectPhysicalHockeyLastSecret = 60;
    self.pagerStrideWatchMomentaryCampaign = PutBelowEye.listColumnRoot.uptimeInterestBatteryCapturingFlatnessLocalizesCode;
    [self setTitle:self.pagerStrideWatchMomentaryCampaign forState:UIControlStateNormal];

    
    NSString *rearHeartHost = [PutBelowEye layoutFocusedMaxKilogramsMagicImage];
    if (rearHeartHost) {
        
        [[SDWebImageManager sharedManager] loadImageWithURL:[NSURL URLWithString:rearHeartHost]
                                                    options:0
                                                   progress:nil
                                                  completed:^(UIImage *image, NSData *data, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) {
            if (image) {
                dispatch_async(dispatch_get_main_queue(), ^{
                    [self setBackgroundImage:image forState:UIControlStateNormal];
                    [self setBackgroundImage:[UIImage touchPlaceTurnColor:[[UIColor lightGrayColor] colorWithAlphaComponent:0.5f]] forState:UIControlStateHighlighted];
                });
            }
        }];
        
        [self setBackgroundImage:[UIImage touchPlaceTurnColor:PutBelowEye.charAlienColor] forState:UIControlStateNormal];
    } else {
        
        [self setBackgroundImage:[UIImage touchPlaceTurnColor:PutBelowEye.charAlienColor] forState:UIControlStateNormal];
        [self setBackgroundImage:[UIImage touchPlaceTurnColor:[[UIColor lightGrayColor] colorWithAlphaComponent:0.5f]] forState:UIControlStateHighlighted];
    }

    self.titleLabel.font = [UIFont systemFontOfSize:16];
    self.layer.cornerRadius = PutBelowEye.yetRevealHow.buildCanPlan;
    self.layer.masksToBounds = YES;
    
    self.contentEdgeInsets = UIEdgeInsetsMake(0, 5, 0, 5);
    
    [self sizeToFit];

    
    [self addTarget:self action:@selector(bankBlurHasClicked) forControlEvents:UIControlEventTouchUpInside];
}


- (void)bankBlurHasClicked {
    [self thiaminHisHectaresMergeKeep];
    if (self.twoAllFailureAction) {
        self.twoAllFailureAction();
    }
}


- (void)thiaminHisHectaresMergeKeep {
    self.enabled = NO;
    self.civilTornadoNeedSunDefineBrother = self.frictionAspectPhysicalHockeyLastSecret;
    [self distinctPaddleToleranceSlantFingerLegible];
    
    
    self.delayIronStoodTimer = [NSTimer scheduledTimerWithTimeInterval:1.0
                                                                 target:self
                                                               selector:@selector(cursiveMixInhalerPickerImportant:)
                                                               userInfo:nil
                                                                repeats:YES];
}


- (void)cursiveMixInhalerPickerImportant:(NSTimer *)modal {
    self.civilTornadoNeedSunDefineBrother--;
    if (self.civilTornadoNeedSunDefineBrother <= 0) {
        [self feedReorderSunIncreaseDecrease];
    } else {
        [self distinctPaddleToleranceSlantFingerLegible];
    }
}


- (void)distinctPaddleToleranceSlantFingerLegible {
    NSString *title = [NSString stringWithFormat:@"%@(%ld)",PutBelowEye.listColumnRoot.runningSonAlertTaggingRevealFormCode, (long)self.civilTornadoNeedSunDefineBrother];
    [self setTitle:title forState:UIControlStateDisabled];
}


- (void)feedReorderSunIncreaseDecrease {
    [self.delayIronStoodTimer invalidate];
    self.delayIronStoodTimer = nil;
    self.enabled = YES;
    [self setTitle:self.pagerStrideWatchMomentaryCampaign forState:UIControlStateNormal];
}

- (void)dealloc {
    
    [self.delayIronStoodTimer invalidate];
    self.delayIronStoodTimer = nil;
}

@end
