|
@@ -16,14 +16,12 @@
|
|
|
#import "diskListTableView.h"
|
|
|
#import "downLoadPreViewCell.h"
|
|
|
#import "editTypeHeadView.h"
|
|
|
-#import "editTypeBottomView.h"
|
|
|
+#import "addAudioToPlayListBottomView.h"
|
|
|
#import "editShareView.h"
|
|
|
#import "previewToUploadFileView.h"
|
|
|
#import "netWorkManager.h"
|
|
|
#import "NASFileAudioModel.h"
|
|
|
-#import "queryShareModel.h"
|
|
|
-#import "audioPlayerViewController.h"
|
|
|
-#import "videoPlayByAVPlayerViewController.h"
|
|
|
+#import "audioPlayListManager.h"
|
|
|
|
|
|
@interface addAudioToPlayListViewController ()<UITableViewDelegate,UITableViewDataSource,DZNEmptyDataSetSource, DZNEmptyDataSetDelegate>
|
|
|
{
|
|
@@ -40,7 +38,7 @@
|
|
|
@property (nonatomic, copy) NSString *defaultDiskPath;
|
|
|
@property(nonatomic,assign) BOOL isEditType;
|
|
|
@property(nonatomic,strong) editTypeHeadView*curEditTypeHeadView;
|
|
|
-@property(nonatomic,strong) editTypeBottomView*curEditTypeBottomView;
|
|
|
+@property(nonatomic,strong) addAudioToPlayListBottomView*bottomView;
|
|
|
|
|
|
@property (nonatomic, strong) NSMutableArray*didSelectListArr;//选中的数据
|
|
|
@property (nonatomic, strong)NASFileAudioModel * curNASFileAudioMod;
|
|
@@ -94,28 +92,19 @@
|
|
|
};
|
|
|
|
|
|
|
|
|
- _curEditTypeBottomView = [[editTypeBottomView alloc] init];
|
|
|
- _curEditTypeBottomView.hidden = YES;
|
|
|
- [self.view addSubview:_curEditTypeBottomView];
|
|
|
+ _bottomView = [[addAudioToPlayListBottomView alloc] init];
|
|
|
+ [self.view addSubview:_bottomView];
|
|
|
|
|
|
- [_curEditTypeBottomView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ [_bottomView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
make.left.mas_equalTo(0);
|
|
|
make.right.mas_equalTo(0);
|
|
|
make.bottom.mas_equalTo(0);
|
|
|
- make.height.mas_equalTo(60 + AdaptTabHeight);
|
|
|
+ make.height.mas_equalTo(60 + safeArea);
|
|
|
}];
|
|
|
|
|
|
-#pragma mark 编辑状态的 下载 分享 删除 响应事件
|
|
|
- _curEditTypeBottomView.didClickButtonFun = ^(NSInteger tag) {
|
|
|
- if(tag==1){
|
|
|
- [weakSelf gotoDownLoadFileFun];
|
|
|
- }
|
|
|
- else if(tag==2){
|
|
|
- [weakSelf gotoShareViewFun];
|
|
|
- }
|
|
|
- else if(tag==3){
|
|
|
- [weakSelf showDeleteAlearViewFun];
|
|
|
- }
|
|
|
+#pragma mark 编辑状态的 添加播放列表 响应事件
|
|
|
+ _bottomView.didClickButtonFun = ^(NSInteger tag) {
|
|
|
+ [weakSelf addToAudioPlayListFun];
|
|
|
};
|
|
|
|
|
|
[self.view addSubview:self.tableView];
|
|
@@ -123,7 +112,7 @@
|
|
|
make.left.mas_equalTo(0);
|
|
|
make.right.mas_equalTo(0);
|
|
|
//make.bottom.mas_equalTo(-(safeArea));
|
|
|
- make.bottom.mas_equalTo(0);
|
|
|
+ make.bottom.mas_equalTo(_bottomView.mas_top);
|
|
|
make.top.equalTo(self.navBarBGView.mas_bottom).offset(10.f);
|
|
|
}];
|
|
|
|
|
@@ -354,14 +343,7 @@
|
|
|
//[self.tableView reloadData];
|
|
|
|
|
|
_curEditTypeHeadView.hidden = NO;
|
|
|
- _curEditTypeBottomView.hidden = NO;
|
|
|
|
|
|
- [self.tableView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.left.mas_equalTo(0);
|
|
|
- make.right.mas_equalTo(0);
|
|
|
- make.bottom.mas_equalTo(_curEditTypeBottomView.mas_top);
|
|
|
- make.top.equalTo(self.navBarBGView.mas_bottom).offset(10.f);
|
|
|
- }];
|
|
|
}
|
|
|
|
|
|
#pragma mark 用户取消编辑编辑
|
|
@@ -372,19 +354,12 @@
|
|
|
model.isSelectType = NO;
|
|
|
}
|
|
|
[_didSelectListArr removeAllObjects];
|
|
|
+ [_bottomView setButtonStateFunBy:NO];
|
|
|
|
|
|
_isEditType = NO;
|
|
|
[self.tableView reloadData];
|
|
|
|
|
|
_curEditTypeHeadView.hidden = YES;
|
|
|
- _curEditTypeBottomView.hidden = YES;
|
|
|
-
|
|
|
- [self.tableView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.left.mas_equalTo(0);
|
|
|
- make.right.mas_equalTo(0);
|
|
|
- make.bottom.mas_equalTo(0);
|
|
|
- make.top.equalTo(self.navBarBGView.mas_bottom).offset(10.f);
|
|
|
- }];
|
|
|
}
|
|
|
|
|
|
- (void)userCheckFilePreviewByRow:(NSInteger)row
|
|
@@ -438,46 +413,9 @@
|
|
|
else{
|
|
|
[self userCancelEditTypeFun];
|
|
|
}
|
|
|
-}
|
|
|
-
|
|
|
-#pragma mark 用户点击分享
|
|
|
-- (void)gotoShareViewFun
|
|
|
-{
|
|
|
- if (_didSelectListArr.count > 5) {
|
|
|
- [[iToast makeText:NSLocalizedString(@"share_max_count_tip2",nil)] show];
|
|
|
- return;
|
|
|
- }
|
|
|
|
|
|
- editShareView *editShareV = [[editShareView alloc] init];
|
|
|
- editShareV.didSelectListArr = _didSelectListArr;
|
|
|
- editShareV.shareFileType = @"4";
|
|
|
- [self.view addSubview:editShareV];
|
|
|
-
|
|
|
- [editShareV mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.left.mas_equalTo(0);
|
|
|
- make.right.mas_equalTo(0);
|
|
|
- make.bottom.mas_equalTo(0);
|
|
|
- make.top.mas_equalTo(0);
|
|
|
- }];
|
|
|
-}
|
|
|
-
|
|
|
-#pragma mark 用户点击上传文件
|
|
|
-- (void)userDidClickUploadViewFun
|
|
|
-{
|
|
|
- previewToUploadFileView *previewToUploadFileV = [[previewToUploadFileView alloc] init];
|
|
|
- [self.view addSubview:previewToUploadFileV];
|
|
|
-
|
|
|
- [previewToUploadFileV mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.left.mas_equalTo(0);
|
|
|
- make.right.mas_equalTo(0);
|
|
|
- make.bottom.mas_equalTo(0);
|
|
|
- make.top.mas_equalTo(0);
|
|
|
- }];
|
|
|
-
|
|
|
- KWeakSelf
|
|
|
- previewToUploadFileV.didClickButtonFun = ^(NSInteger tag) {
|
|
|
- [weakSelf gotoUploadFileFunWith:tag];
|
|
|
- };
|
|
|
+ BOOL canClick = _didSelectListArr.count >0 ? YES : NO;
|
|
|
+ [_bottomView setButtonStateFunBy:canClick];
|
|
|
}
|
|
|
|
|
|
#pragma mark 设置标题
|
|
@@ -601,9 +539,6 @@
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- (void)gotoDownloadloadFileRecordFun
|
|
|
{
|
|
|
uploadFileRecordViewController *vc = [uploadFileRecordViewController new];
|
|
@@ -684,104 +619,29 @@
|
|
|
}];
|
|
|
}
|
|
|
|
|
|
-#pragma mark 调整文件上传
|
|
|
-- (void)gotoUploadFileFunWith:(NSInteger)tag
|
|
|
+#pragma mark 添加播放列表 响应事件
|
|
|
+- (void)addToAudioPlayListFun
|
|
|
{
|
|
|
-
|
|
|
-}
|
|
|
-
|
|
|
-#pragma mark 文件下载
|
|
|
-- (void)gotoDownLoadFileFun
|
|
|
-{
|
|
|
- if(_didSelectListArr.count == 0){
|
|
|
- [[iToast makeText:@""] show];
|
|
|
+ if (_didSelectListArr.count == 0) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- NSMutableArray *arr = [NSMutableArray new];
|
|
|
- for (NASFilePicDataArrModel *dataModel in _didSelectListArr) {
|
|
|
-
|
|
|
- couldPhoneFileModel* fileModel = [couldPhoneFileModel new];
|
|
|
- fileModel.fileType = @"audio";
|
|
|
- fileModel.path = dataModel.path;
|
|
|
- fileModel.name = dataModel.name;
|
|
|
- fileModel.length = dataModel.size;
|
|
|
- fileModel.time = dataModel.duration;
|
|
|
-
|
|
|
- [arr addObject:fileModel];
|
|
|
+ for (NASFileAudioDataModel* dataModel in _didSelectListArr) {
|
|
|
+ lastFileModel *lastFileMod = [lastFileModel new];
|
|
|
+ lastFileMod.path = dataModel.path;
|
|
|
+ lastFileMod.name = dataModel.name;
|
|
|
+ lastFileMod.time = dataModel.time;
|
|
|
+ lastFileMod.size = dataModel.size;
|
|
|
+ lastFileMod.duration = dataModel.duration;
|
|
|
+ lastFileMod.type = @"audio";
|
|
|
+ lastFileMod.lastPreTime = [iTools getNowTimeStamp];
|
|
|
+ [[audioPlayListManager shareManager] saveFileInfoWith:lastFileMod with:dataModel.path];
|
|
|
}
|
|
|
|
|
|
- uploadFileRecordViewController *vc = [uploadFileRecordViewController new];
|
|
|
- [self.navigationController pushViewController:vc animated:YES];
|
|
|
- vc.isDownloadingType = YES;
|
|
|
- [vc gotoDownloadFile:arr];
|
|
|
-}
|
|
|
-
|
|
|
-#pragma mark 删除图片
|
|
|
-- (void)showDeleteAlearViewFun
|
|
|
-{
|
|
|
- NSString *titleStr = NSLocalizedString(@"delete_file_title_msg",nil);
|
|
|
- NSString *tipStr = NSLocalizedString(@"delete_file_tip_msg",nil);
|
|
|
-
|
|
|
- KWeakSelf
|
|
|
- ComontAlretViewController *curAlretVC= [[ComontAlretViewController alloc] initWithTiTle:titleStr
|
|
|
- msg:tipStr
|
|
|
- imageStr:nil
|
|
|
- cancelTitle:NSLocalizedString(@"other_cancel",nil)
|
|
|
- okTitle:NSLocalizedString(@"other_confirm",nil) isOkBtnHighlight:YES
|
|
|
- didClickOk:^{
|
|
|
-
|
|
|
- [weakSelf delFileListFun];
|
|
|
- } didClickCancel:^{
|
|
|
-
|
|
|
- }];
|
|
|
-
|
|
|
- curAlretVC.modalPresentationStyle = UIModalPresentationCustom;
|
|
|
-
|
|
|
- [self presentViewController:curAlretVC animated:YES completion:^{
|
|
|
- curAlretVC.view.superview.backgroundColor = [UIColor clearColor];
|
|
|
- }];
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
-#pragma mark 删除文件数据
|
|
|
-- (void)delFileListFun
|
|
|
-{
|
|
|
- NSMutableDictionary*paraDict = [NSMutableDictionary new];
|
|
|
-
|
|
|
- NSMutableArray *pathArr = [NSMutableArray new];
|
|
|
- for (NASFilePicDataArrModel *dataModel in _didSelectListArr) {
|
|
|
- [pathArr addObject:dataModel.path];
|
|
|
+ if(_didNeedToRegetAudioPlayListFun){
|
|
|
+ _didNeedToRegetAudioPlayListFun();
|
|
|
}
|
|
|
|
|
|
- [paraDict setValue:pathArr forKey:@"path"];
|
|
|
-
|
|
|
- [self showNewIndicatorWithCanBack:YES canTouch:NO];
|
|
|
-
|
|
|
- //NSString*code = [[NSString alloc] initWithFormat:@"delFile?path=%@",paraDict[@"path"]]; //delFile?path=[/storage/emulated/0/Download/IMG_6464.HEIC]
|
|
|
- KWeakSelf //@"delFile"
|
|
|
- [[netWorkManager shareInstance] cloudPhonePostCallBackCode:@"delFile" Parameters:paraDict success:^(id _Nonnull responseObject) {
|
|
|
- [weakSelf removeNewIndicator];
|
|
|
- SuperModel *model = [[SuperModel alloc] initWithDictionary:responseObject error:nil];
|
|
|
- if(model && model.status == 0){
|
|
|
- [[iToast makeText:NSLocalizedString(@"delete_file_suc_msg",nil)] show];
|
|
|
- [weakSelf didDeleteSucFun];
|
|
|
- }
|
|
|
- else{
|
|
|
-
|
|
|
- }
|
|
|
- } failure:^(NSError * _Nonnull error) {
|
|
|
- [weakSelf removeNewIndicator];
|
|
|
- }];
|
|
|
+ [self.navigationController popViewControllerAnimated:YES];
|
|
|
}
|
|
|
-
|
|
|
-#pragma mark 删除成功
|
|
|
-- (void)didDeleteSucFun
|
|
|
-{
|
|
|
- [_didSelectListArr removeAllObjects];
|
|
|
- [self setEditTypeTitleFun];
|
|
|
-
|
|
|
- [self getFileListFun];
|
|
|
-}
|
|
|
-
|
|
|
@end
|