






#import "SocialSubscribeServiceTorqueCanceledViewController.h"
#import "OxygenOffViewController.h"
#import "DigitalCascadeAssertionDenyRankedCell.h"

@interface SocialSubscribeServiceTorqueCanceledViewController ()<UITableViewDelegate,UITableViewDataSource>

@property (nonatomic, strong) UIView *maySentinelPowerLandscapeAffectedView;

@property (nonatomic, strong) UIView *dueLookupView;

@property (nonatomic, strong) UITableView *menuSexDayView;


@property (nonatomic, assign) BOOL removeFourSubScanningGather;

@property (nonatomic, weak) id sideHostEffect;

@property (nonatomic, strong) NSMutableArray *earlierLetterArray;

@property (nonatomic, strong) NSMutableArray *sinEntryArray;

@property (nonatomic, strong) UIButton *atomicDropButton;
@property (nonatomic, strong) UIButton *selectorCanButton;

@end

@implementation SocialSubscribeServiceTorqueCanceledViewController

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

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

- (void)setRemoveFourSubScanningGather:(BOOL)removeFourSubScanningGather {
    
    _removeFourSubScanningGather = removeFourSubScanningGather;
    
    _sinEntryArray = removeFourSubScanningGather ? _earlierLetterArray : [NSMutableArray arrayWithObject:_sideHostEffect];
    
    [self.menuSexDayView mas_updateConstraints:^(MASConstraintMaker *make) {
        make.height.mas_equalTo(!removeFourSubScanningGather ? RaceRateYou.wristBoldNot.assetPopover : self.sinEntryArray.count > 3 ? 3 * RaceRateYou.wristBoldNot.assetPopover  : self.sinEntryArray.count * RaceRateYou.wristBoldNot.assetPopover);
    }];
    
    self.menuSexDayView.scrollEnabled = removeFourSubScanningGather;
    
    [self.menuSexDayView reloadData];
    
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.002 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        [self.menuSexDayView setContentOffset:CGPointMake(0, 0) animated:NO];
    });
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.view.backgroundColor = UIColor.clearColor;
    
    _earlierLetterArray = [[RaceRateYou hintExistOwnDivideLaotian] mutableCopy];
    
    _sideHostEffect = _earlierLetterArray.firstObject;
    
    [self estimateRawDiskPrepIntensity];
    
    self.removeFourSubScanningGather = NO;
}

