|
|
@@ -342,28 +342,115 @@ bool isDownType22 = YES;
|
|
|
//移除扫描层layer
|
|
|
[self.layer removeFromSuperlayer];
|
|
|
|
|
|
+ //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];
|
|
|
+ }
|
|
|
+}
|
|
|
|
|
|
+#pragma mark 根据扫码得到的SN 重新获取信息
|
|
|
+- (void)getScanSnMsgBy:(NSString*)snStr withDict:(NSMutableDictionary*)deviceDict
|
|
|
+{
|
|
|
+ if([AFNetworkReachabilityManager sharedManager].networkReachabilityStatus == AFNetworkReachabilityStatusNotReachable)
|
|
|
+ {
|
|
|
+ [[iToast makeText:NSLocalizedString(@"phone_network_fail_Tips",nil)] show];
|
|
|
+ [self.navigationController popViewControllerAnimated:YES];
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ [self showNewIndicatorHaveStrWithCanBack:NO canTouch:NO showText:NSLocalizedString(@"guide_qrcoede_tips_ok",nil)];
|
|
|
+
|
|
|
+ [[netWorkManager shareInstance] getThridMsgBySN:snStr success:^(id _Nonnull responseObject) {
|
|
|
+ [self removeNewIndicatorHaveStr];
|
|
|
|
|
|
- [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){
|
|
|
-
|
|
|
+ DeviceThirdIdModel *model = responseObject;
|
|
|
+ if([model isKindOfClass:[DeviceThirdIdModel class]]){
|
|
|
+
|
|
|
+ if(model.status == 0 && model.data){
|
|
|
//数据埋点
|
|
|
[[netWorkManager shareInstance] DataEmbeddingPointBy:2 withEventValue:@"Change_device"];
|
|
|
|
|
|
NSMutableDictionary *dict = [[NSMutableDictionary alloc] initWithDictionary:deviceDict];
|
|
|
- [dict setObject:resStr forKey:Const_Have_Add_Device_SN];
|
|
|
+ [dict setObject:snStr 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)];
|
|
|
@@ -397,32 +484,58 @@ bool isDownType22 = YES;
|
|
|
});
|
|
|
|
|
|
|
|
|
- }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];
|
|
|
-// }
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ NSInteger state = 2;
|
|
|
+ if (model.status == 201 || model.status == 202) {
|
|
|
+ state = model.status;
|
|
|
+ }
|
|
|
|
|
|
if(self->_didScanErrorFun){
|
|
|
- self->_didScanErrorFun(didSuc);
|
|
|
+ self->_didScanErrorFun(state);
|
|
|
}
|
|
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|
|
- mainBlock(^{
|
|
|
- [self.navigationController popViewControllerAnimated:YES];
|
|
|
- });
|
|
|
+ [self.navigationController popViewControllerAnimated:YES];
|
|
|
});
|
|
|
-
|
|
|
}
|
|
|
- }];
|
|
|
- }
|
|
|
- else{
|
|
|
- [[iToast makeText:NSLocalizedString(@"guide_qrcoede_tips_error",nil)] show];
|
|
|
- }
|
|
|
+ }
|
|
|
+ else{
|
|
|
+
|
|
|
+ [webRtcManager shareManager].isChangeBoxType = NO;
|
|
|
+
|
|
|
+ NSInteger didSuc =2;
|
|
|
+ if(model.status == 201 ||model.status == 202){
|
|
|
+ didSuc = model.status;
|
|
|
+ }
|
|
|
+
|
|
|
+ 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];
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ } failure:^(NSError * _Nonnull error) {
|
|
|
+ [self removeNewIndicatorHaveStr];
|
|
|
+
|
|
|
+ [webRtcManager shareManager].isChangeBoxType = NO;
|
|
|
+
|
|
|
+ NSInteger didSuc = 0;
|
|
|
+
|
|
|
+ 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];
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }];
|
|
|
+
|
|
|
}
|
|
|
|
|
|
//光感传感器代理
|