|
@@ -130,6 +130,11 @@
|
|
|
|
|
|
|
|
- (void)handleDownloadDoneFun
|
|
- (void)handleDownloadDoneFun
|
|
|
{
|
|
{
|
|
|
|
|
+ if(self.nasFullPath && self.nasFullPath.length >0){
|
|
|
|
|
+ HLog(@"前面一个保存流程没走完")
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
NSString *fileName = [self.curDownloadFileModel getFileNameFun];
|
|
NSString *fileName = [self.curDownloadFileModel getFileNameFun];
|
|
|
NSString*pathStr = [cachesFileManager getFilePathWithName:fileName type:DownLoadFileType];
|
|
NSString*pathStr = [cachesFileManager getFilePathWithName:fileName type:DownLoadFileType];
|
|
|
|
|
|
|
@@ -224,11 +229,25 @@
|
|
|
NSString *fileName = [self.curDownloadFileModel getFileNameFun];
|
|
NSString *fileName = [self.curDownloadFileModel getFileNameFun];
|
|
|
NSString*filePath = [cachesFileManager getFilePathWithName:fileName type:DownLoadFileType];
|
|
NSString*filePath = [cachesFileManager getFilePathWithName:fileName type:DownLoadFileType];
|
|
|
|
|
|
|
|
|
|
+ [self saveDownDoneFileToPhoneFunBy:filePath withKey:self.curDownloadFileModel.path];
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+#pragma mark 处理保存操作
|
|
|
|
|
+- (void)saveDownDoneFileToPhoneFunBy:(NSString*)filePath withKey:(NSString *)key{
|
|
|
|
|
+
|
|
|
|
|
+ if (self.isShowingFileDocumentPickerType) {
|
|
|
|
|
+ HLog(@"上一个任务保存到问题---没保存完");
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
if (![[NSFileManager defaultManager] fileExistsAtPath:filePath]){
|
|
if (![[NSFileManager defaultManager] fileExistsAtPath:filePath]){
|
|
|
- HLog(@"没有找到文件:%@",fileName);
|
|
|
|
|
|
|
+ HLog(@"没有找到文件:%@",filePath);
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ self.wsDownloadSaveFilePath = filePath;
|
|
|
|
|
+ self.wsDownloadDonwPlishPath = key;
|
|
|
|
|
+
|
|
|
NSURL * fileURL = [NSURL fileURLWithPath:filePath];
|
|
NSURL * fileURL = [NSURL fileURLWithPath:filePath];
|
|
|
UIDocumentPickerViewController *documentPickerVC = [[UIDocumentPickerViewController alloc] initWithURL:fileURL inMode:UIDocumentPickerModeExportToService];
|
|
UIDocumentPickerViewController *documentPickerVC = [[UIDocumentPickerViewController alloc] initWithURL:fileURL inMode:UIDocumentPickerModeExportToService];
|
|
|
// 设置代理
|
|
// 设置代理
|
|
@@ -237,6 +256,8 @@
|
|
|
documentPickerVC.modalPresentationStyle = UIModalPresentationFormSheet;
|
|
documentPickerVC.modalPresentationStyle = UIModalPresentationFormSheet;
|
|
|
//[self.navigationController presentViewController:documentPickerVC animated:YES completion:nil];
|
|
//[self.navigationController presentViewController:documentPickerVC animated:YES completion:nil];
|
|
|
[ksharedAppDelegate.window.rootViewController presentViewController:documentPickerVC animated:YES completion:nil];
|
|
[ksharedAppDelegate.window.rootViewController presentViewController:documentPickerVC animated:YES completion:nil];
|
|
|
|
|
+
|
|
|
|
|
+ self.isShowingFileDocumentPickerType = YES;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -262,11 +283,23 @@
|
|
|
[self checkSaveNasFileAgainFun];
|
|
[self checkSaveNasFileAgainFun];
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
+ else{
|
|
|
|
|
+ self.wsDownloadSaveFilePath = nil;
|
|
|
|
|
+ self.wsDownloadDonwPlishPath = nil;
|
|
|
|
|
+ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(20 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|
|
|
|
+ [self checkSaveWebsocketFileAgainFun];
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
} else {
|
|
} else {
|
|
|
NSLog(@"222 fileName : %@", fileName);
|
|
NSLog(@"222 fileName : %@", fileName);
|
|
|
if(!self.nasFullPath){
|
|
if(!self.nasFullPath){
|
|
|
// websock下载流程
|
|
// websock下载流程
|
|
|
- [cachesFileManager removeItemAtPath:fileName type:DownLoadFileType error:nil];
|
|
|
|
|
|
|
+ [[NSFileManager defaultManager] removeItemAtPath:self.wsDownloadSaveFilePath error:nil];
|
|
|
|
|
+ //[cachesFileManager removeItemAtPath:fileName type:DownLoadFileType error:nil];
|
|
|
|
|
+ [[downloadManager shareInstance] deleteDownloadDonePlistInfoBy:self.wsDownloadDonwPlishPath];
|
|
|
|
|
+ self.wsDownloadSaveFilePath = nil;
|
|
|
|
|
+ self.wsDownloadDonwPlishPath = nil;
|
|
|
|
|
+ [self checkSaveWebsocketFileAgainFun];
|
|
|
}
|
|
}
|
|
|
else{
|
|
else{
|
|
|
//nas下载流程
|
|
//nas下载流程
|
|
@@ -277,6 +310,8 @@
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ self.isShowingFileDocumentPickerType = NO;
|
|
|
}];
|
|
}];
|
|
|
[urls.firstObject stopAccessingSecurityScopedResource];
|
|
[urls.firstObject stopAccessingSecurityScopedResource];
|
|
|
} else {
|
|
} else {
|
|
@@ -287,6 +322,15 @@
|
|
|
[self checkSaveNasFileAgainFun];
|
|
[self checkSaveNasFileAgainFun];
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
+ else{
|
|
|
|
|
+ self.wsDownloadSaveFilePath = nil;
|
|
|
|
|
+ self.wsDownloadDonwPlishPath = nil;
|
|
|
|
|
+ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(20 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|
|
|
|
+ [self checkSaveWebsocketFileAgainFun];
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ self.isShowingFileDocumentPickerType = NO;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -295,4 +339,11 @@
|
|
|
{
|
|
{
|
|
|
[[boxDownloadFileManager shareInstance] checkDownloadDonePlistInfoFun];
|
|
[[boxDownloadFileManager shareInstance] checkDownloadDonePlistInfoFun];
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+#pragma mark 再次读取ws下载完成数据做保存操作
|
|
|
|
|
+- (void)checkSaveWebsocketFileAgainFun
|
|
|
|
|
+{
|
|
|
|
|
+ [[downloadManager shareInstance] checkDownloadDonePlistInfoFun];
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
@end
|
|
@end
|