Browse Source

清理缓存同时清理云教练曲目

Steven 9 months ago
parent
commit
e6d1d14167

+ 4 - 2
KulexiuForStudent/KulexiuForStudent/Common/Base/AccompanyWebView/KSAccompanyWebViewController.m

@@ -687,9 +687,11 @@
                         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 {

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

@@ -170,8 +170,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
KulexiuForStudent/KulexiuForStudent/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
KulexiuForStudent/KulexiuForStudent/Common/MediaMerge/AudioMerge/KSMediaMergeView.m

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

+ 18 - 4
KulexiuForStudent/KulexiuForStudent/InstitutionModule/Mine/Controller/INSSettingViewController.m

@@ -154,6 +154,7 @@
 }
 
 - (void)clearCache {
+    [VoNetworking clearDownloadData];
     
     if (COURSEWARE_MANAGER.isDownloading) { // 如果在下载 取消
         [COURSEWARE_MANAGER cancleDownloadCourseware];
@@ -163,13 +164,26 @@
     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:@"清理完成"];
     }
 }

+ 39 - 0
KulexiuForStudent/KulexiuForStudent/Module/Mine/Setting/Controller/SettingViewController.m

@@ -113,11 +113,50 @@
             [self toDelteAccountView];
         }
             break;
+        case SETTINGACTION_CLEARCACHE:
+        {
+            [self clearCache];
+        }
+            break;
         default:
             break;
     }
 }
 
