|
|
@@ -1,6 +1,6 @@
|
|
|
//
|
|
|
// QRCodeScanForChangeDeviceViewController.m
|
|
|
-// 隐私保护
|
|
|
+ //
|
|
|
//
|
|
|
// Created by APPLE on 2023/9/19.
|
|
|
//
|
|
|
@@ -9,16 +9,8 @@
|
|
|
#import <AVFoundation/AVFoundation.h>
|
|
|
#import <ImageIO/ImageIO.h>
|
|
|
#import "RSATool.h"
|
|
|
-#import "connectDeviceManager.h"
|
|
|
-//#import "uploadFileManager.h"
|
|
|
-#import "nasUploadFileManager.h"
|
|
|
-//#import "downloadManager.h"
|
|
|
-#import "nasDownloadFileManager.h"
|
|
|
-#import "backupsFileManager.h"
|
|
|
-#import "nasBackupsManager.h"
|
|
|
#import <TZImageManager.h>
|
|
|
#import <TZImagePickerController.h>
|
|
|
-#import "boxDownloadFileManager.h"
|
|
|
|
|
|
@interface QRCodeScanForChangeDeviceViewController ()<AVCaptureMetadataOutputObjectsDelegate,AVCaptureVideoDataOutputSampleBufferDelegate,UINavigationControllerDelegate,UIImagePickerControllerDelegate,TZImagePickerControllerDelegate>
|
|
|
|
|
|
@@ -56,7 +48,9 @@
|
|
|
AVAuthorizationStatus authStatus =[AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo];
|
|
|
//判断摄像头状态是否可用
|
|
|
if(authStatus==AVAuthorizationStatusAuthorized){
|
|
|
- [self startScan];
|
|
|
+ mainBlock(^{
|
|
|
+ [self startScan];
|
|
|
+ });
|
|
|
}else{
|
|
|
NSLog(@"未开启相机权限,请前往设置中开启");
|
|
|
[AVCaptureDevice requestAccessForMediaType:AVMediaTypeVideo completionHandler:^(BOOL granted) {
|
|
|
@@ -199,7 +193,7 @@ AVCaptureDeviceInput *input = [AVCaptureDeviceInput deviceInputWithDevice:device
|
|
|
//打开相册
|
|
|
UIButton *openAlbunBut = [[UIButton alloc] init];
|
|
|
[openAlbunBut setTitle:NSLocalizedString(@"guide_qrcoede_open_album",nil) forState:UIControlStateNormal];
|
|
|
- [openAlbunBut setTitleColor:[UIColor hwColor:@"#3B7FFF" alpha:1.0] forState:UIControlStateNormal];
|
|
|
+ [openAlbunBut setTitleColor:[UIColor hwColor:@"#FFD315" alpha:1.0] forState:UIControlStateNormal];
|
|
|
openAlbunBut.titleLabel.font = [UIFont systemFontOfSize:14.0];
|
|
|
[openAlbunBut addTarget:self action:@selector(photoBtnClick:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
openAlbunBut.backgroundColor = [UIColor hwColor:@"#FFFFFF" alpha:0.2];
|
|
|
@@ -233,7 +227,7 @@ AVCaptureDeviceInput *input = [AVCaptureDeviceInput deviceInputWithDevice:device
|
|
|
make.width.mas_equalTo(btn_w_h);
|
|
|
make.height.mas_equalTo(btn_w_h);
|
|
|
}];
|
|
|
- [backBtn setImage:[UIImage imageNamed:@"icon_base_back"] forState:(UIControlStateNormal)];
|
|
|
+ [backBtn setImage:[UIImage imageNamed:@"icon_white_back"] forState:(UIControlStateNormal)];
|
|
|
[backBtn setImageEdgeInsets:(UIEdgeInsetsMake((btn_w_h - btn_show)/2.f, (btn_w_h - btn_show)/2.f, (btn_w_h - btn_show)/2.f, (btn_w_h - btn_show)/2.f))];
|
|
|
[backBtn addTarget:self
|
|
|
action:@selector(backBtnPressed)
|
|
|
@@ -291,14 +285,6 @@ bool isDownType22 = YES;
|
|
|
- (void)handleScanCodeResultFun:(NSString*)resultStr
|
|
|
{
|
|
|
|
|
|
- //[[uploadFileManager shareInstance] suspendUploadFileFun:YES withModel:nil];
|
|
|
- [[nasUploadFileManager shareInstance] suspendUploadFileFun:YES withModel:nil];
|
|
|
- //[[downloadManager shareInstance] suspendDownloadFileFun:YES withModel:nil];
|
|
|
- [[nasDownloadFileManager shareInstance] suspendDownloadFileFun:YES withModel:nil];
|
|
|
- //[[backupsFileManager shareInstance] suspendBackupsFileFun];
|
|
|
- [[nasBackupsManager shareInstance] suspendBackupsFileFun];
|
|
|
- [[boxDownloadFileManager shareInstance] suspendDownloadFileFun:YES withModel:nil];
|
|
|
-
|
|
|
NSString *resStr = resultStr;
|
|
|
if(resStr.length > 22)
|
|
|
{
|
|
|
@@ -313,6 +299,7 @@ bool isDownType22 = YES;
|
|
|
|
|
|
if (([resStr containsString:@"RK"] && (resStr.length == @"RK3908P1V62112465".length))
|
|
|
|| resStr.length == @"0333933700223250017273".length
|
|
|
+ || resStr.length == @"BT80240900050aac5bd5a23dd7cc".length
|
|
|
){
|
|
|
|
|
|
NSDictionary *deviceDict = [HWDataManager getObjectWithKey:Const_Have_Add_Device];
|
|
|
@@ -345,82 +332,6 @@ bool isDownType22 = YES;
|
|
|
//webrtc方案
|
|
|
[self getScanSnMsgBy:resStr withDict:deviceDict];
|
|
|
|
|
|
- //瑞云方案
|
|
|
-// [self showNewIndicatorHaveStrWithCanBack:NO canTouch:NO showText:NSLocalizedString(@"guide_qrcoede_tips_ok",nil)];
|
|
|
-// [[connectDeviceManager shareInstance] getThridMsgBySN:resStr needReconnect:YES didNetEnd:^(NSInteger didSuc) {
|
|
|
-//
|
|
|
-// [self removeNewIndicatorHaveStr];
|
|
|
-//
|
|
|
-// if([AFNetworkReachabilityManager sharedManager].networkReachabilityStatus == AFNetworkReachabilityStatusNotReachable)
|
|
|
-// {
|
|
|
-// [[iToast makeText:NSLocalizedString(@"phone_network_fail_Tips",nil)] show];
|
|
|
-// [self.navigationController popViewControllerAnimated:YES];
|
|
|
-// return;
|
|
|
-// }
|
|
|
-//
|
|
|
-//
|
|
|
-// if(didSuc == 1){
|
|
|
-//
|
|
|
-// //数据埋点
|
|
|
-// [[netWorkManager shareInstance] DataEmbeddingPointBy:2 withEventValue:@"Change_device"];
|
|
|
-//
|
|
|
-// NSMutableDictionary *dict = [[NSMutableDictionary alloc] initWithDictionary:deviceDict];
|
|
|
-// [dict setObject:resStr forKey:Const_Have_Add_Device_SN];
|
|
|
-// [HWDataManager setObjectWithKey:Const_Have_Add_Device value:dict];
|
|
|
-//
|
|
|
-// BOOL didSetBackWork = [HWDataManager getBoolWithKey:stringKeyAddSn(Const_file_Transfe_didSet_working_background)];
|
|
|
-// if(!didSetBackWork){
|
|
|
-// [HWDataManager setBoolWithKey:stringKeyAddSn(Const_file_Transfe_didSet_working_background) value:YES];
|
|
|
-// [HWDataManager setBoolWithKey:stringKeyAddSn(Const_file_Transfe_working_background) value:YES];
|
|
|
-// }
|
|
|
-//
|
|
|
-// [webRtcManager shareManager].isChangeBoxType = YES;
|
|
|
-// [[webRtcManager shareManager] closeLinkWebRtcFun];
|
|
|
-//
|
|
|
-// //尝试修复偶现扫码切换云机 已经扫码到 要输新SN密码 但是云机显示是旧SN的 延时一秒跳转
|
|
|
-// dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|
|
-//
|
|
|
-// //清除原来设置的数据
|
|
|
-// ksharedAppDelegate.isWebSockLinkOKAginType = NO;
|
|
|
-// ksharedAppDelegate.cloudPhoneExtraFileListMod = nil;
|
|
|
-// ksharedAppDelegate.DisabledFileTransferType = NO;
|
|
|
-// ksharedAppDelegate.isImageNewFor130 = NO;
|
|
|
-// ksharedAppDelegate.isNeedShowImageNewType = NO;
|
|
|
-// ksharedAppDelegate.TvStatusMod = nil;
|
|
|
-// ksharedAppDelegate.NASMsgMod = nil;
|
|
|
-// ksharedAppDelegate.isDidShowPwdType = NO;
|
|
|
-// ksharedAppDelegate.isDidShowPwdType = NO;
|
|
|
-// ksharedAppDelegate.NASFileByBoxService = nil;
|
|
|
-// ksharedAppDelegate.NASShareFileService = nil;
|
|
|
-// HLog(@"isWebSockLinkOKAginType NO")
|
|
|
-//
|
|
|
-// [[webRtcManager shareManager] beginToLinkWebRtcFun];
|
|
|
-// [[NSNotificationCenter defaultCenter] postNotificationName:GuideOkNotification object:nil];
|
|
|
-// });
|
|
|
-//
|
|
|
-//
|
|
|
-// }else{
|
|
|
-//
|
|
|
-// [webRtcManager shareManager].isChangeBoxType = NO;
|
|
|
-//
|
|
|
-//// if(didSuc == 2){
|
|
|
-//// [[iToast makeText:NSLocalizedString(@"scan_sn_data_error_tip",nil)] show];
|
|
|
-//// }
|
|
|
-//// else{
|
|
|
-//// [[iToast makeText:NSLocalizedString(@"guide_qrcoede_tips_get_SdnID_fail",nil)] show];
|
|
|
-//// }
|
|
|
-//
|
|
|
-// if(self->_didScanErrorFun){
|
|
|
-// self->_didScanErrorFun(didSuc);
|
|
|
-// }
|
|
|
-// dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|
|
-// mainBlock(^{
|
|
|
-// [self.navigationController popViewControllerAnimated:YES];
|
|
|
-// });
|
|
|
-// });
|
|
|
-//
|
|
|
-// }
|
|
|
-// }];
|
|
|
}
|
|
|
else{
|
|
|
[[iToast makeText:NSLocalizedString(@"guide_qrcoede_tips_error",nil)] show];
|