Commit 70a5802661dc1c8057a579927c5c7268ff973d88

Authored by zhangxiaowen
1 parent f6b4dff6

no message

CNLiveQrCodeModule/Classes/Controller/CNLiveScanQrCodeController.m
@@ -185,32 +185,6 @@ static const CGFloat timeValue = 1.5; @@ -185,32 +185,6 @@ static const CGFloat timeValue = 1.5;
185 }]; 185 }];
186 } 186 }
187 187
188 -#pragma mark - 选择图片识别二维码  
189 -- (void)rightButtonDidClicked:(UIButton *)btn {  
190 - // 从相册中读取二维码  
191 - [obtain establishAuthorizationQRCodeObtainAlbumWithController:nil];  
192 - if (obtain.isPHAuthorization == YES) {  
193 - [self.scanView removeTimer];  
194 - }  
195 -  
196 - __weak typeof(self) weakSelf = self;  
197 - [obtain setBlockWithQRCodeObtainAlbumDidCancelImagePickerController:^(SGQRCodeObtain *obtain) {  
198 - __strong typeof(weakSelf) strongSelf = weakSelf;  
199 - if(!strongSelf) return ;  
200 - }];  
201 - [obtain setBlockWithQRCodeObtainAlbumResult:^(SGQRCodeObtain *obtain, NSString *result) {  
202 - __strong typeof(weakSelf) strongSelf = weakSelf;  
203 - if(!strongSelf) return ;  
204 - if (result == nil) {  
205 - NSLog(@"暂未识别出二维码");  
206 - [QMUITips showError:@"暂未识别出二维码" inView:strongSelf.view hideAfterDelay:timeValue];  
207 -  
208 - } else {  
209 - [strongSelf handleResult:result];  
210 - }  
211 - }];  
212 -}  
213 -  
214 #pragma mark - 识别二维码后判断处理 188 #pragma mark - 识别二维码后判断处理
215 - (void)handleResult:(NSString *)result{ 189 - (void)handleResult:(NSString *)result{
216 NSLog(@"结果---%@",result); 190 NSLog(@"结果---%@",result);
@@ -269,9 +243,36 @@ static const CGFloat timeValue = 1.5; @@ -269,9 +243,36 @@ static const CGFloat timeValue = 1.5;
269 243
270 } 244 }
271 245
  246 +#pragma mark - 选择图片识别二维码
272 - (void)navigationBar:(CNLiveQrCodeNavigationBar *)navigationBar actionEvents:(NSString *)actionEvents{ 247 - (void)navigationBar:(CNLiveQrCodeNavigationBar *)navigationBar actionEvents:(NSString *)actionEvents{
273 if ([actionEvents isEqualToString:@"1"]) { 248 if ([actionEvents isEqualToString:@"1"]) {
274 [self goBack]; 249 [self goBack];
  250 + }else if([actionEvents isEqualToString:@"2"]){
  251 + _navigationBar.right.userInteractionEnabled = NO;
  252 + // 从相册中读取二维码
  253 + [obtain establishAuthorizationQRCodeObtainAlbumWithController:nil];
  254 + if (obtain.isPHAuthorization == YES) {
  255 + [self.scanView removeTimer];
  256 + }
  257 +
  258 + __weak typeof(self) weakSelf = self;
  259 + [obtain setBlockWithQRCodeObtainAlbumDidCancelImagePickerController:^(SGQRCodeObtain *obtain) {
  260 + __strong typeof(weakSelf) strongSelf = weakSelf;
  261 + if(!strongSelf) return ;
  262 + strongSelf.navigationBar.right.userInteractionEnabled = YES;
  263 + }];
  264 + [obtain setBlockWithQRCodeObtainAlbumResult:^(SGQRCodeObtain *obtain, NSString *result) {
  265 + __strong typeof(weakSelf) strongSelf = weakSelf;
  266 + if(!strongSelf) return ;
  267 + strongSelf.navigationBar.right.userInteractionEnabled = YES;
  268 + if (result == nil) {
  269 + NSLog(@"暂未识别出二维码");
  270 + [QMUITips showError:@"暂未识别出二维码" inView:strongSelf.view hideAfterDelay:timeValue];
  271 +
  272 + } else {
  273 + [strongSelf handleResult:result];
  274 + }
  275 + }];
275 } 276 }
276 } 277 }
277 #pragma mark - 懒加载 278 #pragma mark - 懒加载
Example/CNLiveQrCodeModule.xcodeproj/xcshareddata/xcschemes/CNLiveQrCodeModule-Example.xcscheme
@@ -15,7 +15,7 @@ @@ -15,7 +15,7 @@
15 <BuildableReference 15 <BuildableReference
16 BuildableIdentifier = "primary" 16 BuildableIdentifier = "primary"
17 BlueprintIdentifier = "6003F589195388D20070C39A" 17 BlueprintIdentifier = "6003F589195388D20070C39A"
18 - BuildableName = "CNLiveQrCodeModule_Example.app" 18 + BuildableName = "&#x4e8c;&#x7ef4;&#x7801;&#x6a21;&#x5757;.app"
19 BlueprintName = "CNLiveQrCodeModule_Example" 19 BlueprintName = "CNLiveQrCodeModule_Example"
20 ReferencedContainer = "container:CNLiveQrCodeModule.xcodeproj"> 20 ReferencedContainer = "container:CNLiveQrCodeModule.xcodeproj">
21 </BuildableReference> 21 </BuildableReference>
@@ -27,6 +27,15 @@ @@ -27,6 +27,15 @@
27 selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" 27 selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28 selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" 28 selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29 shouldUseLaunchSchemeArgsEnv = "YES"> 29 shouldUseLaunchSchemeArgsEnv = "YES">
  30 + <MacroExpansion>
  31 + <BuildableReference
  32 + BuildableIdentifier = "primary"
  33 + BlueprintIdentifier = "6003F589195388D20070C39A"
  34 + BuildableName = "&#x4e8c;&#x7ef4;&#x7801;&#x6a21;&#x5757;.app"
  35 + BlueprintName = "CNLiveQrCodeModule_Example"
  36 + ReferencedContainer = "container:CNLiveQrCodeModule.xcodeproj">
  37 + </BuildableReference>
  38 + </MacroExpansion>
