Browse Source

同步工具类

Steven 1 year ago
parent
commit
e12fbc0442

+ 14 - 26
KulexiuForStudent/KulexiuForStudent.xcodeproj/project.pbxproj

@@ -131,7 +131,6 @@
 		2779354D27E324A70010E277 /* KSGifRefreshFooter.m in Sources */ = {isa = PBXBuildFile; fileRef = 277933E027E3249E0010E277 /* KSGifRefreshFooter.m */; };
 		2779355627E324A70010E277 /* KSPremissionAlert.m in Sources */ = {isa = PBXBuildFile; fileRef = 277933F827E3249F0010E277 /* KSPremissionAlert.m */; };
 		2779355727E324A70010E277 /* KSPremissionAlert.xib in Resources */ = {isa = PBXBuildFile; fileRef = 277933F927E3249F0010E277 /* KSPremissionAlert.xib */; };
-		2779355927E324A70010E277 /* GRCreateManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 277933FD27E3249F0010E277 /* GRCreateManager.m */; };
 		2779355B27E324A70010E277 /* KSStatusView.m in Sources */ = {isa = PBXBuildFile; fileRef = 2779340427E3249F0010E277 /* KSStatusView.m */; };
 		2779355D27E324A70010E277 /* KSHoldButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 2779340B27E3249F0010E277 /* KSHoldButton.m */; };
 		2779355E27E324A70010E277 /* KSAudioRecordFileManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 2779340D27E3249F0010E277 /* KSAudioRecordFileManager.m */; };
@@ -142,7 +141,6 @@
 		2779356527E324A70010E277 /* KSMediaManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 2779341927E3249F0010E277 /* KSMediaManager.m */; };
 		2779356927E324A70010E277 /* YKMultiLevelTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = 2779341E27E324A00010E277 /* YKMultiLevelTableView.m */; };
 		2779356A27E324A70010E277 /* YKNodeModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 2779341F27E324A00010E277 /* YKNodeModel.m */; };
-		2779357727E324A70010E277 /* GRScanManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 2779343E27E324A00010E277 /* GRScanManager.m */; };
 		2779357927E324A70010E277 /* KSImageButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 2779344627E324A00010E277 /* KSImageButton.m */; };
 		2779357C27E324A70010E277 /* NSString+MD5.m in Sources */ = {isa = PBXBuildFile; fileRef = 2779344C27E324A00010E277 /* NSString+MD5.m */; };
 		2779357D27E324A80010E277 /* KSMessageInputView.m in Sources */ = {isa = PBXBuildFile; fileRef = 2779344D27E324A00010E277 /* KSMessageInputView.m */; };
@@ -407,10 +405,10 @@
 		BC38C4A32AFA4F6C00ABFCC2 /* TenantMineFunctionView.xib in Resources */ = {isa = PBXBuildFile; fileRef = BC38C4A22AFA4F6C00ABFCC2 /* TenantMineFunctionView.xib */; };
 		BC3A4EAB28DAC0CD001C4428 /* ShareLiveDisplayView.m in Sources */ = {isa = PBXBuildFile; fileRef = BC3A4EAA28DAC0CD001C4428 /* ShareLiveDisplayView.m */; };
 		BC3A4EAD28DAC0D6001C4428 /* ShareLiveDisplayView.xib in Resources */ = {isa = PBXBuildFile; fileRef = BC3A4EAC28DAC0D6001C4428 /* ShareLiveDisplayView.xib */; };
-		BC3BF62B2B9EAF8200831494 /* CloudAccompanyLibrary.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BC3BF62A2B9EAF8100831494 /* CloudAccompanyLibrary.framework */; };
-		BC3BF62C2B9EAF8800831494 /* KSTunerLibrary.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BC3BF6282B9EAF6F00831494 /* KSTunerLibrary.framework */; };
-		BC3BF62D2B9EAF8800831494 /* KSTunerLibrary.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = BC3BF6282B9EAF6F00831494 /* KSTunerLibrary.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
-		BC3BF63C2B9EFA7200831494 /* KSToolLibrary.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BC3BF63B2B9EFA7200831494 /* KSToolLibrary.framework */; };
+		BC3A556C2BAA7B1A002E1616 /* KSToolLibrary.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BC3A55692BAA7B19002E1616 /* KSToolLibrary.framework */; };
+		BC3A556D2BAA7B1A002E1616 /* CloudAccompanyLibrary.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BC3A556A2BAA7B1A002E1616 /* CloudAccompanyLibrary.framework */; };
+		BC3A556E2BAA7B2D002E1616 /* KSTunerLibrary.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BC3A55682BAA7B19002E1616 /* KSTunerLibrary.framework */; };
+		BC3A556F2BAA7B2D002E1616 /* KSTunerLibrary.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = BC3A55682BAA7B19002E1616 /* KSTunerLibrary.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
 		BC3BF6402B9FE92600831494 /* ShareFunctionView.m in Sources */ = {isa = PBXBuildFile; fileRef = BC3BF63E2B9FE92600831494 /* ShareFunctionView.m */; };
 		BC3BF6412B9FE92600831494 /* ShareFunctionView.xib in Resources */ = {isa = PBXBuildFile; fileRef = BC3BF63F2B9FE92600831494 /* ShareFunctionView.xib */; };
 		BC40B9F82811767A00DEC0D1 /* HotInformationHeadView.m in Sources */ = {isa = PBXBuildFile; fileRef = BC40B9F72811767A00DEC0D1 /* HotInformationHeadView.m */; };
