Procházet zdrojové kódy

清除缓存会同时清理下载的曲目

Steven před 1 rokem
rodič
revize
2c75c00d09

+ 5 - 3
KulexiuForTeacher/KulexiuForTeacher/Common/Base/AccompanyWebView/KSAccompanyWebViewController.m

@@ -685,10 +685,12 @@
                         MJWeakSelf;
                         NSInteger micDelay = [UserDefaultObjectForKey(@"micDelay") integerValue];
                         NSInteger defaultDelay = self.offsetTime + micDelay;
-                        [mergeView configWithVideoUrl:self.videoRecordManager.videoFileURL bgAudioUrl:self.bgAudioUrl remoteBgUrl:self.accompanyUrl  recordUrl:self.recordUrl offsetTime:defaultDelay mergeCallback:^{
+                        [mergeView configWithVideoUrl:self.videoRecordManager.videoFileURL bgAudioUrl:self.bgAudioUrl remoteBgUrl:self.accompanyUrl  recordUrl:self.recordUrl offsetTime:defaultDelay mergeCallback:^(BOOL isPublished) {
                             [weakSelf appEnterForeground];
-                            [weakSelf musicPublishCallBack:content];
-                        }];
+                            if (isPublished) {
+                                [weakSelf musicPublishCallBack:content];
+                            }
+                        }]; 
                     }
                     else {
                         [LOADING_MANAGER MBShowAUTOHidingInWindow:@"麦克风被占用"];

+ 4 - 2
KulexiuForTeacher/KulexiuForTeacher/Common/Base/AccompanyWebView/KSCloudWebManager.m

@@ -167,8 +167,10 @@
     NSURL *recordUrl = [parm valueForKey:@"recordUrl"];
     NSString *accompanyUrl = [parm ks_stringValueForKey:@"remoteBgUrl"];
     
-    [mergeView configWithVideoUrl:videoUrl bgAudioUrl:bgAudioUrl remoteBgUrl:accompanyUrl  recordUrl:recordUrl offsetTime:defaultDelay mergeCallback:^{
-        [weakSelf callBackMergeSuccess:controller];
+    [mergeView configWithVideoUrl:videoUrl bgAudioUrl:bgAudioUrl remoteBgUrl:accompanyUrl  recordUrl:recordUrl offsetTime:defaultDelay mergeCallback:^(BOOL isPublished) {
+        if (isPublished) {
+            [weakSelf callBackMergeSuccess:controller];
+        }
     }];
 }
 

+ 1 - 1
KulexiuForTeacher/KulexiuForTeacher/Common/MediaMerge/AudioMerge/KSMediaMergeView.h

@@ -7,7 +7,7 @@
 
 #import <UIKit/UIKit.h>
 
-typedef void(^MergeCallback)(void);
+typedef void(^MergeCallback)(BOOL isPublished);
 typedef void(^DraftEditCallback)(void);
 
 NS_ASSUME_NONNULL_BEGIN

+ 2 - 2
KulexiuForTeacher/KulexiuForTeacher/Common/MediaMerge/AudioMerge/KSMediaMergeView.m

@@ -881,8 +881,8 @@
     if (self.draftCallback) {
         self.draftCallback();
     }
-    if (needTips && self.mergeCallback) {
-        self.mergeCallback();
+    if (self.mergeCallback) {
+        self.mergeCallback(needTips);
     }
 }
 

+ 18 - 8
KulexiuForTeacher/KulexiuForTeacher/Module/Mine/Setting/Controller/SettingViewController.m

@@ -78,7 +78,6 @@
     }];
 }
 
-
 - (void)operationAction:(SETTINGACTION)type {
     switch (type) {
         case SETTINGACTION_ADDRESS:
@@ -146,24 +145,35 @@
 }
 
 
-//
-
 - (void)clearCache {
+    [VoNetworking clearDownloadData];
     if (COURSEWARE_MANAGER.isDownloading) { // 如果在下载 取消
         [COURSEWARE_MANAGER cancleDownloadCourseware];
     }
-    
     NSString *documentsPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject];
     NSString *bundlePath = [documentsPath stringByAppendingPathComponent:@"CoursewarePath"];
     NSFileManager *fileManager = [NSFileManager defaultManager];
     BOOL isExist = [fileManager fileExistsAtPath:bundlePath];
+    BOOL isSuccessClearCourseware = NO;
     if (isExist) {
-        BOOL isSuccess =  [fileManager removeItemAtPath:bundlePath error:nil];
-        if (isSuccess) {
-            [LOADING_MANAGER MBShowAUTOHidingInWindow:@"清理完成"];
-        }
+        isSuccessClearCourseware = [fileManager removeItemAtPath:bundlePath error:nil];
     }
     else {
+        isSuccessClearCourseware = YES;
+        
+    }
+    
+    NSString *accompanyCachePath = [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) firstObject];
+    NSString *accompanyFilePath= [accompanyCachePath stringByAppendingPathComponent:@"AccompanySong"];
+    BOOL isAccompanySongExist = [fileManager fileExistsAtPath:accompanyFilePath];
+    BOOL isSuccessClearAccompany = NO;
+    if (isAccompanySongExist) {
+        isSuccessClearAccompany = [fileManager removeItemAtPath:accompanyFilePath error:nil];
+    }
+    else {
+        isSuccessClearAccompany = YES;
+    }
+    if (isSuccessClearCourseware && isSuccessClearAccompany) {
         [LOADING_MANAGER MBShowAUTOHidingInWindow:@"清理完成"];
     }
 }