YMRetrievePasswordView.m 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504
  1. //
  2. // YMRetrievePasswordView.m
  3. // MSYOUPAI
  4. //
  5. // Created by YoMi on 2024/2/6.
  6. // Copyright © 2024 MS. All rights reserved.
  7. //
  8. #import "YMRetrievePasswordView.h"
  9. #import "YMRetrievePasswordViewModel.h"
  10. #import "YMCaptchaPopupView.h"
  11. #import "CaptchaCenter.h"
  12. @interface YMRetrievePasswordView ()
  13. /// 找回密码VM
  14. @property (nonatomic, strong) YMRetrievePasswordViewModel *viewModel;
  15. /// 手机视图
  16. @property (nonatomic, strong) UIView *mobileView;
  17. /// 手机号标签
  18. @property (nonatomic, strong) UILabel *mobileLb;
  19. /// 手机号输入框
  20. @property (nonatomic, strong) UITextField *mobileInputBox;
  21. /// 验证码视图
  22. @property (nonatomic, strong) UIView *verifyCodeView;
  23. /// 验证码标签
  24. @property (nonatomic, strong) UILabel *verifyCodeLb;
  25. /// 验证码输入框
  26. @property (nonatomic, strong) UITextField *verifyCodeInputBox;
  27. /// 获取验证码
  28. @property (nonatomic, strong) YMCaptchaCountdownButton *getVerifyCodeBtn;
  29. /// 密码视图
  30. @property (nonatomic, strong) UIView *passwordView;
  31. /// 密码标签
  32. @property (nonatomic, strong) UILabel *passwordLb;
  33. /// 密码输入框
  34. @property (nonatomic, strong) UITextField *passwordInputBox;
  35. /// 协议视图
  36. @property (nonatomic, strong) UIView *agreementView;
  37. /// 单选按钮
  38. @property (nonatomic, strong) UIButton *radioBtn;
  39. /// 协议标签
  40. @property (nonatomic, strong) YYLabel *agreementLb;
  41. /// 确定按钮
  42. @property (nonatomic, strong) UIButton *confirmBtn;
  43. @end
  44. @implementation YMRetrievePasswordView
  45. - (void)ym_setupViews{
  46. [self addSubview:self.mobileView];
  47. [self.mobileView addSubview:self.mobileLb];
  48. [self.mobileView addSubview:self.mobileInputBox];
  49. [self addSubview:self.verifyCodeView];
  50. [self.verifyCodeView addSubview:self.verifyCodeLb];
  51. [self.verifyCodeView addSubview:self.verifyCodeInputBox];
  52. [self.verifyCodeView addSubview:self.getVerifyCodeBtn];
  53. [self addSubview:self.passwordView];
  54. [self.passwordView addSubview:self.passwordLb];
  55. [self.passwordView addSubview:self.passwordInputBox];
  56. [self addSubview:self.agreementView];
  57. [self.agreementView addSubview:self.radioBtn];
  58. [self.agreementView addSubview:self.agreementLb];
  59. [self addSubview:self.confirmBtn];
  60. [self setNeedsUpdateConstraints];
  61. [self updateConstraintsIfNeeded];
  62. }
  63. - (void)updateConstraints{
  64. [self.mobileView mas_makeConstraints:^(MASConstraintMaker *make) {
  65. make.top.equalTo(self).offset(adapt(24));
  66. make.left.equalTo(self).offset(adapt(28));
  67. make.right.equalTo(self).offset(adapt(-28));
  68. }];
  69. [self.mobileLb mas_makeConstraints:^(MASConstraintMaker *make) {
  70. make.top.equalTo(self.mobileView);
  71. make.left.equalTo(self.mobileView);
  72. }];
  73. [self.mobileInputBox mas_makeConstraints:^(MASConstraintMaker *make) {
  74. make.top.equalTo(self.mobileLb.mas_bottom).offset(adapt(10));
  75. make.left.equalTo(self.mobileView);
  76. make.right.equalTo(self.mobileView);
  77. make.bottom.equalTo(self.mobileView);
  78. make.height.mas_equalTo(adapt(30));
  79. }];
  80. [self.verifyCodeView mas_makeConstraints:^(MASConstraintMaker *make) {
  81. make.top.equalTo(self.mobileView.mas_bottom).offset(adapt(24));
  82. make.left.equalTo(self.mobileView.mas_left);
  83. make.right.equalTo(self.mobileView.mas_right);
  84. }];
  85. [self.verifyCodeLb mas_makeConstraints:^(MASConstraintMaker *make) {
  86. make.top.equalTo(self.verifyCodeView);
  87. make.left.equalTo(self.verifyCodeView);
  88. }];
  89. [self.verifyCodeInputBox mas_makeConstraints:^(MASConstraintMaker *make) {
  90. make.top.equalTo(self.verifyCodeLb.mas_bottom).offset(adapt(10));
  91. make.left.equalTo(self.verifyCodeView);
  92. make.bottom.equalTo(self.verifyCodeView);
  93. make.height.mas_equalTo(adapt(30));
  94. }];
  95. [self.getVerifyCodeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  96. make.top.equalTo(self.verifyCodeLb.mas_bottom).offset(adapt(10));
  97. make.left.equalTo(self.verifyCodeInputBox.mas_right).offset(adapt(5));
  98. make.right.equalTo(self.verifyCodeView);
  99. make.bottom.equalTo(self.verifyCodeView);
  100. make.width.mas_equalTo(adapt(100));
  101. }];
  102. [self.passwordView mas_makeConstraints:^(MASConstraintMaker *make) {
  103. make.top.equalTo(self.verifyCodeView.mas_bottom).offset(adapt(24));
  104. make.left.equalTo(self.mobileView.mas_left);
  105. make.right.equalTo(self.mobileView.mas_right);
  106. }];
  107. [self.passwordLb mas_makeConstraints:^(MASConstraintMaker *make) {
  108. make.top.equalTo(self.passwordView);
  109. make.left.equalTo(self.passwordView);
  110. }];
  111. [self.passwordInputBox mas_makeConstraints:^(MASConstraintMaker *make) {
  112. make.top.equalTo(self.passwordLb.mas_bottom).offset(adapt(10));
  113. make.left.equalTo(self.passwordView);
  114. make.right.equalTo(self.passwordView);
  115. make.bottom.equalTo(self.passwordView);
  116. make.height.mas_equalTo(adapt(30));
  117. }];
  118. [self.confirmBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  119. make.top.equalTo(self.passwordView.mas_bottom).offset(adapt(24));
  120. make.left.equalTo(self.mobileView.mas_left);
  121. make.right.equalTo(self.mobileView.mas_right);
  122. make.height.mas_equalTo(adapt(40));
  123. }];
  124. [self.agreementView mas_makeConstraints:^(MASConstraintMaker *make) {
  125. make.centerX.equalTo(self.mas_centerX);
  126. make.bottom.equalTo(self).offset(Is_iPhoneX ? adapt(-32) : adapt(-12));
  127. }];
  128. [self.radioBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  129. make.centerY.equalTo(self.agreementLb.mas_centerY);
  130. make.left.equalTo(self.agreementView).offset(adapt(5));
  131. make.width.height.mas_equalTo(adapt(12));
  132. }];
  133. [self.agreementLb mas_makeConstraints:^(MASConstraintMaker *make) {
  134. make.top.equalTo(self.agreementView).offset(adapt(10));
  135. make.left.equalTo(self.radioBtn.mas_right).offset(adapt(5));
  136. make.right.equalTo(self.agreementView).offset(adapt(-5));
  137. make.bottom.equalTo(self.agreementView).offset(adapt(-10));
  138. }];
  139. [super updateConstraints];
  140. }
  141. - (void)ym_bindViewModel:(YMRetrievePasswordViewModel *)viewModel{
  142. if (!viewModel) {
  143. return;
  144. }
  145. _viewModel = viewModel;
  146. RAC(self.viewModel , mobile) = [[RACSignal merge:@[RACObserve(self.mobileInputBox, text),self.mobileInputBox.rac_textSignal]] takeUntil:self.rac_willDeallocSignal];
  147. RAC(self.viewModel , verifyCode) = [[RACSignal merge:@[RACObserve(self.verifyCodeInputBox, text),self.verifyCodeInputBox.rac_textSignal]]takeUntil:self.rac_willDeallocSignal];
  148. RAC(self.viewModel , password) = [[RACSignal merge:@[RACObserve(self.passwordInputBox, text),self.passwordInputBox.rac_textSignal]]takeUntil:self.rac_willDeallocSignal];
  149. [self.viewModel.validRetrievePasswordSignal subscribeNext:^(id _Nullable value) {
  150. self.confirmBtn.enabled = [value boolValue];
  151. if ([value boolValue]) {
  152. self.confirmBtn.alpha = 1;
  153. } else {
  154. self.confirmBtn.alpha = 0.5;
  155. }
  156. }];
  157. }
  158. - (UIView *)mobileView{
  159. if (!_mobileView) {
  160. _mobileView = [[UIView alloc]init];
  161. }
  162. return _mobileView;
  163. }
  164. - (UILabel *)mobileLb{
  165. if (!_mobileLb) {
  166. _mobileLb = [[UILabel alloc]init];
  167. _mobileLb.font = LCBoldFont(17);
  168. _mobileLb.textColor = HexColorFromRGB(0x1B2739);
  169. _mobileLb.textAlignment = NSTextAlignmentLeft;
  170. _mobileLb.text = @"手机号";
  171. }
  172. return _mobileLb;
  173. }
  174. - (UITextField *)mobileInputBox{
  175. if (!_mobileInputBox) {
  176. NSMutableParagraphStyle *style = [[NSMutableParagraphStyle alloc]init];
  177. style.minimumLineHeight = 0;
  178. NSMutableAttributedString *placeholderAttributed = [[NSMutableAttributedString alloc]initWithString:@"请输入手机号"];
  179. placeholderAttributed.yy_paragraphStyle = style;
  180. placeholderAttributed.yy_font = LCFont(14);
  181. placeholderAttributed.yy_color = HexColorFromRGB(0xADB0BC);
  182. _mobileInputBox = [[UITextField alloc]init];
  183. _mobileInputBox.attributedPlaceholder = placeholderAttributed;
  184. _mobileInputBox.clearButtonMode = UITextFieldViewModeWhileEditing;
  185. _mobileInputBox.autocorrectionType = UITextAutocorrectionTypeDefault;
  186. _mobileInputBox.autocapitalizationType = UITextAutocapitalizationTypeNone;
  187. _mobileInputBox.keyboardType = UIKeyboardTypePhonePad;
  188. _mobileInputBox.ba_maxLength = 11;
  189. //@weakify(self)
  190. [[[_mobileInputBox rac_textSignal] takeUntil:self.rac_willDeallocSignal] subscribeNext:^(id x) {
  191. //@strongify(self)
  192. }];
  193. }
  194. return _mobileInputBox;
  195. }
  196. - (UIView *)verifyCodeView{
  197. if (!_verifyCodeView) {
  198. _verifyCodeView = [[UIView alloc]init];
  199. }
  200. return _verifyCodeView;
  201. }
  202. - (UILabel *)verifyCodeLb{
  203. if (!_verifyCodeLb) {
  204. _verifyCodeLb = [[UILabel alloc]init];
  205. _verifyCodeLb.font = LCBoldFont(17);
  206. _verifyCodeLb.textColor = HexColorFromRGB(0x1B2739);
  207. _verifyCodeLb.textAlignment = NSTextAlignmentLeft;
  208. _verifyCodeLb.text = @"短信验证码";
  209. }
  210. return _verifyCodeLb;
  211. }
  212. - (UITextField *)verifyCodeInputBox{
  213. if (!_verifyCodeInputBox) {
  214. NSMutableParagraphStyle *style = [[NSMutableParagraphStyle alloc]init];
  215. style.minimumLineHeight = 0;
  216. NSMutableAttributedString *placeholderAttributed = [[NSMutableAttributedString alloc]initWithString:@"请输入验证码"];
  217. placeholderAttributed.yy_paragraphStyle = style;
  218. placeholderAttributed.yy_font = LCFont(14);
  219. placeholderAttributed.yy_color = HexColorFromRGB(0xADB0BC);
  220. _verifyCodeInputBox = [[UITextField alloc]init];
  221. _verifyCodeInputBox.attributedPlaceholder = placeholderAttributed;
  222. _verifyCodeInputBox.clearButtonMode = UITextFieldViewModeWhileEditing;
  223. _verifyCodeInputBox.autocorrectionType = UITextAutocorrectionTypeDefault;
  224. _verifyCodeInputBox.autocapitalizationType = UITextAutocapitalizationTypeNone;
  225. _verifyCodeInputBox.keyboardType = UIKeyboardTypeDecimalPad;
  226. //@weakify(self)
  227. [[[_verifyCodeInputBox rac_textSignal] takeUntil:self.rac_willDeallocSignal] subscribeNext:^(id x) {
  228. // @strongify(self)
  229. }];
  230. }
  231. return _verifyCodeInputBox;
  232. }
  233. - (YMCaptchaCountdownButton *)getVerifyCodeBtn{
  234. if (!_getVerifyCodeBtn) {
  235. _getVerifyCodeBtn = [YMCaptchaCountdownButton buttonWithType:UIButtonTypeCustom];
  236. _getVerifyCodeBtn.titleLabel.font = LCFont(14);
  237. [_getVerifyCodeBtn setTitleColor:HexColorFromRGB(0x6D82FD) forState:UIControlStateNormal];
  238. [_getVerifyCodeBtn setTitle:@"获取验证码" forState:UIControlStateNormal];
  239. @weakify(self)
  240. [_getVerifyCodeBtn countDownButtonHandler:^(YMCaptchaCountdownButton *sender, NSInteger tag) {
  241. @strongify(self)
  242. if (OCStringIsEmpty(self.mobileInputBox.text)) {
  243. [ZCHUDHelper showTitle:@"请输入手机号"];
  244. return;
  245. }
  246. [self.mobileInputBox resignFirstResponder];
  247. [self.verifyCodeInputBox resignFirstResponder];
  248. [self.passwordInputBox resignFirstResponder];
  249. [CaptchaCenter.defaultCenter getCaptchaType:^(NSNumber * _Nullable type, NSError * _Nullable error) {
  250. if (error) {
  251. [ZCHUDHelper showTitle:@"获取验证码失败"];
  252. return;
  253. }
  254. if ([type isEqualToNumber:@1]) { // 原生
  255. YMCaptchaPopupView *view = [[YMCaptchaPopupView alloc] init];
  256. view.cancelButtonTappedBlock = ^{};
  257. @weakify(self)
  258. view.confirmButtonTappedBlock = ^(NSString * _Nonnull input) {
  259. @strongify(self)
  260. [self getVerifyCodeWithCapthca:input sender:sender];
  261. };
  262. UIView *currentVCView = [LCTools getCurrentVC].view;
  263. if (currentVCView != nil && ![currentVCView isEqual:NSNull.null]) {
  264. [view showInView:currentVCView];
  265. }
  266. } else { // 阿里
  267. @weakify(self)
  268. [CaptchaCenter.defaultCenter verifyCompletion:^(NSString * _Nonnull status, NSDictionary * _Nonnull result) {
  269. @strongify(self)
  270. [self getVerifyCodeWithCapthca:result sender:sender];
  271. }];
  272. }
  273. }];
  274. }];
  275. }
  276. return _getVerifyCodeBtn;
  277. }
  278. - (void)getVerifyCodeWithCapthca:(id)captcha sender:(YMCaptchaCountdownButton *)sender {
  279. @weakify(self)
  280. [self.viewModel getVerifyCodeWithCapthca:captcha Handler:^(NSDictionary * _Nonnull dic, NSError * _Nullable error) {
  281. @strongify(self)
  282. sender.enabled = NO;
  283. [sender startCountDownWithSecond:59];
  284. [sender countDownChanging:^NSString *(YMCaptchaCountdownButton *countDownButton, NSUInteger second) {
  285. NSString *title = [NSString stringWithFormat:@"重新发送(%zds)",second];
  286. return title;
  287. }];
  288. [sender countDownFinished:^NSString *(YMCaptchaCountdownButton *countDownButton, NSUInteger second) {
  289. countDownButton.enabled = YES;
  290. return @"重新发送";
  291. }];
  292. }];
  293. }
  294. - (UIView *)passwordView{
  295. if (!_passwordView) {
  296. _passwordView = [[UIView alloc]init];
  297. }
  298. return _passwordView;
  299. }
  300. - (UILabel *)passwordLb{
  301. if (!_passwordLb) {
  302. _passwordLb = [[UILabel alloc]init];
  303. _passwordLb.font = LCBoldFont(17);
  304. _passwordLb.textColor = HexColorFromRGB(0x1B2739);
  305. _passwordLb.textAlignment = NSTextAlignmentLeft;
  306. _passwordLb.text = @"密码";
  307. }
  308. return _passwordLb;
  309. }
  310. - (UITextField *)passwordInputBox{
  311. if (!_passwordInputBox) {
  312. NSMutableParagraphStyle *style = [[NSMutableParagraphStyle alloc]init];
  313. style.minimumLineHeight = 0;
  314. NSMutableAttributedString *placeholderAttributed = [[NSMutableAttributedString alloc]initWithString:@"请输入密码"];
  315. placeholderAttributed.yy_paragraphStyle = style;
  316. placeholderAttributed.yy_font = LCFont(14);
  317. placeholderAttributed.yy_color = HexColorFromRGB(0xADB0BC);
  318. _passwordInputBox = [[UITextField alloc]init];
  319. _passwordInputBox.attributedPlaceholder = placeholderAttributed;
  320. _passwordInputBox.clearButtonMode = UITextFieldViewModeWhileEditing;
  321. _passwordInputBox.autocorrectionType = UITextAutocorrectionTypeDefault;
  322. _passwordInputBox.autocapitalizationType = UITextAutocapitalizationTypeNone;
  323. _passwordInputBox.keyboardType = UIKeyboardTypeDefault;
  324. _passwordInputBox.secureTextEntry = YES;
  325. //@weakify(self)
  326. [[[_passwordInputBox rac_textSignal] takeUntil:self.rac_willDeallocSignal] subscribeNext:^(id x) {
  327. //@strongify(self)
  328. }];
  329. }
  330. return _passwordInputBox;
  331. }
  332. - (UIView *)agreementView{
  333. if (!_agreementView) {
  334. _agreementView = [[UIView alloc]init];
  335. }
  336. return _agreementView;
  337. }
  338. - (UIButton *)radioBtn{
  339. if (!_radioBtn) {
  340. _radioBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  341. [_radioBtn setBackgroundImage:ImageByName(@"ym_login_auth_normal_icon") forState:UIControlStateNormal];
  342. [_radioBtn setBackgroundImage:ImageByName(@"ym_login_auth_selected_icon") forState:UIControlStateSelected];
  343. // WS(weakSelf)
  344. [[[_radioBtn rac_signalForControlEvents:UIControlEventTouchUpInside] takeUntil:self.rac_willDeallocSignal] subscribeNext:^(__kindof UIButton * _Nullable sender) {
  345. sender.selected = !sender.selected;
  346. }];
  347. }
  348. return _radioBtn;
  349. }
  350. - (YYLabel *)agreementLb{
  351. if (!_agreementLb) {
  352. _agreementLb = [[YYLabel alloc] init];
  353. _agreementLb.numberOfLines = 0;
  354. _agreementLb.preferredMaxLayoutWidth = kFrameWidth - 55;
  355. NSString *agreementText = @"同意《用户协议》与《隐私政策》";
  356. NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc]init];
  357. paragraphStyle.alignment = NSTextAlignmentLeft;
  358. NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc]initWithString:agreementText];
  359. attributedString.yy_font = LCFont(12);
  360. attributedString.yy_color = HexColorFromRGBA(0x000000,0.65);
  361. attributedString.yy_paragraphStyle = paragraphStyle;
  362. //设置高亮色和点击事件
  363. [attributedString yy_setTextHighlightRange:[agreementText rangeOfString:@"《用户协议》"] color:AGREEMENTColor backgroundColor:[UIColor clearColor] tapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) {
  364. YMWebArticleViewModel *webArticleVM = [[YMWebArticleViewModel alloc]initWithParams:@{
  365. ParamsUrl:[NSString stringWithFormat:@"%@%@",[LCSaveData getBaseURL]?[LCSaveData getBaseURL]:BaseURL,UserProtocolH5]
  366. }];
  367. [YMRouter openURL:stringFormat(@"%@%@", YM_ROUTER_URL_PREFIX, YM_ROUTER_WEB_ARTICLE) withUserInfo:@{
  368. RouterViewModel:webArticleVM
  369. } completion:nil];
  370. }];
  371. //设置高亮色和点击事件
  372. [attributedString yy_setTextHighlightRange:[[attributedString string] rangeOfString:@"《隐私政策》"] color:AGREEMENTColor backgroundColor:[UIColor clearColor] tapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) {
  373. YMWebArticleViewModel *webArticleVM = [[YMWebArticleViewModel alloc]initWithParams:@{
  374. ParamsUrl:[NSString stringWithFormat:@"%@%@",[LCSaveData getBaseURL]?[LCSaveData getBaseURL]:BaseURL,UserPrivacyH5]
  375. }];
  376. [YMRouter openURL:stringFormat(@"%@%@", YM_ROUTER_URL_PREFIX, YM_ROUTER_WEB_ARTICLE) withUserInfo:@{
  377. RouterViewModel:webArticleVM
  378. } completion:nil];
  379. }];
  380. _agreementLb.attributedText = attributedString;
  381. }
  382. return _agreementLb;
  383. }
  384. - (UIButton *)confirmBtn{
  385. if (!_confirmBtn) {
  386. _confirmBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  387. _confirmBtn.titleLabel.font = LCBoldFont(15);
  388. [_confirmBtn setTitle:@"确定" forState:UIControlStateNormal];
  389. [_confirmBtn setTitleColor:MAINGRIDTitleC forState:UIControlStateNormal];
  390. [_confirmBtn ym_setGradientBackgroundWithColors:kMainGradColors locations:kMainGradLocation startPoint:kMainGradStartP endPoint:kMainGradEndP];
  391. _confirmBtn.layer.cornerRadius = adapt(40)/2;
  392. WS(weakSelf)
  393. [[[_confirmBtn rac_signalForControlEvents:UIControlEventTouchUpInside] takeUntil:self.rac_willDeallocSignal] subscribeNext:^(__kindof UIButton * _Nullable sender) {
  394. if (OCStringIsEmpty(weakSelf.mobileInputBox.text)) {
  395. [ZCHUDHelper showTitle:@"请输入手机号"];
  396. return;
  397. }
  398. if (OCStringIsEmpty(weakSelf.verifyCodeInputBox.text)) {
  399. [ZCHUDHelper showTitle:@"请输入短信验证码"];
  400. return;
  401. }
  402. if (OCStringIsEmpty(weakSelf.passwordInputBox.text)) {
  403. [ZCHUDHelper showTitle:@"请输入密码"];
  404. return;
  405. }
  406. if (!weakSelf.radioBtn.selected) {
  407. YMLoginRegistrAgreementPopupView *customView = [[YMLoginRegistrAgreementPopupView alloc]init];
  408. YMPopupView *popupView = [YMPopupView initWithCustomView:customView parentView:nil popStyle:YMPopupStyleFade dismissStyle:YMDismissStyleFade];
  409. popupView.priority = 999;
  410. popupView.cornerRadius = adapt(10);
  411. popupView.rectCorners = UIRectCornerAllCorners;
  412. popupView.positionStyle = YMPositionStyleCenter;
  413. popupView.isHideBg = NO;
  414. popupView.bgAlpha = 0.3;
  415. [popupView pop];
  416. @weakify(popupView)
  417. customView.buttonBlock = ^(BOOL isConfirm) {
  418. @strongify(popupView)
  419. if (isConfirm) {
  420. weakSelf.radioBtn.selected = YES;
  421. [weakSelf.viewModel retrievePasswordRequest];
  422. }
  423. [popupView dismissWithStyle:YMDismissStyleFade duration:2.0];
  424. };
  425. customView.dismissBlock = ^{
  426. @strongify(popupView)
  427. [popupView dismissWithStyle:YMDismissStyleFade duration:2.0];
  428. };
  429. return;
  430. }
  431. [weakSelf.viewModel retrievePasswordRequest];
  432. }];
  433. }
  434. return _confirmBtn;
  435. }
  436. @end