Parcourir la source

agent 赋值修改

Steven il y a 1 an
Parent
commit
2185d11e74

+ 8 - 0
KulexiuForStudent/KulexiuForStudent.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>IDEDidComputeMac32BitWarning</key>
+	<true/>
+</dict>
+</plist>

+ 14 - 0
KulexiuForStudent/KulexiuForStudent.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

@@ -0,0 +1,14 @@
+{
+  "pins" : [
+    {
+      "identity" : "audiokit",
+      "kind" : "remoteSourceControl",
+      "location" : "https://github.com/AudioKit/AudioKit.git",
+      "state" : {
+        "revision" : "36ea09c87bf703291a60e694742d56ff221c56ae",
+        "version" : "5.0.0"
+      }
+    }
+  ],
+  "version" : 2
+}

+ 0 - 1
KulexiuForStudent/KulexiuForStudent/Common/Base/AccompanyLoadingView.m

@@ -43,7 +43,6 @@
 
 + (instancetype)shareInstance {
     AccompanyLoadingView *view = [[[NSBundle mainBundle] loadNibNamed:@"AccompanyLoadingView" owner:nil options:nil] firstObject];
-    view.backgroundColor = [UIColor redColor];
     return view;
 }
 

+ 7 - 8
KulexiuForStudent/KulexiuForStudent/Common/Base/KSAQRecordManager.m

@@ -158,10 +158,6 @@ static const int kNumberBuffers = 3;
         OSStatus status = AudioQueueStop(self.audioQueue, true);
         if (status == noErr) {
             self.isRunning = NO;
-            for (int i = 0; i < kNumberBuffers; ++i) {
-                AudioQueueBufferRef buffer = self->mBuffers[i];
-                AudioQueueFreeBuffer(self.audioQueue, buffer);
-            }
         }
     });
 }
@@ -186,6 +182,12 @@ static const int kNumberBuffers = 3;
     });
 }
 
+- (void)freeBuffer {
+    for (int i = 0; i < kNumberBuffers; ++i) {
+        AudioQueueBufferRef buffer = self->mBuffers[i];
+        AudioQueueFreeBuffer(self.audioQueue, buffer);
+    }
+}
 
 - (void)freeAudioQueue {
     dispatch_async(_queue, ^{
@@ -193,10 +195,7 @@ static const int kNumberBuffers = 3;
             self.isRunning = NO;
             OSStatus stopStatus = AudioQueueStop(self.audioQueue, true);
             if (stopStatus != noErr) { // error
-                for (int i = 0; i < kNumberBuffers; ++i) {
-                    AudioQueueBufferRef buffer = self->mBuffers[i];
-                    AudioQueueFreeBuffer(self.audioQueue, buffer);
-                }
+                [self freeBuffer];
             }
         }
         AudioFileClose(self.mAudioFile);

+ 10 - 2
KulexiuForStudent/KulexiuForStudent/Common/Base/KSAccompanyWebViewController.m

@@ -234,6 +234,8 @@
         }
         config.processPool = [KSBaseWKWebViewController singleWkProcessPool];
         config.websiteDataStore = [WKWebsiteDataStore defaultDataStore];
+        [self configUserAgent:config];
+
         //自定义的WKScriptMessageHandler 是为了解决内存不释放的问题
         WeakWebViewScriptMessageDelegate *weakScriptMessageDelegate = [[WeakWebViewScriptMessageDelegate alloc] initWithDelegate:self];
         //这个类主要用来做native与JavaScript的交互管理
@@ -269,14 +271,20 @@
             // Fallback on earlier versions
         }
         [self setupProgress];
-        // 修改userAgent
-        [self setUserAgent];
+        
+        [self loadRequest];
     }
     else {
         [self.myWebView reload];
     }
 }
 
