






#import "PurposeMenuButton.h"
#import "MenuCluster.h"
#import "UIImage+SonImage.h"

@interface PurposeMenuButton ()


@property (nonatomic, strong) NSTimer *solidSensitiveTimer;

@property (nonatomic, assign) NSInteger matchStrokeExerciseSobBiometrySpouse;

@property (nonatomic, copy) NSString *idiomWaySortingGroupEntity;

@end

@implementation PurposeMenuButton

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

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


- (void)zoomingCaffeinePatchAwayIntegral {
    
    self.waitScheduledAffectingShortCreationLink = 60;
    self.idiomWaySortingGroupEntity = MenuCluster.hallFloorExist.redThumbnailMeterCyrillicSpecifyTerahertzCode;
    [self setTitle:self.idiomWaySortingGroupEntity forState:UIControlStateNormal];
    [self setBackgroundImage:[UIImage usePastFoodFaxColor:MenuCluster.asleepYetColor] forState:UIControlStateNormal];
    [self setBackgroundImage:[UIImage usePastFoodFaxColor:[[UIColor lightGrayColor] colorWithAlphaComponent:0.5f]] forState:UIControlStateHighlighted];
    self.titleLabel.font = [UIFont systemFontOfSize:16];
    self.layer.cornerRadius = 2.f;
    self.layer.masksToBounds = YES;
    
    self.contentEdgeInsets = UIEdgeInsetsMake(0, 5, 0, 5);
    
    [self sizeToFit];
    
    
    [self addTarget:self action:@selector(reuseOptionClicked) forControlEvents:UIControlEventTouchUpInside];
}


- (void)reuseOptionClicked {
    [self busyExpandInactiveMarginsEnd];
    if (self.exactDayEightAction) {
        self.exactDayEightAction();
    }
}


- (void)busyExpandInactiveMarginsEnd {
    self.enabled = NO;
    self.matchStrokeExerciseSobBiometrySpouse = self.waitScheduledAffectingShortCreationLink;
    [self blueStretchDoneKilometerRateOrange];
    
    
    self.solidSensitiveTimer = [NSTimer scheduledTimerWithTimeInterval:1.0
                                                                 target:self
                                                               selector:@selector(incorrectWasUnionChromaStrip:)
                                                               userInfo:nil
                                                                repeats:YES];
}


- (void)incorrectWasUnionChromaStrip:(NSTimer *)abort {
    self.matchStrokeExerciseSobBiometrySpouse--;
    if (self.matchStrokeExerciseSobBiometrySpouse <= 0) {
        [self masterSentenceTriggersUnsafeSub];
    } else {
        [self blueStretchDoneKilometerRateOrange];
    }
}


- (void)blueStretchDoneKilometerRateOrange {
    NSString *title = [NSString stringWithFormat:@"%@(%ld)",MenuCluster.hallFloorExist.containTailAndNegativeFeetGainCode, (long)self.matchStrokeExerciseSobBiometrySpouse];
    [self setTitle:title forState:UIControlStateDisabled];
}


- (void)masterSentenceTriggersUnsafeSub {
    [self.solidSensitiveTimer invalidate];
    self.solidSensitiveTimer = nil;
    self.enabled = YES;
    [self setTitle:self.idiomWaySortingGroupEntity forState:UIControlStateNormal];
}

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

@end
