|
@@ -911,31 +911,67 @@
|
|
|
|
|
|
- (void)handleClearCacheFunWith:(BOOL)isSelectFileTransfer
|
|
|
{
|
|
|
- [self ClearCommonCacheFun];
|
|
|
-
|
|
|
- if(isSelectFileTransfer){
|
|
|
- [self clearCacheByFileTransferFun];
|
|
|
- }
|
|
|
+ [self ClearCommonCacheFun:isSelectFileTransfer];
|
|
|
}
|
|
|
|
|
|
-- (void)ClearCommonCacheFun
|
|
|
+- (void)ClearCommonCacheFun:(BOOL)isSelectFileTransfer
|
|
|
{
|
|
|
NSString *ruiyunLogPath = [NSString stringWithFormat:@"%@/logs/debug_0.log",CachesPatch];
|
|
|
+ long logSize1 = [iTools fileSizeAtPath:ruiyunLogPath];
|
|
|
[[NSFileManager defaultManager] removeItemAtPath:ruiyunLogPath error:nil];
|
|
|
|
|
|
NSString *appLogPath = [NSString stringWithFormat:@"%@/logs/app.log",CachesPatch];
|
|
|
+ long logSize2 = [iTools fileSizeAtPath:appLogPath];
|
|
|
+
|
|
|
[[NSFileManager defaultManager] removeItemAtPath:appLogPath error:nil];
|
|
|
|
|
|
//
|
|
|
NSString *downLoadThumbnailPath = [NSString stringWithFormat:@"%@/DownLoadThumbnail",CachesPatch];
|
|
|
+ long logSize3 = [iTools folderSizeAtPath:downLoadThumbnailPath];
|
|
|
+
|
|
|
[[NSFileManager defaultManager] removeItemAtPath:downLoadThumbnailPath error:nil];
|
|
|
+
|
|
|
+ long clearTotal = logSize1 + logSize2 + logSize3;
|
|
|
+
|
|
|
+ if(isSelectFileTransfer){
|
|
|
+ [self clearCacheByFileTransferFun:clearTotal];
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ [self showClearAllTipBy:clearTotal];
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
-- (void)clearCacheByFileTransferFun
|
|
|
+- (void)showClearAllTipBy:(long)clearTotal
|
|
|
+{
|
|
|
+ long clearTotalK = clearTotal /1024;
|
|
|
+
|
|
|
+ NSString *tipStr1 = NSLocalizedString(@"my_set_no_clear_finish",nil);
|
|
|
+ NSString *tipStr2 = @"";
|
|
|
+
|
|
|
+ if(clearTotalK > 1024*1024){
|
|
|
+ tipStr2 = [[NSString alloc] initWithFormat:@"%.02fGB",clearTotalK/1024.0/1024.0];
|
|
|
+ }
|
|
|
+ else if(clearTotalK > 1024){
|
|
|
+ tipStr2 = [[NSString alloc] initWithFormat:@"%.02fMB",clearTotalK/1024.0];
|
|
|
+ }
|
|
|
+ else //if(clearTotalK > 0)
|
|
|
+ {
|
|
|
+ tipStr2 = [[NSString alloc] initWithFormat:@"%ldKB",clearTotalK];
|
|
|
+ }
|
|
|
+
|
|
|
+ NSString *tipfullStr = [[NSString alloc] initWithFormat:@"%@%@",tipStr1,tipStr2];
|
|
|
+ //提示语
|
|
|
+ [[iToast makeText:tipfullStr] show];
|
|
|
+}
|
|
|
+
|
|
|
+- (void)clearCacheByFileTransferFun:(long)clearTotal
|
|
|
{
|
|
|
//清理图片
|
|
|
BOOL needReUploadingType = NO;
|
|
|
NSString *ImagePath = [NSString stringWithFormat:@"%@/Image",CachesPatch];
|
|
|
+ long imageAllSize = [iTools folderSizeAtPath:ImagePath];
|
|
|
+
|
|
|
if([uploadFileManager shareInstance].curUploadFileDataModel
|
|
|
&& [uploadFileManager shareInstance].curUploadFileDataModel.curUploadFileType == uploadFileTypeImage
|
|
|
&& [uploadFileManager shareInstance].curUploadFileDataModel.curUploadStateType == uploadStateUploading){
|
|
@@ -954,6 +990,7 @@
|
|
|
|
|
|
//清理视频文件
|
|
|
NSString *videoPath = [NSString stringWithFormat:@"%@/Video",CachesPatch];
|
|
|
+ long vide0AllSizeBeforeClear = [iTools folderSizeAtPath:videoPath];
|
|
|
|
|
|
NSString *backupsingVideoName = nil;
|
|
|
if([backupsFileManager shareInstance].curPhotosBackupsTaskMod
|
|
@@ -989,9 +1026,12 @@
|
|
|
[[NSFileManager defaultManager] removeItemAtPath:videoPath error:nil];
|
|
|
}
|
|
|
|
|
|
+ long vide0AllSizeAfterClear = [iTools folderSizeAtPath:videoPath];
|
|
|
+
|
|
|
|
|
|
//清理下载中
|
|
|
NSString *downLoadingPath = [NSString stringWithFormat:@"%@/DownLoadFlie",CachesPatch];
|
|
|
+ long downLoadingSizeBeforeClear = [iTools folderSizeAtPath:downLoadingPath];
|
|
|
|
|
|
NSString *downLoadingFileName = nil;
|
|
|
if([downloadManager shareInstance].curDownloadFileModel
|
|
@@ -1005,6 +1045,9 @@
|
|
|
[[NSFileManager defaultManager] removeItemAtPath:downLoadingPath error:nil];
|
|
|
}
|
|
|
|
|
|
+ long downLoadingSizeAfterClear = [iTools folderSizeAtPath:downLoadingPath];
|
|
|
+
|
|
|
+
|
|
|
//清理数据库表 完成的
|
|
|
|
|
|
//下载完成
|
|
@@ -1023,8 +1066,9 @@
|
|
|
[uploadFileDataModel bg_deleteAsync:upLoadFile_image_tableName where:where2 complete:^(BOOL isSuccess) {
|
|
|
}];
|
|
|
|
|
|
- //提示语
|
|
|
- [[iToast makeText:NSLocalizedString(@"my_set_no_clear_finish",nil)] show];
|
|
|
+ long curTotolSize = (downLoadingSizeBeforeClear - downLoadingSizeAfterClear) + (vide0AllSizeBeforeClear - vide0AllSizeAfterClear) + imageAllSize + clearTotal;
|
|
|
+
|
|
|
+ [self showClearAllTipBy:curTotolSize];
|
|
|
}
|
|
|
|
|
|
- (BOOL)deleteFilesInDirectoryAtPath:(NSString *)path withOutFileName:(NSString*)fileNames {
|