@@ -978,7 +976,7 @@
 			dstPath = "";
 			dstSubfolderSpec = 10;
 			files = (
-				BC3BF62D2B9EAF8800831494 /* KSTunerLibrary.framework in Embed Frameworks */,
+				BC3A556F2BAA7B2D002E1616 /* KSTunerLibrary.framework in Embed Frameworks */,
 			);
 			name = "Embed Frameworks";
 			runOnlyForDeploymentPostprocessing = 0;
@@ -1204,8 +1202,6 @@
 		277933F827E3249F0010E277 /* KSPremissionAlert.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KSPremissionAlert.m; sourceTree = "<group>"; };
 		277933F927E3249F0010E277 /* KSPremissionAlert.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = KSPremissionAlert.xib; sourceTree = "<group>"; };
 		277933FA27E3249F0010E277 /* KSPremissionAlert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KSPremissionAlert.h; sourceTree = "<group>"; };
-		277933FD27E3249F0010E277 /* GRCreateManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GRCreateManager.m; sourceTree = "<group>"; };
-		277933FE27E3249F0010E277 /* GRScanManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GRScanManager.h; sourceTree = "<group>"; };
 		2779340427E3249F0010E277 /* KSStatusView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KSStatusView.m; sourceTree = "<group>"; };
 		2779340927E3249F0010E277 /* KSAudioRecordManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KSAudioRecordManager.h; sourceTree = "<group>"; };
 		2779340A27E3249F0010E277 /* KSRecordStatusView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KSRecordStatusView.h; sourceTree = "<group>"; };
@@ -1230,8 +1226,6 @@
 		2779343527E324A00010E277 /* StateView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StateView.h; sourceTree = "<group>"; };
 		2779343827E324A00010E277 /* KeyChainTools.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KeyChainTools.h; sourceTree = "<group>"; };
 		2779343927E324A00010E277 /* KSStatusView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KSStatusView.h; sourceTree = "<group>"; };
-		2779343E27E324A00010E277 /* GRScanManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GRScanManager.m; sourceTree = "<group>"; };
-		2779343F27E324A00010E277 /* GRCreateManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GRCreateManager.h; sourceTree = "<group>"; };
 		2779344327E324A00010E277 /* KSMediaManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KSMediaManager.h; sourceTree = "<group>"; };
 		2779344627E324A00010E277 /* KSImageButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KSImageButton.m; sourceTree = "<group>"; };
 		2779344C27E324A00010E277 /* NSString+MD5.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+MD5.m"; sourceTree = "<group>"; };
@@ -1701,10 +1695,10 @@
 		BC3A4EA928DAC0CD001C4428 /* ShareLiveDisplayView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ShareLiveDisplayView.h; sourceTree = "<group>"; };
 		BC3A4EAA28DAC0CD001C4428 /* ShareLiveDisplayView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ShareLiveDisplayView.m; sourceTree = "<group>"; };
 		BC3A4EAC28DAC0D6001C4428 /* ShareLiveDisplayView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = ShareLiveDisplayView.xib; sourceTree = "<group>"; };
-		BC3BF6282B9EAF6F00831494 /* KSTunerLibrary.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = KSTunerLibrary.framework; sourceTree = "<group>"; };
-		BC3BF62A2B9EAF8100831494 /* CloudAccompanyLibrary.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = CloudAccompanyLibrary.framework; sourceTree = "<group>"; };
+		BC3A55682BAA7B19002E1616 /* KSTunerLibrary.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = KSTunerLibrary.framework; sourceTree = "<group>"; };
+		BC3A55692BAA7B19002E1616 /* KSToolLibrary.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = KSToolLibrary.framework; sourceTree = "<group>"; };
+		BC3A556A2BAA7B1A002E1616 /* CloudAccompanyLibrary.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = CloudAccompanyLibrary.framework; sourceTree = "<group>"; };
 		BC3BF62F2B9EAFC800831494 /* client.p12 */ = {isa = PBXFileReference; lastKnownFileType = file; path = client.p12; sourceTree = "<group>"; };
