141 lines
5.1 KiB
Objective-C
141 lines
5.1 KiB
Objective-C
//
|
|
// YMMineResetPayPwdViewController.m
|
|
// YUMI
|
|
//
|
|
// Created by YUMI on 2021/9/18.
|
|
// 重置支付密码
|
|
|
|
#import "XPMineResetPayPwdViewController.h"
|
|
///Third
|
|
#import <Masonry/Masonry.h>
|
|
#import <ReactiveObjC/ReactiveObjC.h>
|
|
///Tool
|
|
#import "DJDKMIMOMColor.h"
|
|
#import "UIImage+Utils.h"
|
|
///View
|
|
#import "XPMineModifPayPwdView.h"
|
|
///P
|
|
#import "XPMineResetPayPasswordPresenter.h"
|
|
#import "XPMineResetPayPasswordProtocol.h"
|
|
///VC
|
|
#import "XPMineSettingViewController.h"
|
|
|
|
@interface XPMineResetPayPwdViewController ()<XPMineResetPayPasswordProtocol>
|
|
///容器
|
|
@property (nonatomic,strong) UIStackView *stackView;
|
|
///新的密码
|
|
@property (nonatomic,strong) XPMineModifPayPwdView *passwordView;
|
|
///校验
|
|
@property (nonatomic,strong) XPMineModifPayPwdView *verificationCodeInputView;
|
|
///
|
|
@property (nonatomic,strong) UIButton *submitButton;
|
|
@end
|
|
|
|
@implementation XPMineResetPayPwdViewController
|
|
|
|
- (XPMineResetPayPasswordPresenter *)createPresenter {
|
|
return [[XPMineResetPayPasswordPresenter alloc] init];
|
|
}
|
|
|
|
- (void)viewDidLoad {
|
|
[super viewDidLoad];
|
|
[self initSubViews];
|
|
[self initSubViewConstraints];
|
|
[self initEvents];
|
|
}
|
|
|
|
#pragma mark - Private Method
|
|
- (void)initSubViews {
|
|
self.title = YMLocalizedString(@"XPMineResetPayPwdViewController0");
|
|
[self.view addSubview:self.stackView];
|
|
[self.view addSubview:self.submitButton];
|
|
|
|
[self.stackView addArrangedSubview:self.passwordView];
|
|
[self.stackView addArrangedSubview:self.verificationCodeInputView];
|
|
}
|
|
|
|
- (void)initSubViewConstraints {
|
|
[self.stackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.leading.trailing.top.mas_equalTo(self.view);
|
|
}];
|
|
|
|
[self.submitButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.top.mas_equalTo(self.stackView.mas_bottom).offset(45);
|
|
make.trailing.leading.mas_equalTo(self.view).inset(32);
|
|
make.height.mas_equalTo(45);
|
|
}];
|
|
}
|
|
|
|
- (void)initEvents {
|
|
@weakify(self);
|
|
RAC(self.submitButton, enabled) = [RACSignal combineLatest:@[self.passwordView.contentTextField.rac_textSignal, self.verificationCodeInputView.contentTextField.rac_textSignal] reduce:^id _Nonnull(NSString *password, NSString *checkPassword){
|
|
return @(password.length == 6 && checkPassword.length == 6);
|
|
}];
|
|
}
|
|
|
|
#pragma mark - XPMineResetPayPasswordProtocol
|
|
- (void)resetPayPasswordSuccess {
|
|
[self showErrorToast:YMLocalizedString(@"XPMineResetPayPwdViewController1")];
|
|
for (UIViewController *VC in self.navigationController.viewControllers) {
|
|
if ([VC isKindOfClass:[XPMineSettingViewController class]]) {
|
|
[self.navigationController popToViewController:VC animated:YES];
|
|
return;
|
|
}
|
|
}
|
|
[self.navigationController popViewControllerAnimated:YES];
|
|
}
|
|
#pragma mark - Event Response
|
|
- (void)submitButtonAction:(UIButton *)sender {
|
|
if (![self.passwordView.contentTextField.text isEqual:self.verificationCodeInputView.contentTextField.text]) {
|
|
[self showErrorToast:YMLocalizedString(@"XPMineResetPayPwdViewController2")];
|
|
}
|
|
[self.presenter resetPayPassword:self.passwordView.contentTextField.text phone:@"" veriftCode:@""];
|
|
}
|
|
|
|
#pragma mark - Getters And Setters
|
|
- (UIStackView *)stackView {
|
|
if (!_stackView) {
|
|
_stackView = [[UIStackView alloc] init];
|
|
_stackView.axis = UILayoutConstraintAxisVertical;
|
|
_stackView.distribution = UIStackViewDistributionFill;
|
|
_stackView.alignment = UIStackViewAlignmentFill;
|
|
_stackView.spacing = 0;
|
|
}
|
|
return _stackView;
|
|
}
|
|
|
|
- (XPMineModifPayPwdView *)passwordView {
|
|
if (!_passwordView) {
|
|
_passwordView = [[XPMineModifPayPwdView alloc] init];
|
|
_passwordView.placeholder = YMLocalizedString(@"XPMineResetPayPwdViewController3");
|
|
}
|
|
return _passwordView;
|
|
}
|
|
|
|
- (XPMineModifPayPwdView *)verificationCodeInputView {
|
|
if (!_verificationCodeInputView) {
|
|
_verificationCodeInputView = [[XPMineModifPayPwdView alloc] init];
|
|
_verificationCodeInputView.placeholder = YMLocalizedString(@"XPMineResetPayPwdViewController4");
|
|
}
|
|
return _verificationCodeInputView;
|
|
}
|
|
|
|
- (UIButton *)submitButton {
|
|
if (!_submitButton) {
|
|
_submitButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
[_submitButton setTitleColor:[DJDKMIMOMColor confirmButtonTextColor] forState:UIControlStateNormal];
|
|
[_submitButton setTitleColor:[DJDKMIMOMColor disableButtonTextColor] forState:UIControlStateDisabled];
|
|
[_submitButton setTitle:YMLocalizedString(@"TTAlertConfig0") forState:UIControlStateNormal];
|
|
_submitButton.titleLabel.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:18];
|
|
_submitButton.layer.masksToBounds = YES;
|
|
_submitButton.layer.cornerRadius = 45/2;
|
|
_submitButton.enabled = NO;
|
|
[_submitButton setBackgroundImage:[UIImage gradientColorImageFromColors:@[[DJDKMIMOMColor confirmButtonGradientStartColor], [DJDKMIMOMColor confirmButtonGradientEndColor]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)] forState:UIControlStateNormal];
|
|
[_submitButton setBackgroundImage:[UIImage gradientColorImageFromColors:@[[DJDKMIMOMColor disableButtonColor], [DJDKMIMOMColor disableButtonColor]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)] forState:UIControlStateDisabled];
|
|
[_submitButton addTarget:self action:@selector(submitButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
|
}
|
|
return _submitButton;
|
|
}
|
|
|
|
@end
|