123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864 |
- //
- // uoloadFileRecordViewController.m
- // 隐私保护
- //
- // Created by xd h on 2023/11/13.
- //
- #import "uploadFileRecordViewController.h"
- #import "uploadFileManager.h"
- #import "uploadFileDataModel.h"
- #import "uploadFileRecordheadView.h"
- //#import "uploadFileRecordBodyView.h"
- #import "uploadFileRecordEditBottomView.h"
- #import "uploadFileRecordBgScorllView.h"
- #import "uploadFileRecordTableView.h"
- #import "uploadFileRecordTableViewHeadView.h"
- #import "ComontAlretViewController.h"
- #import "backupsFilerecordTableView.h"
- #import "backupsFileManager.h"
- #import "photosBackupsTaskModel.h"
- @interface uploadFileRecordViewController ()<UIScrollViewDelegate>
- //选中的项
- @property (nonatomic, strong) NSMutableArray *indexPathsForSelectedItems;
- @property (nonatomic, strong) uploadFileRecordheadView *uploadFileRecordheadV;
- //@property (nonatomic, strong) uploadFileRecordBodyView *uploadFileRecordBodyV;
- @property (nonatomic, strong) uploadFileRecordBgScorllView *uploadFileRecordBgScorllV;
- @property (nonatomic, strong) uploadFileRecordTableView *leftTableView;
- @property (nonatomic, strong) uploadFileRecordTableView *midTableView;
- @property (nonatomic, strong) backupsFilerecordTableView *rightTableView;
- //@property (nonatomic,strong) uploadFileRecordTableViewHeadView *leftHeadView;
- //@property (nonatomic,strong) uploadFileRecordTableViewHeadView *midHeadView;
- //@property (nonatomic, strong) NSMutableArray *allDataArr;
- @property (nonatomic, strong) UIButton *leftButton;
- @property (nonatomic, strong) UIButton *rightButton;
- @property (nonatomic, strong) uploadFileRecordEditBottomView *uploadFileRecordEditBottomV;
- @property (nonatomic,assign) BOOL isEditType;
- @property(nonatomic,assign) NSInteger selectIndex;// 从1开始
- @end
- @implementation uploadFileRecordViewController
- - (void)viewDidLoad {
- [super viewDidLoad];
- // Do any additional setup after loading the view.
-
- //[self.view setBackgroundColor:HWF5F7FAColor];
-
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(uploadFileRefreshFun:) name:uploadFileRefreshNotification object:nil];
-
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(uploadFileDeteleFun:) name:uploadFileDeteleNotification object:nil];
-
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(backupsFileRefreshFun:) name:backupsFileRefreshNotification object:nil];
-
- [self.view setBackgroundColor:[UIColor whiteColor]];
-
- self.titleLabel.text = NSLocalizedString(@"my_set_no_File_Transfer_List",nil) ;
-
- [self.toolBar setHidden:YES];
- [self.navigationBar setHidden:YES];
- [self.navBarBGView setHidden:NO];
- self.navBarBGView.backgroundColor = [UIColor whiteColor];
-
- dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
- [self initbaseUIFun];
- [self getDataInDatabaseFun];
- [self getBackupsDatabaseFun];
- });
- }
- - (void)viewWillAppear:(BOOL)animated
- {
- [super viewWillAppear:animated];
-
- }
- #pragma mark UI
- - (void)initbaseUIFun
- {
- _uploadFileRecordheadV = [[uploadFileRecordheadView alloc] init];
- [self.view addSubview:_uploadFileRecordheadV];
-
- [_uploadFileRecordheadV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(15);
- make.right.mas_equalTo(-15);
- make.top.mas_equalTo(self.navBarBGView.mas_bottom).offset(15.0);
- make.height.mas_equalTo(50);
- }];
- _selectIndex = 1;
- KWeakSelf
- #pragma mark 头部点击事件
- _uploadFileRecordheadV.didClickButFun = ^(NSInteger index) {
- [weakSelf didClickHeadFun: index];
- };
-
- // CGRect rrr2= self.navBarBGView.frame;
- // CGRect rrr= _uploadFileRecordheadV.frame;
- CGFloat curHeight = SCREEN_H - CGRectGetMaxY(self.navBarBGView.frame) - 50 - 15;
-
-
- _uploadFileRecordBgScorllV= [[uploadFileRecordBgScorllView alloc] init];
- _uploadFileRecordBgScorllV.delegate = self;
- [self.view addSubview:_uploadFileRecordBgScorllV];
- [_uploadFileRecordBgScorllV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(0);
- make.right.mas_equalTo(0);
- make.top.mas_equalTo(_uploadFileRecordheadV.mas_bottom).offset(0.0);
- make.bottom.mas_equalTo(0);
- }];
-
-
- _leftTableView = [[uploadFileRecordTableView alloc] init];
- _leftTableView.tag =100;
- [_uploadFileRecordBgScorllV addSubview:_leftTableView];
- [_leftTableView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(SCREEN_W*0.0);
- make.width.mas_equalTo(SCREEN_W);
- make.top.mas_equalTo(0);
- make.height.mas_equalTo(curHeight);
- }];
- _leftTableView.didLongPressClick = ^{
- weakSelf.isEditType = YES;
- };
- _midTableView = [[uploadFileRecordTableView alloc] init];
- _midTableView.tag = 101;
- [_uploadFileRecordBgScorllV addSubview:_midTableView];
- [_midTableView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(SCREEN_W*1.0);
- make.width.mas_equalTo(SCREEN_W);
- make.top.mas_equalTo(0);
- make.height.mas_equalTo(curHeight);
- }];
- _midTableView.didLongPressClick = ^{
- weakSelf.isEditType = YES;
- };
-
- _rightTableView = [[backupsFilerecordTableView alloc] init];
- _rightTableView.tag = 102;
- [_uploadFileRecordBgScorllV addSubview:_rightTableView];
- [_rightTableView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(SCREEN_W*2.0);
- make.width.mas_equalTo(SCREEN_W);
- make.top.mas_equalTo(0);
- make.height.mas_equalTo(curHeight);
- }];
- _rightTableView.didLongPressClick = ^{
- // weakSelf.isEditType = YES;
- };
-
- _rightTableView.didClickReUploadBlock = ^(photosBackupsTaskModel* _Nonnull model) {
- // [weakSelf didClickReUploadFun:model];
- };
-
- _uploadFileRecordBgScorllV.contentSize = CGSizeMake(SCREEN_W*3.0, curHeight);
-
- // _leftHeadView = [[uploadFileRecordTableViewHeadView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_W, 40)];
- // _leftTableView.tableHeaderView = _leftHeadView;
- // _leftHeadView.didClickButFun = ^{
- // [weakSelf didClickAllSuspendInLoadingFun];
- // };
- //
- // _midHeadView = [[uploadFileRecordTableViewHeadView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_W, 40)];
- // _midTableView.tableHeaderView = _midHeadView;
- // _midHeadView.didClickButFun = ^{
- // [weakSelf didClickClearRecordInDoneFun];
- // };
-
-
- _leftButton = [[UIButton alloc] init];
- [_leftButton setTitleColor:[UIColor hwColor:@"#01B7EA" alpha:1.0] forState:UIControlStateNormal];
- _leftButton.titleLabel.font = [UIFont systemFontOfSize:18.0];
- _leftButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
- [_leftButton addTarget:self action:@selector(didClickButFun:) forControlEvents:UIControlEventTouchUpInside];
- _leftButton.tag = 1;
- [_leftButton setTitle:NSLocalizedString(@"other_cancel",nil) forState:UIControlStateNormal];
- _leftButton.hidden = YES;
- [self.navBarBGView addSubview:_leftButton];
-
- [_leftButton mas_makeConstraints:^(MASConstraintMaker *make) {
- make.width.mas_equalTo(80);
- make.left.mas_equalTo(15);
- make.height.mas_equalTo(self.backBtn.mas_height);
- make.centerY.mas_equalTo(self.backBtn.mas_centerY);
- }];
-
- _rightButton = [[UIButton alloc] init];
- [_rightButton setTitleColor:[UIColor hwColor:@"#01B7EA" alpha:1.0] forState:UIControlStateNormal];
- _rightButton.titleLabel.font = [UIFont systemFontOfSize:18.0];
- _rightButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentRight;
- [_rightButton addTarget:self action:@selector(didClickButFun:) forControlEvents:UIControlEventTouchUpInside];
- _rightButton.tag = 2;
- [_rightButton setTitle:NSLocalizedString(@"File_upload_Record_select_all",nil) forState:UIControlStateNormal];
- _rightButton.hidden = YES;
- [self.navBarBGView addSubview:_rightButton];
-
- [_rightButton mas_makeConstraints:^(MASConstraintMaker *make) {
- make.width.mas_equalTo(80);
- make.right.mas_equalTo(-15);
- make.height.mas_equalTo(self.backBtn.mas_height);
- make.centerY.mas_equalTo(self.backBtn.mas_centerY);
- }];
-
- _uploadFileRecordEditBottomV = [[uploadFileRecordEditBottomView alloc] init];
- _uploadFileRecordEditBottomV.hidden = YES;
- [self.view addSubview:_uploadFileRecordEditBottomV];
-
- [_uploadFileRecordEditBottomV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(0);
- make.right.mas_equalTo(0);
- make.height.mas_equalTo(60 + safeArea);
- make.bottom.mas_equalTo(0);
- }];
-
- _uploadFileRecordEditBottomV.didClickButFun = ^{
- //[weakSelf.uploadFileRecordBodyV deleteModelOneByOneFun];
-
- [weakSelf didClickBottomDeleteFun];
- };
- }
- #pragma mark 底部删除点击
- -(void)didClickBottomDeleteFun
- {
- NSMutableArray *selectModelArr = nil;
- if(_selectIndex == 1){
- selectModelArr = _leftTableView.selectModelArr;
- }
- else if(_selectIndex == 2){
- selectModelArr = _midTableView.selectModelArr;
- [_midTableView deleteModelOneByOneFun];
- }
- else if(_selectIndex == 3){
- //selectModelArr = _rightTableView.selectModelArr;
- }
-
- if(!selectModelArr || selectModelArr.count== 0){
-
- [[iToast makeText:NSLocalizedString(@"File_upload_Record_delete_noFile",nil)] show];
-
- return;
- }
-
-
- NSString *delTipTip = nil;
- if(_selectIndex == 1){
- delTipTip = NSLocalizedString(@"File_upload_Record_clear_uploading_Tip_msg",nil);
- }
- else if(_selectIndex == 2){
- delTipTip = NSLocalizedString(@"File_upload_Record_clear_done_Tip_msg",nil);
- }
- else if(_selectIndex == 3){
- delTipTip = NSLocalizedString(@"File_upload_Record_clear_fail_Tip_msg",nil);
- }
-
- /*弹窗提示二次确认*/
- KWeakSelf
- ComontAlretViewController *nextVC = [[ComontAlretViewController alloc] initWithTiTle:NSLocalizedString(@"File_upload_Record_clear_Tip_title",nil)
- msg:delTipTip
- imageStr:nil
- cancelTitle:NSLocalizedString(@"other_cancel",nil)
- okTitle:NSLocalizedString(@"other_comment_ok",nil) isOkBtnHighlight:YES
- didClickOk:^{
- [weakSelf didClickBottomDeleteFunAfterAleartFun];
- } didClickCancel:^{
-
- }];
- nextVC.modalPresentationStyle = UIModalPresentationCustom;
-
- [self presentViewController:nextVC animated:YES completion:^{
- nextVC.view.superview.backgroundColor = [UIColor clearColor];
- }];
- }
- -(void)didClickBottomDeleteFunAfterAleartFun
- {
- if(_selectIndex == 1){
- [_leftTableView deleteModelOneByOneFun];
- }
- else if(_selectIndex == 2){
- [_midTableView deleteModelOneByOneFun];
- }
- else if(_selectIndex == 3){
- //[_rightTableView deleteModelOneByOneFun];
- }
- }
- #pragma mark 头部点击 背景滚动
- - (void)didClickHeadFun:(NSInteger)index
- {
- //_uploadFileRecordBodyV.selectIndex = index;
-
- _selectIndex = index;
- _uploadFileRecordBgScorllV.contentOffset = CGPointMake(SCREEN_W *(index -1), 0);
- }
- - (void)didScorllBodyFun:(NSInteger)index
- {
- _uploadFileRecordheadV.selectIndex = index;
-
- _selectIndex = index;
- }
- #pragma mark 背景滚动代理
- - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
- {
- if(scrollView != _uploadFileRecordBgScorllV) return;
-
- CGFloat x = scrollView.contentOffset.x;
- NSInteger index = (x+1)/SCREEN_W;
-
- index += 1;//因为头部是从1开始的
-
- //HLog(@"index:%ld",index);
- [self didScorllBodyFun:index];
- }
- -(void)gotoUploadFile:(NSMutableArray*)indexPathsForSelectedItems
- {
-
- [self realGotoUploadFile:indexPathsForSelectedItems];
- // KWeakSelf
- // [[uploadFileManager shareInstance] getDataInDatabaseFun:YES complete:^(NSMutableArray * _Nonnull Arr) {
- //
- // [weakSelf realGotoUploadFile:indexPathsForSelectedItems];
- // }];
-
- }
- - (void)realGotoUploadFile:(NSMutableArray *)indexPathsForSelectedItems
- {
- KWeakSelf
- [[uploadFileManager shareInstance] handlTZAssetModelToUploadFileDataFunBy:indexPathsForSelectedItems complete:^(NSMutableArray * _Nonnull Arr) {
- //NSMutableArray *arr1 = Arr;
- //[weakSelf setRecordBodyDataFunBy:arr1];
-
- //weakSelf.leftTableView.curDataArr = Arr[0];
- weakSelf.leftTableView.outSideDataArr = Arr;
- [weakSelf.leftTableView reloadDataFun];
-
- //weakSelf.midTableView.curDataArr = Arr[1];
- [weakSelf.midTableView reloadDataFun];
-
- // weakSelf.rightTableView.curDataArr = Arr[2];
- // [weakSelf.rightTableView reloadDataFun];
- }];
- }
- #pragma mark 读取数据库数据
- - (void)getDataInDatabaseFun
- {
-
- KWeakSelf
- [[uploadFileManager shareInstance] getDataInDatabaseFun:_isNotUploadingType complete:^(NSMutableArray * _Nonnull Arr) {
- //[weakSelf setRecordBodyDataFunBy:Arr];
-
- if(!Arr ||Arr.count != 3){
- HLog(@"数据库出错\n\n\n");
- return;
- }
-
- NSMutableArray *curLoadIngArr = Arr[0];
- //不是上传视频和进来的 所以上传状态(上传中和等待)改为暂停
- if(self->_isNotUploadingType && ![uploadFileManager shareInstance].isUploadIngType){
- for (uploadFileDataModel * curModel in curLoadIngArr) {
- curModel.curUploadStateType = uploadStateSuspend;
- }
- }
-
- mainBlock(^{
- weakSelf.leftTableView.outSideDataArr = Arr;
- [weakSelf.leftTableView reloadDataFun];
-
- // weakSelf.midTableView.curDataArr = Arr[1];
- // [weakSelf.midTableView reloadDataFun];
-
- [weakSelf handleUploadingRightButFun];
- });
- }];
-
-
-
- // _allDataArr = [NSMutableArray new];
- //
- // KWeakSelf
- // [uploadFileDataModel bg_findAllAsync:upLoadFile_image_tableName complete:^(NSArray * _Nullable array) {
- // NSMutableArray *failArr = [NSMutableArray new];
- // NSMutableArray *doneArr = [NSMutableArray new];
- // NSMutableArray *otherArr = [NSMutableArray new];
- //
- // for (uploadFileDataModel * curModel in array) {
- //
- // //图片 和视频 还原
- // if(curModel.curUploadFileType == uploadFileTypeImage){
- // NSString*pathStr = [cachesFileManager getFilePathWithName:curModel.filename type:uploadFileTypeImage];
- // curModel.imageData = [NSData dataWithContentsOfFile:pathStr];
- // }
- // else if(curModel.curUploadFileType == uploadFileTypeVideo){
- // NSString*pathStr = [cachesFileManager getFilePathWithName:curModel.videoFirstImageName type:uploadFileTypeImage];
- // curModel.imageData = [NSData dataWithContentsOfFile:pathStr];
- //
- // if(curModel.curUploadStateType != uploadStateDone){
- // NSString*videoPathStr = [cachesFileManager getFilePathWithName:curModel.filename type:uploadFileTypeVideo];
- // curModel.videoData = [NSData dataWithContentsOfFile:videoPathStr];
- // }
- // }
- //
- // if(curModel.curUploadStateType == uploadStateFail){
- // [failArr addObject:curModel];
- // }
- // else if(curModel.curUploadStateType == uploadStateDone){
- // [doneArr addObject:curModel];
- // }
- // else{
- // //不是上传视频和进来的 所以上传状态(上传中和等待)改为暂停
- // if(self->_isNotUploadingType && ![uploadFileManager shareInstance].isUploadIngType){
- // curModel.curUploadStateType = uploadStateSuspend;
- // }
- //
- // [otherArr addObject:curModel];
- // }
- // }
- //
- // [self->_allDataArr addObject:otherArr];
- // [self->_allDataArr addObject:doneArr];
- // [self->_allDataArr addObject:failArr];
- //
- // self->_uploadFileRecordBodyV.allDataArr = self->_allDataArr;
- // }];
- }
- - (void)getBackupsDatabaseFun
- {
- KWeakSelf
- [photosBackupsTaskModel bg_findAsync:backups_photos_tableName limit:1 orderBy:nil desc:YES complete:^(NSArray * _Nullable array) {
- mainBlock(^{
- weakSelf.rightTableView.curDataArr = array;
- });
-
- }];
- }
- #pragma mark 处理上传中的 全部暂停等
- - (void)handleUploadingRightButFun
- {
- // if(_leftTableView.curDataArr.count ==0){
- // //不处理
- // }
- // else{
- // NSMutableArray *upLoadingArr = [uploadFileManager shareInstance].fileModelDataArr;
- // BOOL isUploadIngType = [uploadFileManager shareInstance].isUploadIngType;
- //
- // if(!upLoadingArr ||upLoadingArr.count == 0 || !isUploadIngType){//不是上传状态
- // _leftHeadView.rightButton.selected = YES;
- // }
- // else if(upLoadingArr.count == _leftTableView.curDataArr.count){
- // _leftHeadView.rightButton.selected = NO;
- // }
- // else{
- // _leftHeadView.rightButton.selected = YES;
- // }
- // }
- }
- #pragma mark 给RecordBody 设置数据
- //- (void)setRecordBodyDataFunBy:(NSMutableArray*)arr
- //{
- // if(!arr || ![arr isKindOfClass:[NSMutableArray class]] || arr.count !=3){
- // return;
- // }
- // //不是上传视频和进来的 所以上传状态(上传中和等待)改为暂停
- // if(self->_isNotUploadingType && ![uploadFileManager shareInstance].isUploadIngType){
- // NSMutableArray *otherArr = arr[0];
- // for (uploadFileDataModel * curModel in otherArr) {
- // curModel.curUploadStateType = uploadStateSuspend;
- // }
- //
- // }
- //
- // //_uploadFileRecordBodyV.allDataArr = arr;
- //}
- - (void)uploadFileRefreshFun:(NSNotification*)not
- {
- uploadFileDataModel *uploadFileDataMod = [not object];
- //HLog(@"%@",uploadFileDataMod);
-
- uploadFileDataMod.curTimeInterval = [[NSDate date] timeIntervalSince1970];
-
- //UI和数据还没准备好
- // if(!_leftTableView
- // && (uploadFileDataMod.curUploadStateType == uploadStateFail
- // ||uploadFileDataMod.curUploadStateType == uploadStateDone)){
- // dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
- // [[NSNotificationCenter defaultCenter] postNotificationName:uploadFileRefreshNotification object:uploadFileDataMod];
- // });
- //
- // return;
- // }
- //
- // if(_leftTableView && [uploadFileDataMod isKindOfClass:[uploadFileDataModel class]] ){
- //
- // NSMutableArray *curArr = _leftTableView.curDataArr;
- //
- // NSInteger index = 0;
- // for (uploadFileDataModel*mod in curArr) {
- // //HLog(@"%@ bg_id:%@ ?=? %@",mod.filename,mod.bg_id,uploadFileDataMod.bg_id);
- //
- // if(mod.bg_id.integerValue == uploadFileDataMod.bg_id.integerValue){
- //
- // if(uploadFileDataMod.curUploadStateType == uploadStateDone){
- // [curArr removeObject:mod];
- //
- // NSMutableArray *doneArr = _midTableView.curDataArr;
- // [doneArr insertObject:uploadFileDataMod atIndex:0];
- //
- // //全部上传了
- // if(curArr.count == 0){
- //
- // }
- // }
- // else if(uploadFileDataMod.curUploadStateType == uploadStateFail){
- // [curArr removeObject:mod];
- //
- //// NSMutableArray *failArr = _rightTableView.curDataArr;
- //// [failArr insertObject:uploadFileDataMod atIndex:0];
- // }
- // else{
- // [curArr replaceObjectAtIndex:index withObject:uploadFileDataMod];
- // }
- //
- // break;
- // }
- //
- // index++;
- // }
- //
- // //精准刷新
- // if(uploadFileDataMod.curUploadStateType == uploadStateDone){
- // //[self.uploadFileRecordBodyV RefreshDataWithUploadingArr:_allDataArr[0] withDoneArr:_allDataArr[1] withfailArr:nil];
- //
- // [self.leftTableView reloadDataFun];
- //
- // [self.midTableView reloadDataFun];
- // }
- // else if(uploadFileDataMod.curUploadStateType == uploadStateFail){
- // //[self.uploadFileRecordBodyV RefreshDataWithUploadingArr:_allDataArr[0] withDoneArr:nil withfailArr:_allDataArr[2]];
- //
- // [self.leftTableView reloadDataFun];
- //
- // [self.rightTableView reloadDataFun];
- // }
- // else{
- // //[self.uploadFileRecordBodyV RefreshDataWithUploadingArr:_allDataArr[0] withDoneArr:nil withfailArr:nil];
- //
- // [self.leftTableView reloadDataFun];
- //
- // }
- // }
- //
- }
- - (void)uploadFileDeteleFun:(NSNotification*)not
- {
- uploadFileDataModel *uploadFileDataMod = [not object];
- //HLog(@"%@",uploadFileDataMod);
-
- //UI和数据还没准备好
- if(!_leftTableView.outSideDataArr || _leftTableView.outSideDataArr.count !=3){
- dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
- [[NSNotificationCenter defaultCenter] postNotificationName:uploadFileDeteleNotification object:uploadFileDataMod];
- });
- return;
- }
- if([uploadFileDataMod isKindOfClass:[uploadFileDataModel class]] ){
- NSMutableArray *curArr = _leftTableView.outSideDataArr[0];
- NSInteger index = 0;
- for (uploadFileDataModel*mod in curArr) {
- HLog(@"bg_id:%@ ?=? %@",mod.bg_id,uploadFileDataMod.bg_id);
- if(mod.bg_id.integerValue == uploadFileDataMod.bg_id.integerValue){
- [curArr removeObject:mod];
- break;
- }
- index++;
- }
- //精准刷新
- //[self.uploadFileRecordBodyV RefreshDataWithUploadingArr:_allDataArr[0] withDoneArr:nil withfailArr:nil];
- [self.leftTableView reloadDataFun];
- }
-
- }
- #pragma mark 按钮点击
- - (void)didClickButFun:(UIButton*)but
- {
- NSInteger tag = but.tag;
- if(tag == 1){
- self.isEditType = NO;
- //self.uploadFileRecordBodyV.isEditType = NO;
-
- if(_selectIndex == 1){
- self.leftTableView.isEditType = NO;
- }
- else if(_selectIndex == 2){
- self.midTableView.isEditType = NO;
- }
- else if(_selectIndex == 3){
- //self.rightTableView.isEditType = NO;
- }
-
- }
- else{
- //self.uploadFileRecordBodyV.isSelectAllType = YES;
-
- if(_selectIndex == 1){
- self.leftTableView.isSelectAllType = YES;
- }
- else if(_selectIndex == 2){
- self.midTableView.isSelectAllType = YES;
- }
- else if(_selectIndex == 3){
- //self.rightTableView.isSelectAllType = YES;
- }
- }
- }
- -(void)setIsEditType:(BOOL)isEditType
- {
- _isEditType = isEditType;
-
- _leftButton.hidden = !isEditType;
- _rightButton.hidden = !isEditType;
- self.backBtn.hidden = isEditType;
-
- _uploadFileRecordEditBottomV.hidden = !isEditType;
- _uploadFileRecordheadV.userInteractionEnabled = !isEditType;
- _uploadFileRecordBgScorllV.scrollEnabled = !isEditType;
-
- //_leftHeadView.rightButton.userInteractionEnabled = !isEditType;
-
- if(_isEditType){
-
- CGFloat curHeight = SCREEN_H - CGRectGetMaxY(self.navBarBGView.frame) - 50 - 15 - (60 + safeArea);
- [_uploadFileRecordBgScorllV mas_remakeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(0);
- make.right.mas_equalTo(0);
- make.top.mas_equalTo(_uploadFileRecordheadV.mas_bottom).offset(0.0);
- make.bottom.mas_equalTo(_uploadFileRecordEditBottomV.mas_top);
- }];
-
- [_leftTableView mas_remakeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(SCREEN_W*0.0);
- make.width.mas_equalTo(SCREEN_W);
- make.top.mas_equalTo(0);
- make.height.mas_equalTo(curHeight);
- }];
-
- [_midTableView mas_remakeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(SCREEN_W*1.0);
- make.width.mas_equalTo(SCREEN_W);
- make.top.mas_equalTo(0);
- make.height.mas_equalTo(curHeight);
- }];
-
-
- [_rightTableView mas_remakeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(SCREEN_W*2.0);
- make.width.mas_equalTo(SCREEN_W);
- make.top.mas_equalTo(0);
- make.height.mas_equalTo(curHeight);
- }];
-
- }
- else{
- CGFloat curHeight = SCREEN_H - CGRectGetMaxY(self.navBarBGView.frame) - 50 - 15;
- [_uploadFileRecordBgScorllV mas_remakeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(0);
- make.right.mas_equalTo(0);
- make.top.mas_equalTo(_uploadFileRecordheadV.mas_bottom).offset(0.0);
- make.bottom.mas_equalTo(0);
- }];
-
- [_leftTableView mas_remakeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(SCREEN_W*0.0);
- make.width.mas_equalTo(SCREEN_W);
- make.top.mas_equalTo(0);
- make.height.mas_equalTo(curHeight);
- }];
-
- [_midTableView mas_remakeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(SCREEN_W*1.0);
- make.width.mas_equalTo(SCREEN_W);
- make.top.mas_equalTo(0);
- make.height.mas_equalTo(curHeight);
- }];
-
-
- [_rightTableView mas_remakeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(SCREEN_W*2.0);
- make.width.mas_equalTo(SCREEN_W);
- make.top.mas_equalTo(0);
- make.height.mas_equalTo(curHeight);
- }];
- }
- }
- #pragma mark 点击上传中的全部暂停
- - (void)didClickAllSuspendInLoadingFun
- {
- // _leftHeadView.rightButton.selected = !_leftHeadView.rightButton.selected;
-
- // if(_leftHeadView.rightButton.selected){
- // [[uploadFileManager shareInstance] suspendUploadFileFun:YES];
- // }
- // else{
- // NSMutableArray *leftArr = _leftTableView.curDataArr;
- // [[uploadFileManager shareInstance] reUploadFileFunBy:leftArr];
- // }
- }
- #pragma mark 点击上传成功的清空记录
- - (void)didClickClearRecordInDoneFun
- {
- /*弹窗提示二次确认*/
- KWeakSelf
- ComontAlretViewController *nextVC = [[ComontAlretViewController alloc] initWithTiTle:NSLocalizedString(@"File_upload_Record_clear_Tip_title",nil)
- msg:NSLocalizedString(@"File_upload_Record_clear_done_Tip_msg",nil)
- imageStr:nil
- cancelTitle:NSLocalizedString(@"other_cancel",nil)
- okTitle:NSLocalizedString(@"other_comment_ok",nil) isOkBtnHighlight:YES
- didClickOk:^{
- [weakSelf ClearAllRecordInDoneFun];
- } didClickCancel:^{
-
- }];
- nextVC.modalPresentationStyle = UIModalPresentationCustom;
-
- [self presentViewController:nextVC animated:YES completion:^{
- nextVC.view.superview.backgroundColor = [UIColor clearColor];
- }];
- }
- - (void)ClearAllRecordInDoneFun
- {
- // [[uploadFileManager shareInstance] deleteUploadFileRecordBy:_midTableView.curDataArr withDelCache:YES complete:^(BOOL isSuccess) {
- // HLog(@"isSuccess:%d",isSuccess);
- //
- // if(isSuccess){
- // [self->_midTableView.curDataArr removeAllObjects];
- // [self->_midTableView reloadDataFun];
- // }
- // }];
- }
- #pragma mark 点击上传失败的清空记录
- - (void)didClickClearRecordInFailFun
- {
- /*弹窗提示二次确认*/
- KWeakSelf
- ComontAlretViewController *nextVC = [[ComontAlretViewController alloc] initWithTiTle:NSLocalizedString(@"File_upload_Record_clear_Tip_title",nil)
- msg:NSLocalizedString(@"File_upload_Record_clear_fail_Tip_msg",nil)
- imageStr:nil
- cancelTitle:NSLocalizedString(@"other_cancel",nil)
- okTitle:NSLocalizedString(@"other_comment_ok",nil) isOkBtnHighlight:YES
- didClickOk:^{
- [weakSelf ClearAllRecordInFailFun];
- } didClickCancel:^{
-
- }];
- nextVC.modalPresentationStyle = UIModalPresentationCustom;
-
- [self presentViewController:nextVC animated:YES completion:^{
- nextVC.view.superview.backgroundColor = [UIColor clearColor];
- }];
- }
- - (void)ClearAllRecordInFailFun
- {
- // [[uploadFileManager shareInstance] deleteUploadFileRecordBy:_rightTableView.curDataArr withDelCache:YES complete:^(BOOL isSuccess) {
- // HLog(@"isSuccess:%d",isSuccess);
- //
- // if(isSuccess){
- // [self->_rightTableView.curDataArr removeAllObjects];
- // [self->_rightTableView reloadDataFun];
- // }
- // }];
- }
- #pragma mark 失败重传
- - (void)didClickReUploadFun:(uploadFileDataModel*)model{
-
- if(![model isKindOfClass:[uploadFileDataModel class]]){
- return;
- }
-
- // NSMutableArray *curArr = _leftTableView.curDataArr;
- //
- // BOOL isNeedToAdd = YES;
- //
- // for (uploadFileDataModel*mod in curArr) {
- // if(mod.bg_id.integerValue == model.bg_id.integerValue){
- // isNeedToAdd = NO;
- // break;
- // }
- // }
- //
- // if(isNeedToAdd){
- // [curArr addObject:model];
- // }
- //
- // [_leftTableView reloadDataFun];
- }
- //-(void)backBtnPressed{
- // [super backBtnPressed];
- //
- // _indexPathsForSelectedItems = nil;
- // _uploadFileRecordheadV = nil;
- // //_uploadFileRecordBodyV = nil;
- // //_allDataArr = nil;
- // _uploadFileRecordEditBottomV = nil;
- //
- //}
- - (void)backupsFileRefreshFun:(NSNotification*)not
- {
- photosBackupsTaskModel *photosBackupsTaskMod = [not object];
- //HLog(@"%@",uploadFileDataMod);
-
- photosBackupsTaskMod.curTimeInterval = [[NSDate date] timeIntervalSince1970];
- _rightTableView.photosBackupsIngTaskModel = photosBackupsTaskMod;
- }
- @end
|