-		BC3BF63B2B9EFA7200831494 /* KSToolLibrary.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = KSToolLibrary.framework; sourceTree = "<group>"; };
 		BC3BF63D2B9FE92500831494 /* ShareFunctionView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ShareFunctionView.h; sourceTree = "<group>"; };
 		BC3BF63E2B9FE92600831494 /* ShareFunctionView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ShareFunctionView.m; sourceTree = "<group>"; };
 		BC3BF63F2B9FE92600831494 /* ShareFunctionView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ShareFunctionView.xib; sourceTree = "<group>"; };
@@ -2529,9 +2523,9 @@
 			files = (
 				BCA1136828A3A5CF007FAFB9 /* Accelerate.framework in Frameworks */,
 				BCFEE1932AD15C0E000E888F /* SoundpipeAudioKit in Frameworks */,
-				BC3BF62B2B9EAF8200831494 /* CloudAccompanyLibrary.framework in Frameworks */,
+				BC3A556D2BAA7B1A002E1616 /* CloudAccompanyLibrary.framework in Frameworks */,
 				BCFEE18D2AD15BD4000E888F /* AudioKitEX in Frameworks */,
-				BC3BF63C2B9EFA7200831494 /* KSToolLibrary.framework in Frameworks */,
+				BC3A556C2BAA7B1A002E1616 /* KSToolLibrary.framework in Frameworks */,
 				BC8B6E152856E20800866917 /* WebKit.framework in Frameworks */,
 				BC8A45CB283DDEA100094BBB /* AVFoundation.framework in Frameworks */,
 				BCD9294F28F8FCA4006793E4 /* AudioKit in Frameworks */,
@@ -2548,8 +2542,8 @@
 				BC71D0F32881A2420010F14B /* UMCommonLog.framework in Frameworks */,
 				BC71D1032881A2420010F14B /* libWeiboSDK.a in Frameworks */,
 				BC8A45C7283DDE8E00094BBB /* VideoToolbox.framework in Frameworks */,
+				BC3A556E2BAA7B2D002E1616 /* KSTunerLibrary.framework in Frameworks */,
 				BCA1136328A3A2D0007FAFB9 /* bassmidi.xcframework in Frameworks */,
-				BC3BF62C2B9EAF8800831494 /* KSTunerLibrary.framework in Frameworks */,
 				BC8B6E172856E21000866917 /* SystemConfiguration.framework in Frameworks */,
 				BC71D0FE2881A2420010F14B /* libSocialOfficialWeChat.a in Frameworks */,
 				BC71D1002881A2420010F14B /* libWeChatSDK.a in Frameworks */,
