






#import "RemotelyOffButton.h"
#import "CloudyPrice.h"
#import "UIImage+ItsImage.h"

@interface RemotelyOffButton ()


@property (nonatomic, strong) NSTimer *capCupWayExitsTimer;

@property (nonatomic, assign) NSInteger distortedPintDeepDecipherLeapLargest;

@property (nonatomic, copy) NSString *homeModifiedPowerWinPeople;

@end

@implementation RemotelyOffButton

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

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


- (void)attempterSlovakAboveQuitPostal {
    
    self.eraSinRepeatVisibleSucceededCanonical = 60;
    self.homeModifiedPowerWinPeople = CloudyPrice.presentedIrish.sameAdjustedNextYoungerInputVendorCode;
    [self setTitle:self.homeModifiedPowerWinPeople forState:UIControlStateNormal];
    [self setBackgroundImage:[UIImage tenQuickYouOldColor:CloudyPrice.oneCreditColor] forState:UIControlStateNormal];
    [self setBackgroundImage:[UIImage tenQuickYouOldColor:[[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(optMalayTopClicked) forControlEvents:UIControlEventTouchUpInside];
}


- (void)optMalayTopClicked {
    [self cutMinimizeAchievedStormCommitted];
    if (self.endOverDryManAction) {
        self.endOverDryManAction();
    }
}


- (void)cutMinimizeAchievedStormCommitted {
    self.enabled = NO;
    self.distortedPintDeepDecipherLeapLargest = self.eraSinRepeatVisibleSucceededCanonical;
    [self nineIllegalFarKelvinTreeHead];
    
    
    self.capCupWayExitsTimer = [NSTimer scheduledTimerWithTimeInterval:1.0
                                                                 target:self
                                                               selector:@selector(semanticsKindIncludingQualifiedError:)
                                                               userInfo:nil
                                                                repeats:YES];
}


- (void)semanticsKindIncludingQualifiedError:(NSTimer *)slope {
    self.distortedPintDeepDecipherLeapLargest--;
    if (self.distortedPintDeepDecipherLeapLargest <= 0) {
        [self areWatchTitleIntegrityInteract];
    } else {
        [self nineIllegalFarKelvinTreeHead];
    }
}


- (void)nineIllegalFarKelvinTreeHead {
    NSString *title = [NSString stringWithFormat:@"%@(%ld)",CloudyPrice.presentedIrish.flagProvidingChecksumPermuteSucceedChannelCode, (long)self.distortedPintDeepDecipherLeapLargest];
    [self setTitle:title forState:UIControlStateDisabled];
}


- (void)areWatchTitleIntegrityInteract {
    [self.capCupWayExitsTimer invalidate];
    self.capCupWayExitsTimer = nil;
    self.enabled = YES;
    [self setTitle:self.homeModifiedPowerWinPeople forState:UIControlStateNormal];
}

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

@end
