536 lines
21 KiB
Objective-C
536 lines
21 KiB
Objective-C
//
|
|
// YMLoginViewController.m
|
|
// YUMI
|
|
//
|
|
// Created by XY on 2023/2/13.
|
|
//
|
|
|
|
#import "XPLoginViewController.h"
|
|
#import <Masonry.h>
|
|
|
|
#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 "StatisticsServiceHelper.h"
|
|
#import "XNDJTDDLoadingTool.h"
|
|
#import "XPWebViewController.h"
|
|
#import "XPLoginPhoneViewController.h"
|
|
#import "UserPrivacyView.h"
|
|
#import "AESUtils.h"
|
|
#import "LoginPresenter.h"
|
|
#import "LoginProtocol.h"
|
|
#import "PILoginManager.h"
|
|
UIKIT_EXTERN NSString * const kYouMiNumberCountKey;
|
|
NSString * const HadAgreePrivacy = @"HadAgreePrivacy";
|
|
|
|
@interface XPLoginViewController ()<LoginProtocol>
|
|
///背景
|
|
@property(nonatomic,strong) UIImageView *bgImageView;
|
|
///logo
|
|
@property(nonatomic,strong) UIImageView *logoView;
|
|
/// 一键登录
|
|
@property (nonatomic, strong) UIButton *quickLoginBtn;
|
|
/// 同意按钮
|
|
@property (nonatomic, strong) UIButton *agreeBtn;
|
|
/// 协议隐私政策
|
|
@property (nonatomic, strong) YYLabel *protocolLabel;
|
|
|
|
/// 勾选隐私政策提示泡泡
|
|
@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;
|
|
|
|
@property (nonatomic, strong) UIButton *appleButton;
|
|
|
|
///谷歌登录配置
|
|
@property (nonatomic,strong) GIDConfiguration *configuration;
|
|
///上次登錄背景
|
|
@property(nonatomic,strong) UIImageView *nextView;
|
|
///上次登錄
|
|
@property(nonatomic,strong) UILabel *nextLabel;
|
|
|
|
@end
|
|
|
|
@implementation XPLoginViewController
|
|
|
|
- (LoginPresenter *)createPresenter {
|
|
return [[LoginPresenter alloc] init];
|
|
}
|
|
|
|
- (BOOL)isHiddenNavBar {
|
|
return YES;
|
|
}
|
|
|
|
|
|
- (void)viewDidLoad {
|
|
|
|
[super viewDidLoad];
|
|
[self createUI];
|
|
[[NSNotificationCenter defaultCenter]postNotificationName:@"kInLoginVC" object:nil];
|
|
}
|
|
|
|
- (void)viewWillAppear:(BOOL)animated {
|
|
[super viewWillAppear:animated];
|
|
|
|
}
|
|
|
|
- (void)createUI {
|
|
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
|
[defaults setObject:@"hadAgree" forKey:HadAgreePrivacy];
|
|
[defaults synchronize];
|
|
self.view.backgroundColor = [UIColor whiteColor];
|
|
[self.view addSubview:self.bgImageView];
|
|
[self.view addSubview:self.logoView];
|
|
[self.view addSubview:self.stackView];
|
|
[self.view addSubview:self.quickLoginBtn];
|
|
[self.view addSubview:self.protocolLabel];
|
|
[self.view addSubview:self.agreeBtn];
|
|
|
|
|
|
[self.view addSubview:self.authBubbleView];
|
|
[self.authBubbleView addSubview:self.authBubbleLabel];
|
|
|
|
if (@available(iOS 13.0, *)) {
|
|
#ifdef DEBUG
|
|
|
|
|
|
|
|
[self.stackView addArrangedSubview:self.appleButton];
|
|
|
|
|
|
|
|
#else
|
|
if(isEnterprise == YES){
|
|
[self.stackView addArrangedSubview:self.appleButton];
|
|
}
|
|
#endif
|
|
|
|
}
|
|
[self.stackView addArrangedSubview:self.googleButtonView];
|
|
[self.stackView addArrangedSubview:self.fbButtonView];
|
|
[self.stackView addArrangedSubview:self.lineButtonView];
|
|
|
|
|
|
[self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.left.right.top.equalTo(self.view);
|
|
make.height.mas_equalTo(kGetScaleWidth(355));
|
|
}];
|
|
[self.logoView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.width.mas_offset(kGetScaleWidth(130));
|
|
make.height.mas_equalTo(kGetScaleWidth(148));
|
|
make.centerX.equalTo(self.view);
|
|
make.top.mas_equalTo(kGetScaleWidth(100));
|
|
}];
|
|
|
|
[self.stackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.top.mas_equalTo(self.self.logoView.mas_bottom).offset(kGetScaleWidth(60));
|
|
make.centerX.mas_equalTo(self.view);
|
|
}];
|
|
|
|
|
|
|
|
[self.quickLoginBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.centerX.equalTo(self.view);
|
|
make.height.mas_equalTo(kGetScaleWidth(22));
|
|
make.width.mas_equalTo(kGetScaleWidth(140));
|
|
make.top.equalTo(self.stackView.mas_bottom).mas_offset(kGetScaleWidth(18));
|
|
}];
|
|
[self.protocolLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.centerX.mas_equalTo(self.view).offset(10);
|
|
make.right.mas_lessThanOrEqualTo(-10);
|
|
make.height.mas_greaterThanOrEqualTo(22);
|
|
make.bottom.mas_equalTo(-kGetScaleWidth(35));
|
|
}];
|
|
[self.agreeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.right.mas_equalTo(self.protocolLabel.mas_left).offset(0);
|
|
make.top.mas_equalTo(self.protocolLabel.mas_top);
|
|
make.width.height.mas_equalTo(22);
|
|
}];
|
|
|
|
|
|
[self.authBubbleView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.left.mas_equalTo(self.agreeBtn).mas_offset((-16));
|
|
make.top.mas_equalTo(self.agreeBtn.mas_bottom);
|
|
make.width.mas_equalTo(235);
|
|
make.height.mas_equalTo(29);
|
|
}];
|
|
[self.authBubbleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.left.mas_equalTo(8);
|
|
make.bottom.mas_equalTo(self.authBubbleView).mas_offset(-6);
|
|
}];
|
|
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
|
|
|
|
}
|
|
|
|
[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));
|
|
}];
|
|
[self.lineButtonView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.width.mas_equalTo(kGetScaleWidth(295));
|
|
make.height.mas_equalTo(kGetScaleWidth(46));
|
|
}];
|
|
|
|
id type = [[NSUserDefaults standardUserDefaults]valueForKey:@"kLoginSuccessType"];
|
|
if(type != nil){
|
|
UIButton *typeButton ;
|
|
if([type intValue] == ThirdLoginType_Apple){
|
|
typeButton = self.appleButton;
|
|
}else if([type intValue] == ThirdLoginType_Gmail){
|
|
typeButton = self.googleButtonView;
|
|
}else if([type intValue] == ThirdLoginType_FB){
|
|
typeButton = self.fbButtonView;
|
|
}else if([type intValue] == ThirdLoginType_Line){
|
|
typeButton = self.lineButtonView;
|
|
}
|
|
if(typeButton == nil){
|
|
return;
|
|
}
|
|
[self.view addSubview:self.nextView];
|
|
[self.nextView addSubview:self.nextLabel];
|
|
[self.nextView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.trailing.mas_equalTo(-kGetScaleWidth(28));
|
|
make.width.mas_equalTo(kGetScaleWidth(70));
|
|
make.height.mas_equalTo(kGetScaleWidth(24));
|
|
make.centerY.equalTo(typeButton.mas_top);
|
|
}];
|
|
[self.nextLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.edges.equalTo(self.nextView);
|
|
}];
|
|
}
|
|
|
|
}
|
|
|
|
- (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 {
|
|
if (self.agreeBtn.selected) {
|
|
ThirdLoginType type = sender.tag - 1000;
|
|
if(type == ThirdLoginType_Gmail){
|
|
[self.presenter thirdLoginByGoogleWithPresentingViewController:self configuration:self.configuration];
|
|
return;
|
|
}else if(type == ThirdLoginType_FB){
|
|
[self.presenter thirdLoginByFBWithPresentingViewController:self];
|
|
return;
|
|
}else if(type == ThirdLoginType_Line){
|
|
[self.presenter thirdLoginByLine:self];
|
|
return;
|
|
}
|
|
[self.presenter thirdLoginWithType:type];
|
|
|
|
} else {
|
|
[UIView animateWithDuration:0.5 animations:^{
|
|
self.authBubbleView.alpha = 1.0;
|
|
}];
|
|
}
|
|
|
|
}
|
|
|
|
/// 点击同意
|
|
- (void)agreeBtnClicked {
|
|
self.agreeBtn.selected = !self.agreeBtn.selected;
|
|
if (self.agreeBtn.isSelected) {
|
|
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
|
[defaults setObject:@"hadAgree" forKey:HadAgreePrivacy];
|
|
[defaults synchronize];
|
|
[UIView animateWithDuration:0.5 animations:^{
|
|
self.authBubbleView.alpha = 0.0;
|
|
}];
|
|
} else {
|
|
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
|
NSString * hadAgree = [defaults stringForKey:HadAgreePrivacy];
|
|
if (hadAgree.length > 0) {
|
|
[defaults removeObjectForKey:HadAgreePrivacy];
|
|
}
|
|
}
|
|
}
|
|
|
|
/// 点击手机号登录
|
|
- (void)phoneLoginBtnClicked {
|
|
if (self.agreeBtn.isSelected) {
|
|
XPLoginPhoneViewController *phoneVC = [[XPLoginPhoneViewController alloc] init];
|
|
[self.navigationController pushViewController:phoneVC animated:YES];
|
|
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventLoginPhoneClick];
|
|
} else {
|
|
[UIView animateWithDuration:0.5 animations:^{
|
|
self.authBubbleView.alpha = 1.0;
|
|
}];
|
|
}
|
|
}
|
|
|
|
/// 点击一键登录
|
|
- (void)quickLoginBtnClicked {
|
|
if (self.agreeBtn.isSelected) {
|
|
XPLoginPhoneViewController *phoneVC = [[XPLoginPhoneViewController alloc] init];
|
|
[self.navigationController pushViewController:phoneVC animated:YES];
|
|
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventLoginPhoneClick];
|
|
} else {
|
|
[UIView animateWithDuration:0.5 animations:^{
|
|
self.authBubbleView.alpha = 1.0;
|
|
}];
|
|
}
|
|
}
|
|
#pragma mark - LoginProtocol
|
|
- (void)loginSuccess {
|
|
[PILoginManager loginWithVC:self isLoginPhone:NO];
|
|
[self showSuccessToast:YMLocalizedString(@"XPLoginViewController4")];
|
|
}
|
|
|
|
#pragma mark - 懒加载
|
|
|
|
- (UIButton *)quickLoginBtn {
|
|
if (!_quickLoginBtn) {
|
|
_quickLoginBtn = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
|
|
[_quickLoginBtn setTitle:YMLocalizedString(@"XPLoginViewController16") forState:UIControlStateNormal];
|
|
_quickLoginBtn.titleLabel.font = kFontRegular(14);
|
|
[_quickLoginBtn setTitleColor:UIColorFromRGB(0x1F1B4F) forState:UIControlStateNormal];
|
|
|
|
[_quickLoginBtn setImage:[UIImage imageNamed:@"login_phone_white"] forState:UIControlStateNormal];
|
|
[_quickLoginBtn setImageEdgeInsets:UIEdgeInsetsMake(0, kGetScaleWidth(130), 0, 0)];
|
|
[_quickLoginBtn addTarget:self action:@selector(quickLoginBtnClicked) forControlEvents:UIControlEventTouchUpInside];
|
|
}
|
|
return _quickLoginBtn;
|
|
}
|
|
|
|
- (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];
|
|
NSString *hadAgree = [defaults objectForKey:HadAgreePrivacy];
|
|
if (hadAgree.length > 0) {
|
|
_agreeBtn.selected = YES;
|
|
}
|
|
}
|
|
return _agreeBtn;
|
|
}
|
|
|
|
- (YYLabel *)protocolLabel {
|
|
if (!_protocolLabel) {
|
|
_protocolLabel = [[YYLabel alloc] init];
|
|
_protocolLabel.font = kFontRegular(12);
|
|
_protocolLabel.numberOfLines = 0;
|
|
|
|
NSMutableAttributedString *attString = [[NSMutableAttributedString alloc] initWithString:YMLocalizedString(@"XPLoginViewController6")];
|
|
attString.yy_color = UIColorFromRGB(0xB3B3C3);
|
|
NSString *userString = YMLocalizedString(@"XPLoginViewController7");
|
|
NSMutableAttributedString *userAttString = [[NSMutableAttributedString alloc] initWithString:userString attributes:@{NSForegroundColorAttributeName:UIColorFromRGB(0x1F1B4F)}];
|
|
@weakify(self)
|
|
[userAttString yy_setTextHighlightRange:NSMakeRange(0, userAttString.length) color:nil backgroundColor:nil userInfo:nil tapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) {
|
|
@strongify(self);
|
|
// 跳转用户协议
|
|
XPWebViewController * webVC = [[XPWebViewController alloc] init];
|
|
webVC.url = URLWithType(kUserProtocalURL);
|
|
[self.navigationController pushViewController:webVC animated:YES];
|
|
} longPressAction:nil];
|
|
|
|
NSMutableAttributedString *andString = [[NSMutableAttributedString alloc] initWithString:YMLocalizedString(@"XPLoginViewController8")];
|
|
andString.yy_color = UIColorFromRGB(0xB3B3C3);
|
|
NSString *protocolString = YMLocalizedString(@"XPLoginViewController9");
|
|
NSMutableAttributedString *privateString = [[NSMutableAttributedString alloc] initWithString:protocolString attributes:@{NSForegroundColorAttributeName:UIColorFromRGB(0x1F1B4F)}];
|
|
[privateString yy_setTextHighlightRange:NSMakeRange(0, privateString.length) color:nil backgroundColor:nil userInfo:nil tapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) {
|
|
@strongify(self);
|
|
// 跳转隐私政策
|
|
XPWebViewController * webVC = [[XPWebViewController alloc] init];
|
|
webVC.url = URLWithType(kPrivacyURL);
|
|
[self.navigationController pushViewController:webVC animated:YES];
|
|
} longPressAction:nil];
|
|
[attString appendAttributedString:userAttString];
|
|
[attString appendAttributedString:andString];
|
|
[attString appendAttributedString:privateString];
|
|
|
|
_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 {
|
|
if (!_stackView) {
|
|
_stackView = [[UIStackView alloc] init];
|
|
_stackView.axis = UILayoutConstraintAxisVertical;
|
|
_stackView.distribution = UIStackViewDistributionFillEqually;
|
|
_stackView.alignment = UIStackViewAlignmentFill;
|
|
_stackView.spacing = kGetScaleWidth(16);
|
|
}
|
|
return _stackView;
|
|
}
|
|
|
|
- (UILabel *)authBubbleLabel {
|
|
if (!_authBubbleLabel) {
|
|
_authBubbleLabel = [[UILabel alloc] init];
|
|
_authBubbleLabel.text = YMLocalizedString(@"XPLoginViewController11");
|
|
_authBubbleLabel.font = [UIFont systemFontOfSize:10];
|
|
_authBubbleLabel.textColor = UIColor.whiteColor;
|
|
}
|
|
return _authBubbleLabel;
|
|
}
|
|
|
|
- (UIButton *)fbButtonView {
|
|
if (!_fbButtonView) {
|
|
_fbButtonView = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
[_fbButtonView setImage: [UIImage imageNamed:@"login_facebook"] forState:UIControlStateNormal];
|
|
[_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;
|
|
_fbButtonView.tag = 1000 + ThirdLoginType_FB;
|
|
[_fbButtonView addTarget:self action:@selector(loginDidClick:) forControlEvents:UIControlEventTouchUpInside];
|
|
}
|
|
return _fbButtonView;
|
|
}
|
|
|
|
- (UIButton *)googleButtonView {
|
|
if (!_googleButtonView) {
|
|
_googleButtonView = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
[_googleButtonView setImage: [UIImage imageNamed:@"login_gmail"] forState:UIControlStateNormal];
|
|
[_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;
|
|
_googleButtonView.tag = 1000 + ThirdLoginType_Gmail;
|
|
[_googleButtonView addTarget:self action:@selector(loginDidClick:) forControlEvents:UIControlEventTouchUpInside];
|
|
}
|
|
return _googleButtonView;
|
|
}
|
|
|
|
- (UIButton *)lineButtonView {
|
|
if (!_lineButtonView) {
|
|
_lineButtonView = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
[_lineButtonView setImage: [UIImage imageNamed:@"login_line"] forState:UIControlStateNormal];
|
|
[_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;
|
|
_lineButtonView.tag = 1000 + ThirdLoginType_Line;
|
|
[_lineButtonView addTarget:self action:@selector(loginDidClick:) forControlEvents:UIControlEventTouchUpInside];
|
|
}
|
|
return _lineButtonView;
|
|
}
|
|
- (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;
|
|
}
|
|
|
|
|
|
- (GIDConfiguration *)configuration{
|
|
if (!_configuration){
|
|
NSString * number = [AESUtils aesDecrypt:@"ScLBu7ctIiyGCKPro3Jj6XMdsdCCpNT9L4wyjHEF+bguqubkXNSayFBGMKmoDwe1hjfAc958XSaBdMyEaFXLO38Bwq3xURYVNpgEM4b14zg="];
|
|
_configuration = [[GIDConfiguration alloc] initWithClientID:number];
|
|
}
|
|
return _configuration;
|
|
}
|
|
- (UIImageView *)bgImageView{
|
|
if(!_bgImageView){
|
|
_bgImageView = [[UIImageView alloc]init];
|
|
_bgImageView.image = kImage(@"pi_app_logo_new_bg");
|
|
_bgImageView.contentMode = 2;
|
|
}
|
|
return _bgImageView;
|
|
}
|
|
- (UIImageView *)logoView{
|
|
if(!_logoView){
|
|
_logoView = [UIImageView new];
|
|
_logoView.image = kImage(@"pi_login_new_logo");
|
|
}
|
|
return _logoView;
|
|
}
|
|
- (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;
|
|
}
|
|
@end
|