@@ -3335,10 +3329,6 @@
 		277933FB27E3249F0010E277 /* Custom */ = {
 			isa = PBXGroup;
 			children = (
-				2779343F27E324A00010E277 /* GRCreateManager.h */,
-				277933FD27E3249F0010E277 /* GRCreateManager.m */,
-				277933FE27E3249F0010E277 /* GRScanManager.h */,
-				2779343E27E324A00010E277 /* GRScanManager.m */,
 				2779343827E324A00010E277 /* KeyChainTools.h */,
 				2779345127E324A00010E277 /* KeyChainTools.m */,
 				2779341627E3249F0010E277 /* KSImageButton.h */,
@@ -4544,10 +4534,10 @@
 		BC3BF6252B9EAF4B00831494 /* ToolKit */ = {
 			isa = PBXGroup;
 			children = (
+				BC3A556A2BAA7B1A002E1616 /* CloudAccompanyLibrary.framework */,
+				BC3A55692BAA7B19002E1616 /* KSToolLibrary.framework */,
+				BC3A55682BAA7B19002E1616 /* KSTunerLibrary.framework */,
 				BC3BF62F2B9EAFC800831494 /* client.p12 */,
-				BC3BF63B2B9EFA7200831494 /* KSToolLibrary.framework */,
-				BC3BF6282B9EAF6F00831494 /* KSTunerLibrary.framework */,
-				BC3BF62A2B9EAF8100831494 /* CloudAccompanyLibrary.framework */,
 			);
 			path = ToolKit;
 			sourceTree = "<group>";
@@ -6962,7 +6952,6 @@
 				2723B5BD27F157B100E0B90B /* KSChatListSearchView.m in Sources */,
 				BCCC361A2AAF0D77000D60CA /* INSSettingBodyView.m in Sources */,
 				2723B66727F15CFC00E0B90B /* ModifyBodyView.m in Sources */,
-				2779357727E324A70010E277 /* GRScanManager.m in Sources */,
 				BC106C162A933829000759A9 /* TXLiveTextMessage.m in Sources */,
 				BC11924E280EDD5500A716F7 /* HomeworkListViewController.m in Sources */,
 				2723B5BC27F157B100E0B90B /* GroupCreateView.m in Sources */,
@@ -7063,7 +7052,6 @@
 				BC106C072A933829000759A9 /* TXLiveMessageLikeCount.m in Sources */,
 				BCBFDF46281159990052AFE5 /* HomeHotAlbumView.m in Sources */,
 				2779356A27E324A70010E277 /* YKNodeModel.m in Sources */,
-				2779355927E324A70010E277 /* GRCreateManager.m in Sources */,
 				BC106C052A933829000759A9 /* TXLiveMessageKickOut.m in Sources */,
 				BCB6348227F6D29600ACFDCF /* SeatContentView.m in Sources */,
 				BCC0F6A32A8CDD3F00C4EFA4 /* ClassroomTimerManager.m in Sources */,

+ 0 - 189
KulexiuForStudent/KulexiuForStudent/Common/Tools/Custom/GRCreateManager.m

@@ -1,189 +0,0 @@
-//
-//  GRCreateManager.m
-//  GreenRoad
-//
-//  Created by  jetsum on 2017/2/13.
-//  Copyright © 2017年  jetsum. All rights reserved.
-//
-
-#import "GRCreateManager.h"
-
-@implementation GRCreateManager
-
-//二维码生成
-+ (UIImage *)generateQRCodeImage:(NSString *)source  size: (CGSize)size{
-    if (!source || ![source isKindOfClass:[NSString class]]) {
-        return nil;
-    }
-    if ([NSProcessInfo.processInfo isOperatingSystemAtLeastVersion:(NSOperatingSystemVersion){9,0,0}])  {
-        source = [source stringByRemovingPercentEncoding];
-    }else {
-        source = [source stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
-    }
-   
-    if (!source.length) {
-        return nil;
-    }
-    NSData *data = [source dataUsingEncoding:NSUTF8StringEncoding];
-    CIFilter *filter = [CIFilter filterWithName:@"CIQRCodeGenerator"];
-    [filter setValue:data forKey:@"inputMessage"];
-    [filter setValue:@"Q" forKey:@"inputCorrectionLevel"];
-    
-//   UIImage *image = [self resizeCodeImage:filter.outputImage withSize:size];
-    //    return image;
-    return [self createNonInterpolatedUIImageFormCIImage:filter.outputImage withSize:size];
-}
-
-//条形码生成
-+ (UIImage *)generateBarCodeImage:(NSString *)source size:(CGSize)size
-{
-    if (!source || ![source isKindOfClass:[NSString class]]) {
-        return nil;
-    }
-//    source = [source stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
-    if ([NSProcessInfo.processInfo isOperatingSystemAtLeastVersion:(NSOperatingSystemVersion){9,0,0}])  {
-        source = [source stringByRemovingPercentEncoding];
-    }else {
-        source = [source stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
-    }
-    if (!source.length) {
-        return nil;
-    }
-    // iOS 8.0以上的系统才支持条形码的生成,iOS8.0以下使用第三方控件生成
-    if ([NSProcessInfo.processInfo isOperatingSystemAtLeastVersion:(NSOperatingSystemVersion){8,0,0}]) {
-//        // 注意生成条形码的编码方式
-//        NSData *data = [source dataUsingEncoding: NSASCIIStringEncoding];
-//        CIFilter *filter = [CIFilter filterWithName:@"CICode128BarcodeGenerator"];
-//        [filter setValue:data forKey:@"inputMessage"];
-//        // 设置生成的条形码的上,下,左,右的margins的值
-//        [filter setValue:[NSNumber numberWithInteger:0] forKey:@"inputQuietSpace"];
-//        
-//        UIImage *image = [self resizeCodeImage:filter.outputImage withSize:size];
-//        
-//        return image;
-        
-        // @"CICode128BarcodeGenerator"  条形码
-        // @"CIAztecCodeGenerator"       二维码
-        NSString *filtername = @"CICode128BarcodeGenerator";
-        
-        
-        CIFilter *filter = [CIFilter filterWithName:filtername];
-        [filter setDefaults];
-        
-        NSData *data = [source dataUsingEncoding:NSUTF8StringEncoding];
-        [filter setValue:data forKey:@"inputMessage"];
-        
-        CIImage *outputImage = [filter outputImage];
-        CIContext *context = [CIContext contextWithOptions:nil];
-        CGImageRef cgImage = [context createCGImage:outputImage
-                                           fromRect:[outputImage extent]];
-        UIImage *image = [UIImage imageWithCGImage:cgImage
-                                             scale:1.
-                                       orientation:UIImageOrientationUp];
-        
-        // Resize without interpolating
-//        CGFloat scaleRate = size.width / image.size.width;
-        UIImage *resized = [self resizeImage:image
-                                   withQuality:kCGInterpolationNone
-                                          rate:1];
-        CGImageRelease(cgImage);
-        return resized;
-    }else{
-        return nil;
-    }
-}
-
-/**
- *  调整生成的图片的大小
- *
- *  @param image CIImage对象
- *  @param size  需要的UIImage的大小
- *
- *  @return size大小的UIImage对象
- */
-+ (UIImage *) resizeCodeImage:(CIImage *)image withSize:(CGSize)size
-{
-    if (image) {
-        CGRect extent = CGRectIntegral(image.extent);
-        CGFloat scaleWidth = size.width/CGRectGetWidth(extent);
-        CGFloat scaleHeight = size.height/CGRectGetHeight(extent);
-        size_t width = CGRectGetWidth(extent) * scaleWidth;
-        size_t height = CGRectGetHeight(extent) * scaleHeight;
-        CGColorSpaceRef colorSpaceRef = CGColorSpaceCreateDeviceGray();
-        CGContextRef contentRef = CGBitmapContextCreate(nil, width, height, 8, 0, colorSpaceRef, (CGBitmapInfo)kCGImageAlphaNone);
-        CIContext *context = [CIContext contextWithOptions:nil];
-        CGImageRef imageRef = [context createCGImage:image fromRect:extent];
-        CGContextSetInterpolationQuality(contentRef, kCGInterpolationLow);
-        CGContextScaleCTM(contentRef, scaleWidth, scaleHeight);
-        CGContextDrawImage(contentRef, extent, imageRef);
-        CGImageRef imageRefResized = CGBitmapContextCreateImage(contentRef);
-    
-        
-        UIImage *completeImg = [UIImage imageWithCGImage:imageRefResized];
-        CGColorSpaceRelease(colorSpaceRef);
-        CGContextRelease(contentRef);
-        CGImageRelease(imageRef);
-        CGImageRelease(imageRefResized);
-        return completeImg;
-//        return [UIImage imageWithCGImage:imageRefResized];
-    }else{
-        return nil;
-    }
-}
-
-+ (UIImage *)resizeImage:(UIImage *)image
-             withQuality:(CGInterpolationQuality)quality
-                    rate:(CGFloat)rate {
-    UIImage *resized = nil;
-    CGFloat width    = image.size.width * rate;
-    CGFloat height   = image.size.height * rate;
-    
-    UIGraphicsBeginImageContext(CGSizeMake(width, height));
-    CGContextRef context = UIGraphicsGetCurrentContext();
-    CGContextSetInterpolationQuality(context, quality);
-    [image drawInRect:CGRectMake(0, 0, width, height)];
-    resized = UIGraphicsGetImageFromCurrentImageContext();
-    UIGraphicsEndImageContext();
-    
-    return resized;
-}
-
-/**
- *  根据CIImage生成指定大小的UIImage
- *
- *  @param image CIImage
- *  @param size  图片宽高
- */
-+ (UIImage *)createNonInterpolatedUIImageFormCIImage:(CIImage *)image withSize:(CGSize) size
-{
-    if (!image) {
-        return nil;
-    }
-    CGRect extent = CGRectIntegral(image.extent);
-//    CGFloat scale = MIN(size/CGRectGetWidth(extent), size/CGRectGetHeight(extent));
-//    size_t width = CGRectGetWidth(extent) * scale;
-//    size_t height = CGRectGetHeight(extent) * scale;
-    CGFloat scaleWidth = size.width/CGRectGetWidth(extent);
-    CGFloat scaleHeight = size.height/CGRectGetHeight(extent);
-    size_t width = CGRectGetWidth(extent) * scaleWidth;
-    size_t height = CGRectGetHeight(extent) * scaleHeight;
-    // 1.创建bitmap;
-    CGColorSpaceRef cs = CGColorSpaceCreateDeviceGray();
-    CGContextRef bitmapRef = CGBitmapContextCreate(nil, width, height, 8, 0, cs, (CGBitmapInfo)kCGImageAlphaNone);
-    CIContext *context = [CIContext contextWithOptions:nil];
-    CGImageRef bitmapImage = [context createCGImage:image fromRect:extent];
-    CGContextSetInterpolationQuality(bitmapRef, kCGInterpolationNone);
-    CGContextScaleCTM(bitmapRef, scaleWidth, scaleHeight);
-    CGContextDrawImage(bitmapRef, extent, bitmapImage);
-    
-    // 2.保存bitmap到图片
-    CGImageRef scaledImage = CGBitmapContextCreateImage(bitmapRef);
-    UIImage *img = [UIImage imageWithCGImage:scaledImage];
-    CGColorSpaceRelease(cs);
-    CGContextRelease(bitmapRef);
-    CGImageRelease(bitmapImage);
-    CGImageRelease(scaledImage);;
-    return img;
-}
-
-@end

+ 0 - 226
KulexiuForStudent/KulexiuForStudent/Common/Tools/Custom/GRScanManager.m

@@ -1,226 +0,0 @@
-//
-//  GRCodeManager.m
-//  GreenRoad
-//
-//  Created by Vecige on 16/11/17.
-//  Copyright © 2016年  jetsum. All rights reserved.
-//
-
-#import "GRScanManager.h"
-#import <AVFoundation/AVFoundation.h>
-#import <AudioToolbox/AudioToolbox.h>
-
-@interface GRScanManager()<AVCaptureMetadataOutputObjectsDelegate>
-
-@property (copy, nonatomic) void (^completionBlock) (NSString *);
-
-@property (nonatomic, strong) AVCaptureSession *session;
-
-@property (nonatomic, strong) dispatch_queue_t sessionQueue;
-
-
-@end
-
-@implementation GRScanManager
-
-- (instancetype)init {
-    self = [super init];
-    if (self) {
-        _supportQRCode = YES;
-        _supportBarCode = YES;
-        [self createQueue];
-    }
-    return self;
-}
-
-/**
- *  创建一个队列,防止阻塞主线程
- */
-- (void)createQueue{
-    dispatch_queue_t sessionQueue = dispatch_queue_create("com.Colexiu.KulexiuForStudent.sesson", DISPATCH_QUEUE_SERIAL);
-    self.sessionQueue = sessionQueue;
-}
-
-
-#pragma mark - 扫描二维码
-#pragma mark 开始扫描
-- (void)startScanningQRCodeWithInView:(UIView *)inView scanView:(UIView *)scanView resultCallback:(void(^)(NSString *result))callback {
-    
-    if ([self.session isRunning]) {
-        [self.session stopRunning];
-        self.session = nil;
-    }
-    
-    // 0.保存block
-    self.completionBlock = callback;
-    
-    // 1.创建输入
-    // 1.1.定义错误
-    NSError *error = nil;
-    
-    // 1.2.获取摄像头
-    AVCaptureDevice *device = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
-    
-    if ([device respondsToSelector:@selector(setVideoZoomFactor:)]) {
-        if ([ device lockForConfiguration:nil]) {
-            //            float zoomFactor = device.activeFormat.videoZoomFactorUpscaleThreshold;
-            float zoomFactor = 2.0;
-            [device setVideoZoomFactor:zoomFactor];
-            [device unlockForConfiguration];
-        }
-    }
-    
-    // 1.3.创建输入
-    AVCaptureDeviceInput *input = [AVCaptureDeviceInput deviceInputWithDevice:device error:&error];
-    if (error != nil) {
-        return;
-    }
-    
-    // 2.创建输出
-    AVCaptureMetadataOutput *output = [[AVCaptureMetadataOutput alloc] init];
-    [output setMetadataObjectsDelegate:self queue:dispatch_get_main_queue()];
-    
-    // 3.创建捕捉会话
-    AVCaptureSession *session = [[AVCaptureSession alloc] init];
-    [session addInput:input];
-    [session addOutput:output];
-    
-    self.session = session;
-    
-    // 4.设置输入的内容类型
-    //    [output setMetadataObjectTypes:@[AVMetadataObjectTypeQRCode]];
-//    [output setMetadataObjectTypes:@[AVMetadataObjectTypeQRCode, AVMetadataObjectTypeEAN13Code, AVMetadataObjectTypeEAN8Code, AVMetadataObjectTypeCode128Code]];
-    NSMutableArray *types = [NSMutableArray array];
-    if (self.supportQRCode) {
-        [types addObject:AVMetadataObjectTypeQRCode];
-    }
-    if (self.supportBarCode) {
-        [types addObjectsFromArray:@[AVMetadataObjectTypeEAN13Code, AVMetadataObjectTypeEAN8Code, AVMetadataObjectTypeCode128Code]];
-    }
-    [output setMetadataObjectTypes:[types copy]];
-    // 5.添加预览图层(让用户看到扫描的界面)
-    // 5.1.创建图层
-    AVCaptureVideoPreviewLayer *previewLayer = [[AVCaptureVideoPreviewLayer alloc] initWithSession:session];
-    previewLayer.videoGravity = AVLayerVideoGravityResizeAspectFill;
-    // 5.2.设置的layer的frame
-    previewLayer.frame = inView.bounds;
-
-    inView.clipsToBounds = YES;
-    inView.layer.masksToBounds = YES;
-    scanView.clipsToBounds = YES;
-    scanView.layer.masksToBounds = YES;
-    // 5.3.将图层添加到其它图层中
-    [inView.layer insertSublayer:previewLayer below:scanView.layer];
-    [previewLayer setAffineTransform:CGAffineTransformMakeScale(2.0, 2.0)];
-
-    // 6.设置扫描区域
-    CGSize screenSize = [UIScreen mainScreen].bounds.size;
-    CGFloat x = scanView.frame.origin.y / screenSize.height;
-    CGFloat y = scanView.frame.origin.x / screenSize.width;
-    CGFloat w = scanView.frame.size.height / screenSize.height;
-    CGFloat h = scanView.frame.size.width / screenSize.width;
-    output.rectOfInterest = CGRectMake(x, y, w, h);
-    
-    // 7.开始扫描
-    [self sessionStartRunning];
-}
-- (void)sessionStartRunning {
-    
-    @weakObj(self);
-    dispatch_async(self.sessionQueue, ^{
-        @strongObj(self);
-        if (!self.session.running) {
-            [self.session startRunning];
-        }
-    });
-}
-
--(void)sessionStopRunning{
-    
-    @weakObj(self);
-    dispatch_async(self.sessionQueue, ^{
-        @strongObj(self);
-        if (self.session.running) {
-            [self.session stopRunning];
-        }
-    });
-}
-
-#pragma mark - 实现AVCaptureMetadataOutput代理方法
-- (void)captureOutput:(AVCaptureOutput *)captureOutput didOutputMetadataObjects:(NSArray *)metadataObjects fromConnection:(AVCaptureConnection *)connection {
-    // 1.遍历结果
-    
-    for (AVMetadataMachineReadableCodeObject *result in metadataObjects) {
-        NSString *scannedResult = [(AVMetadataMachineReadableCodeObject *) result stringValue];
-        [self addwarningtone];
-       BLOCK_EXEC(_completionBlock,scannedResult);
-//                [self stopScanning];
-        break;
-    }
-}
-
-#pragma mark 给扫描结果添加提示音
--(void)addwarningtone{
-    SystemSoundID soundID = 1000;
-    AudioServicesPlaySystemSound(soundID);
-    AudioServicesPlayAlertSound(soundID);
-}
-
-
-+ (BOOL)isAvailable
-{
-    @autoreleasepool {
-        AVCaptureDevice *captureDevice = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
-        
-        if (!captureDevice) {
-            return NO;
-        }
-        
-        NSError *error;
-        AVCaptureDeviceInput *deviceInput = [AVCaptureDeviceInput deviceInputWithDevice:captureDevice error:&error];
-        
-        if (!deviceInput || error) {
-            return NO;
-        }
-        
-        return YES;
-    }
-}
-
-
-+ (BOOL)supportsMetadataObjectTypes:(NSArray *)metadataObjectTypes
-{
-    if (![self isAvailable]) {
-        return NO;
-    }
-    
-    @autoreleasepool {
-        // Setup components
-        AVCaptureDevice *captureDevice    = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
-        AVCaptureDeviceInput *deviceInput = [AVCaptureDeviceInput deviceInputWithDevice:captureDevice error:nil];
-        AVCaptureMetadataOutput *output   = [[AVCaptureMetadataOutput alloc] init];
-        AVCaptureSession *session         = [[AVCaptureSession alloc] init];
-        
-        [session addInput:deviceInput];
-        [session addOutput:output];
-        
-        if (metadataObjectTypes == nil || metadataObjectTypes.count == 0) {
-            // Check the QRCode metadata object type by default
-            metadataObjectTypes = @[AVMetadataObjectTypeQRCode];
-        }
-        
-        for (NSString *metadataObjectType in metadataObjectTypes) {
-            if (![output.availableMetadataObjectTypes containsObject:metadataObjectType]) {
-                return NO;
-            }
-        }
-        
-        return YES;
-    }
-}
-
-- (void)stopScanning {
-    [self sessionStopRunning];
-}
-
-@end

+ 1 - 1
KulexiuForStudent/KulexiuForStudent/Module/Mine/Scan/Controller/KSScanViewController.m

@@ -6,7 +6,7 @@
 //
 
 #import "KSScanViewController.h"
-#import "GRScanManager.h"
+#import <KSToolLibrary/GRScanManager.h>
 #import "ScanNavView.h"
 #import "KSBaseWKWebViewController.h"
 #import "KSMediaManager.h"

+ 37 - 7
KulexiuForStudent/KulexiuForStudent/Module/TXClassRoom/View/NewWhiteboard/KSNewWhiteBoard.m

@@ -228,16 +228,46 @@
 {
     dispatch_queue_t queue =  dispatch_queue_create("webViewChallengeQueue", NULL);
     dispatch_async(queue, ^{
-        if ([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]) {
-            if (challenge.previousFailureCount == 0) {
-                NSURLCredential *credential = [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust];
-                completionHandler(NSURLSessionAuthChallengeUseCredential, credential);
-            } else {
-                completionHandler(NSURLSessionAuthChallengeCancelAuthenticationChallenge, nil);
+        if (SSL_AUTH) {
+
+            NSURLSessionAuthChallengeDisposition disposition = NSURLSessionAuthChallengePerformDefaultHandling;
+            NSURLCredential *customCredential = nil;
+            
+            if ([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]) {
+                // 默认信任
+                customCredential = [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust];
+                disposition = NSURLSessionAuthChallengeUseCredential;
+            }
+            else if ([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodClientCertificate]) {
+                // client authentication
+                SecIdentityRef identity = NULL;
+                SecTrustRef trust = NULL;
+                if ([AuthChallengeManager extractIdentity:&identity andTrust:&trust filePath:CERT_PATH]) {
+                    SecCertificateRef certificate = NULL;
+                    SecIdentityCopyCertificate(identity, &certificate);
+                    const void*certs[] = {certificate};
+                    CFArrayRef certArray =CFArrayCreate(kCFAllocatorDefault, certs,1,NULL);
+                    customCredential =[NSURLCredential credentialWithIdentity:identity certificates:(__bridge  NSArray*)certArray persistence:NSURLCredentialPersistencePermanent];
+                    disposition = NSURLSessionAuthChallengeUseCredential;
+                }
+            }
+            
+            if (completionHandler) {
+                completionHandler(disposition, customCredential);
             }
         }
         else {
-            completionHandler(NSURLSessionAuthChallengeCancelAuthenticationChallenge, nil);
+            if ([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]) {
+                if (challenge.previousFailureCount == 0) {
+                    NSURLCredential *credential = [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust];
+                    completionHandler(NSURLSessionAuthChallengeUseCredential, credential);
+                } else {
+                    completionHandler(NSURLSessionAuthChallengeCancelAuthenticationChallenge, nil);
+                }
+            }
+            else {
+                completionHandler(NSURLSessionAuthChallengeCancelAuthenticationChallenge, nil);
+            }
         }
     });
 }

BIN
KulexiuForStudent/KulexiuForStudent/ToolKit/CloudAccompanyLibrary.framework/CloudAccompanyLibrary


BIN
KulexiuForStudent/KulexiuForStudent/ToolKit/CloudAccompanyLibrary.framework/_CodeSignature/CodeDirectory


BIN
KulexiuForStudent/KulexiuForStudent/ToolKit/CloudAccompanyLibrary.framework/_CodeSignature/CodeRequirements-1


BIN
KulexiuForStudent/KulexiuForStudent/ToolKit/CloudAccompanyLibrary.framework/_CodeSignature/CodeSignature


+ 3 - 0
KulexiuForStudent/KulexiuForStudent/ToolKit/KSToolLibrary.framework/Headers/BaseMaroDefine.h

@@ -8,6 +8,9 @@
 #ifndef BaseMaroDefine_h
 #define BaseMaroDefine_h
 
+#define BLOCK_EXEC(block, ...) !block ?: block(__VA_ARGS__);
+
+
 #pragma mark ------ 宽高相关
 
 #define kScreenWidth [UIScreen mainScreen].bounds.size.width

+ 0 - 0
KulexiuForStudent/KulexiuForStudent/Common/Tools/Custom/GRCreateManager.h → KulexiuForStudent/KulexiuForStudent/ToolKit/KSToolLibrary.framework/Headers/GRCreateManager.h


+ 0 - 0
KulexiuForStudent/KulexiuForStudent/Common/Tools/Custom/GRScanManager.h → KulexiuForStudent/KulexiuForStudent/ToolKit/KSToolLibrary.framework/Headers/GRScanManager.h


+ 1 - 0
KulexiuForStudent/KulexiuForStudent/ToolKit/KSToolLibrary.framework/Headers/NSString+Extension.h

@@ -35,6 +35,7 @@ typedef NS_ENUM(NSInteger,CHECKTYPE){
 - (NSString *)getUrlEndcodeString;
 // 移除endcodeing
 - (NSString *)removeUrlEndcodeString;
+
 // 获取保存文件名
 - (NSString *)getUrlFileName;
 /**

BIN
KulexiuForStudent/KulexiuForStudent/ToolKit/KSToolLibrary.framework/KSToolLibrary