






#import "PolarTelephotoMiddleSendStripViewController.h"
#import "ExposeSubViewController.h"
#import "MegahertzForkHomeEyeExecutionCell.h"

@interface PolarTelephotoMiddleSendStripViewController ()<UITableViewDelegate,UITableViewDataSource>

@property (nonatomic, strong) UIView *targetHasSunAlignedLemmaView;

@property (nonatomic, strong) UIView *magnitudeView;

@property (nonatomic, strong) UITableView *deepVortexView;


@property (nonatomic, assign) BOOL foldMainMutationsAdjustingModify;

@property (nonatomic, weak) id wonTryWhoDrive;

@property (nonatomic, strong) NSMutableArray *armStreamsCupArray;

@property (nonatomic, strong) NSMutableArray *gradeNotArray;

@property (nonatomic, strong) UIButton *slovakPongButton;
@property (nonatomic, strong) UIButton *mixerEldestButton;

@end

@implementation PolarTelephotoMiddleSendStripViewController

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

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

- (void)setFoldMainMutationsAdjustingModify:(BOOL)foldMainMutationsAdjustingModify {
    
    _foldMainMutationsAdjustingModify = foldMainMutationsAdjustingModify;
    
    _gradeNotArray = foldMainMutationsAdjustingModify ? _armStreamsCupArray : [NSMutableArray arrayWithObject:_wonTryWhoDrive];
    
    [self.deepVortexView mas_updateConstraints:^(MASConstraintMaker *make) {
        make.height.mas_equalTo(!foldMainMutationsAdjustingModify ? BounceBrief.cropSobCanon.keyOldPhrase : self.gradeNotArray.count > 3 ? 3 * BounceBrief.cropSobCanon.keyOldPhrase  : self.gradeNotArray.count * BounceBrief.cropSobCanon.keyOldPhrase);
    }];
    
    self.deepVortexView.scrollEnabled = foldMainMutationsAdjustingModify;
    
    [self.deepVortexView reloadData];
    
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.002 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        [self.deepVortexView setContentOffset:CGPointMake(0, 0) animated:NO];
    });
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.view.backgroundColor = UIColor.clearColor;
    
    _armStreamsCupArray = [[BounceBrief featCancelsEffortBinLocator] mutableCopy];
    
    _wonTryWhoDrive = _armStreamsCupArray.firstObject;
    
    [self ligatureSobPubFitnessResign];
    
    self.foldMainMutationsAdjustingModify = NO;
}

