Steven 1 year ago
parent
commit
e2a831e0a6

+ 5 - 5
KulexiuForStudent/KulexiuForStudent.xcodeproj/project.pbxproj

@@ -7691,7 +7691,7 @@
 				CLANG_ENABLE_MODULES = YES;
 				CODE_SIGN_ENTITLEMENTS = KulexiuForStudent/KulexiuForStudent.entitlements;
 				CODE_SIGN_STYLE = Automatic;
-				CURRENT_PROJECT_VERSION = 1.4.4;
+				CURRENT_PROJECT_VERSION = 1.4.6;
 				DEVELOPMENT_TEAM = B2AP53HHTU;
 				ENABLE_BITCODE = NO;
 				FRAMEWORK_SEARCH_PATHS = (
@@ -7747,7 +7747,7 @@
 					"$(PROJECT_DIR)/KulexiuForStudent/Common/ThirdPart/UMSocialSDK/share/share_ios_6.10.5/SocialLibraries/Sina/SinaSDK",
 					"$(PROJECT_DIR)/KulexiuForStudent/Common/ThirdPart/UMSocialSDK/share/share_ios_6.10.5/UMSocialSDKPlugin",
 				);
-				MARKETING_VERSION = 1.4.4;
+				MARKETING_VERSION = 1.4.6;
 				PRODUCT_BUNDLE_IDENTIFIER = com.Colexiu.KulexiuForStudent;
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				SWIFT_EMIT_LOC_STRINGS = YES;
@@ -7768,7 +7768,7 @@
 				CLANG_ENABLE_MODULES = YES;
 				CODE_SIGN_ENTITLEMENTS = KulexiuForStudent/KulexiuForStudent.entitlements;
 				CODE_SIGN_STYLE = Automatic;
-				CURRENT_PROJECT_VERSION = 1.4.4;
+				CURRENT_PROJECT_VERSION = 1.4.6;
 				DEVELOPMENT_TEAM = B2AP53HHTU;
 				ENABLE_BITCODE = NO;
 				FRAMEWORK_SEARCH_PATHS = (
@@ -7824,7 +7824,7 @@
 					"$(PROJECT_DIR)/KulexiuForStudent/Common/ThirdPart/UMSocialSDK/share/share_ios_6.10.5/SocialLibraries/Sina/SinaSDK",
 					"$(PROJECT_DIR)/KulexiuForStudent/Common/ThirdPart/UMSocialSDK/share/share_ios_6.10.5/UMSocialSDKPlugin",
 				);
-				MARKETING_VERSION = 1.4.4;
+				MARKETING_VERSION = 1.4.6;
 				PRODUCT_BUNDLE_IDENTIFIER = com.Colexiu.KulexiuForStudent;
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				SWIFT_EMIT_LOC_STRINGS = YES;
@@ -7843,7 +7843,7 @@
 				BUNDLE_LOADER = "$(TEST_HOST)";
 				CODE_SIGN_STYLE = Automatic;
 				CURRENT_PROJECT_VERSION = 1;
-				DEVELOPMENT_TEAM = P664H7S5LL;
+				DEVELOPMENT_TEAM = B2AP53HHTU;
 				GENERATE_INFOPLIST_FILE = YES;
 				IPHONEOS_DEPLOYMENT_TARGET = 15.2;
 				MARKETING_VERSION = 1.0;

+ 2 - 0
KulexiuForStudent/KulexiuForStudent/AppDelegate.m

@@ -484,6 +484,8 @@ didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
             [USER_MANAGER checkTokenEnableConnectRongCloud];
         }
     }
+    // 退到后台发送消息
+    [[NSNotificationCenter defaultCenter] postNotificationName:@"appEnterForeground" object:nil];
 }
 
 

+ 22 - 0
KulexiuForStudent/KulexiuForStudent/Assets.xcassets/cancleButton.imageset/Contents.json

