Commit 0f819d70fa58647cdd5c15a34577045cbe20324a
1 parent
93404f71
no message
Showing
5 changed files
with
369 additions
and
372 deletions
CNLiveBUserAgreement.podspec
| ... | ... | @@ -8,7 +8,7 @@ |
| 8 | 8 | |
| 9 | 9 | Pod::Spec.new do |s| |
| 10 | 10 | s.name = 'CNLiveBUserAgreement' |
| 11 | - s.version = '0.0.3' | |
| 11 | + s.version = '0.0.4' | |
| 12 | 12 | s.summary = 'CNLiveBUserAgreement.' |
| 13 | 13 | |
| 14 | 14 | # This description is used to generate tags and improve search results. |
| ... | ... | @@ -53,7 +53,7 @@ TODO: 网家家企业端-用户协议. |
| 53 | 53 | s.dependency 'CNLiveManager' |
| 54 | 54 | |
| 55 | 55 | # 基类 |
| 56 | - s.dependency 'CNLiveBaseClass' | |
| 56 | +# s.dependency 'CNLiveBaseClass' | |
| 57 | 57 | |
| 58 | 58 | # 相册 |
| 59 | 59 | s.dependency 'CNLiveImagePickerController' | ... | ... |
CNLiveBUserAgreement/Classes/CNLiveUserAgreementController.h
| ... | ... | @@ -6,11 +6,13 @@ |
| 6 | 6 | // Copyright (c) 2019 153993236@qq.com. All rights reserved. |
| 7 | 7 | // |
| 8 | 8 | |
| 9 | -#import "CNLiveInteractionWebController.h" | |
| 9 | +//#import "CNLiveInteractionWebController.h" | |
| 10 | +#import <UIKit/UIKit.h> | |
| 10 | 11 | |
| 11 | 12 | NS_ASSUME_NONNULL_BEGIN |
| 12 | 13 | |
| 13 | -@interface CNLiveUserAgreementController : CNLiveInteractionWebController | |
| 14 | +//@interface CNLiveUserAgreementController : CNLiveInteractionWebController | |
| 15 | +@interface CNLiveUserAgreementController : UIViewController | |
| 14 | 16 | |
| 15 | 17 | |
| 16 | 18 | @end | ... | ... |
CNLiveBUserAgreement/Classes/CNLiveUserAgreementController.m
| ... | ... | @@ -7,26 +7,27 @@ |
| 7 | 7 | // |
| 8 | 8 | |
| 9 | 9 | #import "CNLiveUserAgreementController.h" |
| 10 | -#import "QMUIKit.h" | |
| 11 | -#import "WKWebViewJavascriptBridge.h" | |
| 12 | -#import "QNUploadManager.h" | |
| 13 | -#import "QNResponseInfo.h" | |
| 14 | - | |
| 15 | -#import <AVFoundation/AVCaptureDevice.h> | |
| 16 | -#import <AVFoundation/AVMediaFormat.h> | |
| 17 | -#import "XFCameraController.h" | |
| 18 | -#import "TZImagePickerController.h" | |
| 19 | -#import <CNLiveRequestBastKit/CNLiveNetworking.h> | |
| 20 | -#import "CNLiveManager.h" | |
| 21 | -#import "CNLiveEnvironment.h" | |
| 22 | -#import "CNLiveBusinessTools.h" | |
| 23 | -#import "CNLiveTimeTools.h" | |
| 24 | -#import "CNLiveCommonCategory.h" | |
| 25 | -#import "CNUserInfoManager.h" | |
| 10 | +//#import "QMUIKit.h" | |
| 11 | +////#import "WKWebViewJavascriptBridge.h" | |
| 12 | +//#import "QNUploadManager.h" | |
| 13 | +//#import "QNResponseInfo.h" | |
| 14 | +// | |
| 15 | +//#import <AVFoundation/AVCaptureDevice.h> | |
| 16 | +//#import <AVFoundation/AVMediaFormat.h> | |
| 17 | +//#import "XFCameraController.h" | |
| 18 | +//#import "TZImagePickerController.h" | |
| 19 | +//#import <CNLiveRequestBastKit/CNLiveNetworking.h> | |
| 20 | +//#import "CNLiveManager.h" | |
| 21 | +//#import "CNLiveEnvironment.h" | |
| 22 | +//#import "CNLiveBusinessTools.h" | |
| 23 | +//#import "CNLiveTimeTools.h" | |
| 24 | +//#import "CNLiveCommonCategory.h" | |
| 25 | +//#import "CNUserInfoManager.h" | |
| 26 | 26 | |
| 27 | -#import "CNLiveWebView.h" | |
| 27 | +//#import "CNLiveWebView.h" | |
| 28 | 28 | |
| 29 | -@interface CNLiveUserAgreementController ()<UIImagePickerControllerDelegate,UINavigationControllerDelegate,TZImagePickerControllerDelegate> | |
| 29 | +//@interface CNLiveUserAgreementController ()<UIImagePickerControllerDelegate,UINavigationControllerDelegate,TZImagePickerControllerDelegate> | |
| 30 | +@interface CNLiveUserAgreementController () | |
| 30 | 31 | @property (nonatomic, strong) NSMutableArray *images; |
| 31 | 32 | @property (nonatomic, strong) NSMutableArray *pics; |
| 32 | 33 | |
| ... | ... | @@ -42,353 +43,353 @@ |
| 42 | 43 | #define OCSendNetStatusToJS @"OCSendNetStatusToJS" //网络状态变化信息 |
| 43 | 44 | #define wjjSubmitSuccess @"wjjSubmitSuccess" //帮助与反馈->产品建议:App->h5图片urls |
| 44 | 45 | |
| 45 | -- (void)createSubViews { | |
| 46 | - [super createSubViews]; | |
| 47 | - UIColor *color = [UIColor colorWithRed:72/255.0 green:168/255.0 blue:249/255.0 alpha:1.0]; | |
| 48 | - self.webView.progressViewColor = color; | |
| 49 | -} | |
| 46 | +//- (void)createSubViews { | |
| 47 | +// [super createSubViews]; | |
| 48 | +// UIColor *color = [UIColor colorWithRed:72/255.0 green:168/255.0 blue:249/255.0 alpha:1.0]; | |
| 49 | +// self.webView.progressViewColor = color; | |
| 50 | +//} | |
| 50 | 51 | #pragma mark - 交互 |
| 51 | -- (void)interaction { | |
| 52 | - [super interaction]; | |
| 53 | - __weak typeof(self)weakSelf = self; | |
| 54 | - | |
| 55 | - // 帮助与反馈->产品建议:添加照片按钮 | |
| 56 | - [self.bridge registerHandler:wjjHelpAndFeedbackImage handler:^(id data, WVJBResponseCallback responseCallback) { | |
| 57 | - NSLog(@"ObjC Echo called with: %@", data); | |
| 58 | - [weakSelf uploadPictures]; | |
| 59 | - responseCallback(data); | |
| 60 | - }]; | |
| 61 | - | |
| 62 | - // 帮助与反馈->产品建议:删除照片 | |
| 63 | - [self.bridge registerHandler:wjjDelegateImage handler:^(id data, WVJBResponseCallback responseCallback) { | |
| 64 | - NSLog(@"ObjC Echo called with: %@", data); | |
| 65 | - if ([data isKindOfClass:[NSDictionary class]]) { | |
| 66 | - NSString *index = [data objectForKey:@"index"]; | |
| 67 | - [weakSelf.images removeObjectAtIndex:[index integerValue]]; | |
| 68 | - } | |
| 69 | - responseCallback(data); | |
| 70 | - }]; | |
| 71 | - | |
| 72 | - //帮助与反馈->产品建议:点击提交 | |
| 73 | - [self.bridge registerHandler:wjjSubmitImage handler:^(id data, WVJBResponseCallback responseCallback) { | |
| 74 | - NSLog(@"ObjC Echo called with: %@", data); | |
| 75 | - NSString *text = @""; | |
| 76 | - NSString *mobile = @""; | |
| 77 | - NSString *modeltype = @""; | |
| 78 | - if ([data isKindOfClass:[NSDictionary class]]) { | |
| 79 | - text = [data objectForKey:@"text"]; | |
| 80 | - mobile = [data objectForKey:@"mobile"]; | |
| 81 | - modeltype = [data objectForKey:@"modeltype"]; | |
| 82 | - } | |
| 83 | - if (weakSelf.images.count > 0) { | |
| 84 | - [weakSelf getToken]; | |
| 85 | - } else { | |
| 86 | - NSArray *array = [NSArray array]; | |
| 87 | - id data = @{ @"images": array }; | |
| 88 | - [QMUITips showLoading:@"正在提交" inView:weakSelf.view]; | |
| 89 | - // 帮助与反馈->产品建议App->h5图片urls | |
| 90 | - [weakSelf.bridge callHandler:wjjSubmitSuccess data:data responseCallback:^(id responseData) { | |
| 91 | - NSLog(@"ObjC received response: %@", responseData); | |
| 92 | - }]; | |
| 93 | - } | |
| 94 | - responseCallback(data); | |
| 95 | - }]; | |
| 96 | - | |
| 97 | - // 反馈提交(成功/失败)后隐藏loading | |
| 98 | - [self.bridge registerHandler:wjjSubmitSuccessFinal handler:^(id data, WVJBResponseCallback responseCallback) { | |
| 99 | - NSLog(@"ObjC Echo called with: %@", data); | |
| 100 | - [QMUITips hideAllTipsInView:weakSelf.view]; | |
| 101 | - responseCallback(data); | |
| 102 | - }]; | |
| 103 | - | |
| 104 | - // 帮助与反馈 提交反馈后点击完成 | |
| 105 | - [self.bridge registerHandler:wjjFeedbackSuccess handler:^(id data, WVJBResponseCallback responseCallback) { | |
| 106 | - NSLog(@"ObjC Echo called with: %@", data); | |
| 107 | - [weakSelf.navigationController popViewControllerAnimated:YES]; | |
| 108 | - responseCallback(data); | |
| 109 | - }]; | |
| 110 | - | |
| 111 | - // h5主动从客户端获取网络状态 | |
| 112 | - [self.bridge registerHandler:wjjJSGetNetStatusFromClient handler:^(id data, WVJBResponseCallback responseCallback) { | |
| 113 | - NSLog(@"ObjC Echo called with: %@", data); | |
| 114 | - // 向h5传递网路状态信息 | |
| 115 | - NSInteger networkStatus = 0; | |
| 116 | - if (![CNLiveNetworking isNetworking]) { | |
| 117 | - networkStatus = 0; | |
| 118 | - } | |
| 119 | - else if ([CNLiveNetworking isWWANNetwork]) { | |
| 120 | - networkStatus = 1; | |
| 121 | - } | |
| 122 | - else if ([CNLiveNetworking isWiFiNetwork]) { | |
| 123 | - networkStatus = 2; | |
| 124 | - } | |
| 125 | - id answerData = @{ @"netStatus": [NSString stringWithFormat:@"%ld",(long)networkStatus] }; | |
| 126 | - [weakSelf.bridge callHandler:OCSendNetStatusToJS data:answerData responseCallback:^(id responseData) { | |
| 127 | - NSLog(@"ObjC received response: %@", responseData); | |
| 128 | - }]; | |
| 129 | - responseCallback(data); | |
| 130 | - }]; | |
| 131 | -} | |
| 52 | +//- (void)interaction { | |
| 53 | +// [super interaction]; | |
| 54 | +// __weak typeof(self)weakSelf = self; | |
| 55 | +// | |
| 56 | +// // 帮助与反馈->产品建议:添加照片按钮 | |
| 57 | +// [self.bridge registerHandler:wjjHelpAndFeedbackImage handler:^(id data, WVJBResponseCallback responseCallback) { | |
| 58 | +// NSLog(@"ObjC Echo called with: %@", data); | |
| 59 | +// [weakSelf uploadPictures]; | |
| 60 | +// responseCallback(data); | |
| 61 | +// }]; | |
| 62 | +// | |
| 63 | +// // 帮助与反馈->产品建议:删除照片 | |
| 64 | +// [self.bridge registerHandler:wjjDelegateImage handler:^(id data, WVJBResponseCallback responseCallback) { | |
| 65 | +// NSLog(@"ObjC Echo called with: %@", data); | |
| 66 | +// if ([data isKindOfClass:[NSDictionary class]]) { | |
| 67 | +// NSString *index = [data objectForKey:@"index"]; | |
| 68 | +// [weakSelf.images removeObjectAtIndex:[index integerValue]]; | |
| 69 | +// } | |
| 70 | +// responseCallback(data); | |
| 71 | +// }]; | |
| 72 | +// | |
| 73 | +// //帮助与反馈->产品建议:点击提交 | |
| 74 | +// [self.bridge registerHandler:wjjSubmitImage handler:^(id data, WVJBResponseCallback responseCallback) { | |
| 75 | +// NSLog(@"ObjC Echo called with: %@", data); | |
| 76 | +// NSString *text = @""; | |
| 77 | +// NSString *mobile = @""; | |
| 78 | +// NSString *modeltype = @""; | |
| 79 | +// if ([data isKindOfClass:[NSDictionary class]]) { | |
| 80 | +// text = [data objectForKey:@"text"]; | |
| 81 | +// mobile = [data objectForKey:@"mobile"]; | |
| 82 | +// modeltype = [data objectForKey:@"modeltype"]; | |
| 83 | +// } | |
| 84 | +// if (weakSelf.images.count > 0) { | |
| 85 | +// [weakSelf getToken]; | |
| 86 | +// } else { | |
| 87 | +// NSArray *array = [NSArray array]; | |
| 88 | +// id data = @{ @"images": array }; | |
| 89 | +// [QMUITips showLoading:@"正在提交" inView:weakSelf.view]; | |
| 90 | +// // 帮助与反馈->产品建议App->h5图片urls | |
| 91 | +// [weakSelf.bridge callHandler:wjjSubmitSuccess data:data responseCallback:^(id responseData) { | |
| 92 | +// NSLog(@"ObjC received response: %@", responseData); | |
| 93 | +// }]; | |
| 94 | +// } | |
| 95 | +// responseCallback(data); | |
| 96 | +// }]; | |
| 97 | +// | |
| 98 | +// // 反馈提交(成功/失败)后隐藏loading | |
| 99 | +// [self.bridge registerHandler:wjjSubmitSuccessFinal handler:^(id data, WVJBResponseCallback responseCallback) { | |
| 100 | +// NSLog(@"ObjC Echo called with: %@", data); | |
| 101 | +// [QMUITips hideAllTipsInView:weakSelf.view]; | |
| 102 | +// responseCallback(data); | |
| 103 | +// }]; | |
| 104 | +// | |
| 105 | +// // 帮助与反馈 提交反馈后点击完成 | |
| 106 | +// [self.bridge registerHandler:wjjFeedbackSuccess handler:^(id data, WVJBResponseCallback responseCallback) { | |
| 107 | +// NSLog(@"ObjC Echo called with: %@", data); | |
| 108 | +// [weakSelf.navigationController popViewControllerAnimated:YES]; | |
| 109 | +// responseCallback(data); | |
| 110 | +// }]; | |
| 111 | +// | |
| 112 | +// // h5主动从客户端获取网络状态 | |
| 113 | +// [self.bridge registerHandler:wjjJSGetNetStatusFromClient handler:^(id data, WVJBResponseCallback responseCallback) { | |
| 114 | +// NSLog(@"ObjC Echo called with: %@", data); | |
| 115 | +// // 向h5传递网路状态信息 | |
| 116 | +// NSInteger networkStatus = 0; | |
| 117 | +// if (![CNLiveNetworking isNetworking]) { | |
| 118 | +// networkStatus = 0; | |
| 119 | +// } | |
| 120 | +// else if ([CNLiveNetworking isWWANNetwork]) { | |
| 121 | +// networkStatus = 1; | |
| 122 | +// } | |
| 123 | +// else if ([CNLiveNetworking isWiFiNetwork]) { | |
| 124 | +// networkStatus = 2; | |
| 125 | +// } | |
| 126 | +// id answerData = @{ @"netStatus": [NSString stringWithFormat:@"%ld",(long)networkStatus] }; | |
| 127 | +// [weakSelf.bridge callHandler:OCSendNetStatusToJS data:answerData responseCallback:^(id responseData) { | |
| 128 | +// NSLog(@"ObjC received response: %@", responseData); | |
| 129 | +// }]; | |
| 130 | +// responseCallback(data); | |
| 131 | +// }]; | |
| 132 | +//} | |
| 132 | 133 | |
| 133 | 134 | #pragma mark - Setter方法 |
| 134 | -- (void)setUrl:(NSString *)url{ | |
| 135 | - if(!url||[url isEqualToString:@""]) return; | |
| 136 | - | |
| 137 | - NSString *shortVersion = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]; | |
| 138 | - NSDictionary *params = @{ | |
| 139 | - @"appId":AppId?AppId:@"", | |
| 140 | - @"plat":@"i", | |
| 141 | - @"sid":CNUserShareModel.uid?CNUserShareModel.uid:@"", | |
| 142 | - @"version":shortVersion?shortVersion:@"", | |
| 143 | - @"wjjFrom":@"apple", | |
| 144 | - @"wjjUUID":[CNLiveBusinessTools getUidForStat:[NSDate date]]?[CNLiveBusinessTools getUidForStat:[NSDate date]]:@"", | |
| 145 | - }; | |
| 146 | - NSMutableDictionary *para = [CNLiveBusinessTools encryptionSignWithParameter:[NSMutableDictionary dictionaryWithDictionary:params] encryptionKey:APPKey]; | |
| 147 | - __block NSMutableString * tempString = [[NSMutableString alloc] init]; | |
| 148 | - [para enumerateKeysAndObjectsUsingBlock:^(NSString * _Nonnull key, NSString * _Nonnull value, BOOL * _Nonnull stop) { | |
| 149 | - [tempString appendFormat:@"%@=%@&",key,value]; | |
| 150 | - }]; | |
| 151 | - if ([url componentsSeparatedByString:@"?"].count>1) { | |
| 152 | - url = [NSString stringWithFormat:@"%@&%@",url,[tempString substringToIndex:tempString.length-1]]; | |
| 153 | - }else{ | |
| 154 | - url = [NSString stringWithFormat:@"%@?%@",url,[tempString substringToIndex:tempString.length-1]]; | |
| 155 | - } | |
| 156 | - [super setUrl:url]; | |
| 157 | - | |
| 158 | -} | |
| 159 | - | |
| 160 | -#pragma mark - CNLiveWebViewDelegate | |
| 161 | -- (void)webView:(CNLiveWebView *)webView didFinishLoadWithURL:(NSURL *)url { | |
| 162 | - if(self.title.length == 0){ | |
| 163 | - self.title = webView.title; | |
| 164 | - } | |
| 165 | -} | |
| 135 | +//- (void)setUrl:(NSString *)url{ | |
| 136 | +// if(!url||[url isEqualToString:@""]) return; | |
| 137 | +// | |
| 138 | +// NSString *shortVersion = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]; | |
| 139 | +// NSDictionary *params = @{ | |
| 140 | +// @"appId":AppId?AppId:@"", | |
| 141 | +// @"plat":@"i", | |
| 142 | +// @"sid":CNUserShareModel.uid?CNUserShareModel.uid:@"", | |
| 143 | +// @"version":shortVersion?shortVersion:@"", | |
| 144 | +// @"wjjFrom":@"apple", | |
| 145 | +// @"wjjUUID":[CNLiveBusinessTools getUidForStat:[NSDate date]]?[CNLiveBusinessTools getUidForStat:[NSDate date]]:@"", | |
| 146 | +// }; | |
| 147 | +// NSMutableDictionary *para = [CNLiveBusinessTools encryptionSignWithParameter:[NSMutableDictionary dictionaryWithDictionary:params] encryptionKey:APPKey]; | |
| 148 | +// __block NSMutableString * tempString = [[NSMutableString alloc] init]; | |
| 149 | +// [para enumerateKeysAndObjectsUsingBlock:^(NSString * _Nonnull key, NSString * _Nonnull value, BOOL * _Nonnull stop) { | |
| 150 | +// [tempString appendFormat:@"%@=%@&",key,value]; | |
| 151 | +// }]; | |
| 152 | +// if ([url componentsSeparatedByString:@"?"].count>1) { | |
| 153 | +// url = [NSString stringWithFormat:@"%@&%@",url,[tempString substringToIndex:tempString.length-1]]; | |
| 154 | +// }else{ | |
| 155 | +// url = [NSString stringWithFormat:@"%@?%@",url,[tempString substringToIndex:tempString.length-1]]; | |
| 156 | +// } | |
| 157 | +//// [super setUrl:url]; | |
| 158 | +// | |
| 159 | +//} | |
| 166 | 160 | |
| 167 | -- (void)webView:(CNLiveWebView *)webView didFailLoadWithError:(NSError *)error { | |
| 168 | - | |
| 169 | -} | |
| 161 | +//#pragma mark - CNLiveWebViewDelegate | |
| 162 | +//- (void)webView:(CNLiveWebView *)webView didFinishLoadWithURL:(NSURL *)url { | |
| 163 | +// if(self.title.length == 0){ | |
| 164 | +// self.title = webView.title; | |
| 165 | +// } | |
| 166 | +//} | |
| 167 | +// | |
| 168 | +//- (void)webView:(CNLiveWebView *)webView didFailLoadWithError:(NSError *)error { | |
| 169 | +// | |
| 170 | +//} | |
| 170 | 171 | |
| 171 | 172 | #pragma mark - 添加图片 |
| 172 | -- (void)uploadPictures{ | |
| 173 | - __weak typeof(self) weakSelf = self; | |
| 174 | - QMUIAlertAction *action1 = [QMUIAlertAction actionWithTitle:@"拍照" style:QMUIAlertActionStyleDefault handler:^(__kindof QMUIAlertController *aAlertController, QMUIAlertAction *action) { | |
| 175 | - __strong typeof(weakSelf) strongSelf = weakSelf; | |
| 176 | - if(!strongSelf) return ; | |
| 177 | - __strong typeof(strongSelf) weakSelf = strongSelf; | |
| 178 | - [CNLiveAuthorizationManager getAVAuthorizationStatus:^{ | |
| 179 | - __strong typeof(weakSelf) strongSelf = weakSelf; | |
| 180 | - if(!strongSelf) return ; | |
| 181 | - XFCameraController *cameraController = [[XFCameraController alloc] init]; | |
| 182 | - cameraController.isCanShootVideo = NO; | |
| 183 | - cameraController.modalPresentationStyle = UIModalPresentationFullScreen; | |
| 184 | - __weak XFCameraController *weakCameraController = cameraController; | |
| 185 | - __weak typeof(strongSelf) weakSelf = strongSelf; | |
| 186 | - cameraController.takePhotosCompletionBlock = ^(UIImage *image, NSError *error) { | |
| 187 | - __strong typeof(weakSelf) strongSelf = weakSelf; | |
| 188 | - if(!strongSelf) return ; | |
| 189 | - [strongSelf handleImage:image]; | |
| 190 | -// [strongSelf.images addObject:image]; | |
| 191 | - dispatch_async(dispatch_get_main_queue(), ^{ | |
| 192 | - [weakCameraController dismissViewControllerAnimated:YES completion:nil]; | |
| 193 | - }); | |
| 194 | - }; | |
| 195 | - [strongSelf presentViewController:cameraController animated:YES completion:nil]; | |
| 196 | - }]; | |
| 197 | - | |
| 198 | - }]; | |
| 199 | - QMUIAlertAction *action2 = [QMUIAlertAction actionWithTitle:@"从手机相册中选择" style:QMUIAlertActionStyleDefault handler:^(__kindof QMUIAlertController *aAlertController, QMUIAlertAction *action) { | |
| 200 | - __strong typeof(weakSelf) strongSelf = weakSelf; | |
| 201 | - if(!strongSelf) return ; | |
| 202 | - __strong typeof(strongSelf) weakSelf = strongSelf; | |
| 203 | - [CNLiveAuthorizationManager getPHAuthorizationStatus:^{ | |
| 204 | - __strong typeof(weakSelf) strongSelf = weakSelf; | |
| 205 | - if(!strongSelf) return ; | |
| 206 | - TZImagePickerController *picker = [[TZImagePickerController alloc] initWithMaxImagesCount:1 delegate:strongSelf]; | |
| 207 | - picker.modalPresentationStyle = UIModalPresentationFullScreen; | |
| 208 | - picker.allowPickingVideo = NO; | |
| 209 | - picker.allowPreview = NO; | |
| 210 | - __weak typeof(strongSelf) weakSelf = strongSelf; | |
| 211 | - [picker setDidFinishPickingPhotosHandle:^(NSArray<UIImage *> *photos, NSArray *assets, BOOL isSelectOriginalPhoto) { | |
| 212 | - __strong typeof(weakSelf) strongSelf = weakSelf; | |
| 213 | - if(!strongSelf) return ; | |
| 214 | - [strongSelf handleImage:[photos firstObject]]; | |
| 215 | -// [strongSelf.images addObject:[photos firstObject]]; | |
| 216 | - }]; | |
| 217 | - [strongSelf presentViewController:picker animated:YES completion:nil]; | |
| 218 | - }]; | |
| 219 | - | |
| 220 | - }]; | |
| 221 | - QMUIAlertAction *cancel = [QMUIAlertAction actionWithTitle:@"取消" style:QMUIAlertActionStyleCancel handler:^(__kindof QMUIAlertController *aAlertController, QMUIAlertAction *action) { | |
| 222 | - __strong typeof(weakSelf) strongSelf = weakSelf; | |
| 223 | - if(!strongSelf) return ; | |
| 224 | - | |
| 225 | - }]; | |
| 226 | - | |
| 227 | - QMUIAlertController *alertController = [QMUIAlertController alertControllerWithTitle:@"" message:@"" preferredStyle:QMUIAlertControllerStyleActionSheet]; | |
| 228 | - [alertController addAction:action1]; | |
| 229 | - [alertController addAction:action2]; | |
| 230 | - [alertController addAction:cancel]; | |
| 231 | - | |
| 232 | - NSMutableDictionary *titleAttributs = [[NSMutableDictionary alloc] initWithDictionary:alertController.alertTitleAttributes]; | |
| 233 | - titleAttributs[NSForegroundColorAttributeName] = [UIColor colorWithRed:72/255.0 green:168/255.0 blue:249/255.0 alpha:1.0]; | |
| 234 | - | |
| 235 | - NSMutableDictionary *cancelAttributs = [[NSMutableDictionary alloc] initWithDictionary:alertController.alertTitleAttributes]; | |
| 236 | - cancelAttributs[NSForegroundColorAttributeName] = [UIColor colorWithRed:51/255.0 green:51/255.0 blue:51/255.0 alpha:1.0]; | |
| 237 | - | |
| 238 | - action1.buttonAttributes = titleAttributs; | |
| 239 | - action2.buttonAttributes = titleAttributs; | |
| 240 | - cancel.buttonAttributes = cancelAttributs; | |
| 241 | - | |
| 242 | - [alertController showWithAnimated:YES]; | |
| 243 | - | |
| 244 | -} | |
| 245 | - | |
| 246 | -- (void)handleImage:(UIImage *)image { | |
| 247 | - // 固定方向 | |
| 248 | - image = [image fixOrientation];//这个方法是UIImage+Extras.h中方法 | |
| 249 | - // 加入数组 | |
| 250 | - [self.images addObject:image]; | |
| 251 | - NSData *imageData = [UIImage zipNSDataWithImage:image]; | |
| 252 | - if (imageData.length > 20*1024.0*1024.0) {//压缩后大于20M | |
| 253 | - [QMUITips showError:@"图片过大" inView:self.view hideAfterDelay:1.5]; | |
| 254 | - return; | |
| 255 | - } | |
| 256 | - NSString *imageString = [imageData base64EncodedStringWithOptions:0]; | |
| 257 | - imageString = [self removeSpaceAndNewline:imageString]; | |
| 258 | - id dataDic = @{ | |
| 259 | - @"image" : imageString | |
| 260 | - }; | |
| 261 | - // 帮助与反馈->产品建议:App提交图片数据给h5展示 | |
| 262 | - [self.bridge callHandler:@"wjjCommitImageToJS" data:dataDic responseCallback:^(id responseData) { | |
| 263 | - NSLog(@"ObjC received response: %@", responseData); | |
| 264 | - }]; | |
| 265 | - | |
| 266 | -} | |
| 267 | - | |
| 268 | -// 获取图片的token | |
| 269 | -- (void)getToken { | |
| 270 | - NSDictionary *param = @{@"appId":AppId, | |
| 271 | - @"verb":@"POST", | |
| 272 | - @"storageType":@"2", | |
| 273 | - @"bucket":API_BucketName | |
| 274 | - }; | |
| 275 | - [QMUITips showLoading:@"正在提交" inView:self.view]; | |
| 276 | - [CNLiveNetworking setAllowRequestDefaultArgument:NO]; | |
| 277 | - [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodPOST URLString:CNUploadAuthForApp Param:param CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) { | |
| 278 | - NSMutableDictionary *data = [NSMutableDictionary dictionaryWithDictionary:responseObject[@"data"]]; | |
| 279 | - NSDictionary *dic = (NSDictionary *)data; | |
| 280 | - if (!error && dic[@"token"]) { | |
| 281 | - [self QNStartUploadWithtoken:dic[@"token"]]; | |
| 282 | - }else { | |
| 283 | - [QMUITips hideAllToastInView:self.view animated:YES]; | |
| 284 | - [QMUITips showError:error.localizedDescription inView:self.view hideAfterDelay:1.5]; | |
| 285 | - } | |
| 286 | - }]; | |
| 287 | -} | |
| 288 | - | |
| 289 | -// 图片开始上传 | |
| 290 | -- (void)QNStartUploadWithtoken:(NSString *)token { | |
| 291 | - __weak typeof(self) weakSelf = self; | |
| 292 | - // 图片视频压缩(LXG) | |
| 293 | - [_images enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { | |
| 294 | - if (!weakSelf.images[idx]) { | |
| 295 | - [QMUITips hideAllToastInView:self.view animated:YES]; | |
| 296 | - [QMUITips showError:@"提交失败" inView:self.view hideAfterDelay:1.5]; | |
| 297 | - return; | |
| 298 | - } | |
| 299 | - NSData *zipData = [UIImage zipNSDataWithImage:weakSelf.images[idx]];//非原图压缩 | |
| 300 | - if (zipData.length > 20*1024.0*1024.0) {//压缩后大于20M | |
| 301 | - [QMUITips hideAllToastInView:self.view animated:YES]; | |
| 302 | - [QMUITips showError:@"图片过大" inView:self.view hideAfterDelay:1.5]; | |
| 303 | - return; | |
| 304 | - }else{ | |
| 305 | - weakSelf.images[idx] = [UIImage imageWithData:zipData]; | |
| 306 | - } | |
| 307 | - | |
| 308 | - }]; | |
| 309 | - | |
| 310 | - NSMutableDictionary *picDict = [NSMutableDictionary dictionaryWithCapacity:_images.count]; | |
| 311 | - NSMutableArray *keyArr = [NSMutableArray arrayWithCapacity:_images.count]; | |
| 312 | - self.pics = [NSMutableArray arrayWithCapacity:_images.count]; | |
| 313 | - for (int i = 0; i < _images.count; i++) { | |
| 314 | - @autoreleasepool { | |
| 315 | - UIImage *image = _images[i]; | |
| 316 | - __block NSData *imageData1 = UIImageJPEGRepresentation(image, 1); | |
| 317 | - NSString *timeTampStr = [CNLiveTimeTools get13tsRandTimeStr]; | |
| 318 | - // NSString *mineType = @"image/jpeg"; | |
| 319 | - NSString *qiniuFileName; | |
| 320 | - qiniuFileName = [NSString stringWithFormat:@"%@/%@.jpg",[self getImageBuketkeyFromServerWithExt], timeTampStr]; | |
| 321 | - QNUploadManager *uploadManager = [QNUploadManager sharedInstanceWithConfiguration:nil]; | |
| 322 | - [uploadManager putData:imageData1 key:qiniuFileName token:token complete:^(QNResponseInfo *info, NSString *key, NSDictionary *resp) { | |
| 323 | - if (info.ok) { | |
| 324 | - NSString *imageUrl = [NSString stringWithFormat:@"%@%@",API_PhotoUrl,key]; | |
| 325 | - [picDict setObject:imageUrl ? imageUrl: @"" forKey:@"imageUrl"]; | |
| 326 | - [picDict setObject:[NSString stringWithFormat:@"%.0f",image.size.width] forKey:@"imageWidth"]; | |
| 327 | - [picDict setObject:[NSString stringWithFormat:@"%.0f",image.size.height] forKey:@"imageHeight"]; | |
| 328 | - [keyArr addObject:key]; | |
| 329 | - NSMutableDictionary *dict = [[NSMutableDictionary alloc]initWithDictionary:picDict]; | |
| 330 | - [self.pics addObject:dict]; | |
| 331 | - | |
| 332 | - if (keyArr.count == weakSelf.images.count) { | |
| 333 | - id imagesArrData = @{ @"images": self.pics.copy }; | |
| 334 | - [weakSelf.images removeAllObjects]; | |
| 335 | - // 帮助与反馈->产品建议App->h5图片urls | |
| 336 | - [self.bridge callHandler:wjjSubmitSuccess data:imagesArrData responseCallback:^(id responseData) { | |
| 337 | - NSLog(@"ObjC received response: %@", responseData); | |
| 338 | - }]; | |
| 339 | - } | |
| 340 | - } else if (info.broken) { | |
| 341 | - [QMUITips hideAllToastInView:self.view animated:YES]; | |
| 342 | - [QMUITips showError:@"网络连接已断开" inView:self.view hideAfterDelay:1.5]; | |
| 343 | - return ; | |
| 344 | - } else { | |
| 345 | - [QMUITips hideAllToastInView:self.view animated:YES]; | |
| 346 | - [QMUITips showError:info.error.localizedDescription inView:self.view hideAfterDelay:1.5]; | |
| 347 | - return ; | |
| 348 | - } | |
| 349 | - } option:nil]; | |
| 350 | - } | |
| 351 | - } | |
| 352 | - | |
| 353 | -} | |
| 354 | - | |
| 355 | -// 图片转成base64字符串需要先取出所有空格和换行符 | |
| 356 | -- (NSString *)removeSpaceAndNewline:(NSString *)str{ | |
| 357 | - NSString *temp = [str stringByReplacingOccurrencesOfString:@" " withString:@""]; | |
| 358 | - temp = [temp stringByReplacingOccurrencesOfString:@"\r" withString:@""]; | |
| 359 | - temp = [temp stringByReplacingOccurrencesOfString:@"\n" withString:@""]; | |
| 360 | - return temp; | |
| 361 | -} | |
| 362 | - | |
| 363 | -// 图片的BucketKey,BuketKey为文件路径 | |
| 364 | -- (NSString *)getImageBuketkeyFromServerWithExt{ | |
| 365 | - NSString *spid = [CNLiveBusinessTools getSpid]; | |
| 366 | - NSString *imgBucketKey = [NSString stringWithFormat:@"%@/img", spid]; | |
| 367 | - NSString *yearTime = [CNLiveTimeTools getyyMMdd]; | |
| 368 | - NSString *bucketKey = [NSString stringWithFormat:@"%@/%@",imgBucketKey,yearTime]; | |
| 369 | - return bucketKey; | |
| 370 | - | |
| 371 | -} | |
| 372 | - | |
| 373 | -- (NSData *)image_TransForm_Data:(UIImage *)image{ | |
| 374 | - NSData *imageData = UIImageJPEGRepresentation(image, 0.5); | |
| 375 | - //几乎是按0.5图片大小就降到原来的一半 | |
| 376 | - return imageData; | |
| 377 | -} | |
| 378 | - | |
| 379 | -//压缩图片质量 | |
| 380 | --(UIImage *)reduceImage:(UIImage *)image percent:(float)percent{ | |
| 381 | - NSData *imageData = UIImageJPEGRepresentation(image, percent); | |
| 382 | - UIImage *newImage = [UIImage imageWithData:imageData]; | |
| 383 | - return newImage; | |
| 384 | -} | |
| 385 | -//压缩图片尺寸 | |
| 386 | -- (UIImage*)imageWithImageSimple:(UIImage*)image scaledToSize:(CGSize)newSize{ | |
| 387 | - UIGraphicsBeginImageContext(newSize); | |
| 388 | - [image drawInRect:CGRectMake(0,0,newSize.width,newSize.height)]; | |
| 389 | - UIImage* newImage = UIGraphicsGetImageFromCurrentImageContext(); | |
| 390 | - UIGraphicsEndImageContext(); | |
| 391 | - return newImage; | |
| 392 | -} | |
| 173 | +//- (void)uploadPictures{ | |
| 174 | +// __weak typeof(self) weakSelf = self; | |
| 175 | +// QMUIAlertAction *action1 = [QMUIAlertAction actionWithTitle:@"拍照" style:QMUIAlertActionStyleDefault handler:^(__kindof QMUIAlertController *aAlertController, QMUIAlertAction *action) { | |
| 176 | +// __strong typeof(weakSelf) strongSelf = weakSelf; | |
| 177 | +// if(!strongSelf) return ; | |
| 178 | +// __strong typeof(strongSelf) weakSelf = strongSelf; | |
| 179 | +// [CNLiveAuthorizationManager getAVAuthorizationStatus:^{ | |
| 180 | +// __strong typeof(weakSelf) strongSelf = weakSelf; | |
| 181 | +// if(!strongSelf) return ; | |
| 182 | +// XFCameraController *cameraController = [[XFCameraController alloc] init]; | |
| 183 | +// cameraController.isCanShootVideo = NO; | |
| 184 | +// cameraController.modalPresentationStyle = UIModalPresentationFullScreen; | |
| 185 | +// __weak XFCameraController *weakCameraController = cameraController; | |
| 186 | +// __weak typeof(strongSelf) weakSelf = strongSelf; | |
| 187 | +// cameraController.takePhotosCompletionBlock = ^(UIImage *image, NSError *error) { | |
| 188 | +// __strong typeof(weakSelf) strongSelf = weakSelf; | |
| 189 | +// if(!strongSelf) return ; | |
| 190 | +// [strongSelf handleImage:image]; | |
| 191 | +//// [strongSelf.images addObject:image]; | |
| 192 | +// dispatch_async(dispatch_get_main_queue(), ^{ | |
| 193 | +// [weakCameraController dismissViewControllerAnimated:YES completion:nil]; | |
| 194 | +// }); | |
| 195 | +// }; | |
| 196 | +// [strongSelf presentViewController:cameraController animated:YES completion:nil]; | |
| 197 | +// }]; | |
| 198 | +// | |
| 199 | +// }]; | |
| 200 | +// QMUIAlertAction *action2 = [QMUIAlertAction actionWithTitle:@"从手机相册中选择" style:QMUIAlertActionStyleDefault handler:^(__kindof QMUIAlertController *aAlertController, QMUIAlertAction *action) { | |
| 201 | +// __strong typeof(weakSelf) strongSelf = weakSelf; | |
| 202 | +// if(!strongSelf) return ; | |
| 203 | +// __strong typeof(strongSelf) weakSelf = strongSelf; | |
| 204 | +// [CNLiveAuthorizationManager getPHAuthorizationStatus:^{ | |
| 205 | +// __strong typeof(weakSelf) strongSelf = weakSelf; | |
| 206 | +// if(!strongSelf) return ; | |
| 207 | +// TZImagePickerController *picker = [[TZImagePickerController alloc] initWithMaxImagesCount:1 delegate:strongSelf]; | |
| 208 | +// picker.modalPresentationStyle = UIModalPresentationFullScreen; | |
| 209 | +// picker.allowPickingVideo = NO; | |
| 210 | +// picker.allowPreview = NO; | |
| 211 | +// __weak typeof(strongSelf) weakSelf = strongSelf; | |
| 212 | +// [picker setDidFinishPickingPhotosHandle:^(NSArray<UIImage *> *photos, NSArray *assets, BOOL isSelectOriginalPhoto) { | |
| 213 | +// __strong typeof(weakSelf) strongSelf = weakSelf; | |
| 214 | +// if(!strongSelf) return ; | |
| 215 | +// [strongSelf handleImage:[photos firstObject]]; | |
| 216 | +//// [strongSelf.images addObject:[photos firstObject]]; | |
| 217 | +// }]; | |
| 218 | +// [strongSelf presentViewController:picker animated:YES completion:nil]; | |
| 219 | +// }]; | |
| 220 | +// | |
| 221 | +// }]; | |
| 222 | +// QMUIAlertAction *cancel = [QMUIAlertAction actionWithTitle:@"取消" style:QMUIAlertActionStyleCancel handler:^(__kindof QMUIAlertController *aAlertController, QMUIAlertAction *action) { | |
| 223 | +// __strong typeof(weakSelf) strongSelf = weakSelf; | |
| 224 | +// if(!strongSelf) return ; | |
| 225 | +// | |
| 226 | +// }]; | |
| 227 | +// | |
| 228 | +// QMUIAlertController *alertController = [QMUIAlertController alertControllerWithTitle:@"" message:@"" preferredStyle:QMUIAlertControllerStyleActionSheet]; | |
| 229 | +// [alertController addAction:action1]; | |
| 230 | +// [alertController addAction:action2]; | |
| 231 | +// [alertController addAction:cancel]; | |
| 232 | +// | |
| 233 | +// NSMutableDictionary *titleAttributs = [[NSMutableDictionary alloc] initWithDictionary:alertController.alertTitleAttributes]; | |
| 234 | +// titleAttributs[NSForegroundColorAttributeName] = [UIColor colorWithRed:72/255.0 green:168/255.0 blue:249/255.0 alpha:1.0]; | |
| 235 | +// | |
| 236 | +// NSMutableDictionary *cancelAttributs = [[NSMutableDictionary alloc] initWithDictionary:alertController.alertTitleAttributes]; | |
| 237 | +// cancelAttributs[NSForegroundColorAttributeName] = [UIColor colorWithRed:51/255.0 green:51/255.0 blue:51/255.0 alpha:1.0]; | |
| 238 | +// | |
| 239 | +// action1.buttonAttributes = titleAttributs; | |
| 240 | +// action2.buttonAttributes = titleAttributs; | |
| 241 | +// cancel.buttonAttributes = cancelAttributs; | |
| 242 | +// | |
| 243 | +// [alertController showWithAnimated:YES]; | |
| 244 | +// | |
| 245 | +//} | |
| 246 | +// | |
| 247 | +//- (void)handleImage:(UIImage *)image { | |
| 248 | +// // 固定方向 | |
| 249 | +// image = [image fixOrientation];//这个方法是UIImage+Extras.h中方法 | |
| 250 | +// // 加入数组 | |
| 251 | +// [self.images addObject:image]; | |
| 252 | +// NSData *imageData = [UIImage zipNSDataWithImage:image]; | |
| 253 | +// if (imageData.length > 20*1024.0*1024.0) {//压缩后大于20M | |
| 254 | +// [QMUITips showError:@"图片过大" inView:self.view hideAfterDelay:1.5]; | |
| 255 | +// return; | |
| 256 | +// } | |
| 257 | +// NSString *imageString = [imageData base64EncodedStringWithOptions:0]; | |
| 258 | +// imageString = [self removeSpaceAndNewline:imageString]; | |
| 259 | +// id dataDic = @{ | |
| 260 | +// @"image" : imageString | |
| 261 | +// }; | |
| 262 | +// // 帮助与反馈->产品建议:App提交图片数据给h5展示 | |
| 263 | +//// [self.bridge callHandler:@"wjjCommitImageToJS" data:dataDic responseCallback:^(id responseData) { | |
| 264 | +//// NSLog(@"ObjC received response: %@", responseData); | |
| 265 | +//// }]; | |
| 266 | +// | |
| 267 | +//} | |
| 268 | +// | |
| 269 | +//// 获取图片的token | |
| 270 | +//- (void)getToken { | |
| 271 | +// NSDictionary *param = @{@"appId":AppId, | |
| 272 | +// @"verb":@"POST", | |
| 273 | +// @"storageType":@"2", | |
| 274 | +// @"bucket":API_BucketName | |
| 275 | +// }; | |
| 276 | +// [QMUITips showLoading:@"正在提交" inView:self.view]; | |
| 277 | +// [CNLiveNetworking setAllowRequestDefaultArgument:NO]; | |
| 278 | +// [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodPOST URLString:CNUploadAuthForApp Param:param CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) { | |
| 279 | +// NSMutableDictionary *data = [NSMutableDictionary dictionaryWithDictionary:responseObject[@"data"]]; | |
| 280 | +// NSDictionary *dic = (NSDictionary *)data; | |
| 281 | +// if (!error && dic[@"token"]) { | |
| 282 | +// [self QNStartUploadWithtoken:dic[@"token"]]; | |
| 283 | +// }else { | |
| 284 | +// [QMUITips hideAllToastInView:self.view animated:YES]; | |
| 285 | +// [QMUITips showError:error.localizedDescription inView:self.view hideAfterDelay:1.5]; | |
| 286 | +// } | |
| 287 | +// }]; | |
| 288 | +//} | |
| 289 | +// | |
| 290 | +//// 图片开始上传 | |
| 291 | +//- (void)QNStartUploadWithtoken:(NSString *)token { | |
| 292 | +// __weak typeof(self) weakSelf = self; | |
| 293 | +// // 图片视频压缩(LXG) | |
| 294 | +// [_images enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { | |
| 295 | +// if (!weakSelf.images[idx]) { | |
| 296 | +// [QMUITips hideAllToastInView:self.view animated:YES]; | |
| 297 | +// [QMUITips showError:@"提交失败" inView:self.view hideAfterDelay:1.5]; | |
| 298 | +// return; | |
| 299 | +// } | |
| 300 | +// NSData *zipData = [UIImage zipNSDataWithImage:weakSelf.images[idx]];//非原图压缩 | |
| 301 | +// if (zipData.length > 20*1024.0*1024.0) {//压缩后大于20M | |
| 302 | +// [QMUITips hideAllToastInView:self.view animated:YES]; | |
| 303 | +// [QMUITips showError:@"图片过大" inView:self.view hideAfterDelay:1.5]; | |
| 304 | +// return; | |
| 305 | +// }else{ | |
| 306 | +// weakSelf.images[idx] = [UIImage imageWithData:zipData]; | |
| 307 | +// } | |
| 308 | +// | |
| 309 | +// }]; | |
| 310 | +// | |
| 311 | +// NSMutableDictionary *picDict = [NSMutableDictionary dictionaryWithCapacity:_images.count]; | |
| 312 | +// NSMutableArray *keyArr = [NSMutableArray arrayWithCapacity:_images.count]; | |
| 313 | +// self.pics = [NSMutableArray arrayWithCapacity:_images.count]; | |
| 314 | +// for (int i = 0; i < _images.count; i++) { | |
| 315 | +// @autoreleasepool { | |
| 316 | +// UIImage *image = _images[i]; | |
| 317 | +// __block NSData *imageData1 = UIImageJPEGRepresentation(image, 1); | |
| 318 | +// NSString *timeTampStr = [CNLiveTimeTools get13tsRandTimeStr]; | |
| 319 | +// // NSString *mineType = @"image/jpeg"; | |
| 320 | +// NSString *qiniuFileName; | |
| 321 | +// qiniuFileName = [NSString stringWithFormat:@"%@/%@.jpg",[self getImageBuketkeyFromServerWithExt], timeTampStr]; | |
| 322 | +// QNUploadManager *uploadManager = [QNUploadManager sharedInstanceWithConfiguration:nil]; | |
| 323 | +// [uploadManager putData:imageData1 key:qiniuFileName token:token complete:^(QNResponseInfo *info, NSString *key, NSDictionary *resp) { | |
| 324 | +// if (info.ok) { | |
| 325 | +// NSString *imageUrl = [NSString stringWithFormat:@"%@%@",API_PhotoUrl,key]; | |
| 326 | +// [picDict setObject:imageUrl ? imageUrl: @"" forKey:@"imageUrl"]; | |
| 327 | +// [picDict setObject:[NSString stringWithFormat:@"%.0f",image.size.width] forKey:@"imageWidth"]; | |
| 328 | +// [picDict setObject:[NSString stringWithFormat:@"%.0f",image.size.height] forKey:@"imageHeight"]; | |
| 329 | +// [keyArr addObject:key]; | |
| 330 | +// NSMutableDictionary *dict = [[NSMutableDictionary alloc]initWithDictionary:picDict]; | |
| 331 | +// [self.pics addObject:dict]; | |
| 332 | +// | |
| 333 | +// if (keyArr.count == weakSelf.images.count) { | |
| 334 | +// id imagesArrData = @{ @"images": self.pics.copy }; | |
| 335 | +// [weakSelf.images removeAllObjects]; | |
| 336 | +// // 帮助与反馈->产品建议App->h5图片urls | |
| 337 | +//// [self.bridge callHandler:wjjSubmitSuccess data:imagesArrData responseCallback:^(id responseData) { | |
| 338 | +//// NSLog(@"ObjC received response: %@", responseData); | |
| 339 | +//// }]; | |
| 340 | +// } | |
| 341 | +// } else if (info.broken) { | |
| 342 | +// [QMUITips hideAllToastInView:self.view animated:YES]; | |
| 343 | +// [QMUITips showError:@"网络连接已断开" inView:self.view hideAfterDelay:1.5]; | |
| 344 | +// return ; | |
| 345 | +// } else { | |
| 346 | +// [QMUITips hideAllToastInView:self.view animated:YES]; | |
| 347 | +// [QMUITips showError:info.error.localizedDescription inView:self.view hideAfterDelay:1.5]; | |
| 348 | +// return ; | |
| 349 | +// } | |
| 350 | +// } option:nil]; | |
| 351 | +// } | |
| 352 | +// } | |
| 353 | +// | |
| 354 | +//} | |
| 355 | +// | |
| 356 | +//// 图片转成base64字符串需要先取出所有空格和换行符 | |
| 357 | +//- (NSString *)removeSpaceAndNewline:(NSString *)str{ | |
| 358 | +// NSString *temp = [str stringByReplacingOccurrencesOfString:@" " withString:@""]; | |
| 359 | +// temp = [temp stringByReplacingOccurrencesOfString:@"\r" withString:@""]; | |
| 360 | +// temp = [temp stringByReplacingOccurrencesOfString:@"\n" withString:@""]; | |
| 361 | +// return temp; | |
| 362 | +//} | |
| 363 | +// | |
| 364 | +//// 图片的BucketKey,BuketKey为文件路径 | |
| 365 | +//- (NSString *)getImageBuketkeyFromServerWithExt{ | |
| 366 | +// NSString *spid = [CNLiveBusinessTools getSpid]; | |
| 367 | +// NSString *imgBucketKey = [NSString stringWithFormat:@"%@/img", spid]; | |
| 368 | +// NSString *yearTime = [CNLiveTimeTools getyyMMdd]; | |
| 369 | +// NSString *bucketKey = [NSString stringWithFormat:@"%@/%@",imgBucketKey,yearTime]; | |
| 370 | +// return bucketKey; | |
| 371 | +// | |
| 372 | +//} | |
| 373 | +// | |
| 374 | +//- (NSData *)image_TransForm_Data:(UIImage *)image{ | |
| 375 | +// NSData *imageData = UIImageJPEGRepresentation(image, 0.5); | |
| 376 | +// //几乎是按0.5图片大小就降到原来的一半 | |
| 377 | +// return imageData; | |
| 378 | +//} | |
| 379 | +// | |
| 380 | +////压缩图片质量 | |
| 381 | +//-(UIImage *)reduceImage:(UIImage *)image percent:(float)percent{ | |
| 382 | +// NSData *imageData = UIImageJPEGRepresentation(image, percent); | |
| 383 | +// UIImage *newImage = [UIImage imageWithData:imageData]; | |
| 384 | +// return newImage; | |
| 385 | +//} | |
| 386 | +////压缩图片尺寸 | |
| 387 | +//- (UIImage*)imageWithImageSimple:(UIImage*)image scaledToSize:(CGSize)newSize{ | |
| 388 | +// UIGraphicsBeginImageContext(newSize); | |
| 389 | +// [image drawInRect:CGRectMake(0,0,newSize.width,newSize.height)]; | |
| 390 | +// UIImage* newImage = UIGraphicsGetImageFromCurrentImageContext(); | |
| 391 | +// UIGraphicsEndImageContext(); | |
| 392 | +// return newImage; | |
| 393 | +//} | |
| 393 | 394 | |
| 394 | 395 | @end | ... | ... |
CNLiveBUserAgreement/Classes/CNLiveUserAgreementManager.m
| ... | ... | @@ -330,8 +330,8 @@ static CNLiveUserAgreementManager *_instance = nil; |
| 330 | 330 | |
| 331 | 331 | #pragma mark - 跳转控制器 |
| 332 | 332 | + (void)pushToWebControllerUrl:(NSString *)url name:(NSString *)name closeHidden:(BOOL)closeHidden{ |
| 333 | - CNLiveUserAgreementController *vc = [[CNLiveUserAgreementController alloc] initWithUrl:url title:name closeHidden:closeHidden]; | |
| 334 | - [CNLivePageJumpManager jumpViewController:vc]; | |
| 333 | +// CNLiveUserAgreementController *vc = [[CNLiveUserAgreementController alloc] initWithUrl:url title:name closeHidden:closeHidden]; | |
| 334 | +// [CNLivePageJumpManager jumpViewController:vc]; | |
| 335 | 335 | |
| 336 | 336 | } |
| 337 | 337 | ... | ... |
Example/CNLiveBUserAgreement.xcodeproj/project.pbxproj
| ... | ... | @@ -308,13 +308,11 @@ |
| 308 | 308 | "${PODS_ROOT}/Target Support Files/Pods-CNLiveBUserAgreement_Example/Pods-CNLiveBUserAgreement_Example-frameworks.sh", |
| 309 | 309 | "${BUILT_PRODUCTS_DIR}/AFNetworking/AFNetworking.framework", |
| 310 | 310 | "${BUILT_PRODUCTS_DIR}/CNLiveAVCamera/CNLiveAVCamera.framework", |
| 311 | - "${BUILT_PRODUCTS_DIR}/CNLiveBaseClass/CNLiveBaseClass.framework", | |
| 312 | 311 | "${BUILT_PRODUCTS_DIR}/CNLiveBaseKit/CNLiveBaseKit.framework", |
| 313 | 312 | "${BUILT_PRODUCTS_DIR}/CNLiveBaseTools/CNLiveBaseTools.framework", |
| 314 | 313 | "${BUILT_PRODUCTS_DIR}/CNLiveBusinessTools/CNLiveBusinessTools.framework", |
| 315 | 314 | "${BUILT_PRODUCTS_DIR}/CNLiveCategory/CNLiveCategory.framework", |
| 316 | 315 | "${BUILT_PRODUCTS_DIR}/CNLiveCommonCategory/CNLiveCommonCategory.framework", |
| 317 | - "${BUILT_PRODUCTS_DIR}/CNLiveCustomControl/CNLiveCustomControl.framework", | |
| 318 | 316 | "${BUILT_PRODUCTS_DIR}/CNLiveEnvironment/CNLiveEnvironment.framework", |
| 319 | 317 | "${BUILT_PRODUCTS_DIR}/CNLiveImagePickerController/CNLiveImagePickerController.framework", |
| 320 | 318 | "${BUILT_PRODUCTS_DIR}/CNLiveManager/CNLiveManager.framework", |
| ... | ... | @@ -329,20 +327,17 @@ |
| 329 | 327 | "${BUILT_PRODUCTS_DIR}/Qiniu/Qiniu.framework", |
| 330 | 328 | "${BUILT_PRODUCTS_DIR}/SDAutoLayout/SDAutoLayout.framework", |
| 331 | 329 | "${BUILT_PRODUCTS_DIR}/SDWebImage/SDWebImage.framework", |
| 332 | - "${BUILT_PRODUCTS_DIR}/WebViewJavascriptBridge/WebViewJavascriptBridge.framework", | |
| 333 | 330 | "${BUILT_PRODUCTS_DIR}/YYKit/YYKit.framework", |
| 334 | 331 | ); |
| 335 | 332 | name = "[CP] Embed Pods Frameworks"; |
| 336 | 333 | outputPaths = ( |
| 337 | 334 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AFNetworking.framework", |
| 338 | 335 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveAVCamera.framework", |
| 339 | - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveBaseClass.framework", | |
| 340 | 336 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveBaseKit.framework", |
| 341 | 337 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveBaseTools.framework", |
| 342 | 338 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveBusinessTools.framework", |
| 343 | 339 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveCategory.framework", |
| 344 | 340 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveCommonCategory.framework", |
| 345 | - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveCustomControl.framework", | |
| 346 | 341 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveEnvironment.framework", |
| 347 | 342 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveImagePickerController.framework", |
| 348 | 343 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveManager.framework", |
| ... | ... | @@ -357,7 +352,6 @@ |
| 357 | 352 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Qiniu.framework", |
| 358 | 353 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SDAutoLayout.framework", |
| 359 | 354 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SDWebImage.framework", |
| 360 | - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/WebViewJavascriptBridge.framework", | |
| 361 | 355 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/YYKit.framework", |
| 362 | 356 | ); |
| 363 | 357 | runOnlyForDeploymentPostprocessing = 0; | ... | ... |