






#import "UsabilityNotUnwindingSeparatedUserViewController.h"
#import "PressPrepViewController.h"
#import "ConjugateInternalFeedbackDescribeDetermineCell.h"

@interface UsabilityNotUnwindingSeparatedUserViewController ()<UITableViewDelegate,UITableViewDataSource>

@property (nonatomic, strong) UIView *joiningCalorieAddSmoothedUppercaseView;

@property (nonatomic, strong) UIView *traitFactView;

@property (nonatomic, strong) UITableView *unsafeGrowView;


@property (nonatomic, assign) BOOL sinDirectlyRecursiveTextInland;

@property (nonatomic, weak) id beenSpanSpaKin;

@property (nonatomic, strong) NSMutableArray *leasePanoramaArray;

@property (nonatomic, strong) NSMutableArray *tomorrowArray;

@property (nonatomic, strong) UIButton *eggFactoryButton;
@property (nonatomic, strong) UIButton *icySayTraitButton;

@end

@implementation UsabilityNotUnwindingSeparatedUserViewController

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

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

- (void)setSinDirectlyRecursiveTextInland:(BOOL)sinDirectlyRecursiveTextInland {
    
    _sinDirectlyRecursiveTextInland = sinDirectlyRecursiveTextInland;
    
    _tomorrowArray = sinDirectlyRecursiveTextInland ? _leasePanoramaArray : [NSMutableArray arrayWithObject:_beenSpanSpaKin];
    
    [self.unsafeGrowView mas_updateConstraints:^(MASConstraintMaker *make) {
        make.height.mas_equalTo(!sinDirectlyRecursiveTextInland ? FrictionShe.headphoneMay.kilovoltsAdd : self.tomorrowArray.count > 3 ? 3 * FrictionShe.headphoneMay.kilovoltsAdd  : self.tomorrowArray.count * FrictionShe.headphoneMay.kilovoltsAdd);
    }];
    
    self.unsafeGrowView.scrollEnabled = sinDirectlyRecursiveTextInland;
    
    [self.unsafeGrowView reloadData];
    
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.002 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        [self.unsafeGrowView setContentOffset:CGPointMake(0, 0) animated:NO];
    });
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.view.backgroundColor = UIColor.clearColor;
    
    _leasePanoramaArray = [[FrictionShe listTenPintTextualCreation] mutableCopy];
    
    _beenSpanSpaKin = _leasePanoramaArray.firstObject;
    
    [self fitSlantMixMealCervical];
    
    self.sinDirectlyRecursiveTextInland = NO;
}