@@ -0,0 +1,22 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "scale" : "1x"
+    },
+    {
+      "filename" : "cancleButton@2x.png",
+      "idiom" : "universal",
+      "scale" : "2x"
+    },
+    {
+      "filename" : "cancleButton@3x.png",
+      "idiom" : "universal",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

BIN
KulexiuForStudent/KulexiuForStudent/Assets.xcassets/cancleButton.imageset/cancleButton@2x.png


BIN
KulexiuForStudent/KulexiuForStudent/Assets.xcassets/cancleButton.imageset/cancleButton@3x.png


+ 17 - 6
KulexiuForStudent/KulexiuForStudent/Common/Base/KSAccompanyWebViewController.m

@@ -116,6 +116,7 @@
     // Do any additional setup after loading the view.
     [self configAudioSession];
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(appEnterBackground) name:@"appEnterBackground" object:nil];
+    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(appEnterForeground) name:@"appEnterForeground" object:nil];
 }
 
 - (void)connectSocketService {
@@ -193,6 +194,14 @@
     [self handerAudioInterruption];
 }
 
+- (void)appEnterForeground {
+    if (self.isCameraOpen) {
+        if ([self.videoRecordManager getSessionStatusisActive] == NO) {
+            [self.videoRecordManager configSessiondisplayInView:self.viewContainer];
+        }
+    }
+}
+
 - (void)initWebView {
     [self.view addSubview:self.navView];
     CGFloat topHeight = kNaviBarHeight;
@@ -315,6 +324,7 @@
       didReceiveScriptMessage:(WKScriptMessage *)message {
     if ([message.name isEqualToString:@"COLEXIU"]) {
         NSDictionary *parm = [self convertJsonStringToNSDictionary:message.body];
+        NSLog(@"---- receive parm %@", [parm mj_JSONString]);
         // 回到主线程
         dispatch_async(dispatch_get_main_queue(), ^{
              if ([[parm stringValueForKey:@"api"] isEqualToString:@"startEvaluating"]) { // 开始评测
@@ -441,18 +451,19 @@
                 NSMutableDictionary *sendParm = [NSMutableDictionary dictionaryWithDictionary:parm];
                 NSMutableDictionary *contentParm = [NSMutableDictionary dictionaryWithDictionary:[sendParm dictionaryValueForKey:@"content"]];
                 if (self.videoRecordManager) {
+                    MJWeakSelf;
                     [self.videoRecordManager uploadRecordVideoSuccess:^(NSString * _Nonnull videoUrl) {
                         [contentParm setValue:@"success" forKey:@"type"];
                         [contentParm setValue:videoUrl forKey:@"filePath"];
                         [contentParm setValue:@"上传成功" forKey:@"message"];
                         [sendParm setValue:contentParm forKey:@"content"];
                         
-                        [self postMessage:sendParm];
+                        [weakSelf postMessage:sendParm];
                     } failure:^(NSString * _Nonnull desc) {
                         [contentParm setValue:@"error" forKey:@"type"];
                         [contentParm setValue:desc forKey:@"message"];
                         [sendParm setValue:contentParm forKey:@"content"];
-                        [self postMessage:sendParm];
+                        [weakSelf postMessage:sendParm];
                     }];
                 }
             }
@@ -719,7 +730,7 @@
         }
         
     } faliure:^(NSError * _Nonnull error) {
-        faliure();
+//        faliure();
     }];
 }
 
@@ -877,7 +888,7 @@
 }
 
 #pragma mark-------- KSAQRecordManagerDelegate
-- (void)audioRecordInterruption {
+- (void)recordInterruption {
     NSDictionary *postParm = @{@"api" : @"cancelEvaluating",
                                @"content" : @{@"reson":@"录制错误,请重试"}
     };
@@ -911,6 +922,7 @@
         default:
             break;
     }
+    
     NSDictionary *postParm = @{@"api" : @"listenerWiredStatus",
                                @"content" : @{@"type":valueStr,
                                               @"checkIsWired":[NSNumber numberWithBool:checkIsWired]
@@ -960,7 +972,7 @@
         NSString *startString = [self configDataCommond:checkStartMessage body:nil type:@"PITCH_DETECTION"];
         [self sendDataToSocketService:startString];
     }
-        NSLog(@"--------- send audio data length %d", length);
+//        NSLog(@"--------- send audio data length %d", length);
     [self sendDataToSocketService:pushData];
 }
 
@@ -1028,7 +1040,6 @@
                 
             }
         }];
