瀏覽代碼

清除缓存时,停止下载

Steven 11 月之前
父節點
當前提交
22259bda39

+ 9 - 0
KulexiuForStudent/KulexiuForStudent/Common/Base/LoginManger/KSLoginManager.m

@@ -14,6 +14,7 @@
 #import <KSToolLibrary/UIDevice+TFDevice.h>
 #import "AppDelegate+AppService.h"
 
+#import "CoursewareDownloadManager.h"
 
 @implementation KSLoginManager
 
@@ -50,7 +51,15 @@
     [USER_MANAGER stopCountUMEvent];
 }
 
+- (void)closeDownload {
+    if (COURSEWARE_MANAGER.isDownloading) { // 如果在下载 取消
+        [COURSEWARE_MANAGER cancleDownloadCourseware];
+    }
+}
+
 - (void)logoutAction {
+    [self closeDownload];
+
     [[NSNotificationCenter defaultCenter] postNotificationName:@"refreshLiveClickStatus" object:nil];
     [self clearUMCount];
     [KSNetworkingManager clearRequestHeader];

+ 7 - 0
KulexiuForStudent/KulexiuForStudent/InstitutionModule/Mine/Controller/INSSettingViewController.m

@@ -22,6 +22,8 @@
 #import <KSToolLibrary/KSSmallChoosePicker.h>
 #import "CustomNavViewController.h"
 
+#import "CoursewareDownloadManager.h"
+
 @interface INSSettingViewController ()<RSKImageCropViewControllerDelegate>
 
 @property (nonatomic, strong) INSSettingBodyView *bodyView;
@@ -152,6 +154,11 @@
 }
 
 - (void)clearCache {
+    
+    if (COURSEWARE_MANAGER.isDownloading) { // 如果在下载 取消
+        [COURSEWARE_MANAGER cancleDownloadCourseware];
+    }
+    
     NSString *documentsPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject];
     NSString *bundlePath = [documentsPath stringByAppendingPathComponent:@"CoursewarePath"];
     NSFileManager *fileManager = [NSFileManager defaultManager];