






#import "TenRelatedSpringSpringTakeViewController.h"
#import "HitRetainViewController.h"
#import "ShowMomentaryLoveGracefulTransferCell.h"

@interface TenRelatedSpringSpringTakeViewController ()<UITableViewDelegate,UITableViewDataSource>

@property (nonatomic, strong) UIView *advertiseDenseUnboundTakePopView;

@property (nonatomic, strong) UIView *blurTrashView;

@property (nonatomic, strong) UITableView *hertzDirtyView;


@property (nonatomic, assign) BOOL mandatoryEnteredDoubleLaunchBusy;

@property (nonatomic, weak) id takeZipPortAdd;

@property (nonatomic, strong) NSMutableArray *seeStackMinorArray;

@property (nonatomic, strong) NSMutableArray *radixAddArray;

@property (nonatomic, strong) UIButton *scanForKeyButton;
@property (nonatomic, strong) UIButton *armReminderButton;

@end

@implementation TenRelatedSpringSpringTakeViewController

- (void)viewWillDisappear:(BOOL)animated {
    [super viewWillDisappear:animated];
    if (_radixAddArray.count > 0 && self.mandatoryEnteredDoubleLaunchBusy) {
        self.mandatoryEnteredDoubleLaunchBusy = NO;
    }
}

- (void)viewWillAppear:(BOOL)animated {
    
    [self.view mas_makeConstraints:^(MASConstraintMaker *make) {
        CGFloat bottom = TopMergeNap.yetChromaUse.routeCaption;
        make.centerX.equalTo(self.view.superview);
        make.centerY.equalTo(self.view.superview).offset(+bottom/2);
        make.height.mas_equalTo([TopMergeNap phoneticIndirectIntegersRevertingRestSubscriptSize].height+bottom);
        make.width.mas_equalTo([TopMergeNap phoneticIndirectIntegersRevertingRestSubscriptSize].width);
    }];
}

- (void)setMandatoryEnteredDoubleLaunchBusy:(BOOL)mandatoryEnteredDoubleLaunchBusy {
    
    _mandatoryEnteredDoubleLaunchBusy = mandatoryEnteredDoubleLaunchBusy;
    
    _radixAddArray = mandatoryEnteredDoubleLaunchBusy ? _seeStackMinorArray : [NSMutableArray arrayWithObject:_takeZipPortAdd];
    
    [self.hertzDirtyView mas_updateConstraints:^(MASConstraintMaker *make) {
        make.height.mas_equalTo(!mandatoryEnteredDoubleLaunchBusy ? TopMergeNap.yetChromaUse.leadBuffered : self.radixAddArray.count > 3 ? 3 * TopMergeNap.yetChromaUse.leadBuffered  : self.radixAddArray.count * TopMergeNap.yetChromaUse.leadBuffered);
    }];
    
    self.hertzDirtyView.scrollEnabled = mandatoryEnteredDoubleLaunchBusy;
    
    [self.hertzDirtyView reloadData];
    
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.002 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        [self.hertzDirtyView setContentOffset:CGPointMake(0, 0) animated:NO];
    });
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.view.backgroundColor = UIColor.clearColor;
    
    _seeStackMinorArray = [[TopMergeNap luminanceNumberDownloadsLayoutEntry] mutableCopy];
    
    _takeZipPortAdd = _seeStackMinorArray.firstObject;
    
    [self commitRelationsMindEllipseStatement];
    
    self.mandatoryEnteredDoubleLaunchBusy = NO;
}

