2023-07-14 18:50:55 +08:00
|
|
|
|
//
|
|
|
|
|
// YMLoginViewController.m
|
|
|
|
|
// YUMI
|
|
|
|
|
//
|
|
|
|
|
// Created by XY on 2023/2/13.
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
#import "XPLoginViewController.h"
|
|
|
|
|
#import <Masonry.h>
|
2023-10-28 04:46:10 +08:00
|
|
|
|
|
2023-07-14 18:50:55 +08:00
|
|
|
|
#import "DJDKMIMOMColor.h"
|
|
|
|
|
#import "UIImage+Utils.h"
|
|
|
|
|
#import "YUMIMacroUitls.h"
|
|
|
|
|
#import <ReactiveObjC.h>
|
|
|
|
|
#import "YUMIHtmlUrl.h"
|
|
|
|
|
#import "UIButton+EnlargeTouchArea.h"
|
|
|
|
|
#import <AuthenticationServices/ASAuthorizationAppleIDButton.h>
|
|
|
|
|
#import "YUMIConstant.h"
|
|
|
|
|
#import "GCDHelper.h"
|
|
|
|
|
#import "TTPopup.h"
|
|
|
|
|
#import "XNDJTDDLoadingTool.h"
|
|
|
|
|
#import "XPWebViewController.h"
|
|
|
|
|
#import "XPLoginPhoneViewController.h"
|
|
|
|
|
#import "UserPrivacyView.h"
|
|
|
|
|
#import "AESUtils.h"
|
|
|
|
|
#import "LoginPresenter.h"
|
|
|
|
|
#import "LoginProtocol.h"
|
2023-10-07 16:21:47 +08:00
|
|
|
|
#import "PILoginManager.h"
|
2024-04-11 15:47:44 +08:00
|
|
|
|
#import "XPLoginInputView.h"
|
|
|
|
|
#import "XPLoginAraeViewController.h"
|
|
|
|
|
#import "XPForgetPwdViewController.h"
|
2024-05-23 11:25:18 +08:00
|
|
|
|
#import "PISwitchingEnvironmentVC.h"
|
2024-07-03 21:22:40 +08:00
|
|
|
|
#import "FeedBackViewController.h"
|
2024-09-27 11:17:04 +08:00
|
|
|
|
#import "IAPManager.h"
|
2024-04-11 15:47:44 +08:00
|
|
|
|
|
2023-07-14 18:50:55 +08:00
|
|
|
|
UIKIT_EXTERN NSString * const kYouMiNumberCountKey;
|
2025-03-14 19:43:04 +08:00
|
|
|
|
NSString * const _HadAgreePrivacy = @"HadAgreePrivacy";
|
2023-07-14 18:50:55 +08:00
|
|
|
|
|
2024-04-11 15:47:44 +08:00
|
|
|
|
@interface XPLoginViewController ()<LoginProtocol,XPLoginInputViewDelegate,XPLoginAraeViewControllerDelegate>
|
2023-08-11 14:46:56 +08:00
|
|
|
|
///背景
|
|
|
|
|
@property(nonatomic,strong) UIImageView *bgImageView;
|
|
|
|
|
///logo
|
|
|
|
|
@property(nonatomic,strong) UIImageView *logoView;
|
2024-04-11 15:47:44 +08:00
|
|
|
|
|
2023-07-14 18:50:55 +08:00
|
|
|
|
/// 同意按钮
|
|
|
|
|
@property (nonatomic, strong) UIButton *agreeBtn;
|
|
|
|
|
/// 协议隐私政策
|
|
|
|
|
@property (nonatomic, strong) YYLabel *protocolLabel;
|
2023-08-14 14:39:41 +08:00
|
|
|
|
|
2023-07-14 18:50:55 +08:00
|
|
|
|
/// 勾选隐私政策提示泡泡
|
|
|
|
|
@property (nonatomic, strong) UIImageView *authBubbleView;
|
|
|
|
|
/// 泡泡提示内容
|
|
|
|
|
@property (nonatomic, strong) UILabel *authBubbleLabel;
|
|
|
|
|
@property (nonatomic, strong) UIStackView *stackView;
|
|
|
|
|
///手机
|
|
|
|
|
@property (nonatomic, strong) UIButton *fbButtonView;
|
|
|
|
|
///wx
|
|
|
|
|
@property (nonatomic, strong) UIButton *googleButtonView;
|
|
|
|
|
///qq
|
|
|
|
|
@property (nonatomic, strong) UIButton *lineButtonView;
|
2023-08-11 14:46:56 +08:00
|
|
|
|
|
2023-08-16 23:16:13 +08:00
|
|
|
|
@property (nonatomic, strong) UIButton *appleButton;
|
2023-08-11 14:46:56 +08:00
|
|
|
|
|
2023-07-14 18:50:55 +08:00
|
|
|
|
///谷歌登录配置
|
|
|
|
|
@property (nonatomic,strong) GIDConfiguration *configuration;
|
2023-08-14 14:39:41 +08:00
|
|
|
|
///上次登錄背景
|
|
|
|
|
@property(nonatomic,strong) UIImageView *nextView;
|
|
|
|
|
///上次登錄
|
|
|
|
|
@property(nonatomic,strong) UILabel *nextLabel;
|
|
|
|
|
|
2024-04-11 15:47:44 +08:00
|
|
|
|
///选择手机登录
|
2025-02-28 19:04:09 +08:00
|
|
|
|
@property(nonatomic,strong) UIButton *currentLoginWayButton;
|
2024-04-11 15:47:44 +08:00
|
|
|
|
///选择密码登录
|
2025-02-28 19:04:09 +08:00
|
|
|
|
@property(nonatomic,strong) UIButton *otherLoginWayButton;
|
2024-04-11 15:47:44 +08:00
|
|
|
|
/// 手机号输入框
|
|
|
|
|
@property (nonatomic, strong) XPLoginInputView *phoneInputView;
|
|
|
|
|
/// 验证码输入框
|
|
|
|
|
@property (nonatomic, strong) XPLoginInputView *codeInputView;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
///// 账号登录手机号输入框
|
|
|
|
|
@property (nonatomic, strong) XPLoginInputView *accountView;
|
|
|
|
|
/// 账号登录密码输入框
|
|
|
|
|
@property (nonatomic, strong) XPLoginInputView *accountPwdView;
|
|
|
|
|
|
|
|
|
|
/// 忘记密码
|
|
|
|
|
@property (nonatomic, strong) UIButton *forgetBtn;
|
|
|
|
|
|
|
|
|
|
/// 登录按钮
|
|
|
|
|
@property (nonatomic, strong) UIButton *loginBtn;
|
|
|
|
|
|
|
|
|
|
///区号
|
|
|
|
|
@property (nonatomic,copy) NSString *pi_phoneAreaCode;
|
|
|
|
|
///类型,0,密码,1.手机
|
2024-06-13 17:52:59 +08:00
|
|
|
|
@property(nonatomic,assign) int loginType;
|
2024-04-11 15:47:44 +08:00
|
|
|
|
|
2024-07-02 18:54:42 +08:00
|
|
|
|
@property (nonatomic, strong) UIButton *feedBackButton;
|
|
|
|
|
|
2023-07-14 18:50:55 +08:00
|
|
|
|
@end
|
|
|
|
|
|
|
|
|
|
@implementation XPLoginViewController
|
|
|
|
|
|
|
|
|
|
- (LoginPresenter *)createPresenter {
|
|
|
|
|
return [[LoginPresenter alloc] init];
|
|
|
|
|
}
|
|
|
|
|
|
2023-08-11 14:46:56 +08:00
|
|
|
|
- (BOOL)isHiddenNavBar {
|
|
|
|
|
return YES;
|
|
|
|
|
}
|
|
|
|
|
|
2025-03-14 19:43:04 +08:00
|
|
|
|
- (instancetype)init
|
|
|
|
|
{
|
|
|
|
|
self = [super init];
|
|
|
|
|
if (self) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
return self;
|
|
|
|
|
}
|
|
|
|
|
|
2023-07-14 18:50:55 +08:00
|
|
|
|
- (void)viewDidLoad {
|
|
|
|
|
[super viewDidLoad];
|
|
|
|
|
[self createUI];
|
2024-04-11 15:47:44 +08:00
|
|
|
|
[self racBind];
|
2024-06-13 17:52:59 +08:00
|
|
|
|
|
2024-05-23 11:25:18 +08:00
|
|
|
|
#ifdef DEBUG
|
|
|
|
|
[self setSwitchingEnvironmentVC];
|
|
|
|
|
#endif
|
2024-06-13 17:52:59 +08:00
|
|
|
|
|
|
|
|
|
[self setupDefaultLoginType];
|
2024-09-27 11:17:04 +08:00
|
|
|
|
|
|
|
|
|
[[IAPManager sharedManager] handleLogout];
|
2024-06-13 17:52:59 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void)setupDefaultLoginType {
|
|
|
|
|
self.loginType = 0;
|
|
|
|
|
|
2024-04-11 15:47:44 +08:00
|
|
|
|
NSString *code = [NSString getCountryCode];
|
|
|
|
|
self.pi_phoneAreaCode = [code stringByReplacingOccurrencesOfString:@"+" withString:@""];
|
2024-06-13 17:52:59 +08:00
|
|
|
|
|
|
|
|
|
[[NSNotificationCenter defaultCenter] postNotificationName:@"kInLoginVC" object:nil];
|
2023-07-14 18:50:55 +08:00
|
|
|
|
}
|
2024-06-13 17:52:59 +08:00
|
|
|
|
|
2024-04-11 15:47:44 +08:00
|
|
|
|
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
|
|
|
|
|
[self.view endEditing:YES];
|
|
|
|
|
}
|
2024-06-13 17:52:59 +08:00
|
|
|
|
|
2024-04-11 15:47:44 +08:00
|
|
|
|
- (void)racBind {
|
|
|
|
|
@weakify(self);
|
2024-06-13 17:52:59 +08:00
|
|
|
|
RAC(self.loginBtn, enabled) = [[RACSignal combineLatest:@[self.phoneInputView.inputTextField.rac_textSignal,
|
|
|
|
|
self.codeInputView.inputTextField.rac_textSignal,
|
|
|
|
|
self.accountView.inputTextField.rac_textSignal,
|
|
|
|
|
self.accountPwdView.inputTextField.rac_textSignal]
|
|
|
|
|
reduce:^id _Nonnull(NSString *phone, NSString* smsCode, NSString *account, NSString *accountPwd){
|
2024-04-11 15:47:44 +08:00
|
|
|
|
@strongify(self);
|
2024-06-13 17:52:59 +08:00
|
|
|
|
if(self.loginType == 0){
|
2024-04-11 15:47:44 +08:00
|
|
|
|
return @(account.length > 0 && accountPwd.length >= 6);
|
2024-06-13 17:52:59 +08:00
|
|
|
|
} else {
|
|
|
|
|
return @((phone.length > 0) && smsCode.length > 0);
|
2024-04-11 15:47:44 +08:00
|
|
|
|
}
|
2024-06-13 17:52:59 +08:00
|
|
|
|
}]
|
|
|
|
|
takeUntil:self.rac_willDeallocSignal];
|
2023-07-14 18:50:55 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void)createUI {
|
2023-09-20 17:34:12 +08:00
|
|
|
|
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
2025-03-14 19:43:04 +08:00
|
|
|
|
[defaults setObject:@"hadAgree" forKey:_HadAgreePrivacy];
|
2023-09-20 17:34:12 +08:00
|
|
|
|
[defaults synchronize];
|
2024-06-13 17:52:59 +08:00
|
|
|
|
|
2023-08-11 14:46:56 +08:00
|
|
|
|
self.view.backgroundColor = [UIColor whiteColor];
|
|
|
|
|
[self.view addSubview:self.bgImageView];
|
|
|
|
|
[self.view addSubview:self.logoView];
|
2024-07-02 18:54:42 +08:00
|
|
|
|
[self.view addSubview:self.feedBackButton];
|
|
|
|
|
|
2025-02-28 19:04:09 +08:00
|
|
|
|
[self.view addSubview:self.currentLoginWayButton];
|
|
|
|
|
[self.view addSubview:self.otherLoginWayButton];
|
2024-04-11 15:47:44 +08:00
|
|
|
|
|
|
|
|
|
[self.view addSubview:self.accountView];
|
|
|
|
|
[self.view addSubview:self.accountPwdView];
|
|
|
|
|
[self.view addSubview:self.phoneInputView];
|
|
|
|
|
[self.view addSubview:self.codeInputView];
|
|
|
|
|
[self.view addSubview:self.forgetBtn];
|
|
|
|
|
[self.view addSubview:self.loginBtn];
|
2024-06-13 17:52:59 +08:00
|
|
|
|
|
2023-08-11 14:46:56 +08:00
|
|
|
|
[self.view addSubview:self.stackView];
|
2023-07-14 18:50:55 +08:00
|
|
|
|
[self.view addSubview:self.protocolLabel];
|
|
|
|
|
[self.view addSubview:self.agreeBtn];
|
2023-11-01 20:38:26 +08:00
|
|
|
|
|
2023-07-14 18:50:55 +08:00
|
|
|
|
[self.view addSubview:self.authBubbleView];
|
|
|
|
|
[self.authBubbleView addSubview:self.authBubbleLabel];
|
2023-11-01 20:38:26 +08:00
|
|
|
|
|
2023-08-16 23:16:13 +08:00
|
|
|
|
if (@available(iOS 13.0, *)) {
|
2023-11-01 20:38:26 +08:00
|
|
|
|
#ifdef DEBUG
|
|
|
|
|
[self.stackView addArrangedSubview:self.appleButton];
|
|
|
|
|
#else
|
|
|
|
|
if(isEnterprise == YES){
|
|
|
|
|
[self.stackView addArrangedSubview:self.appleButton];
|
|
|
|
|
}
|
|
|
|
|
#endif
|
2023-08-16 23:16:13 +08:00
|
|
|
|
}
|
2023-08-11 14:46:56 +08:00
|
|
|
|
[self.stackView addArrangedSubview:self.googleButtonView];
|
2023-11-01 20:38:26 +08:00
|
|
|
|
[self.stackView addArrangedSubview:self.fbButtonView];
|
|
|
|
|
[self.stackView addArrangedSubview:self.lineButtonView];
|
2024-06-13 17:52:59 +08:00
|
|
|
|
|
2023-08-11 14:46:56 +08:00
|
|
|
|
[self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
2024-04-11 17:05:27 +08:00
|
|
|
|
make.leading.trailing.top.equalTo(self.view);
|
2024-06-04 18:04:08 +08:00
|
|
|
|
make.height.mas_equalTo(kGetScaleWidth(111));
|
2023-08-11 14:46:56 +08:00
|
|
|
|
}];
|
2024-06-13 17:52:59 +08:00
|
|
|
|
|
2023-08-11 14:46:56 +08:00
|
|
|
|
[self.logoView mas_makeConstraints:^(MASConstraintMaker *make) {
|
2024-04-11 15:47:44 +08:00
|
|
|
|
make.width.mas_offset(kGetScaleWidth(162));
|
|
|
|
|
make.height.mas_equalTo(kGetScaleWidth(32));
|
2023-08-11 14:46:56 +08:00
|
|
|
|
make.centerX.equalTo(self.view);
|
2024-06-13 17:52:59 +08:00
|
|
|
|
make.top.equalTo(self.bgImageView.mas_bottom).mas_offset(-16);
|
2023-08-11 14:46:56 +08:00
|
|
|
|
}];
|
2024-06-13 17:52:59 +08:00
|
|
|
|
|
2024-04-11 15:47:44 +08:00
|
|
|
|
CGFloat width = KScreenWidth/2;
|
2025-02-28 19:04:09 +08:00
|
|
|
|
[self.currentLoginWayButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
2025-01-22 21:22:58 +08:00
|
|
|
|
make.centerX.equalTo(self.view);
|
2024-04-11 15:47:44 +08:00
|
|
|
|
make.height.mas_equalTo(kGetScaleWidth(22));
|
|
|
|
|
make.width.mas_equalTo(width);
|
2025-02-28 19:04:09 +08:00
|
|
|
|
make.top.equalTo(self.logoView.mas_bottom).mas_offset(kGetScaleWidth(15));
|
2024-04-11 15:47:44 +08:00
|
|
|
|
}];
|
2024-06-13 17:52:59 +08:00
|
|
|
|
|
2024-04-11 15:47:44 +08:00
|
|
|
|
[self.accountView mas_makeConstraints:^(MASConstraintMaker *make) {
|
2023-08-11 14:46:56 +08:00
|
|
|
|
make.centerX.equalTo(self.view);
|
2024-04-11 15:47:44 +08:00
|
|
|
|
make.width.mas_equalTo(kGetScaleWidth(303));
|
2025-02-28 19:04:09 +08:00
|
|
|
|
make.top.mas_equalTo(self.currentLoginWayButton.mas_bottom).offset(kGetScaleWidth(13));
|
2024-04-11 15:47:44 +08:00
|
|
|
|
make.height.mas_equalTo(kGetScaleWidth(52));
|
|
|
|
|
}];
|
|
|
|
|
|
|
|
|
|
[self.accountPwdView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
|
make.centerX.equalTo(self.view);
|
|
|
|
|
make.width.mas_equalTo(kGetScaleWidth(303));
|
|
|
|
|
make.top.mas_equalTo(self.phoneInputView.mas_bottom).offset(kGetScaleWidth(20));
|
|
|
|
|
make.height.mas_equalTo(kGetScaleWidth(52));
|
|
|
|
|
}];
|
|
|
|
|
|
|
|
|
|
[self.phoneInputView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
|
make.edges.equalTo(self.accountView);
|
|
|
|
|
}];
|
|
|
|
|
[self.codeInputView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
|
make.edges.equalTo(self.accountPwdView);
|
2023-07-14 18:50:55 +08:00
|
|
|
|
}];
|
2024-04-11 15:47:44 +08:00
|
|
|
|
|
|
|
|
|
[self.forgetBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
|
make.top.equalTo(self.codeInputView.mas_bottom).mas_offset(kGetScaleWidth(8));
|
|
|
|
|
make.trailing.mas_equalTo(-kGetScaleWidth(52));
|
|
|
|
|
make.height.mas_equalTo(kGetScaleWidth(17));
|
|
|
|
|
}];
|
|
|
|
|
|
|
|
|
|
[self.loginBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
|
make.width.mas_equalTo(kGetScaleWidth(303));
|
|
|
|
|
make.centerX.equalTo(self.view);
|
|
|
|
|
make.top.equalTo(self.forgetBtn.mas_bottom).mas_offset(kGetScaleWidth(23));
|
|
|
|
|
make.height.mas_equalTo(kGetScaleWidth(48));
|
2024-04-10 17:39:37 +08:00
|
|
|
|
}];
|
2024-04-11 15:47:44 +08:00
|
|
|
|
|
|
|
|
|
[self.stackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
2024-06-13 17:52:59 +08:00
|
|
|
|
make.top.mas_equalTo(self.loginBtn.mas_bottom).offset(kGetScaleWidth(23));
|
2024-04-11 15:47:44 +08:00
|
|
|
|
make.centerX.mas_equalTo(self.view);
|
|
|
|
|
}];
|
2025-01-22 21:22:58 +08:00
|
|
|
|
|
2025-02-28 19:04:09 +08:00
|
|
|
|
[self.otherLoginWayButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
2025-01-22 21:22:58 +08:00
|
|
|
|
make.height.mas_equalTo(kGetScaleWidth(22));
|
|
|
|
|
make.width.mas_equalTo(width);
|
2025-02-28 19:04:09 +08:00
|
|
|
|
make.top.equalTo(self.stackView.mas_bottom).mas_offset(kGetScaleWidth(23));
|
2025-01-22 21:22:58 +08:00
|
|
|
|
make.centerX.mas_equalTo(self.stackView);
|
|
|
|
|
}];
|
2024-06-13 17:52:59 +08:00
|
|
|
|
|
2024-04-17 16:02:42 +08:00
|
|
|
|
CGFloat left = isMSRTL() ? -11 : 11;
|
|
|
|
|
CGFloat protocolWidth = 204;
|
|
|
|
|
if (isMSRTL()){
|
|
|
|
|
protocolWidth = 250;
|
|
|
|
|
}else if (isMSEN()){
|
|
|
|
|
protocolWidth = 270;
|
|
|
|
|
}
|
2023-07-14 18:50:55 +08:00
|
|
|
|
[self.protocolLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
2024-04-17 16:02:42 +08:00
|
|
|
|
make.centerX.mas_equalTo(self.view).offset(left);
|
2023-07-14 18:50:55 +08:00
|
|
|
|
make.height.mas_greaterThanOrEqualTo(22);
|
2024-04-17 16:02:42 +08:00
|
|
|
|
make.width.mas_equalTo(protocolWidth);
|
2023-08-14 14:39:41 +08:00
|
|
|
|
make.bottom.mas_equalTo(-kGetScaleWidth(35));
|
2023-07-14 18:50:55 +08:00
|
|
|
|
}];
|
|
|
|
|
[self.agreeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
2024-04-11 17:05:27 +08:00
|
|
|
|
make.trailing.mas_equalTo(self.protocolLabel.mas_leading).offset(0);
|
2023-07-14 18:50:55 +08:00
|
|
|
|
make.top.mas_equalTo(self.protocolLabel.mas_top);
|
|
|
|
|
make.width.height.mas_equalTo(22);
|
|
|
|
|
}];
|
2023-08-14 14:39:41 +08:00
|
|
|
|
|
2023-08-11 14:46:56 +08:00
|
|
|
|
|
2023-07-14 18:50:55 +08:00
|
|
|
|
[self.authBubbleView mas_makeConstraints:^(MASConstraintMaker *make) {
|
2024-04-11 17:05:27 +08:00
|
|
|
|
make.leading.mas_equalTo(self.agreeBtn).mas_offset((-16));
|
2023-07-14 18:50:55 +08:00
|
|
|
|
make.top.mas_equalTo(self.agreeBtn.mas_bottom);
|
|
|
|
|
make.width.mas_equalTo(235);
|
|
|
|
|
make.height.mas_equalTo(29);
|
|
|
|
|
}];
|
|
|
|
|
[self.authBubbleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
2024-04-11 17:05:27 +08:00
|
|
|
|
make.leading.mas_equalTo(8);
|
2024-04-17 16:02:42 +08:00
|
|
|
|
make.trailing.mas_equalTo(-8);
|
|
|
|
|
make.bottom.mas_equalTo(self.authBubbleView).mas_offset(isMSZH() ? -6:0);
|
2023-07-14 18:50:55 +08:00
|
|
|
|
}];
|
2023-11-01 20:38:26 +08:00
|
|
|
|
if (@available(iOS 13.0, *)) {
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
|
[self.appleButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
|
make.width.mas_equalTo(kGetScaleWidth(295));
|
|
|
|
|
make.height.mas_equalTo(kGetScaleWidth(46));
|
|
|
|
|
}];
|
|
|
|
|
#else
|
|
|
|
|
if(isEnterprise == YES){
|
|
|
|
|
[self.appleButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
|
make.width.mas_equalTo(kGetScaleWidth(295));
|
|
|
|
|
make.height.mas_equalTo(kGetScaleWidth(46));
|
|
|
|
|
}];
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2023-08-11 14:46:56 +08:00
|
|
|
|
[self.googleButtonView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
|
make.width.mas_equalTo(kGetScaleWidth(295));
|
|
|
|
|
make.height.mas_equalTo(kGetScaleWidth(46));
|
|
|
|
|
}];
|
|
|
|
|
[self.fbButtonView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
|
make.width.mas_equalTo(kGetScaleWidth(295));
|
|
|
|
|
make.height.mas_equalTo(kGetScaleWidth(46));
|
|
|
|
|
}];
|
2024-04-11 15:47:44 +08:00
|
|
|
|
self.fbButtonView.hidden = YES;
|
|
|
|
|
self.lineButtonView.hidden = YES;
|
2023-08-11 14:46:56 +08:00
|
|
|
|
[self.lineButtonView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
|
make.width.mas_equalTo(kGetScaleWidth(295));
|
|
|
|
|
make.height.mas_equalTo(kGetScaleWidth(46));
|
|
|
|
|
}];
|
2024-07-02 18:54:42 +08:00
|
|
|
|
|
|
|
|
|
[self.feedBackButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
|
make.trailing.mas_equalTo(-15);
|
|
|
|
|
make.top.mas_equalTo(kStatusBarHeight+20);
|
|
|
|
|
}];
|
|
|
|
|
|
2023-07-14 18:50:55 +08:00
|
|
|
|
}
|
2024-05-23 11:25:18 +08:00
|
|
|
|
-(void)setSwitchingEnvironmentVC{
|
|
|
|
|
UIButton *but = [UIButton new];
|
|
|
|
|
[but setTitle:@"切换环境" forState:UIControlStateNormal];
|
|
|
|
|
[but setTitleColor:[UIColor blueColor] forState:UIControlStateNormal];
|
|
|
|
|
[self.view addSubview:but];
|
|
|
|
|
[but addTarget:self action:@selector(switchingEnvironmentVCAction) forControlEvents:UIControlEventTouchUpInside];
|
|
|
|
|
[but mas_makeConstraints:^(MASConstraintMaker *make) {
|
2024-07-02 18:54:42 +08:00
|
|
|
|
make.leading.mas_equalTo(kGetScaleWidth(30));
|
2024-05-23 11:25:18 +08:00
|
|
|
|
make.top.mas_equalTo(kStatusBarHeight+20);
|
|
|
|
|
}];
|
|
|
|
|
}
|
|
|
|
|
-(void)switchingEnvironmentVCAction{
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
|
PISwitchingEnvironmentVC *vc = [PISwitchingEnvironmentVC new];
|
|
|
|
|
[self.navigationController pushViewController:vc animated:YES];
|
|
|
|
|
#else
|
|
|
|
|
#endif
|
|
|
|
|
}
|
2023-07-14 18:50:55 +08:00
|
|
|
|
- (void)setConfigPrivacyAlertView {
|
|
|
|
|
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
|
|
|
|
NSString *isShow = [defaults objectForKey:kYouMiNumberCountKey];
|
|
|
|
|
// 隐私协议弹出
|
|
|
|
|
if (!isShow && isShow.length <= 0) {
|
|
|
|
|
UserPrivacyView * alertView = [[UserPrivacyView alloc] init];
|
|
|
|
|
alertView.controller = self;
|
|
|
|
|
TTPopupService * config = [[TTPopupService alloc] init];
|
|
|
|
|
config.shouldDismissOnBackgroundTouch = NO;
|
|
|
|
|
config.contentView = alertView;
|
|
|
|
|
[TTPopup popupWithConfig:config];
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void)loginDidClick:(UIButton *)sender {
|
2023-11-01 20:38:26 +08:00
|
|
|
|
if (self.agreeBtn.selected) {
|
|
|
|
|
ThirdLoginType type = sender.tag - 1000;
|
|
|
|
|
if(type == ThirdLoginType_Gmail){
|
|
|
|
|
[self.presenter thirdLoginByGoogleWithPresentingViewController:self configuration:self.configuration];
|
|
|
|
|
return;
|
2023-08-14 14:39:41 +08:00
|
|
|
|
}else if(type == ThirdLoginType_FB){
|
|
|
|
|
[self.presenter thirdLoginByFBWithPresentingViewController:self];
|
|
|
|
|
return;
|
2023-12-29 16:43:37 +08:00
|
|
|
|
}else if(type == ThirdLoginType_Line){
|
|
|
|
|
[self.presenter thirdLoginByLine:self];
|
|
|
|
|
return;
|
2023-08-14 14:39:41 +08:00
|
|
|
|
}
|
2023-11-01 20:38:26 +08:00
|
|
|
|
[self.presenter thirdLoginWithType:type];
|
|
|
|
|
} else {
|
2023-08-16 15:50:27 +08:00
|
|
|
|
[UIView animateWithDuration:0.5 animations:^{
|
|
|
|
|
self.authBubbleView.alpha = 1.0;
|
|
|
|
|
}];
|
2023-11-01 20:38:26 +08:00
|
|
|
|
}
|
2023-07-14 18:50:55 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// 点击同意
|
|
|
|
|
- (void)agreeBtnClicked {
|
|
|
|
|
self.agreeBtn.selected = !self.agreeBtn.selected;
|
|
|
|
|
if (self.agreeBtn.isSelected) {
|
|
|
|
|
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
2025-03-14 19:43:04 +08:00
|
|
|
|
[defaults setObject:@"hadAgree" forKey:_HadAgreePrivacy];
|
2023-07-14 18:50:55 +08:00
|
|
|
|
[defaults synchronize];
|
|
|
|
|
[UIView animateWithDuration:0.5 animations:^{
|
|
|
|
|
self.authBubbleView.alpha = 0.0;
|
|
|
|
|
}];
|
|
|
|
|
} else {
|
|
|
|
|
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
2025-03-14 19:43:04 +08:00
|
|
|
|
NSString * hadAgree = [defaults stringForKey:_HadAgreePrivacy];
|
2023-07-14 18:50:55 +08:00
|
|
|
|
if (hadAgree.length > 0) {
|
2025-03-14 19:43:04 +08:00
|
|
|
|
[defaults removeObjectForKey:_HadAgreePrivacy];
|
2023-07-14 18:50:55 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// 点击手机号登录
|
|
|
|
|
- (void)phoneLoginBtnClicked {
|
|
|
|
|
if (self.agreeBtn.isSelected) {
|
|
|
|
|
XPLoginPhoneViewController *phoneVC = [[XPLoginPhoneViewController alloc] init];
|
|
|
|
|
[self.navigationController pushViewController:phoneVC animated:YES];
|
|
|
|
|
} else {
|
|
|
|
|
[UIView animateWithDuration:0.5 animations:^{
|
|
|
|
|
self.authBubbleView.alpha = 1.0;
|
|
|
|
|
}];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// 点击一键登录
|
|
|
|
|
- (void)quickLoginBtnClicked {
|
|
|
|
|
if (self.agreeBtn.isSelected) {
|
2023-11-01 20:38:26 +08:00
|
|
|
|
XPLoginPhoneViewController *phoneVC = [[XPLoginPhoneViewController alloc] init];
|
|
|
|
|
[self.navigationController pushViewController:phoneVC animated:YES];
|
2023-07-14 18:50:55 +08:00
|
|
|
|
} else {
|
|
|
|
|
[UIView animateWithDuration:0.5 animations:^{
|
|
|
|
|
self.authBubbleView.alpha = 1.0;
|
|
|
|
|
}];
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-11 15:47:44 +08:00
|
|
|
|
/// 登录
|
|
|
|
|
- (void)loginBtnClicked {
|
2024-06-13 17:52:59 +08:00
|
|
|
|
[self.view endEditing:true];
|
|
|
|
|
|
2024-04-17 16:02:42 +08:00
|
|
|
|
if (!self.agreeBtn.selected) {
|
|
|
|
|
[UIView animateWithDuration:0.5 animations:^{
|
|
|
|
|
self.authBubbleView.alpha = 1.0;
|
|
|
|
|
}];
|
|
|
|
|
return;
|
|
|
|
|
}
|
2024-04-11 15:47:44 +08:00
|
|
|
|
[XNDJTDDLoadingTool showOnlyView:self.view];
|
2024-06-13 17:52:59 +08:00
|
|
|
|
if(self.loginType == 0){
|
2024-04-11 15:47:44 +08:00
|
|
|
|
NSString *phone = self.accountView.inputTextField.text;
|
|
|
|
|
NSString *password = self.accountPwdView.inputTextField.text;
|
|
|
|
|
[self.presenter loginWithPhone:phone password:password];
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
NSString *phone = self.phoneInputView.inputTextField.text;
|
|
|
|
|
NSString *smsCode = self.codeInputView.inputTextField.text;
|
|
|
|
|
NSString * phoneStr = [NSString stringWithFormat:@"%@%@",self.pi_phoneAreaCode, phone];
|
|
|
|
|
[self.presenter loginWithPhone:phoneStr code:smsCode phoneAreaCode:self.pi_phoneAreaCode];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void)forgetBtnClicked {
|
|
|
|
|
XPForgetPwdViewController *forgetVC = [[XPForgetPwdViewController alloc] init];
|
|
|
|
|
[self.navigationController pushViewController:forgetVC animated:YES];
|
|
|
|
|
}
|
2024-06-13 17:52:59 +08:00
|
|
|
|
|
2024-07-02 18:54:42 +08:00
|
|
|
|
- (void)didTapFeedback {
|
2024-07-03 21:22:40 +08:00
|
|
|
|
FeedBackViewController *vc = [[FeedBackViewController alloc] init];
|
|
|
|
|
[self.navigationController pushViewController:vc animated:YES];
|
2024-07-02 18:54:42 +08:00
|
|
|
|
}
|
|
|
|
|
|
2023-07-14 18:50:55 +08:00
|
|
|
|
#pragma mark - LoginProtocol
|
2024-04-11 15:47:44 +08:00
|
|
|
|
- (void)loginThirdPartSuccess {
|
|
|
|
|
[self.codeInputView cancelTimer];
|
2023-10-07 16:21:47 +08:00
|
|
|
|
[PILoginManager loginWithVC:self isLoginPhone:NO];
|
2023-07-14 18:50:55 +08:00
|
|
|
|
[self showSuccessToast:YMLocalizedString(@"XPLoginViewController4")];
|
|
|
|
|
}
|
2024-06-13 17:52:59 +08:00
|
|
|
|
|
2024-04-11 15:47:44 +08:00
|
|
|
|
-(void)chooseAccountAction{
|
2025-02-28 19:04:09 +08:00
|
|
|
|
// self.loginType = self.loginType == 0 ? 1 : 0;
|
2024-04-11 15:47:44 +08:00
|
|
|
|
}
|
2024-06-13 17:52:59 +08:00
|
|
|
|
|
2024-04-11 15:47:44 +08:00
|
|
|
|
-(void)chooseSMSAction{
|
2025-02-28 19:04:09 +08:00
|
|
|
|
self.loginType = self.loginType == 0 ? 1 : 0;
|
2024-04-11 15:47:44 +08:00
|
|
|
|
}
|
2024-06-13 17:52:59 +08:00
|
|
|
|
|
|
|
|
|
-(void)setLoginType:(int)selectType{
|
|
|
|
|
_loginType = selectType;
|
2025-02-28 19:04:09 +08:00
|
|
|
|
|
2024-06-13 17:52:59 +08:00
|
|
|
|
_forgetBtn.hidden = _loginType != 0;
|
2024-07-02 18:54:42 +08:00
|
|
|
|
|
2024-06-13 17:52:59 +08:00
|
|
|
|
_accountView.hidden = _loginType != 0;
|
|
|
|
|
_accountPwdView.hidden = _loginType != 0;
|
2024-04-11 15:47:44 +08:00
|
|
|
|
|
2024-06-13 17:52:59 +08:00
|
|
|
|
_phoneInputView.hidden = _loginType == 0;
|
|
|
|
|
_codeInputView.hidden = _loginType == 0;
|
2025-02-28 19:04:09 +08:00
|
|
|
|
|
|
|
|
|
switch (selectType) {
|
|
|
|
|
case 0:
|
2025-03-06 15:26:44 +08:00
|
|
|
|
[_currentLoginWayButton setTitle:YMLocalizedString(@"1.0.37_text_26") forState:UIControlStateNormal];
|
2025-02-28 19:04:09 +08:00
|
|
|
|
[_otherLoginWayButton setTitle:YMLocalizedString(@"1.0.37_text_27")forState:UIControlStateNormal];
|
|
|
|
|
break;
|
|
|
|
|
case 1:
|
2025-03-06 15:26:44 +08:00
|
|
|
|
[_currentLoginWayButton setTitle:YMLocalizedString(@"1.0.37_text_27") forState:UIControlStateNormal];
|
2025-02-28 19:04:09 +08:00
|
|
|
|
[_otherLoginWayButton setTitle:YMLocalizedString(@"1.0.37_text_26")forState:UIControlStateNormal];
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-11 15:47:44 +08:00
|
|
|
|
}
|
2023-07-14 18:50:55 +08:00
|
|
|
|
|
2024-06-13 17:52:59 +08:00
|
|
|
|
#pragma mark - XPLoginInputViewDelegate
|
2024-04-11 15:47:44 +08:00
|
|
|
|
- (void)smsCodeAction {
|
|
|
|
|
NSString *phone = self.phoneInputView.inputTextField.text;
|
|
|
|
|
if (phone.length == 0 ) {
|
|
|
|
|
[self showErrorToast:YMLocalizedString(@"XPLoginPhoneViewController0")];
|
|
|
|
|
return;
|
2023-07-14 18:50:55 +08:00
|
|
|
|
}
|
2024-06-13 17:52:59 +08:00
|
|
|
|
[self.presenter phoneSmsCode:[NSString stringWithFormat:@"%@%@", self.pi_phoneAreaCode,phone]
|
|
|
|
|
type:GetSmsType_Regist
|
|
|
|
|
phoneAreaCode:self.pi_phoneAreaCode];
|
2024-04-11 15:47:44 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void)areaListAction {
|
|
|
|
|
XPLoginAraeViewController *codeVC = [XPLoginAraeViewController new];
|
|
|
|
|
codeVC.delegate = self;
|
|
|
|
|
[self.navigationController pushViewController:codeVC animated:YES];
|
2023-07-14 18:50:55 +08:00
|
|
|
|
}
|
2024-06-13 17:52:59 +08:00
|
|
|
|
|
2024-04-11 15:47:44 +08:00
|
|
|
|
#pragma mark - XPLoginAraeViewControllerDelegate
|
|
|
|
|
- (void)chooseAreaCodeSuccess:(NSString *)code {
|
|
|
|
|
if (code.length > 0) {
|
|
|
|
|
self.pi_phoneAreaCode = code;
|
|
|
|
|
[self.phoneInputView.areaCodeBtn setTitle:[NSString stringWithFormat:@"+%@", code] forState:UIControlStateNormal];
|
2024-04-10 17:39:37 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2024-06-13 17:52:59 +08:00
|
|
|
|
|
2024-04-11 15:47:44 +08:00
|
|
|
|
#pragma mark - LoginVerifCodeProtocol
|
|
|
|
|
- (void)loginWithPhoenSuccess{
|
|
|
|
|
[XNDJTDDLoadingTool hideOnlyView:self.view];
|
|
|
|
|
[self showSuccessToast:YMLocalizedString(@"XPLoginPhoneViewController1")];
|
|
|
|
|
[PILoginManager loginWithVC:self isLoginPhone:YES];
|
|
|
|
|
}
|
2024-06-13 17:52:59 +08:00
|
|
|
|
|
2024-04-11 15:47:44 +08:00
|
|
|
|
- (void)loginSuccess {
|
|
|
|
|
[self.codeInputView cancelTimer];
|
|
|
|
|
[XNDJTDDLoadingTool hideOnlyView:self.view];
|
|
|
|
|
[self showSuccessToast:YMLocalizedString(@"XPLoginPhoneViewController1")];
|
|
|
|
|
[PILoginManager loginWithVC:self isLoginPhone:NO];
|
|
|
|
|
}
|
2024-06-13 17:52:59 +08:00
|
|
|
|
|
2024-04-11 15:47:44 +08:00
|
|
|
|
- (void)loginFailWithMsg:(NSString *)msg{
|
|
|
|
|
[self showErrorToast:msg];
|
|
|
|
|
[XNDJTDDLoadingTool hideOnlyView:self.view];
|
|
|
|
|
}
|
2024-06-13 17:52:59 +08:00
|
|
|
|
|
2024-04-11 15:47:44 +08:00
|
|
|
|
- (void)phoneSmsCodeSuccess {
|
|
|
|
|
[self showSuccessToast:YMLocalizedString(@"XPLoginPhoneViewController2")];
|
|
|
|
|
[self.codeInputView fireTimer];
|
|
|
|
|
}
|
|
|
|
|
|
2024-06-13 17:52:59 +08:00
|
|
|
|
#pragma mark - 懒加载
|
2023-07-14 18:50:55 +08:00
|
|
|
|
- (UIButton *)agreeBtn {
|
|
|
|
|
if(!_agreeBtn) {
|
|
|
|
|
_agreeBtn = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
|
|
|
[_agreeBtn setImage:[UIImage imageNamed:@"login_agree"] forState:UIControlStateSelected];
|
|
|
|
|
[_agreeBtn setImage:[UIImage imageNamed:@"login_disagree"] forState:UIControlStateNormal];
|
|
|
|
|
[_agreeBtn setEnlargeEdgeWithTop:10 right:10 bottom:10 left:10];
|
|
|
|
|
[_agreeBtn addTarget:self action:@selector(agreeBtnClicked) forControlEvents:UIControlEventTouchUpInside];
|
|
|
|
|
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
2025-03-14 19:43:04 +08:00
|
|
|
|
NSString *hadAgree = [defaults objectForKey:_HadAgreePrivacy];
|
2023-07-14 18:50:55 +08:00
|
|
|
|
if (hadAgree.length > 0) {
|
|
|
|
|
_agreeBtn.selected = YES;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return _agreeBtn;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (YYLabel *)protocolLabel {
|
|
|
|
|
if (!_protocolLabel) {
|
|
|
|
|
_protocolLabel = [[YYLabel alloc] init];
|
2023-08-14 14:39:41 +08:00
|
|
|
|
_protocolLabel.font = kFontRegular(12);
|
2023-07-14 18:50:55 +08:00
|
|
|
|
_protocolLabel.numberOfLines = 0;
|
|
|
|
|
|
|
|
|
|
NSMutableAttributedString *attString = [[NSMutableAttributedString alloc] initWithString:YMLocalizedString(@"XPLoginViewController6")];
|
2023-08-14 14:39:41 +08:00
|
|
|
|
attString.yy_color = UIColorFromRGB(0xB3B3C3);
|
2024-04-17 16:02:42 +08:00
|
|
|
|
NSRange userRange = [attString.string rangeOfString:YMLocalizedString(@"XPLoginViewController7")];
|
|
|
|
|
[attString addAttributes:@{NSForegroundColorAttributeName:UIColorFromRGB(0x1F1B4F)} range:userRange];
|
|
|
|
|
@weakify(self);
|
|
|
|
|
[attString yy_setTextHighlightRange:userRange color:nil backgroundColor:nil userInfo:nil tapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) {
|
2023-07-14 18:50:55 +08:00
|
|
|
|
@strongify(self);
|
|
|
|
|
// 跳转用户协议
|
2024-10-08 11:47:06 +08:00
|
|
|
|
XPWebViewController * webVC = [[XPWebViewController alloc] initWithRoomUID:nil];
|
2023-07-14 18:50:55 +08:00
|
|
|
|
webVC.url = URLWithType(kUserProtocalURL);
|
|
|
|
|
[self.navigationController pushViewController:webVC animated:YES];
|
|
|
|
|
} longPressAction:nil];
|
|
|
|
|
|
2024-04-17 16:02:42 +08:00
|
|
|
|
NSRange andRange = [attString.string rangeOfString:YMLocalizedString(@"XPLoginViewController8")];
|
|
|
|
|
[attString addAttributes:@{NSForegroundColorAttributeName:UIColorFromRGB(0xB3B3C3)} range:andRange];
|
|
|
|
|
NSRange protocolRange = [attString.string rangeOfString:YMLocalizedString(@"XPLoginViewController9")];
|
|
|
|
|
[attString addAttributes:@{NSForegroundColorAttributeName:UIColorFromRGB(0x1F1B4F)} range:protocolRange];
|
|
|
|
|
|
|
|
|
|
[attString yy_setTextHighlightRange:protocolRange color:nil backgroundColor:nil userInfo:nil tapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) {
|
2023-07-14 18:50:55 +08:00
|
|
|
|
@strongify(self);
|
|
|
|
|
// 跳转隐私政策
|
2024-10-08 11:47:06 +08:00
|
|
|
|
XPWebViewController * webVC = [[XPWebViewController alloc] initWithRoomUID:nil];
|
2023-07-14 18:50:55 +08:00
|
|
|
|
webVC.url = URLWithType(kPrivacyURL);
|
|
|
|
|
[self.navigationController pushViewController:webVC animated:YES];
|
|
|
|
|
} longPressAction:nil];
|
2024-04-17 16:02:42 +08:00
|
|
|
|
|
2023-07-14 18:50:55 +08:00
|
|
|
|
|
|
|
|
|
_protocolLabel.attributedText = attString;
|
|
|
|
|
}
|
|
|
|
|
return _protocolLabel;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (UIImageView *)authBubbleView {
|
|
|
|
|
if (!_authBubbleView) {
|
|
|
|
|
_authBubbleView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"login_auth_bubble"]];
|
|
|
|
|
_authBubbleView.contentMode = UIViewContentModeScaleAspectFit;
|
|
|
|
|
_authBubbleView.alpha = 0;
|
|
|
|
|
}
|
|
|
|
|
return _authBubbleView;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (UIStackView *)stackView {
|
2023-11-01 20:38:26 +08:00
|
|
|
|
if (!_stackView) {
|
|
|
|
|
_stackView = [[UIStackView alloc] init];
|
|
|
|
|
_stackView.axis = UILayoutConstraintAxisVertical;
|
|
|
|
|
_stackView.distribution = UIStackViewDistributionFillEqually;
|
|
|
|
|
_stackView.alignment = UIStackViewAlignmentFill;
|
|
|
|
|
_stackView.spacing = kGetScaleWidth(16);
|
|
|
|
|
}
|
|
|
|
|
return _stackView;
|
2023-07-14 18:50:55 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (UILabel *)authBubbleLabel {
|
|
|
|
|
if (!_authBubbleLabel) {
|
|
|
|
|
_authBubbleLabel = [[UILabel alloc] init];
|
|
|
|
|
_authBubbleLabel.text = YMLocalizedString(@"XPLoginViewController11");
|
2024-04-17 16:02:42 +08:00
|
|
|
|
_authBubbleLabel.font = [UIFont systemFontOfSize:9];
|
2023-07-14 18:50:55 +08:00
|
|
|
|
_authBubbleLabel.textColor = UIColor.whiteColor;
|
2024-04-17 16:02:42 +08:00
|
|
|
|
_authBubbleLabel.numberOfLines = 2;
|
2023-07-14 18:50:55 +08:00
|
|
|
|
}
|
|
|
|
|
return _authBubbleLabel;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (UIButton *)fbButtonView {
|
2023-11-01 20:38:26 +08:00
|
|
|
|
if (!_fbButtonView) {
|
|
|
|
|
_fbButtonView = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
|
|
|
[_fbButtonView setImage: [UIImage imageNamed:@"login_facebook"] forState:UIControlStateNormal];
|
2023-08-11 14:46:56 +08:00
|
|
|
|
[_fbButtonView setTitle:YMLocalizedString(@"XPLoginViewController14") forState:UIControlStateNormal];
|
|
|
|
|
_fbButtonView.titleLabel.font = kFontMedium(16);
|
|
|
|
|
[_fbButtonView setTitleColor:UIColorFromRGB(0x6D6B89) forState:UIControlStateNormal];
|
|
|
|
|
[_fbButtonView setImageEdgeInsets:UIEdgeInsetsMake(0, kGetScaleWidth(28), 0, kGetScaleWidth(200))];
|
|
|
|
|
_fbButtonView.backgroundColor = UIColorFromRGB(0xF3F5FA);
|
|
|
|
|
_fbButtonView.layer.cornerRadius = kGetScaleWidth(46)/2;
|
|
|
|
|
_fbButtonView.layer.masksToBounds = YES;
|
2023-11-01 20:38:26 +08:00
|
|
|
|
_fbButtonView.tag = 1000 + ThirdLoginType_FB;
|
|
|
|
|
[_fbButtonView addTarget:self action:@selector(loginDidClick:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
|
|
}
|
|
|
|
|
return _fbButtonView;
|
2023-07-14 18:50:55 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (UIButton *)googleButtonView {
|
2023-11-01 20:38:26 +08:00
|
|
|
|
if (!_googleButtonView) {
|
|
|
|
|
_googleButtonView = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
|
|
|
[_googleButtonView setImage: [UIImage imageNamed:@"login_gmail"] forState:UIControlStateNormal];
|
2023-08-11 14:46:56 +08:00
|
|
|
|
[_googleButtonView setTitle:YMLocalizedString(@"XPLoginViewController13") forState:UIControlStateNormal];
|
|
|
|
|
_googleButtonView.titleLabel.font = kFontMedium(16);
|
|
|
|
|
[_googleButtonView setTitleColor:UIColorFromRGB(0x6D6B89) forState:UIControlStateNormal];
|
|
|
|
|
[_googleButtonView setImageEdgeInsets:UIEdgeInsetsMake(0, kGetScaleWidth(28), 0, kGetScaleWidth(200))];
|
|
|
|
|
_googleButtonView.backgroundColor = UIColorFromRGB(0xF3F5FA);
|
|
|
|
|
_googleButtonView.layer.cornerRadius = kGetScaleWidth(46)/2;
|
|
|
|
|
_googleButtonView.layer.masksToBounds = YES;
|
2023-11-01 20:38:26 +08:00
|
|
|
|
_googleButtonView.tag = 1000 + ThirdLoginType_Gmail;
|
|
|
|
|
[_googleButtonView addTarget:self action:@selector(loginDidClick:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
|
|
}
|
|
|
|
|
return _googleButtonView;
|
2023-07-14 18:50:55 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (UIButton *)lineButtonView {
|
2023-11-01 20:38:26 +08:00
|
|
|
|
if (!_lineButtonView) {
|
|
|
|
|
_lineButtonView = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
|
|
|
[_lineButtonView setImage: [UIImage imageNamed:@"login_line"] forState:UIControlStateNormal];
|
2023-08-11 14:46:56 +08:00
|
|
|
|
[_lineButtonView setTitle:YMLocalizedString(@"XPLoginViewController15") forState:UIControlStateNormal];
|
|
|
|
|
_lineButtonView.titleLabel.font = kFontMedium(16);
|
|
|
|
|
[_lineButtonView setTitleColor:UIColorFromRGB(0x6D6B89) forState:UIControlStateNormal];
|
|
|
|
|
[_lineButtonView setImageEdgeInsets:UIEdgeInsetsMake(0, kGetScaleWidth(28), 0, kGetScaleWidth(200))];
|
|
|
|
|
_lineButtonView.backgroundColor = UIColorFromRGB(0xF3F5FA);
|
|
|
|
|
_lineButtonView.layer.cornerRadius = kGetScaleWidth(46)/2;
|
|
|
|
|
_lineButtonView.layer.masksToBounds = YES;
|
2023-11-01 20:38:26 +08:00
|
|
|
|
_lineButtonView.tag = 1000 + ThirdLoginType_Line;
|
|
|
|
|
[_lineButtonView addTarget:self action:@selector(loginDidClick:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
|
|
}
|
|
|
|
|
return _lineButtonView;
|
2023-07-14 18:50:55 +08:00
|
|
|
|
}
|
2023-08-16 23:16:13 +08:00
|
|
|
|
- (UIButton *)appleButton {
|
|
|
|
|
if (!_appleButton) {
|
|
|
|
|
_appleButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
|
|
|
[_appleButton setImage: [UIImage imageNamed:@"login_apple"] forState:UIControlStateNormal];
|
|
|
|
|
[_appleButton setTitle:YMLocalizedString(@"XPLoginViewController12") forState:UIControlStateNormal];
|
|
|
|
|
_appleButton.titleLabel.font = kFontMedium(16);
|
|
|
|
|
[_appleButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
|
|
|
|
|
[_appleButton setImageEdgeInsets:UIEdgeInsetsMake(0, kGetScaleWidth(28), 0, kGetScaleWidth(200))];
|
|
|
|
|
_appleButton.backgroundColor = UIColorFromRGB(0x141414);
|
|
|
|
|
_appleButton.layer.cornerRadius = kGetScaleWidth(46)/2;
|
|
|
|
|
_appleButton.layer.masksToBounds = YES;
|
|
|
|
|
_appleButton.tag = 1000 + ThirdLoginType_Apple;
|
|
|
|
|
[_appleButton addTarget:self action:@selector(loginDidClick:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
|
|
}
|
|
|
|
|
return _appleButton;
|
|
|
|
|
}
|
2023-08-11 14:46:56 +08:00
|
|
|
|
|
|
|
|
|
|
2023-07-14 18:50:55 +08:00
|
|
|
|
- (GIDConfiguration *)configuration{
|
2023-11-01 20:38:26 +08:00
|
|
|
|
if (!_configuration){
|
|
|
|
|
NSString * number = [AESUtils aesDecrypt:@"ScLBu7ctIiyGCKPro3Jj6XMdsdCCpNT9L4wyjHEF+bguqubkXNSayFBGMKmoDwe1hjfAc958XSaBdMyEaFXLO38Bwq3xURYVNpgEM4b14zg="];
|
|
|
|
|
_configuration = [[GIDConfiguration alloc] initWithClientID:number];
|
|
|
|
|
}
|
|
|
|
|
return _configuration;
|
2023-07-14 18:50:55 +08:00
|
|
|
|
}
|
2023-08-11 14:46:56 +08:00
|
|
|
|
- (UIImageView *)bgImageView{
|
|
|
|
|
if(!_bgImageView){
|
|
|
|
|
_bgImageView = [[UIImageView alloc]init];
|
2024-07-02 18:54:42 +08:00
|
|
|
|
_bgImageView.image = kImage(@"Login_top_bg");
|
2024-06-13 17:52:59 +08:00
|
|
|
|
_bgImageView.contentMode = UIViewContentModeScaleAspectFill;
|
2023-11-01 20:38:26 +08:00
|
|
|
|
}
|
2023-08-11 14:46:56 +08:00
|
|
|
|
return _bgImageView;
|
|
|
|
|
}
|
|
|
|
|
- (UIImageView *)logoView{
|
|
|
|
|
if(!_logoView){
|
|
|
|
|
_logoView = [UIImageView new];
|
|
|
|
|
_logoView.image = kImage(@"pi_login_new_logo");
|
|
|
|
|
}
|
|
|
|
|
return _logoView;
|
|
|
|
|
}
|
2023-08-14 14:39:41 +08:00
|
|
|
|
- (UIImageView *)nextView{
|
|
|
|
|
if(!_nextView){
|
|
|
|
|
_nextView = [UIImageView new];
|
|
|
|
|
_nextView.image = kImage(@"login_next_login");
|
|
|
|
|
}
|
|
|
|
|
return _nextView;
|
|
|
|
|
}
|
|
|
|
|
- (UILabel *)nextLabel{
|
|
|
|
|
if(!_nextLabel){
|
|
|
|
|
_nextLabel = [UILabel labelInitWithText:YMLocalizedString(@"XPLoginViewController17") font:kFontMedium(12) textColor:[UIColor whiteColor]];
|
|
|
|
|
_nextLabel.textAlignment = NSTextAlignmentCenter;
|
|
|
|
|
}
|
|
|
|
|
return _nextLabel;
|
|
|
|
|
}
|
2024-04-11 15:47:44 +08:00
|
|
|
|
|
|
|
|
|
- (XPLoginInputView *)phoneInputView {
|
|
|
|
|
if (!_phoneInputView) {
|
|
|
|
|
_phoneInputView = [[XPLoginInputView alloc] init];
|
|
|
|
|
_phoneInputView.areaStackView.hidden = NO;
|
|
|
|
|
_phoneInputView.delegate = self;
|
|
|
|
|
NSMutableAttributedString *placeholder = [[NSMutableAttributedString alloc] initWithString:YMLocalizedString(@"XPLoginPhoneViewController5")];
|
|
|
|
|
[placeholder addAttribute:NSForegroundColorAttributeName value:UIColorFromRGB(0xB3B3C3) range:NSMakeRange(0, placeholder.length)];
|
|
|
|
|
_phoneInputView.inputTextField.attributedPlaceholder = placeholder;
|
|
|
|
|
_phoneInputView.inputTextField.keyboardType = UIKeyboardTypeNumberPad;
|
|
|
|
|
_phoneInputView.hidden = YES;
|
|
|
|
|
}
|
|
|
|
|
return _phoneInputView;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (XPLoginInputView *)codeInputView {
|
|
|
|
|
if (!_codeInputView) {
|
|
|
|
|
_codeInputView = [[XPLoginInputView alloc] init];
|
|
|
|
|
_codeInputView.smsCodeBtn.hidden = NO;
|
|
|
|
|
NSMutableAttributedString *placeholder = [[NSMutableAttributedString alloc] initWithString:YMLocalizedString(@"XPLoginPhoneViewController6")];
|
|
|
|
|
[placeholder addAttribute:NSForegroundColorAttributeName value:UIColorFromRGB(0xB3B3C3) range:NSMakeRange(0, placeholder.length)];
|
|
|
|
|
_codeInputView.inputTextField.attributedPlaceholder = placeholder;
|
|
|
|
|
_codeInputView.inputTextField.keyboardType = UIKeyboardTypeNumberPad;
|
|
|
|
|
_codeInputView.delegate = self;
|
|
|
|
|
_codeInputView.hidden = YES;
|
|
|
|
|
}
|
|
|
|
|
return _codeInputView;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (UIButton *)loginBtn {
|
|
|
|
|
if (!_loginBtn) {
|
|
|
|
|
_loginBtn = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
|
|
|
|
2024-07-02 18:54:42 +08:00
|
|
|
|
UIImage *nextImage = [UIImage gradientColorImageFromColors:@[UIColorFromRGB(0x57e193), UIColorFromRGB(0x14d2a6)] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(kGetScaleWidth(303), kGetScaleWidth(48))];
|
|
|
|
|
UIImage *disableImage = [UIImage gradientColorImageFromColors:@[UIColorFromRGB(0xa5eec8), UIColorFromRGB(0xabf5e3)] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(kGetScaleWidth(303), kGetScaleWidth(48))];
|
|
|
|
|
|
2024-04-11 15:47:44 +08:00
|
|
|
|
[_loginBtn setImage:nextImage forState:UIControlStateNormal];
|
|
|
|
|
[_loginBtn setImage:disableImage forState:UIControlStateDisabled];
|
|
|
|
|
_loginBtn.layer.cornerRadius = kGetScaleWidth(48)/2;
|
|
|
|
|
_loginBtn.layer.masksToBounds = YES;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UILabel *titleView = [UILabel labelInitWithText:YMLocalizedString(@"XPLoginPhoneViewController8") font:kFontMedium(16) textColor:[UIColor whiteColor]];
|
|
|
|
|
titleView.textAlignment = NSTextAlignmentCenter;
|
|
|
|
|
[_loginBtn addSubview:titleView];
|
|
|
|
|
[titleView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
|
make.edges.equalTo(self.loginBtn);
|
|
|
|
|
}];
|
|
|
|
|
[_loginBtn addTarget:self action:@selector(loginBtnClicked) forControlEvents:UIControlEventTouchUpInside];
|
|
|
|
|
}
|
|
|
|
|
return _loginBtn;
|
|
|
|
|
}
|
|
|
|
|
|
2025-02-28 19:04:09 +08:00
|
|
|
|
- (UIButton *)currentLoginWayButton{
|
|
|
|
|
if(!_currentLoginWayButton){
|
|
|
|
|
_currentLoginWayButton = [UIButton new];
|
2025-03-06 15:26:44 +08:00
|
|
|
|
[_currentLoginWayButton setTitle:YMLocalizedString(@"1.0.37_text_26") forState:UIControlStateNormal];
|
2025-02-28 19:04:09 +08:00
|
|
|
|
[_currentLoginWayButton setTitleColor:UIColorFromRGB(0xafb1b3) forState:UIControlStateNormal];
|
|
|
|
|
[_currentLoginWayButton setTitleColor:UIColorFromRGB(0x000000) forState:UIControlStateSelected];
|
|
|
|
|
_currentLoginWayButton.titleLabel.font = kFontMedium(16);
|
|
|
|
|
[_currentLoginWayButton setEnlargeEdgeWithTop:10 right:10 bottom:10 left:10];
|
|
|
|
|
_currentLoginWayButton.selected = NO;
|
|
|
|
|
[_currentLoginWayButton addTarget:self action:@selector(chooseAccountAction) forControlEvents:UIControlEventTouchUpInside];
|
|
|
|
|
}
|
|
|
|
|
return _currentLoginWayButton;
|
|
|
|
|
}
|
|
|
|
|
- (UIButton *)otherLoginWayButton{
|
|
|
|
|
if(!_otherLoginWayButton){
|
|
|
|
|
_otherLoginWayButton = [UIButton new];
|
|
|
|
|
[_otherLoginWayButton setTitle:YMLocalizedString(@"1.0.37_text_27") forState:UIControlStateNormal];
|
|
|
|
|
[_otherLoginWayButton setTitleColor:UIColorFromRGB(0x313131) forState:UIControlStateNormal];
|
|
|
|
|
[_otherLoginWayButton setTitleColor:UIColorFromRGB(0x000000) forState:UIControlStateSelected];
|
|
|
|
|
_otherLoginWayButton.titleLabel.font = kFontMedium(14);
|
|
|
|
|
_otherLoginWayButton.selected = YES;
|
|
|
|
|
[_otherLoginWayButton setEnlargeEdgeWithTop:10 right:10 bottom:10 left:10];
|
|
|
|
|
[_otherLoginWayButton addTarget:self action:@selector(chooseSMSAction) forControlEvents:UIControlEventTouchUpInside];
|
2024-04-11 15:47:44 +08:00
|
|
|
|
|
|
|
|
|
}
|
2025-02-28 19:04:09 +08:00
|
|
|
|
return _otherLoginWayButton;
|
2024-04-11 15:47:44 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (XPLoginInputView *)accountView {
|
|
|
|
|
if (!_accountView) {
|
|
|
|
|
_accountView = [[XPLoginInputView alloc] init];
|
|
|
|
|
_accountView.areaStackView.hidden = YES;
|
|
|
|
|
NSMutableAttributedString *placeholder = [[NSMutableAttributedString alloc] initWithString:YMLocalizedString(@"XPLoginPwdViewController6")];
|
|
|
|
|
[placeholder addAttribute:NSForegroundColorAttributeName value:UIColorFromRGB(0xB4B7BD) range:NSMakeRange(0, placeholder.length)];
|
|
|
|
|
_accountView.inputTextField.attributedPlaceholder = placeholder;
|
|
|
|
|
_accountView.inputTextField.keyboardType = UIKeyboardTypeNumberPad;
|
|
|
|
|
}
|
|
|
|
|
return _accountView;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (XPLoginInputView *)accountPwdView {
|
|
|
|
|
if (!_accountPwdView) {
|
|
|
|
|
_accountPwdView = [[XPLoginInputView alloc] init];
|
|
|
|
|
NSMutableAttributedString *placeholder = [[NSMutableAttributedString alloc] initWithString:YMLocalizedString(@"XPLoginPwdViewController3")];
|
|
|
|
|
[placeholder addAttribute:NSForegroundColorAttributeName value:UIColorFromRGB(0xB4B7BD) range:NSMakeRange(0, placeholder.length)];
|
|
|
|
|
_accountPwdView.inputTextField.attributedPlaceholder = placeholder;
|
|
|
|
|
_accountPwdView.inputTextField.keyboardType = UIKeyboardTypeAlphabet;
|
|
|
|
|
_accountPwdView.inputTextField.secureTextEntry = YES;
|
|
|
|
|
}
|
|
|
|
|
return _accountPwdView;
|
|
|
|
|
}
|
|
|
|
|
- (UIButton *)forgetBtn {
|
|
|
|
|
if (!_forgetBtn) {
|
|
|
|
|
_forgetBtn = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
|
|
|
[_forgetBtn setTitle:YMLocalizedString(@"XPRoomRedPacketPwdView1") forState:UIControlStateNormal];
|
|
|
|
|
[_forgetBtn setTitleColor:UIColorFromRGB(0xB4B7BD) forState:UIControlStateNormal];
|
|
|
|
|
_forgetBtn.titleLabel.font = kFontRegular(12);
|
|
|
|
|
[_forgetBtn addTarget:self action:@selector(forgetBtnClicked) forControlEvents:UIControlEventTouchUpInside];
|
|
|
|
|
}
|
|
|
|
|
return _forgetBtn;
|
|
|
|
|
}
|
|
|
|
|
|
2024-07-02 18:54:42 +08:00
|
|
|
|
- (UIButton *)feedBackButton {
|
|
|
|
|
if (!_feedBackButton) {
|
|
|
|
|
_feedBackButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
2024-07-03 21:22:40 +08:00
|
|
|
|
// [_feedBackButton setBackgroundImage:kImage(@"login_custom_servise") forState:UIControlStateNormal];
|
|
|
|
|
[_feedBackButton setTitle:YMLocalizedString(@"XPMineFeedbackViewController0") forState:UIControlStateNormal];
|
2024-07-02 18:54:42 +08:00
|
|
|
|
[_feedBackButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
|
|
|
|
|
_feedBackButton.titleLabel.font = [UIFont systemFontOfSize:14 weight:UIFontWeightBold];
|
|
|
|
|
[_feedBackButton addTarget:self
|
|
|
|
|
action:@selector(didTapFeedback)
|
|
|
|
|
forControlEvents:UIControlEventTouchUpInside];
|
2024-07-03 21:22:40 +08:00
|
|
|
|
[_feedBackButton enlargeTouchArea:UIEdgeInsetsMake(10, 10, 10, 10)];
|
2024-07-02 18:54:42 +08:00
|
|
|
|
}
|
|
|
|
|
return _feedBackButton;
|
|
|
|
|
}
|
|
|
|
|
|
2023-07-14 18:50:55 +08:00
|
|
|
|
@end
|