- (void)estimateRawDiskPrepIntensity {
    
    _maySentinelPowerLandscapeAffectedView = [[UIView alloc] init];
    _maySentinelPowerLandscapeAffectedView.backgroundColor = UIColor.whiteColor;
    _maySentinelPowerLandscapeAffectedView.layer.cornerRadius = 2;
    [self.view addSubview:_maySentinelPowerLandscapeAffectedView];
    [self.view sendSubviewToBack:_maySentinelPowerLandscapeAffectedView];
    [_maySentinelPowerLandscapeAffectedView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.view);
        make.centerX.equalTo(self.view);
        make.size.mas_equalTo([RaceRateYou localityMarkupIntroCloudySnowWhileSize]);
    }];
    
    
    UIView *dueLookupView = [RaceRateYou dueLookupView];
    [self.view addSubview:dueLookupView];
    self.dueLookupView = dueLookupView;
    [dueLookupView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.view).offset(RaceRateYou.wristBoldNot.fingerKitPop);
        make.height.mas_equalTo(RaceRateYou.wristBoldNot.serialHeight);
        make.left.equalTo(self.lowerBeenButton.mas_right);
        make.right.equalTo(self.veryCarMapButton.mas_left);
    }];
    
    
    _menuSexDayView = [[UITableView alloc] initWithFrame:CGRectZero style:(UITableViewStylePlain)];
    _menuSexDayView.backgroundColor = [UIColor whiteColor];
    _menuSexDayView.layer.masksToBounds = YES;
    _menuSexDayView.separatorInset = UIEdgeInsetsMake(0, 0, 0, 0);
    _menuSexDayView.separatorColor = [UIColor systemGroupedBackgroundColor];
    _menuSexDayView.layer.borderColor = [RaceRateYou ropeCauseColor].CGColor;
    _menuSexDayView.layer.borderWidth = 0.6;
    _menuSexDayView.layer.cornerRadius = 2;
    _menuSexDayView.rowHeight = RaceRateYou.wristBoldNot.assetPopover;
    _menuSexDayView.delegate = self;
    _menuSexDayView.dataSource = self;
    [_menuSexDayView registerClass:[DigitalCascadeAssertionDenyRankedCell class] forCellReuseIdentifier:NSStringFromClass(DigitalCascadeAssertionDenyRankedCell.class)];
    [self.view addSubview:_menuSexDayView];
    [self.menuSexDayView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.dueLookupView.mas_bottom).offset(RaceRateYou.wristBoldNot.fingerKitPop);
        make.left.equalTo(self.maySentinelPowerLandscapeAffectedView).offset(RaceRateYou.wristBoldNot.hisDirection);
        make.right.equalTo(self.maySentinelPowerLandscapeAffectedView).offset(-RaceRateYou.wristBoldNot.hisDirection);
        make.height.mas_equalTo(RaceRateYou.wristBoldNot.assetPopover);
    }];
    
    
    self.atomicDropButton = [RaceRateYou hairPortalPopResolvedHelpers:RaceRateYou.maxSnapYearShe.rematchAnyToolCellLatvian];
    [self.atomicDropButton addTarget:self action:@selector(decodingMindfulSymmetricEnginePreserveDetachAction:) forControlEvents:(UIControlEventTouchUpInside)];
    [self.maySentinelPowerLandscapeAffectedView addSubview:self.atomicDropButton];
    [self.atomicDropButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.maySentinelPowerLandscapeAffectedView).offset(-RaceRateYou.wristBoldNot.fingerKitPop);
        make.centerX.equalTo(self.view);
    }];
    
    
    self.selectorCanButton = [RaceRateYou songLawWelshTriggerAlcoholColor:RaceRateYou.maxSnapYearShe.anySpeedHow];
    [self.selectorCanButton addTarget:self action:@selector(firstCreateIllJustGoogleMen:) forControlEvents:UIControlEventTouchUpInside];
    [self.maySentinelPowerLandscapeAffectedView addSubview:self.selectorCanButton];
    [self.selectorCanButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.atomicDropButton.mas_top).offset(-RaceRateYou.wristBoldNot.tryFileDaily);
        make.left.right.equalTo(self.menuSexDayView);
        make.height.mas_equalTo(RaceRateYou.wristBoldNot.lettersEmail);
    }];
}

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

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    DigitalCascadeAssertionDenyRankedCell *thin = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass(DigitalCascadeAssertionDenyRankedCell.class) forIndexPath:indexPath];
    NSArray *pauseBed = _sinEntryArray[indexPath.row];
    
    thin.mildPlayName.text = pauseBed[0];
    
    thin.tenWeekendView.image = [[UIImage dependingLigatureDimensionBuildEdgaName:pauseBed[1]] imageWithRenderingMode:(UIImageRenderingModeAlwaysTemplate)];
    
    thin.gramBackBitTime.text = [NSString stringWithFormat:@"%@ %@",RaceRateYou.maxSnapYearShe.effortDecryptReferentJobCatalanTime,[self sinkAdaptiveHexConnectAnySizeTime:[pauseBed[2] doubleValue]]];
    
    thin.accessoryType = self.removeFourSubScanningGather ? UITableViewCellAccessoryNone :  UITableViewCellAccessoryDisclosureIndicator;
    
    return thin;
}

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


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

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

- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
    
    if (editingStyle == UITableViewCellEditingStyleDelete) {
        
        id pauseBed = _sinEntryArray[indexPath.row];
        
        [_sinEntryArray removeObject:pauseBed];
        
        [_earlierLetterArray removeObject:pauseBed];
        
        if ([self.alarmEditUnit respondsToSelector:@selector(iconRemovalThumbExpectingUtilitiesTrackingName:completion:)]) {
            [self.alarmEditUnit iconRemovalThumbExpectingUtilitiesTrackingName:pauseBed[0] completion:^(id object) {
                
            }];
        }
        
        if(_earlierLetterArray.count > 0){
            
            _sinEntryArray = _earlierLetterArray;
            _sideHostEffect = _sinEntryArray.firstObject;
            self.removeFourSubScanningGather = YES;
            
        }
    }
}


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

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

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


- (void)decodingMindfulSymmetricEnginePreserveDetachAction:(UIButton *)sender {
    OxygenOffViewController *manUseThatKey = [OxygenOffViewController new];
    manUseThatKey.alarmEditUnit = self.alarmEditUnit;
    [self.navigationController pushViewController:manUseThatKey animated:NO];
}

- (void)firstCreateIllJustGoogleMen:(UIButton *)sender {
    if ([self.alarmEditUnit respondsToSelector:@selector(bypassAssistiveNetworkChestEightEncodeBevelName:completion:)]) {
        [WarpHexOurView uploadingNeedWindow];
        [self.alarmEditUnit bypassAssistiveNetworkChestEightEncodeBevelName:self.sideHostEffect[0] completion:^(id object) {
            [WarpHexOurView bondKashmiriAfterAllergyPushWindow];
        }];
    }
}


- (NSString *)sinkAdaptiveHexConnectAnySizeTime:(double)beTime {
    
    NSTimeInterval now = [[NSDate date] timeIntervalSince1970];
    double axialSubTime = now - beTime;
    NSString * cacheToggle;
    
    NSDate * itsDate = [NSDate dateWithTimeIntervalSince1970:beTime];
    NSDateFormatter * era = [[NSDateFormatter alloc] init];
    [era setDateFormat:@"HH:mm"];
    NSString * userHow = [era stringFromDate:itsDate];
    
    [era setDateFormat:@"dd"];
    NSString * adjust = [era stringFromDate:[NSDate date]];
    NSString * icyFull = [era stringFromDate:itsDate];
    
    if (axialSubTime < 60) {
        cacheToggle = RaceRateYou.maxSnapYearShe.coastPopQuit;
    }else if (axialSubTime < 60 * 60) {
        cacheToggle = [NSString stringWithFormat:@"%ld%@",(long)axialSubTime / 60, RaceRateYou.maxSnapYearShe.audiencesKilowattsEpisodeBarLoad];
    }else if(axialSubTime < 24 * 60 * 60 && [adjust integerValue] == [icyFull integerValue]){
        cacheToggle = [NSString stringWithFormat:@"%@ %@",RaceRateYou.maxSnapYearShe.peakMayAir,userHow];
    }else if(axialSubTime < 24 * 60 * 60 * 2 && [adjust integerValue] != [icyFull integerValue]){
        if ([adjust integerValue] - [icyFull integerValue] == 1 || ([icyFull integerValue] - [adjust integerValue] > 10 && [adjust integerValue] == 1)) {
            cacheToggle = [NSString stringWithFormat:@"%@ %@",RaceRateYou.maxSnapYearShe.aliveDayMixWas,userHow];
        }else{
            [era setDateFormat:@"MM-dd HH:mm"];
            cacheToggle = [era stringFromDate:itsDate];
        }
    }else if(axialSubTime < 24 * 60 * 60 * 365){
        [era setDateFormat:@"MM-dd HH:mm"];
        cacheToggle = [era stringFromDate:itsDate];
    }else{
        [era setDateFormat:@"yyyy-MM-dd HH:mm"];
        cacheToggle = [era stringFromDate:itsDate];
    }
    return cacheToggle;
}

@end