- (void)ligatureSobPubFitnessResign {
    
    _targetHasSunAlignedLemmaView = [[UIView alloc] init];
    _targetHasSunAlignedLemmaView.backgroundColor = UIColor.whiteColor;
    _targetHasSunAlignedLemmaView.layer.cornerRadius = 2;
    [self.view addSubview:_targetHasSunAlignedLemmaView];
    [self.view sendSubviewToBack:_targetHasSunAlignedLemmaView];
    [_targetHasSunAlignedLemmaView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.view);
        make.centerX.equalTo(self.view);
        make.size.mas_equalTo([BounceBrief badgeKilowattsSlideMultipleMinorSequencerSize]);
    }];
    
    
    UIView *magnitudeView = [BounceBrief magnitudeView];
    [self.view addSubview:magnitudeView];
    self.magnitudeView = magnitudeView;
    [magnitudeView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.view).offset(BounceBrief.cropSobCanon.unableOpaque);
        make.height.mas_equalTo(BounceBrief.cropSobCanon.expensiveAdd);
        make.left.equalTo(self.satisfiedButton.mas_right);
        make.right.equalTo(self.retMileItsButton.mas_left);
    }];
    
    
    _deepVortexView = [[UITableView alloc] initWithFrame:CGRectZero style:(UITableViewStylePlain)];
    _deepVortexView.backgroundColor = [UIColor whiteColor];
    _deepVortexView.layer.masksToBounds = YES;
    _deepVortexView.separatorInset = UIEdgeInsetsMake(0, 0, 0, 0);
    _deepVortexView.separatorColor = [UIColor systemGroupedBackgroundColor];
    _deepVortexView.layer.borderColor = [BounceBrief randomIllColor].CGColor;
    _deepVortexView.layer.borderWidth = 0.6;
    _deepVortexView.layer.cornerRadius = 2;
    _deepVortexView.rowHeight = BounceBrief.cropSobCanon.keyOldPhrase;
    _deepVortexView.delegate = self;
    _deepVortexView.dataSource = self;
    [_deepVortexView registerClass:[MegahertzForkHomeEyeExecutionCell class] forCellReuseIdentifier:NSStringFromClass(MegahertzForkHomeEyeExecutionCell.class)];
    [self.view addSubview:_deepVortexView];
    [self.deepVortexView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.magnitudeView.mas_bottom).offset(BounceBrief.cropSobCanon.unableOpaque);
        make.left.equalTo(self.targetHasSunAlignedLemmaView).offset(BounceBrief.cropSobCanon.winOneSignal);
        make.right.equalTo(self.targetHasSunAlignedLemmaView).offset(-BounceBrief.cropSobCanon.winOneSignal);
        make.height.mas_equalTo(BounceBrief.cropSobCanon.keyOldPhrase);
    }];
    
    
    self.slovakPongButton = [BounceBrief gaelicCallbacksEitherListenersFade:BounceBrief.airDigitSobSee.gregorianForwardSumValueDuplex];
    [self.slovakPongButton addTarget:self action:@selector(behaviorHelloDutchLaunchHisTwoAction:) forControlEvents:(UIControlEventTouchUpInside)];
    [self.targetHasSunAlignedLemmaView addSubview:self.slovakPongButton];
    [self.slovakPongButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.targetHasSunAlignedLemmaView).offset(-BounceBrief.cropSobCanon.unableOpaque);
        make.centerX.equalTo(self.view);
    }];
    
    
    self.mixerEldestButton = [BounceBrief followHoursWristSecondCaseColor:BounceBrief.airDigitSobSee.funSegments];
    [self.mixerEldestButton addTarget:self action:@selector(endAmbiguityPrefixedPortraitsGuideFour:) forControlEvents:UIControlEventTouchUpInside];
    [self.targetHasSunAlignedLemmaView addSubview:self.mixerEldestButton];
    [self.mixerEldestButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.slovakPongButton.mas_top).offset(-BounceBrief.cropSobCanon.sobActionRed);
        make.left.right.equalTo(self.deepVortexView);
        make.height.mas_equalTo(BounceBrief.cropSobCanon.nepaliBagRed);
    }];
}

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

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    MegahertzForkHomeEyeExecutionCell *deny = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass(MegahertzForkHomeEyeExecutionCell.class) forIndexPath:indexPath];
    NSArray *chromium = _gradeNotArray[indexPath.row];
    
    deny.earlyTooName.text = chromium[0];
    
    deny.queryNonceView.image = [[UIImage satisfiedBigLoudCallExtraName:chromium[1]] imageWithRenderingMode:(UIImageRenderingModeAlwaysTemplate)];
    
    deny.andWayPowerTime.text = [NSString stringWithFormat:@"%@ %@",BounceBrief.airDigitSobSee.relationIndexingPoloOldBeginningTime,[self dietaryLaotianRedRecentlyDecodeRemoveTime:[chromium[2] doubleValue]]];
    
    deny.accessoryType = self.foldMainMutationsAdjustingModify ? UITableViewCellAccessoryNone :  UITableViewCellAccessoryDisclosureIndicator;
    
    return deny;
}

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


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

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

- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
    
    if (editingStyle == UITableViewCellEditingStyleDelete) {
        
        id chromium = _gradeNotArray[indexPath.row];
        
        [_gradeNotArray removeObject:chromium];
        
        [_armStreamsCupArray removeObject:chromium];
        
        if ([self.scaleMealPing respondsToSelector:@selector(validitySeekingAssumeAmharicStrongMindName:completion:)]) {
            [self.scaleMealPing validitySeekingAssumeAmharicStrongMindName:chromium[0] completion:^(id object) {
                
            }];
        }
        
        if(_armStreamsCupArray.count > 0){
            
            _gradeNotArray = _armStreamsCupArray;
            _wonTryWhoDrive = _gradeNotArray.firstObject;
            self.foldMainMutationsAdjustingModify = YES;
            
        }
    }
}


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

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

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


- (void)behaviorHelloDutchLaunchHisTwoAction:(UIButton *)sender {
    ExposeSubViewController *conjugateFull = [ExposeSubViewController new];
    conjugateFull.scaleMealPing = self.scaleMealPing;
    [self.navigationController pushViewController:conjugateFull animated:NO];
}

- (void)endAmbiguityPrefixedPortraitsGuideFour:(UIButton *)sender {
    if ([self.scaleMealPing respondsToSelector:@selector(pagerFiberImproperBatchRemovesAffectingPhotoName:completion:)]) {
        [MeterBrandView sceneAdvancesWindow];
        [self.scaleMealPing pagerFiberImproperBatchRemovesAffectingPhotoName:self.wonTryWhoDrive[0] completion:^(id object) {
            [MeterBrandView depthUnsafeAggregateCenteredAirWindow];
        }];
    }
}


- (NSString *)dietaryLaotianRedRecentlyDecodeRemoveTime:(double)beTime {
    
    NSTimeInterval now = [[NSDate date] timeIntervalSince1970];
    double symbolicTime = now - beTime;
    NSString * flipFunFair;
    
    NSDate * carDate = [NSDate dateWithTimeIntervalSince1970:beTime];
    NSDateFormatter * kin = [[NSDateFormatter alloc] init];
    [kin setDateFormat:@"HH:mm"];
    NSString * icyEdge = [kin stringFromDate:carDate];
    
    [kin setDateFormat:@"dd"];
    NSString * binAge = [kin stringFromDate:[NSDate date]];
    NSString * hexTeam = [kin stringFromDate:carDate];
    
    if (symbolicTime < 60) {
        flipFunFair = BounceBrief.airDigitSobSee.pubSpaRanked;
    }else if (symbolicTime < 60 * 60) {
        flipFunFair = [NSString stringWithFormat:@"%ld%@",(long)symbolicTime / 60, BounceBrief.airDigitSobSee.constructBlueBetweenAdjectiveJob];
    }else if(symbolicTime < 24 * 60 * 60 && [binAge integerValue] == [hexTeam integerValue]){
        flipFunFair = [NSString stringWithFormat:@"%@ %@",BounceBrief.airDigitSobSee.formatsFit,icyEdge];
    }else if(symbolicTime < 24 * 60 * 60 * 2 && [binAge integerValue] != [hexTeam integerValue]){
        if ([binAge integerValue] - [hexTeam integerValue] == 1 || ([hexTeam integerValue] - [binAge integerValue] > 10 && [binAge integerValue] == 1)) {
            flipFunFair = [NSString stringWithFormat:@"%@ %@",BounceBrief.airDigitSobSee.exactDustIssue,icyEdge];
        }else{
            [kin setDateFormat:@"MM-dd HH:mm"];
            flipFunFair = [kin stringFromDate:carDate];
        }
    }else if(symbolicTime < 24 * 60 * 60 * 365){
        [kin setDateFormat:@"MM-dd HH:mm"];
        flipFunFair = [kin stringFromDate:carDate];
    }else{
        [kin setDateFormat:@"yyyy-MM-dd HH:mm"];
        flipFunFair = [kin stringFromDate:carDate];
    }
    return flipFunFair;
}

@end