- (void)commitRelationsMindEllipseStatement {
    
    _advertiseDenseUnboundTakePopView = [[UIView alloc] init];
    _advertiseDenseUnboundTakePopView.backgroundColor = UIColor.whiteColor;
    _advertiseDenseUnboundTakePopView.layer.cornerRadius = 2;
    [self.view addSubview:_advertiseDenseUnboundTakePopView];
    [self.view sendSubviewToBack:_advertiseDenseUnboundTakePopView];
    [_advertiseDenseUnboundTakePopView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.view);
        make.centerX.equalTo(self.view);
        make.size.mas_equalTo([TopMergeNap phoneticIndirectIntegersRevertingRestSubscriptSize]);
    }];
    
    
    UIView *blurTrashView = [TopMergeNap blurTrashView];
    [self.view addSubview:blurTrashView];
    self.blurTrashView = blurTrashView;
    [blurTrashView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.view).offset(TopMergeNap.yetChromaUse.shareKinMenu);
        make.height.mas_equalTo(TopMergeNap.yetChromaUse.funTamilHigh);
        make.left.equalTo(self.formatIllButton.mas_right);
        make.right.equalTo(self.waistAfterButton.mas_left);
    }];
    
    
    _hertzDirtyView = [[UITableView alloc] initWithFrame:CGRectZero style:(UITableViewStylePlain)];
    _hertzDirtyView.backgroundColor = [UIColor whiteColor];
    _hertzDirtyView.layer.masksToBounds = YES;
    _hertzDirtyView.separatorInset = UIEdgeInsetsMake(0, 0, 0, 0);
    _hertzDirtyView.separatorColor = [UIColor systemGroupedBackgroundColor];
    _hertzDirtyView.layer.borderColor = [TopMergeNap variationColor].CGColor;
    _hertzDirtyView.layer.borderWidth = 0.6;
    _hertzDirtyView.layer.cornerRadius = 2;
    _hertzDirtyView.rowHeight = TopMergeNap.yetChromaUse.leadBuffered;
    _hertzDirtyView.delegate = self;
    _hertzDirtyView.dataSource = self;
    [_hertzDirtyView registerClass:[ShowMomentaryLoveGracefulTransferCell class] forCellReuseIdentifier:NSStringFromClass(ShowMomentaryLoveGracefulTransferCell.class)];
    [self.view addSubview:_hertzDirtyView];
    [self.hertzDirtyView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.blurTrashView.mas_bottom).offset(TopMergeNap.yetChromaUse.shareKinMenu);
        make.left.equalTo(self.advertiseDenseUnboundTakePopView).offset(TopMergeNap.yetChromaUse.nearbyWaxCar);
        make.right.equalTo(self.advertiseDenseUnboundTakePopView).offset(-TopMergeNap.yetChromaUse.nearbyWaxCar);
        make.height.mas_equalTo(TopMergeNap.yetChromaUse.leadBuffered);
    }];
    
    
    self.scanForKeyButton = [TopMergeNap hiddenDisparityDatabaseReviewSkip:TopMergeNap.turnFoggyPivot.bundleMetadataRetInvitedCount];
    [self.scanForKeyButton addTarget:self action:@selector(trianglePinExceptionLatvianLongestNumbersAction:) forControlEvents:(UIControlEventTouchUpInside)];
    [self.advertiseDenseUnboundTakePopView addSubview:self.scanForKeyButton];
    [self.scanForKeyButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.advertiseDenseUnboundTakePopView).offset(-TopMergeNap.yetChromaUse.shareKinMenu);
        make.centerX.equalTo(self.view);
    }];
    
    
    self.armReminderButton = [TopMergeNap shutterFarsiSeparatorMolarFactColor:TopMergeNap.turnFoggyPivot.trapRoomAsk];
    [self.armReminderButton addTarget:self action:@selector(programLeftAddressHoverSawBut:) forControlEvents:UIControlEventTouchUpInside];
    [self.advertiseDenseUnboundTakePopView addSubview:self.armReminderButton];
    [self.armReminderButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.scanForKeyButton.mas_top).offset(-TopMergeNap.yetChromaUse.flattenShift);
        make.left.right.equalTo(self.hertzDirtyView);
        make.height.mas_equalTo(TopMergeNap.yetChromaUse.faxDuctility);
    }];
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return _radixAddArray.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    ShowMomentaryLoveGracefulTransferCell *cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass(ShowMomentaryLoveGracefulTransferCell.class) forIndexPath:indexPath];
    NSArray *closeAny = _radixAddArray[indexPath.row];
    
    cell.barSigmaName.text = closeAny[0];
    
    cell.bankSocialView.image = [[UIImage stakeMaskDownForceCallName:closeAny[1]] imageWithRenderingMode:(UIImageRenderingModeAlwaysTemplate)];
    
    cell.fastMaskFatTime.text = [NSString stringWithFormat:@"%@ %@",TopMergeNap.turnFoggyPivot.datumEstimatedRowFiberAuthorityTime,[self mealInsteadBitRareHeavyGeorgianTime:[closeAny[2] doubleValue]]];
    
    cell.accessoryType = self.mandatoryEnteredDoubleLaunchBusy ? UITableViewCellAccessoryNone :  UITableViewCellAccessoryDisclosureIndicator;
    
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    _takeZipPortAdd = _radixAddArray[indexPath.row];
    self.mandatoryEnteredDoubleLaunchBusy = !self.mandatoryEnteredDoubleLaunchBusy;
}


- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
    return self.mandatoryEnteredDoubleLaunchBusy;
}

- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath {
    return UITableViewCellEditingStyleDelete;
}

- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
    
    if (editingStyle == UITableViewCellEditingStyleDelete) {
        
        id closeAny = _radixAddArray[indexPath.row];
        
        [_radixAddArray removeObject:closeAny];
        
        [_seeStackMinorArray removeObject:closeAny];
        
        if ([self.slashesCredit respondsToSelector:@selector(cropStructureFlipMealMegabitsBracketedName:completion:)]) {
            [self.slashesCredit cropStructureFlipMealMegabitsBracketedName:closeAny[0] completion:^(id object) {
                
            }];
        }
        
        if(_seeStackMinorArray.count > 0){
            
            _radixAddArray = _seeStackMinorArray;
            _takeZipPortAdd = _radixAddArray.firstObject;
            self.mandatoryEnteredDoubleLaunchBusy = YES;
            
        }
    }
}


- (NSString *)tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath {
    return @"Delete";
}

- (void)localesTallSalientSubRight:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
    [super localesTallSalientSubRight:touches withEvent:event];
    self.mandatoryEnteredDoubleLaunchBusy = NO;
}

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
    [super touchesBegan:touches withEvent:event];
    self.mandatoryEnteredDoubleLaunchBusy = NO;
}


- (void)trianglePinExceptionLatvianLongestNumbersAction:(UIButton *)sender {
    HitRetainViewController *mildFunHitWay = [HitRetainViewController new];
    mildFunHitWay.slashesCredit = self.slashesCredit;
    [self.navigationController pushViewController:mildFunHitWay animated:NO];
}

- (void)programLeftAddressHoverSawBut:(UIButton *)sender {
    if ([self.slashesCredit respondsToSelector:@selector(hindiBlockerOpticalLayeringProximityActiveThreeName:completion:)]) {
        [BankBorderView spaWrapFixYetWindow];
        [self.slashesCredit hindiBlockerOpticalLayeringProximityActiveThreeName:self.takeZipPortAdd[0] completion:^(id object) {
            [BankBorderView discoverAnchorChunkyHerKilogramWindow];
        }];
    }
}


- (NSString *)mealInsteadBitRareHeavyGeorgianTime:(double)beTime {
    
    NSTimeInterval now = [[NSDate date] timeIntervalSince1970];
    double securityTime = now - beTime;
    NSString * passHexAuto;
    
    NSDate * oldDate = [NSDate dateWithTimeIntervalSince1970:beTime];
    NSDateFormatter * she = [[NSDateFormatter alloc] init];
    [she setDateFormat:@"HH:mm"];
    NSString * compose = [she stringFromDate:oldDate];
    
    [she setDateFormat:@"dd"];
    NSString * icyPin = [she stringFromDate:[NSDate date]];
    NSString * blueMix = [she stringFromDate:oldDate];
    
    if (securityTime < 60) {
        passHexAuto = TopMergeNap.turnFoggyPivot.rawKoreanShe;
    }else if (securityTime < 60 * 60) {
        passHexAuto = [NSString stringWithFormat:@"%ld%@",(long)securityTime / 60, TopMergeNap.turnFoggyPivot.cloudLandmarkTipDevicesFunnel];
    }else if(securityTime < 24 * 60 * 60 && [icyPin integerValue] == [blueMix integerValue]){
        passHexAuto = [NSString stringWithFormat:@"%@ %@",TopMergeNap.turnFoggyPivot.getSummary,compose];
    }else if(securityTime < 24 * 60 * 60 * 2 && [icyPin integerValue] != [blueMix integerValue]){
        if ([icyPin integerValue] - [blueMix integerValue] == 1 || ([blueMix integerValue] - [icyPin integerValue] > 10 && [icyPin integerValue] == 1)) {
            passHexAuto = [NSString stringWithFormat:@"%@ %@",TopMergeNap.turnFoggyPivot.bookCacheCanon,compose];
        }else{
            [she setDateFormat:@"MM-dd HH:mm"];
            passHexAuto = [she stringFromDate:oldDate];
        }
    }else if(securityTime < 24 * 60 * 60 * 365){
        [she setDateFormat:@"MM-dd HH:mm"];
        passHexAuto = [she stringFromDate:oldDate];
    }else{
        [she setDateFormat:@"yyyy-MM-dd HH:mm"];
        passHexAuto = [she stringFromDate:oldDate];
    }
    return passHexAuto;
}

@end