-//        _videoRecordManager.bgAudioUrl = [NSURL fileURLWithPath:[[NSBundle mainBundle]pathForResource:@"banzou" ofType:@"mp3"]];
     }
     return _videoRecordManager;
 }

+ 4 - 6
KulexiuForStudent/KulexiuForStudent/Common/Base/KSBaseWKWebViewController.m

@@ -132,16 +132,12 @@ typedef NS_ENUM(NSInteger, CHOOSETYPE) {
         // 切换到横屏
         AppDelegate* delegate = (AppDelegate*)[UIApplication sharedApplication].delegate;
         delegate.allowAutoRotate = YES;
-        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
-            [UIDevice switchNewOrientation:UIInterfaceOrientationLandscapeRight inController:self];
-        });
+        [UIDevice switchNewOrientation:UIInterfaceOrientationLandscapeRight inController:self];
     }
     else {
         AppDelegate* delegate = (AppDelegate*)[UIApplication sharedApplication].delegate;
         delegate.allowAutoRotate = NO;
-//        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
-            [UIDevice switchNewOrientation:UIInterfaceOrientationPortrait inController:self];
-//        });
+        [UIDevice switchNewOrientation:UIInterfaceOrientationPortrait inController:self];
     }
 }
 
@@ -743,6 +739,7 @@ typedef NS_ENUM(NSInteger, CHOOSETYPE) {
 }
 
 - (void)postMessage:(NSDictionary *)parm {
+    NSLog(@"------ parm %@", [parm mj_JSONString]);
     if (_myWebView) {
         dispatch_async(dispatch_get_main_queue(), ^{
             NSString *jsString = [parm mj_JSONString];
@@ -1068,6 +1065,7 @@ typedef NS_ENUM(NSInteger, CHOOSETYPE) {
 }
 
 - (void)dealloc {
+    NSLog(@"webView dealloc -----");
     [[_myWebView configuration].userContentController removeScriptMessageHandlerForName:@"COLEXIU"];
     [_myWebView removeObserver:self forKeyPath:@"estimatedProgress"];
     [_myWebView removeObserver:self forKeyPath:@"title"];

+ 2 - 0
KulexiuForStudent/KulexiuForStudent/Common/Base/KSVideoRecordManager.h

@@ -22,6 +22,8 @@ NS_ASSUME_NONNULL_BEGIN
 
 @property (nonatomic, assign) BOOL skipSaveRecord;
 
+- (BOOL)getSessionStatusisActive;
+
 - (instancetype)initSessionRecordCallback:(KSVideoRecordCallback)callback;
 
 - (void)configSessiondisplayInView:(UIView *)containerView;

+ 48 - 7
KulexiuForStudent/KulexiuForStudent/Common/Base/KSVideoRecordManager.m

@@ -42,6 +42,9 @@
 
 @property (strong, nonatomic) MBProgressHUD *HUD;
 
+@property (nonatomic, strong) dispatch_queue_t videoRecordQueue;
+
+
 @end
 
 @implementation KSVideoRecordManager
@@ -61,7 +64,17 @@
     [self resetSession];
 }
 
+- (BOOL)getSessionStatusisActive {
+    if (self.captureSession && self.captureSession.isRunning) {
+        return YES;
+    }
+    else  {
+        return NO;
+    }
+}
+
 - (void)configSessiondisplayInView:(UIView *)containerView {
+    
     _captureSession = [[AVCaptureSession alloc] init];
 
     // 设置YES 播放web伴奏会导致打断
@@ -140,8 +153,7 @@
     // 一定要在添加了 input 和 output之后~
     AVCaptureConnection *captureConnection = [_captureMovieFileOutput connectionWithMediaType:AVMediaTypeVideo];
     captureConnection.videoOrientation = AVCaptureVideoOrientationLandscapeRight;
-    
-    [self.captureSession startRunning];
+    [self startSession];
 }
 
 - (void)removeDisplay {
@@ -178,15 +190,30 @@
         }
         
         [_captureSession commitConfiguration];
-        
     }
-    [self.captureSession startRunning];
-    
+    [self startSession];
+}
+
+
+- (void)startSession {
+    @weakObj(self);
+    dispatch_async(self.videoRecordQueue, ^{
+        @strongObj(self);
+        if (!self.captureSession.running) {
+            [self.captureSession startRunning];
+        }
+    });
 }
 
 - (void)stopSession {
     if (_captureSession) {
-        [self.captureSession stopRunning];
+        @weakObj(self);
+        dispatch_async(self.videoRecordQueue, ^{
+            @strongObj(self);
+            if (self.captureSession.running) {
+                [self.captureSession stopRunning];
+            }
+        });
         self.captureSession = nil;
     }
 }
@@ -266,7 +293,14 @@
     }
     NSLog(@"录制结束");
     _isRecording = NO;
-    [self.captureSession stopRunning];
+    @weakObj(self);
+    dispatch_async(self.videoRecordQueue, ^{
+        @strongObj(self);
+        if (self.captureSession.running) {
+            [self.captureSession stopRunning];
+        }
+    });
+
     // 暂时存储文件地址
     self.videoFileURL = outputFileURL;
     // 保存文件
@@ -435,4 +469,11 @@
     NSString *filePath = [path stringByAppendingPathComponent:fileName];
     return filePath;
 }