- (void)fitSlantMixMealCervical {
    
    _joiningCalorieAddSmoothedUppercaseView = [[UIView alloc] init];
    _joiningCalorieAddSmoothedUppercaseView.backgroundColor = UIColor.whiteColor;
    _joiningCalorieAddSmoothedUppercaseView.layer.cornerRadius = 2;
    [self.view addSubview:_joiningCalorieAddSmoothedUppercaseView];
    [self.view sendSubviewToBack:_joiningCalorieAddSmoothedUppercaseView];
    [_joiningCalorieAddSmoothedUppercaseView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.view);
        make.centerX.equalTo(self.view);
        make.size.mas_equalTo([FrictionShe traveledPinHourlyTripleBiometryBuddySize]);
    }];
    
    
    UIView *traitFactView = [FrictionShe traitFactView];
    [self.view addSubview:traitFactView];
    self.traitFactView = traitFactView;
    [traitFactView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.view).offset(FrictionShe.headphoneMay.widthDateBox);
        make.height.mas_equalTo(FrictionShe.headphoneMay.learnSurface);
        make.left.equalTo(self.squareButButton.mas_right);
        make.right.equalTo(self.bikeDarwinButton.mas_left);
    }];
    
    
    _unsafeGrowView = [[UITableView alloc] initWithFrame:CGRectZero style:(UITableViewStylePlain)];
    _unsafeGrowView.backgroundColor = [UIColor whiteColor];
    _unsafeGrowView.layer.masksToBounds = YES;
    _unsafeGrowView.separatorInset = UIEdgeInsetsMake(0, 0, 0, 0);
    _unsafeGrowView.separatorColor = [UIColor systemGroupedBackgroundColor];
    _unsafeGrowView.layer.borderColor = [FrictionShe collectorColor].CGColor;
    _unsafeGrowView.layer.borderWidth = 0.6;
    _unsafeGrowView.layer.cornerRadius = 2;
    _unsafeGrowView.rowHeight = FrictionShe.headphoneMay.kilovoltsAdd;
    _unsafeGrowView.delegate = self;
    _unsafeGrowView.dataSource = self;
    [_unsafeGrowView registerClass:[ConjugateInternalFeedbackDescribeDetermineCell class] forCellReuseIdentifier:NSStringFromClass(ConjugateInternalFeedbackDescribeDetermineCell.class)];
    [self.view addSubview:_unsafeGrowView];
    [self.unsafeGrowView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.traitFactView.mas_bottom).offset(FrictionShe.headphoneMay.widthDateBox);
        make.left.equalTo(self.joiningCalorieAddSmoothedUppercaseView).offset(FrictionShe.headphoneMay.identifyMill);
        make.right.equalTo(self.joiningCalorieAddSmoothedUppercaseView).offset(-FrictionShe.headphoneMay.identifyMill);
        make.height.mas_equalTo(FrictionShe.headphoneMay.kilovoltsAdd);
    }];
    
    
    self.eggFactoryButton = [FrictionShe velocityResultSearchingSignalingParser:FrictionShe.saltBurstFinal.clampSerialDirectoryStayInterlace];
    [self.eggFactoryButton addTarget:self action:@selector(picturesTryShrinkMovieConstructNotAction:) forControlEvents:(UIControlEventTouchUpInside)];
    [self.joiningCalorieAddSmoothedUppercaseView addSubview:self.eggFactoryButton];
    [self.eggFactoryButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.joiningCalorieAddSmoothedUppercaseView).offset(-FrictionShe.headphoneMay.widthDateBox);
        make.centerX.equalTo(self.view);
    }];
    
    
    self.icySayTraitButton = [FrictionShe icyThiaminFarsiReadoutRetColor:FrictionShe.saltBurstFinal.positiveCar];
    [self.icySayTraitButton addTarget:self action:@selector(densityDetectionLazyFiveNotationNext:) forControlEvents:UIControlEventTouchUpInside];
    [self.joiningCalorieAddSmoothedUppercaseView addSubview:self.icySayTraitButton];
    [self.icySayTraitButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.eggFactoryButton.mas_top).offset(-FrictionShe.headphoneMay.unlockBuffer);
        make.left.right.equalTo(self.unsafeGrowView);
        make.height.mas_equalTo(FrictionShe.headphoneMay.beatTouchMap);
    }];
}

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

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    ConjugateInternalFeedbackDescribeDetermineCell *skip = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass(ConjugateInternalFeedbackDescribeDetermineCell.class) forIndexPath:indexPath];
    NSArray *magicOwn = _tomorrowArray[indexPath.row];
    
    skip.downYardName.text = magicOwn[0];
    
    skip.bedPartialView.image = [[UIImage forbiddenIndoorStaleAllExistingName:magicOwn[1]] imageWithRenderingMode:(UIImageRenderingModeAlwaysTemplate)];
    
    skip.getMapModelTime.text = [NSString stringWithFormat:@"%@ %@",FrictionShe.saltBurstFinal.runEggActivatedTagOriginsTime,[self endsCollapseMeasureInsertedHandoverPreferredTime:[magicOwn[2] doubleValue]]];
    
    skip.accessoryType = self.sinDirectlyRecursiveTextInland ? UITableViewCellAccessoryNone :  UITableViewCellAccessoryDisclosureIndicator;
    
    return skip;
}

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


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

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

- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
    
    if (editingStyle == UITableViewCellEditingStyleDelete) {
        
        id magicOwn = _tomorrowArray[indexPath.row];
        
        [_tomorrowArray removeObject:magicOwn];
        
        [_leasePanoramaArray removeObject:magicOwn];
        
        if ([self.buddhistAgent respondsToSelector:@selector(certConnectedLowSwappedEpsilonReplyName:completion:)]) {
            [self.buddhistAgent certConnectedLowSwappedEpsilonReplyName:magicOwn[0] completion:^(id object) {
                
            }];
        }
        
        if(_leasePanoramaArray.count > 0){
            
            _tomorrowArray = _leasePanoramaArray;
            _beenSpanSpaKin = _tomorrowArray.firstObject;
            self.sinDirectlyRecursiveTextInland = YES;
            
        }
    }
}


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

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

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


- (void)picturesTryShrinkMovieConstructNotAction:(UIButton *)sender {
    PressPrepViewController *presentTwelve = [PressPrepViewController new];
    presentTwelve.buddhistAgent = self.buddhistAgent;
    [self.navigationController pushViewController:presentTwelve animated:NO];
}

- (void)densityDetectionLazyFiveNotationNext:(UIButton *)sender {
    if ([self.buddhistAgent respondsToSelector:@selector(settingReviewSquaresKitPulseWireMaskName:completion:)]) {
        [BaseLookupView mergeMoleFeetWindow];
        [self.buddhistAgent settingReviewSquaresKitPulseWireMaskName:self.beenSpanSpaKin[0] completion:^(id object) {
            [BaseLookupView adoptPickSlantResolvedEntityWindow];
        }];
    }
}


- (NSString *)endsCollapseMeasureInsertedHandoverPreferredTime:(double)beTime {
    
    NSTimeInterval now = [[NSDate date] timeIntervalSince1970];
    double beganSawTime = now - beTime;
    NSString * mainPromise;
    
    NSDate * hisDate = [NSDate dateWithTimeIntervalSince1970:beTime];
    NSDateFormatter * own = [[NSDateFormatter alloc] init];
    [own setDateFormat:@"HH:mm"];
    NSString * sideWet = [own stringFromDate:hisDate];
    
    [own setDateFormat:@"dd"];
    NSString * yetWay = [own stringFromDate:[NSDate date]];
    NSString * symptom = [own stringFromDate:hisDate];
    
    if (beganSawTime < 60) {
        mainPromise = FrictionShe.saltBurstFinal.preserveRest;
    }else if (beganSawTime < 60 * 60) {
        mainPromise = [NSString stringWithFormat:@"%ld%@",(long)beganSawTime / 60, FrictionShe.saltBurstFinal.evaluatedReaderExportedUsesDecide];
    }else if(beganSawTime < 24 * 60 * 60 && [yetWay integerValue] == [symptom integerValue]){
        mainPromise = [NSString stringWithFormat:@"%@ %@",FrictionShe.saltBurstFinal.retElapsed,sideWet];
    }else if(beganSawTime < 24 * 60 * 60 * 2 && [yetWay integerValue] != [symptom integerValue]){
        if ([yetWay integerValue] - [symptom integerValue] == 1 || ([symptom integerValue] - [yetWay integerValue] > 10 && [yetWay integerValue] == 1)) {
            mainPromise = [NSString stringWithFormat:@"%@ %@",FrictionShe.saltBurstFinal.weekdayYiddish,sideWet];
        }else{
            [own setDateFormat:@"MM-dd HH:mm"];
            mainPromise = [own stringFromDate:hisDate];
        }
    }else if(beganSawTime < 24 * 60 * 60 * 365){
        [own setDateFormat:@"MM-dd HH:mm"];
        mainPromise = [own stringFromDate:hisDate];
    }else{
        [own setDateFormat:@"yyyy-MM-dd HH:mm"];
        mainPromise = [own stringFromDate:hisDate];
    }
    return mainPromise;
}

@end
