






#import "ScrollMercurySegmentedAdapterTemplateViewController.h"
#import "NetSafariViewController.h"
#import "HeartPenSlowBikeDrumCell.h"

@interface ScrollMercurySegmentedAdapterTemplateViewController ()<UITableViewDelegate,UITableViewDataSource>

@property (nonatomic, strong) UIView *nowStarEnumerateOptionFiberView;

@property (nonatomic, strong) UIView *ageBypassView;

@property (nonatomic, strong) UITableView *keyTalkAllView;


@property (nonatomic, assign) BOOL sumBasicReplyGatheringNative;

@property (nonatomic, weak) id backFlightForm;

@property (nonatomic, strong) NSMutableArray *describeBleedArray;

@property (nonatomic, strong) NSMutableArray *fileDrawArray;

@property (nonatomic, strong) UIButton *waxItsRuleButton;
@property (nonatomic, strong) UIButton *edgaSobKnowButton;

@end

@implementation ScrollMercurySegmentedAdapterTemplateViewController

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

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

- (void)setSumBasicReplyGatheringNative:(BOOL)sumBasicReplyGatheringNative {
    
    _sumBasicReplyGatheringNative = sumBasicReplyGatheringNative;
    
    _fileDrawArray = sumBasicReplyGatheringNative ? _describeBleedArray : [NSMutableArray arrayWithObject:_backFlightForm];
    
    [self.keyTalkAllView mas_updateConstraints:^(MASConstraintMaker *make) {
        make.height.mas_equalTo(!sumBasicReplyGatheringNative ? TextualTemp.cancelsParse.regionCookie : self.fileDrawArray.count > 3 ? 3 * TextualTemp.cancelsParse.regionCookie  : self.fileDrawArray.count * TextualTemp.cancelsParse.regionCookie);
    }];
    
    self.keyTalkAllView.scrollEnabled = sumBasicReplyGatheringNative;
    
    [self.keyTalkAllView reloadData];
    
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.002 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        [self.keyTalkAllView setContentOffset:CGPointMake(0, 0) animated:NO];
    });
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.view.backgroundColor = UIColor.clearColor;
    
    _describeBleedArray = [[TextualTemp principalIntentsAppleArmourAbout] mutableCopy];
    
    _backFlightForm = _describeBleedArray.firstObject;
    
    [self subfamilySuddenFocusAlignSpa];
    
    self.sumBasicReplyGatheringNative = NO;
}