+- (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) {
+        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:@"清理完成"];
+    }
+}
+
 - (void)toDelteAccountView {
     AccountDeleteViewController *detailView = [[AccountDeleteViewController alloc] init];
     [self.navigationController pushViewController:detailView animated:YES];

+ 1 - 0
KulexiuForStudent/KulexiuForStudent/Module/Mine/Setting/View/SettingBodyView.h

@@ -15,6 +15,7 @@ typedef NS_ENUM(NSInteger, SETTINGACTION) {
     SETTINGACTION_ABOUTUS,  // 关于我们
     SETTINGACTION_LOGOUT,   // 退出
     SETTINGACTION_DELETEACCOUNT,  // 注销账号
+    SETTINGACTION_CLEARCACHE,   // 清除缓存
 };
 
 typedef void(^SettingCallback)(SETTINGACTION type);

+ 59 - 8
KulexiuForStudent/KulexiuForStudent/Module/Mine/Setting/View/SettingBodyView.xib

@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="20037" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="32700.99.1234" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
     <device id="retina6_1" orientation="portrait" appearance="light"/>
     <dependencies>
         <deployment identifier="iOS"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="20020"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22684"/>
         <capability name="System colors in document resources" minToolsVersion="11.0"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
@@ -15,7 +15,7 @@
             <autoresizingMask key="autoresizingMask"/>
             <subviews>
                 <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="bvI-vo-wNV">
-                    <rect key="frame" x="14" y="15" width="386" height="208"/>
+                    <rect key="frame" x="14" y="15" width="386" height="258"/>
                     <subviews>
                         <view tag="1001" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="66O-io-Yxa">
                             <rect key="frame" x="0.0" y="0.0" width="386" height="50"/>
@@ -168,7 +168,7 @@
                                 </label>
                                 <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="4CA-GT-YfE">
                                     <rect key="frame" x="11" y="49" width="366" height="1"/>
-                                    <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                    <color key="backgroundColor" red="0.94901960784313721" green="0.94901960784313721" blue="0.94901960784313721" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                     <constraints>
                                         <constraint firstAttribute="height" constant="1" id="djO-bz-hIy"/>
                                     </constraints>
@@ -181,7 +181,7 @@
                                     </constraints>
                                 </imageView>
                             </subviews>
-                            <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                            <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                             <gestureRecognizers/>
                             <constraints>
                                 <constraint firstAttribute="trailing" secondItem="5jx-H8-TZm" secondAttribute="trailing" constant="15" id="5pe-vR-hxw"/>
@@ -197,14 +197,60 @@
                                 <outletCollection property="gestureRecognizers" destination="yC5-gy-NpL" appends="YES" id="Hte-vz-kAR"/>
                             </connections>
                         </view>
+                        <view tag="1008" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="r68-dU-wRS">
+                            <rect key="frame" x="0.0" y="200" width="386" height="50"/>
+                            <subviews>
+                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="清除缓存" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="91s-68-MTY">
+                                    <rect key="frame" x="12" y="15" width="75" height="20"/>
+                                    <constraints>
+                                        <constraint firstAttribute="width" constant="75" id="HB5-ep-WR1"/>
+                                    </constraints>
+                                    <fontDescription key="fontDescription" type="system" pointSize="16"/>
+                                    <color key="textColor" red="0.1019607843" green="0.1019607843" blue="0.1019607843" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                    <nil key="highlightedColor"/>
+                                </label>
+                                <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="setting_next" translatesAutoresizingMaskIntoConstraints="NO" id="52p-ku-co2">
+                                    <rect key="frame" x="365" y="19.5" width="6" height="11"/>
+                                    <constraints>
+                                        <constraint firstAttribute="width" constant="6" id="HUB-Tw-zmX"/>
+                                        <constraint firstAttribute="height" constant="11" id="OQc-bu-5lF"/>
+                                    </constraints>
+                                </imageView>
+                                <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="OCO-WN-1gT">
+                                    <rect key="frame" x="11" y="49" width="366" height="1"/>
+                                    <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                    <constraints>
+                                        <constraint firstAttribute="height" constant="1" id="XjE-49-xLu"/>
+                                    </constraints>
+                                </view>
+                            </subviews>
+                            <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                            <gestureRecognizers/>
+                            <constraints>
+                                <constraint firstAttribute="trailing" secondItem="OCO-WN-1gT" secondAttribute="trailing" constant="9" id="JCE-pb-4l7"/>
+                                <constraint firstItem="OCO-WN-1gT" firstAttribute="leading" secondItem="r68-dU-wRS" secondAttribute="leading" constant="11" id="PnE-Y3-yvq"/>
+                                <constraint firstItem="91s-68-MTY" firstAttribute="centerY" secondItem="r68-dU-wRS" secondAttribute="centerY" id="QuR-Wy-igr"/>
+                                <constraint firstAttribute="trailing" secondItem="52p-ku-co2" secondAttribute="trailing" constant="15" id="R3W-Po-0v9"/>
+                                <constraint firstItem="52p-ku-co2" firstAttribute="centerY" secondItem="r68-dU-wRS" secondAttribute="centerY" id="Z9t-Ba-bDf"/>
+                                <constraint firstAttribute="height" constant="50" id="dTq-pA-pip"/>
+                                <constraint firstItem="91s-68-MTY" firstAttribute="leading" secondItem="r68-dU-wRS" secondAttribute="leading" constant="12" id="igK-un-ebU"/>
+                                <constraint firstAttribute="bottom" secondItem="OCO-WN-1gT" secondAttribute="bottom" id="vLE-b5-qxm"/>
+                            </constraints>
+                            <connections>
+                                <outletCollection property="gestureRecognizers" destination="FEP-aA-vC5" appends="YES" id="dhx-AY-adq"/>
+                            </connections>
+                        </view>
                     </subviews>
                     <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                     <constraints>
+                        <constraint firstItem="r68-dU-wRS" firstAttribute="top" secondItem="fae-Ws-ND6" secondAttribute="bottom" id="4uc-iV-BI8"/>
+                        <constraint firstAttribute="bottom" secondItem="r68-dU-wRS" secondAttribute="bottom" constant="8" id="AOl-Ls-iyp"/>
                         <constraint firstAttribute="trailing" secondItem="66O-io-Yxa" secondAttribute="trailing" id="Bu8-cb-AIo"/>
                         <constraint firstItem="IrL-hq-2eU" firstAttribute="leading" secondItem="bvI-vo-wNV" secondAttribute="leading" id="CLc-rU-xPU"/>
+                        <constraint firstAttribute="trailing" secondItem="r68-dU-wRS" secondAttribute="trailing" id="Da3-9z-SyF"/>
                         <constraint firstItem="66O-io-Yxa" firstAttribute="leading" secondItem="bvI-vo-wNV" secondAttribute="leading" id="Hkj-Fz-5iB"/>
                         <constraint firstAttribute="trailing" secondItem="fae-Ws-ND6" secondAttribute="trailing" id="PHZ-JF-g1b"/>
-                        <constraint firstAttribute="bottom" secondItem="fae-Ws-ND6" secondAttribute="bottom" constant="8" id="QlX-Q3-vpm"/>
+                        <constraint firstItem="r68-dU-wRS" firstAttribute="leading" secondItem="bvI-vo-wNV" secondAttribute="leading" id="PxT-Ae-6fp"/>
                         <constraint firstItem="IrL-hq-2eU" firstAttribute="top" secondItem="66O-io-Yxa" secondAttribute="bottom" id="SAO-fg-84E"/>
                         <constraint firstAttribute="trailing" secondItem="IrL-hq-2eU" secondAttribute="trailing" id="WW8-th-rjC"/>
                         <constraint firstItem="fae-Ws-ND6" firstAttribute="top" secondItem="l7Z-Gj-hWL" secondAttribute="bottom" id="Y4d-cQ-Sjc"/>
@@ -241,7 +287,7 @@
                     </connections>
                 </button>
                 <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="E2i-As-HC7">
-                    <rect key="frame" x="14" y="235" width="386" height="50"/>
+                    <rect key="frame" x="14" y="285" width="386" height="50"/>
                     <subviews>
                         <view tag="1007" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="AEo-Tn-nDU">
                             <rect key="frame" x="0.0" y="0.0" width="386" height="50"/>
@@ -310,8 +356,8 @@
                 <constraint firstItem="bvI-vo-wNV" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" constant="15" id="QbZ-et-vlc"/>
                 <constraint firstAttribute="trailing" secondItem="E2i-As-HC7" secondAttribute="trailing" constant="14" id="WFI-BB-PFC"/>
                 <constraint firstAttribute="bottom" secondItem="6YJ-Ux-PMN" secondAttribute="bottom" constant="20" id="ee5-re-JQh"/>
-                <constraint firstItem="E2i-As-HC7" firstAttribute="top" secondItem="bvI-vo-wNV" secondAttribute="bottom" constant="12" id="fZw-1P-uis"/>
                 <constraint firstItem="6YJ-Ux-PMN" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="14" id="tjy-fb-nU4"/>
+                <constraint firstItem="E2i-As-HC7" firstAttribute="top" secondItem="bvI-vo-wNV" secondAttribute="bottom" constant="12" id="y6I-Jk-4fT"/>
             </constraints>
             <nil key="simulatedTopBarMetrics"/>
             <nil key="simulatedBottomBarMetrics"/>
@@ -347,6 +393,11 @@
                 <action selector="tapAction:" destination="iN0-l3-epB" id="269-6d-3Zd"/>
             </connections>
         </tapGestureRecognizer>
+        <tapGestureRecognizer id="FEP-aA-vC5">
+            <connections>
+                <action selector="tapAction:" destination="iN0-l3-epB" id="Lxl-u2-IAU"/>
+            </connections>
+        </tapGestureRecognizer>
     </objects>
     <resources>
         <image name="setting_next" width="6" height="11"/>