// // LoginSignUpV.m // Asteria // // Created by ēŽ‹ēŒ› on 2023/5/17. // #import "LoginSignUpV.h" #import "PassWordSecureBtnV.h" #import "EamilTFmatchV.h" #import @interface LoginSignUpV () @property (nonatomic, strong) TT_CustonTF *xxx_firstName; @property (nonatomic, strong) TT_CustonTF *xxx_lasetName; @property (nonatomic, strong) EamilTFmatchV *xxx_regMmailV; @property (nonatomic, strong) PassWordSecureBtnV *xxx_regPassWord; @property (nonatomic, strong) UILabel *xxx_dateLab; @property (nonatomic, strong) UIButton *xxx_creatBtn; @property (nonatomic, strong) UIButton *xxx_subscribedBtn; @property (nonatomic, strong) QMUILabel *xxx_subscribedLab; @property (nonatomic, strong) YYLabel *xxx_ClickLab; @property (nonatomic, strong) UIButton *xxx_selectBtn; @property (nonatomic, strong) NSDate *birthdaySelectDate; @end @implementation LoginSignUpV - (void)tt_setupViews{ [self addSubview:self.xxx_firstName]; [self addSubview:self.xxx_lasetName]; [self addSubview:self.xxx_regMmailV]; [self addSubview:self.xxx_regPassWord]; [self addSubview:self.xxx_dateLab]; [self addSubview:self.xxx_creatBtn]; [self addSubview:self.xxx_subscribedBtn]; [self addSubview:self.xxx_subscribedLab]; [self addSubview:self.xxx_selectBtn]; [self addSubview:self.xxx_ClickLab]; [self bringSubviewToFront:self.xxx_regMmailV]; self.birthdaySelectDate = [NSDate date]; } #pragma mark - **************** action **************** -(void)action_dateOfBirth{ UIViewController *topVC = topViewController(); [topVC.view endEditing:YES]; BRDatePickerView *datePickerView = [[BRDatePickerView alloc]init]; datePickerView.pickerMode = BRDatePickerModeDate; datePickerView.title = @"Please Select The Date Of Birth"; datePickerView.selectDate = self.birthdaySelectDate; datePickerView.minDate = [NSDate br_setYear:1900 month:1 day:1]; datePickerView.maxDate = [NSDate date]; datePickerView.isAutoSelect = YES; datePickerView.resultBlock = ^(NSDate *selectDate, NSString *selectValue) { self.birthdaySelectDate = selectDate; NSDateFormatter *formartter= [[NSDateFormatter alloc]init]; [formartter setDateFormat:@"MM/dd/yyyy"]; NSString *currentDateStr = [formartter stringFromDate:selectDate]; self.xxx_dateLab.text = currentDateStr; self.xxx_dateLab.textColor = [UIColor qmui_colorWithHexString:@"#000000"]; NSLog(@"selectValue=%@", selectValue); NSLog(@"selectDate=%@", selectDate); NSLog(@"---------------------------------"); }; [datePickerView show]; } -(void)action_creatClick{ if (self.xxx_selectBtn.selected == NO) { [self makeToast:@"Please select 'I Agree' to continue." duration:2 position:CSToastPositionCenter]; return; }else if (self.xxx_firstName.text.length == 0) { [self makeToast:@"Please Input FirstName" duration:2 position:CSToastPositionCenter]; return; }else if (self.xxx_lasetName.text.length == 0){ [self makeToast:@"Please Input LastName" duration:2 position:CSToastPositionCenter]; return; }else if(self.xxx_regMmailV.xxx_emailTF.text.length == 0 || ![Current_normalTool xxx_isValidateEmail:self.xxx_regMmailV.xxx_emailTF.text]){ [self makeToast:@"Please prvide an email address." duration:2 position:CSToastPositionCenter]; return; }else if(self.xxx_regPassWord.xxx_passwordTF.text.length<6){ [self makeToast:@"Please set the correct password." duration:2 position:CSToastPositionCenter]; return; } NSMutableDictionary *tempDic = [NSMutableDictionary dictionary]; [tempDic setObject:self.xxx_firstName.text forKey:@"firstName"]; [tempDic setObject:self.xxx_lasetName.text forKey:@"lastName"]; [tempDic setObject:self.xxx_regMmailV.xxx_emailTF.text forKey:@"email"]; [tempDic setObject:self.xxx_regPassWord.xxx_passwordTF.text forKey:@"password"]; BOOL isSubscribedSelect = self.xxx_subscribedBtn.selected; [tempDic setObject:[NSString stringWithFormat:@"%d",isSubscribedSelect] forKey:@"is_subscribed"]; if ([self.xxx_dateLab.text isEqualToString:@"Date Of Birth"]) { [tempDic setObject:@"" forKey:@"birthday"]; }else{ [tempDic setObject:self.xxx_dateLab.text forKey:@"birthday"]; } [self generaltriggermethodType:1 data:tempDic]; } -(void)action_xxx_subscribedBtnClick:(UIButton *)btn{ btn.selected = !btn.selected; } -(void)action_selectClick:(UIButton *)btn{ btn.selected = !btn.selected; } -(TT_CustonTF *)xxx_firstName{ if (!_xxx_firstName) { _xxx_firstName = [TT_ControlTool FTT_ControlToolUITextFieldFrame:CGRectMake(20, 0, (KScreenWidth-60)/2, 50) PlaceHolder:@"* FIRST NAME" andLifImage:nil AndRightImage:nil LiftImageFrame:CGRectZero RightImageFrame:CGRectZero AndTag:0 AndKeyboardType:UIKeyboardTypeDefault clearButtonMode:UITextFieldViewModeAlways AndReturnKeyType:UIReturnKeyDone masksToBounds:YES conrenRadius:4 BorderColor:[UIColor colorWithHexString:@"#000000"] BorderWidth:1]; _xxx_firstName.font = [UIFont fontWithName:Rob_Regular size:14]; _xxx_firstName.backgroundColor = [UIColor colorWithHexString:@"#FFFFFF"]; } return _xxx_firstName; } -(TT_CustonTF *)xxx_lasetName{ if (!_xxx_lasetName) { _xxx_lasetName = [TT_ControlTool FTT_ControlToolUITextFieldFrame:CGRectMake(CGRectGetMaxX(self.xxx_firstName.frame)+20, 0, (KScreenWidth-60)/2, 50) PlaceHolder:@"* LAST NAME" andLifImage:nil AndRightImage:nil LiftImageFrame:CGRectZero RightImageFrame:CGRectZero AndTag:0 AndKeyboardType:UIKeyboardTypeDefault clearButtonMode:UITextFieldViewModeAlways AndReturnKeyType:UIReturnKeyDone masksToBounds:YES conrenRadius:4 BorderColor:[UIColor colorWithHexString:@"#000000"] BorderWidth:1]; _xxx_lasetName.font = [UIFont fontWithName:Rob_Regular size:14]; _xxx_lasetName.backgroundColor = [UIColor colorWithHexString:@"#FFFFFF"]; } return _xxx_lasetName; } -(EamilTFmatchV *)xxx_regMmailV{ if (!_xxx_regMmailV) { _xxx_regMmailV = [[EamilTFmatchV alloc]initWithFrame:CGRectMake(0,CGRectGetMaxY(self.xxx_firstName.frame)+30 , KScreenWidth, 50)]; } return _xxx_regMmailV; } -(PassWordSecureBtnV *)xxx_regPassWord{ if (!_xxx_regPassWord) { _xxx_regPassWord = [[PassWordSecureBtnV alloc]initWithFrame:CGRectMake(20, CGRectGetMaxY(self.xxx_regMmailV.frame)+30, KScreenWidth-40, 50+20)]; } return _xxx_regPassWord; } -(UILabel *)xxx_dateLab{ if (!_xxx_dateLab) { _xxx_dateLab = [TT_ControlTool uc_ControlToolUILabelFrame:CGRectMake(20,CGRectGetMaxY(self.xxx_regPassWord.frame)+10, KScreenWidth-40, 50) AndTitle:@"DATE OF BIRTH" AndFontSize:14 AndTitleColor:[UIColor colorWithHexString:@"#999999"] Numberoflines:1 TextAlignment:NSTextAlignmentCenter adjustesFontSizesTowidth:NO masksToBounds:YES conrenrRadius:4 userInteractionEnabled:YES tap_selector:@selector(action_dateOfBirth) object:self]; _xxx_dateLab.layer.borderColor = [UIColor colorWithHexString:@"#000000"].CGColor; _xxx_dateLab.layer.borderWidth = 1; _xxx_dateLab.text = @"DATE OF BIRTH"; } return _xxx_dateLab; } - (UIButton *)xxx_creatBtn { if (!_xxx_creatBtn) { _xxx_creatBtn = [TT_ControlTool FTT_ControlToolUIButtonFrame:CGRectMake(20,CGRectGetMaxY(self.xxx_dateLab.frame)+30 ,KScreenWidth-40,50) taeget:self sel:@selector(action_creatClick) tag:0 AntTitle:@"CREATE ACCOUNT" titleFont:17 titleColor:[UIColor whiteColor] andImage:nil AndBackColor:nil adjustsFontSizesTowidth:NO masksToBounds:YES conrenRadius:5 BorderColor:nil BorderWidth:0 ContentHorizontalAligment:0]; _xxx_creatBtn.titleLabel.font = [UIFont fontWithName:Rob_Bold size:16]; _xxx_creatBtn.backgroundColor = ThemeColor; } return _xxx_creatBtn; } -(UIButton *)xxx_subscribedBtn{ if (!_xxx_subscribedBtn) { _xxx_subscribedBtn = [TT_ControlTool FTT_ControlToolUIButtonFrame:CGRectMake(20,CGRectGetMaxY(self.xxx_creatBtn.frame)+20, 40, 40) taeget:self sel:@selector(action_xxx_subscribedBtnClick:) tag:0 AntTitle:nil titleFont:0 titleColor:nil andImage:@"login_selectRido" AndBackColor:[UIColor clearColor] adjustsFontSizesTowidth:NO masksToBounds:NO conrenRadius:0 BorderColor:nil BorderWidth:0 ContentHorizontalAligment:0]; [_xxx_subscribedBtn setImage:[UIImage imageNamed:@"login_selectRido_select"] forState:UIControlStateSelected]; _xxx_subscribedBtn.selected = YES; } return _xxx_subscribedBtn; } -(QMUILabel *)xxx_subscribedLab{ if (!_xxx_subscribedLab) { _xxx_subscribedLab = [[QMUILabel alloc]init]; _xxx_subscribedLab.frame = CGRectMake(60, CGRectGetMaxY(self.xxx_creatBtn.frame)+20, KScreenWidth - 20-20-40, 40); NSString *string = @"I’d Like To Receive Emails Or Sms With Exclusive Discounts And News From Asteriahair"; _xxx_subscribedLab.text = string; _xxx_subscribedLab.font = [UIFont fontWithName:Rob_Regular size:12]; _xxx_subscribedLab.textColor = [UIColor colorWithHexString:@"#000000"]; } return _xxx_subscribedLab; } -(UIButton *)xxx_selectBtn{ if (!_xxx_selectBtn) { _xxx_selectBtn = [TT_ControlTool FTT_ControlToolUIButtonFrame:CGRectMake(20,CGRectGetMaxY(self.xxx_subscribedBtn.frame)+10, 40, 40) taeget:self sel:@selector(action_selectClick:) tag:1 AntTitle:nil titleFont:0 titleColor:nil andImage:@"login_selectRido" AndBackColor:[UIColor clearColor] adjustsFontSizesTowidth:NO masksToBounds:NO conrenRadius:0 BorderColor:nil BorderWidth:0 ContentHorizontalAligment:0]; [_xxx_selectBtn setImage:[UIImage imageNamed:@"login_selectRido_select"] forState:UIControlStateSelected]; } return _xxx_selectBtn; } -(YYLabel *)xxx_ClickLab{ if (!_xxx_ClickLab) { _xxx_ClickLab = [YYLabel new]; _xxx_ClickLab.numberOfLines = 0; _xxx_ClickLab.textVerticalAlignment = YYTextVerticalAlignmentCenter; _xxx_ClickLab.frame = CGRectMake(60, CGRectGetMaxY(self.xxx_subscribedBtn.frame)+10, KScreenWidth - 20-20-40, 40); NSString *string = @"I Agree To Asteriahair Terms & Conditions And Privacy Policy."; NSMutableAttributedString *attributed = [[NSMutableAttributedString alloc] initWithString:string]; YYTextHighlight *protocolHightlight = [[YYTextHighlight alloc] init]; [attributed yy_setTextHighlight:protocolHightlight range:[string rangeOfString:@"Terms & Conditions"]]; [attributed yy_setTextUnderline:[YYTextDecoration decorationWithStyle:YYTextLineStyleSingle] range:[string rangeOfString:@"Terms & Conditions"]]; YYTextHighlight *layHightlight = [[YYTextHighlight alloc] init]; [attributed yy_setTextHighlight:layHightlight range:[string rangeOfString:@"Privacy Policy"]]; [attributed yy_setTextUnderline:[YYTextDecoration decorationWithStyle:YYTextLineStyleSingle] range:[string rangeOfString:@"Privacy Policy"]]; [attributed yy_setColor:ThemeColor range:[string rangeOfString:@"Terms & Conditions"]]; [attributed yy_setColor:ThemeColor range:[string rangeOfString:@"Privacy Policy"]]; @weakify(self) [attributed yy_setTextHighlightRange:[string rangeOfString:@"Terms & Conditions"] color:ThemeColor backgroundColor:[UIColor clearColor] tapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) { NSLog(@"----"); NSString *temrUrl = [NSString stringWithFormat:@"%@terms-conditions",AS_WebSever]; [Fuction_Tool push_BaseWebUrl:temrUrl webTitle:@"Terms & Conditions"]; }]; [attributed yy_setTextHighlightRange:[string rangeOfString:@"Privacy Policy"] color:ThemeColor backgroundColor:[UIColor clearColor] tapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) { NSLog(@"----"); NSString *PrivacyUrl = [NSString stringWithFormat:@"%@privacy_policy",AS_WebSever]; [Fuction_Tool push_BaseWebUrl:PrivacyUrl webTitle:@"Privacy Policy"]; }]; _xxx_ClickLab.attributedText = attributed; _xxx_ClickLab.font = [UIFont systemFontOfSize:12]; } return _xxx_ClickLab; } @end