+- (void)configUserAgent:(WKWebViewConfiguration *)config {
+    NSString *oldUserAgent = config.applicationNameForUserAgent;
+    NSString *newAgent = [NSString stringWithFormat:@"%@ %@ %@",oldUserAgent,@"ORCHESTRAAPPI",@"ORCHESTRASTUDENT"];
+    config.applicationNameForUserAgent = newAgent;
+}
+
 - (void)configRecordManager {
     self.AQManager = [[KSAQRecordManager alloc] init];
     self.AQManager.delegate = self;

+ 1 - 1
KulexiuForStudent/KulexiuForStudent/Common/Base/KSBaseWKWebViewController.h

@@ -51,7 +51,7 @@ NS_ASSUME_NONNULL_BEGIN
 
 - (void)setupProgress;
 
-- (void)setUserAgent;
+- (void)loadRequest;
 
 + (WKProcessPool*)singleWkProcessPool;
 

+ 10 - 10
KulexiuForStudent/KulexiuForStudent/Common/Base/KSBaseWKWebViewController.m

@@ -214,6 +214,8 @@ typedef NS_ENUM(NSInteger, CHOOSETYPE) {
         }
         config.processPool = [KSBaseWKWebViewController singleWkProcessPool];
         config.websiteDataStore = [WKWebsiteDataStore defaultDataStore];
+        [self configUserAgent:config];
+
         //自定义的WKScriptMessageHandler 是为了解决内存不释放的问题
         WeakWebViewScriptMessageDelegate *weakScriptMessageDelegate = [[WeakWebViewScriptMessageDelegate alloc] initWithDelegate:self];
         //这个类主要用来做native与JavaScript的交互管理
@@ -249,8 +251,8 @@ typedef NS_ENUM(NSInteger, CHOOSETYPE) {
         }
         [self setupProgress];
         // 修改userAgent
-        [self setUserAgent];
-        
+        [self loadRequest];
+
         [self.view bringSubviewToFront:self.navView];
         [self.view bringSubviewToFront:self.webBackButton];
     }
@@ -259,16 +261,14 @@ typedef NS_ENUM(NSInteger, CHOOSETYPE) {
     }
 }
 
-- (void)setUserAgent {
-    MJWeakSelf;
-    [self.myWebView evaluateJavaScript:@"navigator.userAgent" completionHandler:^(id result, NSError *error) {
-        NSString *oldUserAgent = result;
-        NSString *newUserAgent = [NSString stringWithFormat:@"%@ %@ %@",oldUserAgent,@"COLEXIUAPPI",@"COLEXIUSTUDENT"];
-        weakSelf.myWebView.customUserAgent = newUserAgent;
-        [weakSelf loadRequest];;
-    }];
+- (void)configUserAgent:(WKWebViewConfiguration *)config {
+    NSString *oldUserAgent = config.applicationNameForUserAgent;
+    NSString *newAgent = [NSString stringWithFormat:@"%@ %@ %@",oldUserAgent,@"COLEXIUAPPI",@"COLEXIUSTUDENT"];
+    config.applicationNameForUserAgent = newAgent;
 }
 
+
+
 - (void)loadRequest {
     MJWeakSelf;
     [self.myWebView evaluateJavaScript:@"navigator.userAgent" completionHandler:^(id result, NSError *error) {

+ 14 - 14
KulexiuForStudent/KulexiuForStudent/Common/Define/KSDomain.h

@@ -10,13 +10,13 @@
 
 //#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 (NO)
 
 // 预生产环境
 
@@ -30,13 +30,13 @@
 
 //#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
 

+ 4 - 4
KulexiuForStudent/KulexiuForStudent/Module/Home/View/HotMusic/HomeHotMusicCellView.xib

@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="21225" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="21701" 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="21207"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21679"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>
@@ -66,8 +66,8 @@
                         <constraint firstAttribute="width" constant="15" id="Hqu-Jg-wlv"/>
                     </constraints>
                 </imageView>
-                <button opaque="NO" contentMode="scaleToFill" misplaced="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="fGG-J1-J8q">
-                    <rect key="frame" x="0.0" y="73" width="414" height="7"/>
+                <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="fGG-J1-J8q">
+                    <rect key="frame" x="0.0" y="0.0" width="414" height="80"/>
                     <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
                     <connections>
                         <action selector="buttonAction:" destination="iN0-l3-epB" eventType="touchUpInside" id="fvd-A1-IJ7"/>