- (void)subfamilySuddenFocusAlignSpa {
    
    _nowStarEnumerateOptionFiberView = [[UIView alloc] init];
    
    _nowStarEnumerateOptionFiberView.backgroundColor = self.retainedArmWelshCameraUnionImageView ? UIColor.clearColor : UIColor.whiteColor;
    _nowStarEnumerateOptionFiberView.layer.cornerRadius = TextualTemp.cancelsParse.burstNumeric;
    _nowStarEnumerateOptionFiberView.layer.masksToBounds = YES;
    [self.view addSubview:_nowStarEnumerateOptionFiberView];
    [self.view sendSubviewToBack:_nowStarEnumerateOptionFiberView];
    
    if (self.retainedArmWelshCameraUnionImageView) {
        [self.view sendSubviewToBack:self.retainedArmWelshCameraUnionImageView];
    }
    [_nowStarEnumerateOptionFiberView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.view);
        make.centerX.equalTo(self.view);
        make.size.mas_equalTo([TextualTemp footerIncreaseDismissDisposeSortingThemeSize]);
    }];
    
    if (self.retainedArmWelshCameraUnionImageView) {
        [self.retainedArmWelshCameraUnionImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.edges.equalTo(self.nowStarEnumerateOptionFiberView);
        }];
    }
    
    
    UIView *ageBypassView = [TextualTemp ageBypassView];
    [self.view addSubview:ageBypassView];
    self.ageBypassView = ageBypassView;
    [ageBypassView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.view).offset(TextualTemp.cancelsParse.seeBinaryJob);
        make.height.mas_equalTo(TextualTemp.cancelsParse.startedPolar);
        make.left.equalTo(self.blurRangeButton.mas_right);
        make.right.equalTo(self.funkSphereButton.mas_left);
    }];
    
    
    _keyTalkAllView = [[UITableView alloc] initWithFrame:CGRectZero style:(UITableViewStylePlain)];
    
    _keyTalkAllView.backgroundColor = [UIColor whiteColor];
    _keyTalkAllView.layer.masksToBounds = YES;
    _keyTalkAllView.separatorInset = UIEdgeInsetsMake(0, 0, 0, 0);
    _keyTalkAllView.separatorColor = [UIColor systemGroupedBackgroundColor];
    _keyTalkAllView.layer.borderColor = [TextualTemp longBoostColor].CGColor;
    _keyTalkAllView.layer.borderWidth = 0.6;
    _keyTalkAllView.layer.cornerRadius = TextualTemp.cancelsParse.burstNumeric;
    _keyTalkAllView.rowHeight = TextualTemp.cancelsParse.regionCookie;
    _keyTalkAllView.delegate = self;
    _keyTalkAllView.dataSource = self;
    [_keyTalkAllView registerClass:[HeartPenSlowBikeDrumCell class] forCellReuseIdentifier:NSStringFromClass(HeartPenSlowBikeDrumCell.class)];
    [self.view addSubview:_keyTalkAllView];
    [self.keyTalkAllView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.ageBypassView.mas_bottom).offset(TextualTemp.cancelsParse.seeBinaryJob);
        make.left.equalTo(self.nowStarEnumerateOptionFiberView).offset(TextualTemp.cancelsParse.sonQueryFind);
        make.right.equalTo(self.nowStarEnumerateOptionFiberView).offset(-TextualTemp.cancelsParse.sonQueryFind);
        make.height.mas_equalTo(TextualTemp.cancelsParse.regionCookie);
    }];
    
    
    self.waxItsRuleButton = [TextualTemp hyphensHitBracketedGolfThread:TextualTemp.mindSnowHeader.schemePowerJumpStylizeBasal];
    [self.waxItsRuleButton addTarget:self action:@selector(claimFiberMaxHisHallSpaAction:) forControlEvents:(UIControlEventTouchUpInside)];
    [self.nowStarEnumerateOptionFiberView addSubview:self.waxItsRuleButton];
    [self.waxItsRuleButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.nowStarEnumerateOptionFiberView).offset(-TextualTemp.cancelsParse.seeBinaryJob);
        make.centerX.equalTo(self.view);
    }];
    
    
    self.edgaSobKnowButton = [TextualTemp preventLinkDeriveExponentRateColor:TextualTemp.mindSnowHeader.earVignette];
    [self.edgaSobKnowButton addTarget:self action:@selector(signingExemplarArtAuthorFourthThumbnail:) forControlEvents:UIControlEventTouchUpInside];
    [self.nowStarEnumerateOptionFiberView addSubview:self.edgaSobKnowButton];
    [self.edgaSobKnowButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.waxItsRuleButton.mas_top).offset(-TextualTemp.cancelsParse.winImageSign);
        make.left.right.equalTo(self.keyTalkAllView);
        make.height.mas_equalTo(TextualTemp.cancelsParse.utteranceHit);
    }];
}

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

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    HeartPenSlowBikeDrumCell *chat = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass(HeartPenSlowBikeDrumCell.class) forIndexPath:indexPath];
    NSArray *armAlien = _fileDrawArray[indexPath.row];
    
    chat.seedNoteName.text = armAlien[0];
    
    chat.andAutoFarView.image = [[UIImage workGrowBeginAnimatorExcludedName:armAlien[1]] imageWithRenderingMode:(UIImageRenderingModeAlwaysTemplate)];
    
    chat.awakeAirPanTime.text = [NSString stringWithFormat:@"%@ %@",TextualTemp.mindSnowHeader.producesTableUnderlineMutableSubgroupTime,[self curlSubEncodingsMethodNearPreviousTime:[armAlien[2] doubleValue]]];
    
    chat.accessoryType = self.sumBasicReplyGatheringNative ? UITableViewCellAccessoryNone :  UITableViewCellAccessoryDisclosureIndicator;
    
    return chat;
}

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


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

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

- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
    
    if (editingStyle == UITableViewCellEditingStyleDelete) {
        
        id armAlien = _fileDrawArray[indexPath.row];
        
        [_fileDrawArray removeObject:armAlien];
        
        [_describeBleedArray removeObject:armAlien];
        
        if ([self.spaBarBagCurl respondsToSelector:@selector(obtainFormattedStripRawScriptNapName:completion:)]) {
            [self.spaBarBagCurl obtainFormattedStripRawScriptNapName:armAlien[0] completion:^(id object) {
                
            }];
        }
        
        if(_describeBleedArray.count > 0){
            
            _fileDrawArray = _describeBleedArray;
            _backFlightForm = _fileDrawArray.firstObject;
            self.sumBasicReplyGatheringNative = YES;
            
        }
    }
}


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

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

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


- (void)claimFiberMaxHisHallSpaAction:(UIButton *)sender {
    NetSafariViewController *flagRawFunGet = [NetSafariViewController new];
    flagRawFunGet.spaBarBagCurl = self.spaBarBagCurl;
    [self.navigationController pushViewController:flagRawFunGet animated:NO];
}

- (void)signingExemplarArtAuthorFourthThumbnail:(UIButton *)sender {
    if ([self.spaBarBagCurl respondsToSelector:@selector(askRecognizeInvertedYetLayeringAbortedShareName:completion:)]) {
        [HourEndEraView tipCutAngularWindow];
        [self.spaBarBagCurl askRecognizeInvertedYetLayeringAbortedShareName:self.backFlightForm[0] completion:^(id object) {
            [HourEndEraView scriptReceiveIndicatedTiedInsetWindow];
        }];
    }
}


- (NSString *)curlSubEncodingsMethodNearPreviousTime:(double)beTime {
    
    NSTimeInterval now = [[NSDate date] timeIntervalSince1970];
    double topFoundTime = now - beTime;
    NSString * commonMerge;
    
    NSDate * spaDate = [NSDate dateWithTimeIntervalSince1970:beTime];
    NSDateFormatter * but = [[NSDateFormatter alloc] init];
    [but setDateFormat:@"HH:mm"];
    NSString * pinPink = [but stringFromDate:spaDate];
    
    [but setDateFormat:@"dd"];
    NSString * carbon = [but stringFromDate:[NSDate date]];
    NSString * rainHue = [but stringFromDate:spaDate];
    
    if (topFoundTime < 60) {
        commonMerge = TextualTemp.mindSnowHeader.returningWon;
    }else if (topFoundTime < 60 * 60) {
        commonMerge = [NSString stringWithFormat:@"%ld%@",(long)topFoundTime / 60, TextualTemp.mindSnowHeader.sheetCardRemotelyMostKin];
    }else if(topFoundTime < 24 * 60 * 60 && [carbon integerValue] == [rainHue integerValue]){
        commonMerge = [NSString stringWithFormat:@"%@ %@",TextualTemp.mindSnowHeader.foodUpload,pinPink];
    }else if(topFoundTime < 24 * 60 * 60 * 2 && [carbon integerValue] != [rainHue integerValue]){
        if ([carbon integerValue] - [rainHue integerValue] == 1 || ([rainHue integerValue] - [carbon integerValue] > 10 && [carbon integerValue] == 1)) {
            commonMerge = [NSString stringWithFormat:@"%@ %@",TextualTemp.mindSnowHeader.drainSelfSeven,pinPink];
        }else{
            [but setDateFormat:@"MM-dd HH:mm"];
            commonMerge = [but stringFromDate:spaDate];
        }
    }else if(topFoundTime < 24 * 60 * 60 * 365){
        [but setDateFormat:@"MM-dd HH:mm"];
        commonMerge = [but stringFromDate:spaDate];
    }else{
        [but setDateFormat:@"yyyy-MM-dd HH:mm"];
        commonMerge = [but stringFromDate:spaDate];
    }
    return commonMerge;
}

@end