30 <Testables> 39 <Testables>
31 <TestableReference 40 <TestableReference
32 skipped = "NO"> 41 skipped = "NO">
@@ -39,17 +48,6 @@ @@ -39,17 +48,6 @@
39 </BuildableReference> 48 </BuildableReference>
40 </TestableReference> 49 </TestableReference>
41 </Testables> 50 </Testables>
42 - <MacroExpansion>  
43 - <BuildableReference  
44 - BuildableIdentifier = "primary"  
45 - BlueprintIdentifier = "6003F589195388D20070C39A"  
46 - BuildableName = "CNLiveQrCodeModule_Example.app"  
47 - BlueprintName = "CNLiveQrCodeModule_Example"  
48 - ReferencedContainer = "container:CNLiveQrCodeModule.xcodeproj">  
49 - </BuildableReference>  
50 - </MacroExpansion>  
51 - <AdditionalOptions>  
52 - </AdditionalOptions>  
53 </TestAction> 51 </TestAction>
54 <LaunchAction 52 <LaunchAction
55 buildConfiguration = "Debug" 53 buildConfiguration = "Debug"
@@ -66,13 +64,11 @@ @@ -66,13 +64,11 @@
66 <BuildableReference 64 <BuildableReference
67 BuildableIdentifier = "primary" 65 BuildableIdentifier = "primary"
68 BlueprintIdentifier = "6003F589195388D20070C39A" 66 BlueprintIdentifier = "6003F589195388D20070C39A"
69 - BuildableName = "CNLiveQrCodeModule_Example.app" 67 + BuildableName = "&#x4e8c;&#x7ef4;&#x7801;&#x6a21;&#x5757;.app"
70 BlueprintName = "CNLiveQrCodeModule_Example" 68 BlueprintName = "CNLiveQrCodeModule_Example"
71 ReferencedContainer = "container:CNLiveQrCodeModule.xcodeproj"> 69 ReferencedContainer = "container:CNLiveQrCodeModule.xcodeproj">
72 </BuildableReference> 70 </BuildableReference>
73 </BuildableProductRunnable> 71 </BuildableProductRunnable>
74 - <AdditionalOptions>  
75 - </AdditionalOptions>  
76 </LaunchAction> 72 </LaunchAction>
77 <ProfileAction 73 <ProfileAction
78 buildConfiguration = "Release" 74 buildConfiguration = "Release"
@@ -85,7 +81,7 @@ @@ -85,7 +81,7 @@
85 <BuildableReference 81 <BuildableReference
86 BuildableIdentifier = "primary" 82 BuildableIdentifier = "primary"
87 BlueprintIdentifier = "6003F589195388D20070C39A" 83 BlueprintIdentifier = "6003F589195388D20070C39A"
88 - BuildableName = "CNLiveQrCodeModule_Example.app" 84 + BuildableName = "&#x4e8c;&#x7ef4;&#x7801;&#x6a21;&#x5757;.app"
89 BlueprintName = "CNLiveQrCodeModule_Example" 85 BlueprintName = "CNLiveQrCodeModule_Example"
90 ReferencedContainer = "container:CNLiveQrCodeModule.xcodeproj"> 86 ReferencedContainer = "container:CNLiveQrCodeModule.xcodeproj">
91 </BuildableReference> 87 </BuildableReference>