+
+- (dispatch_queue_t)videoRecordQueue {
+    if (!_videoRecordQueue) {
+        _videoRecordQueue = dispatch_queue_create("com.Colexiu.videoRecord", DISPATCH_QUEUE_SERIAL);
+    }
+    return _videoRecordQueue;
+}
 @end

+ 14 - 14
KulexiuForStudent/KulexiuForStudent/Common/Define/PrefixHeader.pch

@@ -139,13 +139,13 @@ shouldPrevent = NO; \
 
 //#ifdef DEBUG
 
-#define hostURL (@"https://dev.colexiu.com")
-#define SEALCLASSHOST (@"https://dev.colexiu.com/api-classroom")
-#define WEBHOST (@"https://dev.colexiu.com/student")
-#define SOCKET_URL (@"wss://dev.colexiu.com/audioAnalysis")
-#define JSPUSH_ENVIRONMENT (NO)
-#define RCIM_KEY (@"0vnjpoad0jbdz")
-#define SUBMIT_UUID (YES)
+//#define hostURL (@"https://dev.colexiu.com")
+//#define SEALCLASSHOST (@"https://dev.colexiu.com/api-classroom")
+//#define WEBHOST (@"https://dev.colexiu.com/student")
+//#define SOCKET_URL (@"wss://dev.colexiu.com/audioAnalysis")
+//#define JSPUSH_ENVIRONMENT (NO)
+//#define RCIM_KEY (@"0vnjpoad0jbdz")
+//#define SUBMIT_UUID (YES)
 
 // 预生产环境
 
@@ -159,13 +159,13 @@ shouldPrevent = NO; \
 
 //#else
 
-//#define hostURL (@"https://online.colexiu.com")
-//#define SEALCLASSHOST (@"https://online.colexiu.com/api-classroom")
-//#define WEBHOST (@"https://online.colexiu.com/student")
-//#define SOCKET_URL (@"wss://online.colexiu.com/audioAnalysis")
-//#define JSPUSH_ENVIRONMENT (YES)
-//#define RCIM_KEY (@"e5t4ouvpe42pa")
-//#define SUBMIT_UUID (YES)
+#define hostURL (@"https://online.colexiu.com")
+#define SEALCLASSHOST (@"https://online.colexiu.com/api-classroom")
+#define WEBHOST (@"https://online.colexiu.com/student")
+#define SOCKET_URL (@"wss://online.colexiu.com/audioAnalysis")
+#define JSPUSH_ENVIRONMENT (YES)
+#define RCIM_KEY (@"e5t4ouvpe42pa")
+#define SUBMIT_UUID (YES)
 
 //#endif
 

