|
|
@@ -0,0 +1,497 @@
|
|
|
+//
|
|
|
+// LoginType1ViewController.m
|
|
|
+// Private-x
|
|
|
+//
|
|
|
+// Created by xd h on 2025/1/16.
|
|
|
+//
|
|
|
+
|
|
|
+#import "LoginType1ViewController.h"
|
|
|
+#import "ScanToLoginViewController.h"
|
|
|
+#import "GuideViewController.h"
|
|
|
+#import "IQKeyboardManager.h"
|
|
|
+#import "CustomerWebViewController.h"
|
|
|
+
|
|
|
+@interface LoginType1ViewController ()<UITextViewDelegate,UITextFieldDelegate>
|
|
|
+@property(nonatomic,strong) UITextField *accountTF;
|
|
|
+@property(nonatomic,strong) UIButton *scanBut;
|
|
|
+@property(nonatomic,strong) UIButton *loginOkBut;
|
|
|
+@property(nonatomic,strong) UIButton *protocolSelectBut;//协议按钮
|
|
|
+@property(nonatomic,strong) CAGradientLayer *gradientLayer;
|
|
|
+@end
|
|
|
+
|
|
|
+@implementation LoginType1ViewController
|
|
|
+
|
|
|
+- (void)viewDidLoad {
|
|
|
+ [super viewDidLoad];
|
|
|
+ // Do any additional setup after loading the view.
|
|
|
+
|
|
|
+ [self drawAnyView];
|
|
|
+
|
|
|
+ [self setupKeyboardManager];
|
|
|
+}
|
|
|
+
|
|
|
+- (void)viewWillAppear:(BOOL)animated
|
|
|
+{
|
|
|
+ [super viewWillAppear:animated];
|
|
|
+ IQKeyboardManager *keyboardManager = [IQKeyboardManager sharedManager];
|
|
|
+ keyboardManager.enable = YES;
|
|
|
+}
|
|
|
+
|
|
|
+- (void)viewWillDisappear:(BOOL)animated
|
|
|
+{
|
|
|
+ [super viewWillDisappear:animated];
|
|
|
+ IQKeyboardManager *keyboardManager = [IQKeyboardManager sharedManager];
|
|
|
+ keyboardManager.enable = NO;
|
|
|
+}
|
|
|
+
|
|
|
+- (void)setupKeyboardManager {
|
|
|
+ IQKeyboardManager *keyboardManager = [IQKeyboardManager sharedManager];
|
|
|
+ keyboardManager.enable = YES;
|
|
|
+ keyboardManager.shouldResignOnTouchOutside = YES;
|
|
|
+ keyboardManager.shouldShowToolbarPlaceholder = NO;
|
|
|
+ keyboardManager.enableAutoToolbar = NO;
|
|
|
+}
|
|
|
+
|
|
|
+- (void)drawAnyView{
|
|
|
+ [self.navigationBar setHidden:YES];
|
|
|
+ [self.toolBar setHidden:YES];
|
|
|
+
|
|
|
+ [self initBaseUIFun];
|
|
|
+}
|
|
|
+
|
|
|
+- (void)initBaseUIFun
|
|
|
+{
|
|
|
+ self.view.backgroundColor = [UIColor whiteColor];
|
|
|
+
|
|
|
+ UIImageView *logoImageV = [UIImageView new];
|
|
|
+ logoImageV.image = [UIImage imageNamed:@"PrivateX_icon"];
|
|
|
+ [self.view addSubview:logoImageV];
|
|
|
+
|
|
|
+ [logoImageV mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.width.mas_equalTo(64);
|
|
|
+ make.height.mas_equalTo(64);
|
|
|
+ make.centerX.mas_equalTo(0);
|
|
|
+ make.top.mas_equalTo(180);
|
|
|
+ }];
|
|
|
+
|
|
|
+ //背景
|
|
|
+ UIView *bgView = [UIView new];
|
|
|
+ bgView.backgroundColor = [UIColor hwColor:@"#F5F7FA"];
|
|
|
+ bgView.layer.cornerRadius = 8;
|
|
|
+ [self.view addSubview:bgView];
|
|
|
+
|
|
|
+ [bgView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.left.mas_equalTo(20);
|
|
|
+ make.right.mas_equalTo(-20);
|
|
|
+ make.height.mas_equalTo(50);
|
|
|
+ make.top.equalTo(logoImageV.mas_bottom).offset(80);
|
|
|
+ }];
|
|
|
+
|
|
|
+ NSString *curTitle = NSLocalizedString(@"input_your_account",nil);
|
|
|
+// UILabel *tipLabel = [[UILabel alloc] init];
|
|
|
+// tipLabel.text = curTitle;
|
|
|
+// tipLabel.textColor = [UIColor hwColor:@"#999999"];
|
|
|
+// tipLabel.font = [UIFont systemFontOfSize:14.0];
|
|
|
+// [bgView addSubview:tipLabel];
|
|
|
+//
|
|
|
+// [tipLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+// make.left.mas_equalTo(15);
|
|
|
+// make.height.mas_equalTo(30);
|
|
|
+// make.centerY.mas_equalTo(0);
|
|
|
+// }];
|
|
|
+
|
|
|
+ _scanBut = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 50, 50)];
|
|
|
+ [_scanBut setImage:[UIImage imageNamed:@"login_scan"] forState:UIControlStateNormal];
|
|
|
+ [_scanBut addTarget:self action:@selector(didClickScanButtonFun:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
+ [bgView addSubview:_scanBut];
|
|
|
+ //scanBut.backgroundColor = [UIColor greenColor];
|
|
|
+
|
|
|
+// [scanBut mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+// make.right.mas_equalTo(0);
|
|
|
+// make.width.mas_equalTo(50);
|
|
|
+// make.height.mas_equalTo(50);
|
|
|
+// make.top.mas_equalTo(0);
|
|
|
+// }];
|
|
|
+
|
|
|
+ _accountTF = [[UITextField alloc] init];
|
|
|
+ _accountTF.placeholder = curTitle;
|
|
|
+ _accountTF.textColor = [UIColor blackColor];
|
|
|
+ _accountTF.font = [UIFont systemFontOfSize:14];
|
|
|
+ _accountTF.delegate = self;
|
|
|
+ _accountTF.keyboardType = UIKeyboardTypeASCIICapable;//UIKeyboardTypeNamePhonePad;
|
|
|
+ _accountTF.rightView = _scanBut;
|
|
|
+ _accountTF.rightViewMode = UITextFieldViewModeAlways;
|
|
|
+ [bgView addSubview:_accountTF];
|
|
|
+
|
|
|
+ [_accountTF mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+// make.left.equalTo(tipLabel.mas_right).offset(5);
|
|
|
+// make.right.equalTo(scanBut.mas_left).offset(0);
|
|
|
+ make.left.mas_equalTo(15);
|
|
|
+ make.right.mas_equalTo(-15);
|
|
|
+ make.height.mas_equalTo(50);
|
|
|
+ make.top.mas_equalTo(0);
|
|
|
+ }];
|
|
|
+
|
|
|
+ _loginOkBut = [[UIButton alloc] init];
|
|
|
+
|
|
|
+ _gradientLayer = [CAGradientLayer layer];
|
|
|
+ _gradientLayer.frame = CGRectMake(0, 0, (SCREEN_W - 20*2), 50);
|
|
|
+ _gradientLayer.colors = @[(__bridge NSString *)[UIColor hwColor:@"#0CDEFD" alpha:0.5].CGColor, (__bridge NSString *)[UIColor hwColor:@"#058DFB" alpha:0.5].CGColor];
|
|
|
+ _gradientLayer.locations = @[@(0), @(1.0f)];
|
|
|
+ _gradientLayer.startPoint = CGPointMake(0, 0.5);
|
|
|
+ _gradientLayer.endPoint = CGPointMake(0.97, 0.5);
|
|
|
+ [_loginOkBut.layer addSublayer:_gradientLayer];
|
|
|
+
|
|
|
+ [_loginOkBut setTitle:NSLocalizedString(@"login_type1_but_title",nil) forState:UIControlStateNormal];
|
|
|
+ _loginOkBut.titleLabel.font = [UIFont systemFontOfSize:16.0];
|
|
|
+ [_loginOkBut setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
|
|
|
+ _loginOkBut.layer.cornerRadius = 8;
|
|
|
+ _loginOkBut.layer.masksToBounds = YES;
|
|
|
+ _loginOkBut.enabled = NO;
|
|
|
+ _loginOkBut.tag = 1;
|
|
|
+ [_loginOkBut addTarget:self action:@selector(didClickButtonFun:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
+ [self.view addSubview:_loginOkBut];
|
|
|
+
|
|
|
+
|
|
|
+ [_loginOkBut mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.height.mas_equalTo(50);
|
|
|
+ make.left.mas_equalTo(20);
|
|
|
+ make.right.mas_equalTo(-20);
|
|
|
+ make.top.mas_equalTo(bgView.mas_bottom).offset(42);
|
|
|
+ }];
|
|
|
+
|
|
|
+ //协议
|
|
|
+ _protocolSelectBut = [[UIButton alloc] init];
|
|
|
+ [_protocolSelectBut setImage:[UIImage imageNamed:@"common_un_check_24"] forState:UIControlStateNormal];
|
|
|
+ [_protocolSelectBut setImage:[UIImage imageNamed:@"common_did_check_24"] forState:UIControlStateSelected];
|
|
|
+ [_protocolSelectBut addTarget:self action:@selector(didClickProtocolButtonFun:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
+ [self.view addSubview:_protocolSelectBut];
|
|
|
+
|
|
|
+ [_protocolSelectBut mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.left.mas_equalTo(20);
|
|
|
+ make.width.mas_equalTo(30);
|
|
|
+ make.height.mas_equalTo(30);
|
|
|
+ make.top.equalTo(_loginOkBut.mas_bottom).offset(15);
|
|
|
+ }];
|
|
|
+
|
|
|
+ UITextView *contentTV = [[UITextView alloc] init];
|
|
|
+ contentTV.backgroundColor = [UIColor whiteColor];
|
|
|
+ contentTV.textColor = [UIColor hwColor:@"#999999"];
|
|
|
+ contentTV.delegate = self;
|
|
|
+ contentTV.editable = YES; //必须禁止输入,否则点击将弹出输入键盘
|
|
|
+ contentTV.scrollEnabled = NO;
|
|
|
+ [self.view addSubview:contentTV];
|
|
|
+ //contentTV.backgroundColor = [UIColor greenColor];
|
|
|
+
|
|
|
+ [contentTV mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.height.mas_equalTo(60);
|
|
|
+ make.left.equalTo(_protocolSelectBut.mas_right).offset(0);
|
|
|
+ make.right.mas_equalTo(-20);
|
|
|
+ make.top.equalTo(_protocolSelectBut.mas_top).offset(-2);
|
|
|
+ }];
|
|
|
+
|
|
|
+ // 创建长按手势识别器
|
|
|
+ UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longPress)];
|
|
|
+ // 设置长按手势的最小按压时间
|
|
|
+ longPress.minimumPressDuration = 1.3; // 2
|
|
|
+ // 将手势识别器添加到视图上
|
|
|
+ [contentTV addGestureRecognizer:longPress];
|
|
|
+
|
|
|
+ NSString *title1 = NSLocalizedString(@"login_protocol_tip_1",nil);
|
|
|
+ NSString *title2 = NSLocalizedString(@"login_protocol_tip_2",nil);
|
|
|
+ NSString *title3 = NSLocalizedString(@"login_protocol_tip_3",nil);
|
|
|
+ NSString *title4 = NSLocalizedString(@"login_protocol_tip_4",nil);
|
|
|
+ NSString *title5 = NSLocalizedString(@"login_protocol_tip_5",nil);
|
|
|
+
|
|
|
+
|
|
|
+ NSString *fullTitle = [[NSString alloc] initWithFormat:@"%@%@%@%@%@",title1,title2,title3,title4,title5];
|
|
|
+
|
|
|
+ NSMutableAttributedString *attrStr = [[NSMutableAttributedString alloc] initWithString:fullTitle];
|
|
|
+ NSRange redRange = NSMakeRange([fullTitle rangeOfString:title2].location, [fullTitle rangeOfString:title2].length);
|
|
|
+ UIColor *noteColor =[UIColor hwColor:@"#13B2EB" alpha:1.0];
|
|
|
+ [attrStr addAttribute:NSForegroundColorAttributeName value:noteColor range:redRange];
|
|
|
+
|
|
|
+ NSRange redRange4 = NSMakeRange([fullTitle rangeOfString:title4].location, [fullTitle rangeOfString:title4].length);
|
|
|
+ [attrStr addAttribute:NSForegroundColorAttributeName value:noteColor range:redRange4];
|
|
|
+
|
|
|
+ [attrStr addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:14.0] range:NSMakeRange(0, attrStr.length)];
|
|
|
+
|
|
|
+ // 设置段落样式以实现水平中间对齐
|
|
|
+ NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
|
|
|
+ paragraphStyle.alignment = NSTextAlignmentLeft; // 水平中间对齐
|
|
|
+ [attrStr addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, attrStr.length)];
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ [attrStr addAttribute:NSLinkAttributeName
|
|
|
+ value:@"didclick1://"
|
|
|
+ range:redRange];
|
|
|
+
|
|
|
+ [attrStr addAttribute:NSLinkAttributeName
|
|
|
+ value:@"didclick2://"
|
|
|
+ range:redRange4];
|
|
|
+
|
|
|
+ contentTV.attributedText = attrStr;
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+#pragma mark ---- textView Delegate ----
|
|
|
+- (BOOL)textView:(UITextView *)textView shouldInteractWithURL:(NSURL *)URL inRange:(NSRange)characterRange interaction:(UITextItemInteraction)interaction
|
|
|
+{
|
|
|
+ HLog(@"按事件")
|
|
|
+ if([[URL scheme] isEqualToString:@"didclick1"]){
|
|
|
+ [self ruleBtnClick];
|
|
|
+ return NO;
|
|
|
+ }
|
|
|
+ else if([[URL scheme] isEqualToString:@"didclick2"]){
|
|
|
+ [self privateBtnClick];
|
|
|
+ return NO;
|
|
|
+ }
|
|
|
+
|
|
|
+ return YES;
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+-(BOOL)textViewShouldBeginEditing:(UITextView *)textView
|
|
|
+{
|
|
|
+ return NO;
|
|
|
+}
|
|
|
+
|
|
|
+#pragma mark 拦截长按事件
|
|
|
+- (void)longPress{
|
|
|
+ HLog(@"拦截长按事件")
|
|
|
+}
|
|
|
+
|
|
|
+#pragma mark - UITextFieldDelegate Methods
|
|
|
+
|
|
|
+- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
|
|
|
+ // 允许删除操作
|
|
|
+ if (string.length == 0) {
|
|
|
+ return YES;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 定义允许输入的字符集
|
|
|
+ NSCharacterSet *allowedCharacters = [NSCharacterSet alphanumericCharacterSet];
|
|
|
+
|
|
|
+ // 检查输入的字符是否在允许的字符集中
|
|
|
+ for (NSInteger i = 0; i < string.length; i++) {
|
|
|
+ unichar character = [string characterAtIndex:i];
|
|
|
+ if (![allowedCharacters characterIsMember:character]) {
|
|
|
+ return NO;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ [self checkLoginButCanClickFun];
|
|
|
+ return YES;
|
|
|
+}
|
|
|
+
|
|
|
+- (void)textFieldDidEndEditing:(UITextField *)textField
|
|
|
+{
|
|
|
+ [self checkLoginButCanClickFun];
|
|
|
+}
|
|
|
+
|
|
|
+#pragma mark 点击登录
|
|
|
+- (void)didClickScanButtonFun:(UIButton*)but
|
|
|
+{
|
|
|
+ _scanBut.userInteractionEnabled = NO;
|
|
|
+ ScanToLoginViewController *vc =[ScanToLoginViewController new];
|
|
|
+ [self.navigationController pushViewController:vc animated:YES];
|
|
|
+
|
|
|
+ KWeakSelf
|
|
|
+ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|
|
+ weakSelf.scanBut.userInteractionEnabled = YES;
|
|
|
+ });
|
|
|
+
|
|
|
+ vc.didScanSNFun = ^(NSString * _Nonnull curSnStr) {
|
|
|
+ weakSelf.accountTF.text = curSnStr;
|
|
|
+ [weakSelf checkLoginButCanClickFun];
|
|
|
+ };
|
|
|
+}
|
|
|
+
|
|
|
+#pragma mark 点击登录
|
|
|
+- (void)didClickButtonFun:(UIButton*)but
|
|
|
+{
|
|
|
+ NSString *trimmedText = [_accountTF.text stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
|
|
|
+ [self checkSNFunBy:trimmedText];
|
|
|
+}
|
|
|
+
|
|
|
+#pragma mark 点击协议
|
|
|
+- (void)didClickProtocolButtonFun:(UIButton*)but
|
|
|
+{
|
|
|
+ _protocolSelectBut.selected = !_protocolSelectBut.selected;
|
|
|
+ [self checkLoginButCanClickFun];
|
|
|
+}
|
|
|
+
|
|
|
+#pragma mark 检测登录按钮是否可用
|
|
|
+- (void)checkLoginButCanClickFun
|
|
|
+{
|
|
|
+ if(_protocolSelectBut.selected && _accountTF.text.length > 0){
|
|
|
+ if (!_loginOkBut.enabled) {
|
|
|
+ _loginOkBut.enabled = YES;
|
|
|
+ _gradientLayer.colors = @[(__bridge NSString *)[UIColor hwColor:@"#0CDEFD" alpha:1.0].CGColor, (__bridge NSString *)[UIColor hwColor:@"#058DFB" alpha:1.0].CGColor];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ if(_loginOkBut.enabled){
|
|
|
+ _loginOkBut.enabled = NO;
|
|
|
+ _gradientLayer.colors = @[(__bridge NSString *)[UIColor hwColor:@"#0CDEFD" alpha:0.5].CGColor, (__bridge NSString *)[UIColor hwColor:@"#058DFB" alpha:0.5].CGColor];
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+#pragma mark 验证SN
|
|
|
+- (void)checkSNFunBy:(NSString *)sn{
|
|
|
+
|
|
|
+ if(sn.length != 22){
|
|
|
+ NSString *title1 = NSLocalizedString(@"login_input_error_tip",nil);
|
|
|
+ [[iToast makeText:title1] show];
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ KWeakSelf
|
|
|
+ [[netWorkManager shareInstance] getThridMsgBySN:sn success:^(id _Nonnull responseObject) {
|
|
|
+ DeviceThirdIdModel *model = responseObject;
|
|
|
+ if([model isKindOfClass:[DeviceThirdIdModel class]]){
|
|
|
+
|
|
|
+ if(model.status == 0 && model.data){
|
|
|
+ ksharedAppDelegate.DeviceThirdIdMod = model;
|
|
|
+ [weakSelf gotoGuideViewFunBy:sn withResponseObject:model];
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ NSInteger state = 2;
|
|
|
+ if (model.status == 201 || model.status == 202) {
|
|
|
+ state = model.status;
|
|
|
+ }
|
|
|
+
|
|
|
+ [weakSelf showAlertFun:state];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else{
|
|
|
+// if(self->_didScanErrorFun){
|
|
|
+// self->_didScanErrorFun(2);
|
|
|
+// }
|
|
|
+ [weakSelf showAlertFun:2];
|
|
|
+ }
|
|
|
+
|
|
|
+ } failure:^(NSError * _Nonnull error) {
|
|
|
+ [weakSelf showAlertFun:0];
|
|
|
+
|
|
|
+// if(self->_didScanErrorFun){
|
|
|
+// self->_didScanErrorFun(0);
|
|
|
+// }
|
|
|
+// dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|
|
+// [self.navigationController popViewControllerAnimated:YES];
|
|
|
+// });
|
|
|
+ }];
|
|
|
+}
|
|
|
+
|
|
|
+- (void)showAlertFun:(NSInteger)_getSNMsgcode
|
|
|
+{
|
|
|
+
|
|
|
+
|
|
|
+ NSString *linkErrTitle = NSLocalizedString(@"scan_sn_data_error_title",nil);
|
|
|
+ NSString *linkErrTip = NSLocalizedString(@"scan_sn_data_error_content",nil);
|
|
|
+
|
|
|
+ if(_getSNMsgcode == 202){
|
|
|
+ linkErrTitle = NSLocalizedString(@"get_sn_msg_202_title",nil);
|
|
|
+ linkErrTip = NSLocalizedString(@"get_sn_msg_202_content",nil);
|
|
|
+ }else if (_getSNMsgcode == 201){
|
|
|
+ linkErrTitle = NSLocalizedString(@"get_sn_msg_201_title",nil);
|
|
|
+ linkErrTip = NSLocalizedString(@"get_sn_msg_201_content",nil);
|
|
|
+ }
|
|
|
+
|
|
|
+ ComontAlretViewController *linkFailAlretVC= [[ComontAlretViewController alloc] initWithTiTle:linkErrTitle
|
|
|
+ msg:linkErrTip
|
|
|
+ imageStr:nil
|
|
|
+ cancelTitle:NSLocalizedString(@"guide_set_pwd_guide_know",nil)
|
|
|
+ okTitle:nil isOkBtnHighlight:NO
|
|
|
+ didClickOk:^{
|
|
|
+
|
|
|
+
|
|
|
+ } didClickCancel:^{
|
|
|
+
|
|
|
+ }];
|
|
|
+
|
|
|
+ linkFailAlretVC.modalPresentationStyle = UIModalPresentationCustom;
|
|
|
+
|
|
|
+ //[linkFailAlretVC setMsgTextAlignment:NSTextAlignmentLeft];
|
|
|
+ [self presentViewController:linkFailAlretVC animated:YES completion:^{
|
|
|
+ linkFailAlretVC.view.superview.backgroundColor = [UIColor clearColor];
|
|
|
+ }];
|
|
|
+}
|
|
|
+
|
|
|
+#pragma mark GuideViewController
|
|
|
+- (void)gotoGuideViewFunBy:(NSString*)sn withResponseObject:(DeviceThirdIdModel*)DeviceThirdIdMod
|
|
|
+{
|
|
|
+ //数据埋点
|
|
|
+ //[[netWorkManager shareInstance] DataEmbeddingPointBy:0 withEventValue:@"Scan_code"];
|
|
|
+
|
|
|
+ NSDictionary *newDict = [[NSDictionary alloc] initWithObjectsAndKeys:sn,Const_Have_Add_Device_SN, nil];
|
|
|
+ [HWDataManager setObjectWithKey:Const_Have_Add_Device value:newDict];
|
|
|
+ [HWDataManager setBoolWithKey:stringKeyAddSn(Const_file_Transfe_working_background) value:YES];
|
|
|
+
|
|
|
+ //不走引导页
|
|
|
+ [HWDataManager setBoolWithKey:Const_Have_Show_Guide value:YES];
|
|
|
+
|
|
|
+ /*下一步*/
|
|
|
+// GuideViewController *nextVC = [[GuideViewController alloc] init];
|
|
|
+// nextVC.sn = sn;
|
|
|
+// [self.navigationController pushViewController:nextVC animated:YES];
|
|
|
+
|
|
|
+ //是否已经有密码了 有就是输入密码 没有就是设置密码
|
|
|
+ NSString *curPwd = DeviceThirdIdMod.data.password;
|
|
|
+
|
|
|
+ if(curPwd && curPwd.length > 0){
|
|
|
+ BOOL haveOpenMask = ksharedAppDelegate.DeviceThirdIdMod.data.isPrivacyMode;
|
|
|
+ if(!haveOpenMask)
|
|
|
+ {
|
|
|
+ ksharedAppDelegate.isFirstInputPwdDone = YES;
|
|
|
+ [[NSNotificationCenter defaultCenter] postNotificationName:GuideOkNotification object:nil];
|
|
|
+
|
|
|
+ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|
|
+ [[NSNotificationCenter defaultCenter] postNotificationName:didInputPWDNotification object:nil];
|
|
|
+ });
|
|
|
+
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ /*设置密码*/
|
|
|
+// inputPWDViewController *nextVC = [[inputPWDViewController alloc] init];
|
|
|
+// nextVC.isQRCodeType = YES;
|
|
|
+// [self.navigationController pushViewController:nextVC animated:YES];
|
|
|
+
|
|
|
+ [[NSNotificationCenter defaultCenter] postNotificationName:GuideOkNotification object:nil];
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ /*设置密码*/
|
|
|
+// SetPWDFirstViewController *nextVC = [[SetPWDFirstViewController alloc] init];
|
|
|
+// [self.navigationController pushViewController:nextVC animated:YES];
|
|
|
+
|
|
|
+ [[NSNotificationCenter defaultCenter] postNotificationName:GuideOkNotification object:nil];
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+#pragma mark 用户协议
|
|
|
+- (void)ruleBtnClick {
|
|
|
+//https://cliys.armclouding.com/h5/protocol/protocol.html?agreementCoding=YSZYHXY2002&type=1
|
|
|
+// [self gotoProtocolWKWebVCByPush:YES];
|
|
|
+ CustomerWebViewController *vc = [[CustomerWebViewController alloc] init];
|
|
|
+ vc.titleStr = NSLocalizedString(@"app_update_use_deal",nil);
|
|
|
+ NSString *url = @"https://cliys.armclouding.com/h5/protocol/protocol.html?agreementCoding=YSZYHXY2003&type=1";//[NSString stringWithFormat:@"%@/h5/protocol/protocol.html?agreementCoding=YSZYHXY2002&type=1", CloudService];
|
|
|
+ vc.webUrl = url;
|
|
|
+ [self.navigationController pushViewController:vc animated:YES];
|
|
|
+}
|
|
|
+
|
|
|
+#pragma mark 隐私协议
|
|
|
+- (void)privateBtnClick {
|
|
|
+
|
|
|
+// [self gotoPrivateProtocolWKWebVCByPush:YES];
|
|
|
+ CustomerWebViewController *vc = [[CustomerWebViewController alloc] init];
|
|
|
+ vc.titleStr = NSLocalizedString(@"app_update_private",nil);
|
|
|
+ NSString *url = @"https://cliys.armclouding.com/h5/protocol/protocol.html?agreementCoding=YSZYSXY2002&type=1";//[NSString stringWithFormat:@"%@/h5/protocol/protocol.html?agreementCoding=YSZYSXY2001&type=1", CloudService];
|
|
|
+ vc.webUrl = url;
|
|
|
+ [self.navigationController pushViewController:vc animated:YES];
|
|
|
+}
|
|
|
+@end
|