+ 1 - 1
KulexiuForStudent/KulexiuForStudent/Module/CloudEngine/Controller/KSCloudViewController.m

@@ -896,7 +896,7 @@ typedef NS_ENUM(NSInteger,COLOR_DISPLAYTYPE) {
 
 
 #pragma mark-------- KSAQRecordManagerDelegate
-- (void)audioRecordInterruption {
+- (void)recordInterruption {
 
     [self cancelEvaluating];
     [self showErrorMessage:@"录制错误,请重试"];

+ 2 - 2
KulexiuForStudent/KulexiuForStudent/Module/Login/View/VefiBodyView.m

@@ -111,10 +111,10 @@
         sender.text = [sender.text substringFromIndex:sender.text.length - _codeCount];
         [self hideKeyboard];
     }
-    if (sender.text.length == self.codeCount) {
+    else if (sender.text.length == self.codeCount) {
         [self hideKeyboard];
     }
-    if (sender.text.length >= _codeCount + 1) { //对于持续输入,只要前面N个就行
+    else if (sender.text.length >= _codeCount + 1) { //对于持续输入,只要前面N个就行
         NSLog(@"持续输入");
         sender.text = [sender.text substringToIndex:_codeCount];
         [self hideKeyboard];

+ 12 - 5
KulexiuForStudent/KulexiuForStudent/Module/Widget/Controller/ToneTuningViewController.m

@@ -93,23 +93,30 @@ static float correctTime = 0.5;
 }
 
 - (void)configUI {
-    [self.scrollView removeFromSuperview];
+    self.scrollView.backgroundColor = [UIColor clearColor];
+    [self.scrollView mas_remakeConstraints:^(MASConstraintMaker *make) {
+        make.left.right.mas_equalTo(self.view);
+        make.top.mas_equalTo(self.view.mas_top).offset(kNaviBarHeight);
+        make.bottom.mas_equalTo(self.view.mas_bottom);
+    }];
     CAGradientLayer *layer = [self createGradientLayerFromColor:HexRGB(0x1D2027) startPoint:CGPointMake(0.5, 0) endColor:HexRGB(0x17181C) endPoint:CGPointMake(0.5, 1) bounds:CGRectMake(0, 0, KPortraitWidth, KPortraitHeight)];
     layer.masksToBounds = YES;
     [self.view.layer addSublayer:layer];
+    [self.view bringSubviewToFront:self.scrollView];
     
     [self.view addSubview:self.navView];
     [self.navView mas_makeConstraints:^(MASConstraintMaker *make) {
-        make.left.right.top.mas_equalTo(self.view);
+        make.top.left.right.mas_equalTo(self.view);
         make.height.mas_equalTo(kNaviBarHeight);
     }];
 
-    [self.view addSubview:self.bodyView];
+    [self.scrollView addSubview:self.bodyView];
     self.bodyView.A4Frequence = self.A4Frequence;
     [self.bodyView mas_makeConstraints:^(MASConstraintMaker *make) {
         make.left.right.mas_equalTo(self.view);
-        make.top.mas_equalTo(self.navView.mas_bottom);
-        make.bottom.mas_equalTo(self.view.mas_bottom).offset(-iPhoneXSafeBottomMargin);
+        make.top.mas_equalTo(self.scrollView.mas_top);
+        make.bottom.mas_equalTo(self.scrollView.mas_bottom);
+        make.height.mas_equalTo(700);
     }];
     [self.bodyView.plateView addSubview:self.plateView];
     [self.plateView mas_makeConstraints:^(MASConstraintMaker *make) {

+ 0 - 1
KulexiuForStudent/Podfile

@@ -49,7 +49,6 @@ target 'KulexiuForStudent' do
   pod 'AlipaySDK-iOS'
   #lottie 动画库
   pod 'lottie-ios', '~> 2.5'
-#  pod 'AudioKit', '~>5.0.0'
   # Pods for KulexiuForStudent
 
   target 'KulexiuForStudentTests' do