Compare commits

..

4 Commits

Author SHA1 Message Date
edwinQQQ
e27b564fdc 完成 2.7.32 需求 2025-03-21 16:19:07 +08:00
edwinQQQ
d6e13ac0fe 修正线上首页显示内容不对问题
阿语环境下,有概率会 hot 列表显示为最后一个 tab 的内容
2025-03-14 19:44:58 +08:00
edwinQQQ
e7b2f594e8 版本需求修改暂存 2025-03-14 19:43:04 +08:00
edwinQQQ
e152d0f8a1 Feature: 完成金币兑换 UX 调整 2025-03-07 11:03:35 +08:00
168 changed files with 18816 additions and 60864 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -171,13 +171,6 @@ UIKIT_EXTERN NSString * adImageName;
NSString *filePath = [XPAdImageTool.shareImageTool getFilePathWithImageName:adName];
BOOL isExist = [XPAdImageTool.shareImageTool isFileExistWithFilePath:filePath];
// if ([kUserDefaults integerForKey:@"adShow"]) {
// [kUserDefaults setInteger:[kUserDefaults integerForKey:@"adShow"]+1
// forKey:@"adShow"];
// } else {
// [kUserDefaults setInteger:1 forKey:@"adShow"];
// }
if (isExist) {//
// if ([kUserDefaults integerForKey:@"adShow"] > 4) {
@kWeakify(self);

View File

@@ -10,7 +10,6 @@
#import <UMCommon/UMCommon.h>
#import <MobLinkPro/MobLink.h>
#import <MobLinkPro/MLSDKScene.h>
//#import <FBSDKCoreKit/FBSDKCoreKit.h>
#import "TabbarViewController.h"
#import "BaseNavigationController.h"
#import "AppDelegate+ThirdConfig.h"
@@ -18,15 +17,15 @@
#import <AppTrackingTransparency/AppTrackingTransparency.h>
#import "ClientConfig.h"
#import <GoogleSignIn/GoogleSignIn.h>
//#import "GULAppDelegateSwizzler.h"
#import <GoogleSignIn/GoogleSignIn.h>
#import "XPLoginViewController.h"
#import "LoginViewController.h"
#import "AccountModel.h"
#import "YuMi-swift.h"
#import "SessionViewController.h"
#import "LoginFullInfoViewController.h"
#import "UIView+VAP.h"
//@import Firebase;
#import "SocialShareManager.h"
UIKIT_EXTERN NSString * const kOpenRoomNotification;
@interface AppDelegate ()<IMLSDKRestoreDelegate>
@@ -77,7 +76,6 @@ void qg_VAP_Logger_handler(VAPLogLevel level, const char* file, int line, const
[self loadMainPage];
[self setupLaunchADView];
});
}];
return YES;
@@ -91,8 +89,6 @@ void qg_VAP_Logger_handler(VAPLogLevel level, const char* file, int line, const
[UMConfigure initWithAppkey:@"6434c6dfd64e686139618269"
channel:@"appstore"];
}
// [[FBSDKApplicationDelegate sharedInstance] application:application didFinishLaunchingWithOptions:launchOptions];
// [FIRApp configure];
[MobLink setDelegate:self];
}
@@ -110,7 +106,7 @@ void qg_VAP_Logger_handler(VAPLogLevel level, const char* file, int line, const
}
- (void)toLoginPage {
XPLoginViewController *lvc = [[XPLoginViewController alloc] init];
LoginViewController *lvc = [[LoginViewController alloc] init];
BaseNavigationController * navigationController = [[BaseNavigationController alloc] initWithRootViewController:lvc];
navigationController.modalPresentationStyle = UIModalPresentationFullScreen;
self.window.rootViewController = navigationController;
@@ -202,57 +198,47 @@ void qg_VAP_Logger_handler(VAPLogLevel level, const char* file, int line, const
///URL Scheme
-(BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<NSString *,id> *)options{
NSString *bundleID = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleIdentifier"];
if ([url.scheme isEqualToString:[NSString stringWithFormat:@"line3rdp.%@",bundleID]]) {
return [PILineLoginManager applicationOpenurl:app open:url];
}
NSString *text = [url query];
if(text.length){
NSMutableDictionary *paramsDict = [NSMutableDictionary dictionary];
NSArray *paramArray = [text componentsSeparatedByString:@"&"];
for (NSString *param in paramArray) {
if (param && param.length) {
NSArray *parArr = [param componentsSeparatedByString:@"="];
if (parArr.count == 2) {
[paramsDict setObject:parArr[1] forKey:parArr[0]];
}
}
}
if(paramsDict[@"type"] != nil){
NSInteger type = [paramsDict[@"type"] integerValue];
if (type == 2) {
NSString *uid = [NSString stringWithFormat:@"%@",paramsDict[@"uid"]];
[[NSNotificationCenter defaultCenter]postNotificationName:kOpenRoomNotification object:nil userInfo:@{@"uid":uid}];
ClientConfig *config = [ClientConfig shareConfig];
config.roomId = uid;
}else if(type == 7){
NSString *uid = [NSString stringWithFormat:@"%@",paramsDict[@"uid"]];
[[NSNotificationCenter defaultCenter]postNotificationName:kOpenRoomNotification object:nil userInfo:@{@"type":@"kOpenChat",@"uid":uid}];
ClientConfig *config = [ClientConfig shareConfig];
config.chatId = uid;
}else if (type == 8){
NSString *inviteCode = paramsDict[@"inviteCode"];
if (inviteCode != nil && [[AccountInfoStorage instance]getUid].length == 0){
ClientConfig *config = [ClientConfig shareConfig];
config.inviteCode = inviteCode;
}
}
return YES;
}
}
// if([url.absoluteString containsString:@"fb1266232494209868"]){
// return [[FBSDKApplicationDelegate sharedInstance] application:app
// openURL:url
// sourceApplication:options[UIApplicationOpenURLOptionsSourceApplicationKey]
// annotation:options[UIApplicationOpenURLOptionsAnnotationKey]];
// }
[[SocialShareManager sharedManager] handleURL:url];
return [GIDSignIn.sharedInstance handleURL:url];
}
//- (void)__oldApplicationOpenURLMethod:(NSURL *)url {
// NSString *text = [url query];
// if(text.length){
// NSMutableDictionary *paramsDict = [NSMutableDictionary dictionary];
// NSArray *paramArray = [text componentsSeparatedByString:@"&"];
// for (NSString *param in paramArray) {
// if (param && param.length) {
// NSArray *parArr = [param componentsSeparatedByString:@"="];
// if (parArr.count == 2) {
// [paramsDict setObject:parArr[1] forKey:parArr[0]];
// }
// }
// }
// if(paramsDict[@"type"] != nil){
// NSInteger type = [paramsDict[@"type"] integerValue];
// if (type == 2) {
// NSString *uid = [NSString stringWithFormat:@"%@",paramsDict[@"uid"]];
// [[NSNotificationCenter defaultCenter]postNotificationName:kOpenRoomNotification object:nil userInfo:@{@"uid":uid}];
// ClientConfig *config = [ClientConfig shareConfig];
// config.roomId = uid;
// }else if(type == 7){
// NSString *uid = [NSString stringWithFormat:@"%@",paramsDict[@"uid"]];
// [[NSNotificationCenter defaultCenter]postNotificationName:kOpenRoomNotification object:nil userInfo:@{@"type":@"kOpenChat",@"uid":uid}];
// ClientConfig *config = [ClientConfig shareConfig];
// config.chatId = uid;
// }else if (type == 8){
// NSString *inviteCode = paramsDict[@"inviteCode"];
// if (inviteCode != nil && [[AccountInfoStorage instance]getUid].length == 0){
// ClientConfig *config = [ClientConfig shareConfig];
// config.inviteCode = inviteCode;
// }
// }
//// return YES;
// }
// }
//}
#pragma mark - Core Data stack
@synthesize managedObjectContext = _managedObjectContext;

View File

@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 229 KiB

View File

@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "5394b7b084545ef1ec94ee1f396616d3f476c6bb8a758-r7deHF_fw480@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "切图 65@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "路径 186@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 428 B

View File

@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "bg@3x (1).png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 432 KiB

View File

@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "bg@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 436 KiB

View File

@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "闭眼.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "切图 65@3x (2).png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "闭眼 (1).png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "logo@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

View File

@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "切图 65@3x (1).png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "HI@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View File

@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "手机@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

View File

@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "勾选@3x (1).png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "勾选@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "top@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

View File

@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "返回 1.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "切图 27.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "share_icon.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

View File

@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "容器.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

@@ -45,6 +45,8 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, copy) NSString *zipMd5;
@property (nonatomic, strong) NSURL *zipUrl;
@property(nonatomic, assign) BOOL shouldDisplayCaptcha;
- (UIColor *)bgColor;
- (NSString *)tabName:(NSInteger)tabIndex;

View File

@@ -255,4 +255,8 @@
return [self.selectedTabImageSource xpSafeObjectAtIndex:tabIndex];
}
- (BOOL)shouldDisplayCaptcha {
return [self.configInfo captchaSwitch];
}
@end

View File

@@ -106,6 +106,8 @@ typedef NS_ENUM(NSInteger, FaceLivenessStrategy) {
@property (nonatomic, copy) NSString *appStoreAuditNoticeVersion;
@property(nonatomic, assign) BOOL captchaSwitch;
@end
NS_ASSUME_NONNULL_END

View File

@@ -33,6 +33,9 @@ static int const showtime = 3;
@property (nonatomic, strong) UIWindow *window;
@property(nonatomic, strong) NSMutableArray *imageLoaders;
@end
@implementation XPAdvertiseView
@@ -173,7 +176,7 @@ static int const showtime = 3;
#pragma mark - Setter
- (void)setFilePath:(NSString *)filePath {
_filePath = filePath;
_imageLoaders = @[].mutableCopy;
if (self.type == SplashInfoSkipTypeWeb_CP || self.type == SplashInfoSkipTypeWeb_Custom || self.type == SplashInfoSkipTypeWeb_WeekStar) {
_svgaView = [[SVGAImageView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)];
_svgaView.delegate = self;
@@ -216,7 +219,21 @@ static int const showtime = 3;
- (void)updateSvgaImage:(NSString *)imagePath key:(NSString *)key {
if (self.svgaView && ![NSString isEmpty:imagePath] && ![NSString isEmpty:key]) {
[self.svgaView setImageWithURL:[NSURL URLWithString:imagePath] forKey:key];
UIImage *image = [UIImage imageWithColor:[UIColor colorWithWhite:0.9 alpha:0.9] size:CGSizeMake(100, 100)];
[self.svgaView setImage:image
forKey:key];
__block NetImageView *loader = [[NetImageView alloc] init];
@kWeakify(self);
@kWeakify(loader);
[loader loadImageWithUrl:imagePath
completion:^(UIImage * _Nullable image, NSURL * _Nonnull url) {
@kStrongify(self);
@kStrongify(loader);
[self.svgaView setImage:image
forKey:key];
[self.imageLoaders removeObject:loader];
}];
[self.imageLoaders addObject:loader];
}
}
@@ -255,7 +272,6 @@ static int const showtime = 3;
- (UIButton *)countdownButton {
if (_countdownButton == nil) {
_countdownButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_countdownButton addTarget:self action:@selector(onClickSkipButton:) forControlEvents:UIControlEventTouchUpInside];
[_countdownButton setTitle:YMLocalizedString(@"XPAdvertiseView1") forState:UIControlStateNormal];

View File

@@ -32,6 +32,8 @@ typedef void(^TTActionSheetClickAction)(void);
/** 点击事件 */
@property (nonatomic, copy) TTActionSheetClickAction clickAction;
@property(nonatomic, assign) BOOL displayMoliCoin;
/**
构建 actionSheet item 实例
@@ -52,6 +54,7 @@ typedef void(^TTActionSheetClickAction)(void);
+ (TTActionSheetConfig *)actionWithTitle:(NSString *)title
color:(UIColor *)textColor
handler:(TTActionSheetClickAction)handler;
@end
NS_ASSUME_NONNULL_END

View File

@@ -45,4 +45,5 @@
return config;
}
@end

View File

@@ -37,6 +37,7 @@ typedef NS_ENUM(NSUInteger, TTAlertActionStyle) {
@property (nonatomic, strong) UIColor *messageColor;
/** 内容的行间距,默认不设置,当值为 0 或负数时无效 */
@property (nonatomic, assign) CGFloat messageLineSpacing;
@property(nonatomic, assign) NSTextAlignment messageTextAlignment;
/** 内容富文本配置 */
@property (nonatomic, strong) NSArray<TTAlertMessageAttributedConfig *> *messageAttributedConfig;
///配置内容的富文本

View File

@@ -44,6 +44,7 @@ static CGFloat kAlertButtonCornerRadius = 8.f;
_messageColor = [DJDKMIMOMColor alertMessageColor];//
_messageLineSpacing = kAlertMessageFontLineSpace;//
_messageAttributedConfig = @[];//
_messageTextAlignment = NSTextAlignmentCenter;
// cancel button
_cancelButtonConfig = [[TTAlertButtonConfig alloc] init];

View File

@@ -62,8 +62,8 @@ static CGFloat const kMaxHeight = 450.f;
// 200 450
if (height < kMixHeight) {
height = kMixHeight;
} else if (height > kMaxHeight) {
height = kMaxHeight;
} else if (height > KScreenHeight - kSafeAreaTopHeight - kSafeAreaBottomHeight) {
height = KScreenHeight - kSafeAreaTopHeight - kSafeAreaBottomHeight;
}
TTAlertView *contentView = [[TTAlertView alloc] initWithFrame:CGRectMake(0, 0, width, height)];
contentView.config = config;

View File

@@ -81,6 +81,30 @@ static NSString *const kSheetViewCellConst = @"kSheetViewCellConst";
cell.textLabel.textAlignment = NSTextAlignmentCenter;
cell.textLabel.text = _items[indexPath.row].title;
cell.textLabel.textColor = _items[indexPath.row].titleColor;
if ([_items[indexPath.row] displayMoliCoin]) {
NSTextAttachment *coinAttachment = [[NSTextAttachment alloc] init];
coinAttachment.image = kImage(@"moli_money_icon");
coinAttachment.bounds = CGRectMake(0, -3.5, 20, 20);
NSAttributedString *coinAttributedString = [NSAttributedString attributedStringWithAttachment:coinAttachment];
NSMutableAttributedString *string = [[NSMutableAttributedString alloc] initWithAttributedString:coinAttributedString];
NSAttributedString *titleAttributedString = [[NSAttributedString alloc] initWithString:_items[indexPath.row].title
attributes:@{
NSForegroundColorAttributeName: _items[indexPath.row].titleColor,
NSFontAttributeName: cell.textLabel.font
}];
[string insertAttributedString:titleAttributedString atIndex:0];
cell.textLabel.attributedText = string.copy;
UIImageView *questionMark = [[UIImageView alloc] initWithImage:kImage(@"question_mark")];
[cell.contentView addSubview:questionMark];
[questionMark mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.mas_equalTo(cell.textLabel);
make.trailing.mas_equalTo(-20);
make.size.mas_equalTo(CGSizeMake(22, 22));
}];
}
return cell;
}

View File

@@ -55,6 +55,7 @@ static CGFloat const kBtnHeight = 38.f;
[self.messageLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.titleLabel.mas_bottom).offset(kMargin);
make.leading.trailing.mas_equalTo(self).inset(kPadding);
make.bottom.mas_equalTo(self).offset(-kBtnHeight * 2);
}];
[self.stackView mas_makeConstraints:^(MASConstraintMaker *make) {
@@ -95,7 +96,7 @@ static CGFloat const kBtnHeight = 38.f;
if (config.messageLineSpacing > 0) { //
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
paragraphStyle.lineSpacing = config.messageLineSpacing;
paragraphStyle.alignment = self.messageLabel.textAlignment;
paragraphStyle.alignment = config.messageTextAlignment;
[attString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, config.message.length)];
}
@@ -178,6 +179,7 @@ static CGFloat const kBtnHeight = 38.f;
_messageLabel.textAlignment = NSTextAlignmentCenter;
} else {
_messageLabel.text = config.message;
_messageLabel.textAlignment = config.messageTextAlignment;
}
_cancelButton.layer.borderColor = [DJDKMIMOMColor dividerColor].CGColor;
@@ -218,6 +220,8 @@ static CGFloat const kBtnHeight = 38.f;
_messageLabel = [[UILabel alloc] init];
_messageLabel.numberOfLines = 0;
_messageLabel.textAlignment = NSTextAlignmentCenter;
_messageLabel.minimumScaleFactor = 0.7;
_messageLabel.adjustsFontSizeToFitWidth = YES;
}
return _messageLabel;
}

View File

@@ -60,4 +60,6 @@ typedef NS_ENUM(NSUInteger, GradientType) {
- (UIImage *)resizeTo:(CGSize)size;
- (UIImage *)imageByApplyingAlpha:(CGFloat)alpha;
@end

View File

@@ -570,4 +570,23 @@
}
return image;
}
- (UIImage *)imageByApplyingAlpha:(CGFloat)alpha {
UIGraphicsBeginImageContextWithOptions(self.size, NO, 0.0f);
CGContextRef ctx = UIGraphicsGetCurrentContext();
CGRect area = CGRectMake(0, 0, self.size.width, self.size.height);
CGContextScaleCTM(ctx, 1, -1);
CGContextTranslateCTM(ctx, 0, -area.size.height);
CGContextSetBlendMode(ctx, kCGBlendModeMultiply);
CGContextSetAlpha(ctx, alpha);
CGContextDrawImage(ctx, area, self.CGImage);
UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return newImage;
}
@end

View File

@@ -109,6 +109,8 @@ typedef NS_ENUM(NSUInteger, URLType) {
KRoomLevelRule,
/// 红包规则说明
KLuckyPackageRule,
/// 人機驗證
kCaptchaSwitchPath,
};
NSString * const URLWithType(URLType type);

View File

@@ -27,6 +27,7 @@ NSString * const URLWithType(URLType type) {
@(KBoomRule) : @"modules/rule/boom.html?partitionId=",///,
@(KRoomLevelRule) : @"modules/roomLevel/index.html",///,
@(KLuckyPackageRule) : @"modules/luckyBagRules/index.html",///,
@(kCaptchaSwitchPath) : @"modules/humanMachineVerification/index.html"
};
NSString * newUrl = [newDic objectForKey:@(type)];
if(newUrl != nil){

View File

@@ -46,7 +46,7 @@ isPhoneXSeries = [[UIApplication sharedApplication] delegate].window.safeAreaIns
#define kFontHeavy(font) [UIFont systemFontOfSize:kGetScaleWidth(font) weight:UIFontWeightHeavy]
///内置版本号
#define PI_App_Version @"1.0.38"
#define PI_App_Version @"1.0.39"
///渠道
#define PI_App_Source @"appstore"
#define PI_Test_Flight @"TestFlight"

View File

@@ -27,22 +27,6 @@
<string>$(MARKETING_VERSION)</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<string>line3rdp.$(PRODUCT_BUNDLE_IDENTIFIER)</string>
</array>
</dict>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<string>fb1266232494209868</string>
</array>
</dict>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
@@ -56,7 +40,7 @@
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<string>pikoapp</string>
<string>molistar</string>
</array>
</dict>
</array>

View File

@@ -1230,7 +1230,7 @@
}
NSMutableArray *indexPathsToReload = [NSMutableArray array];
if (previousIndexPath) {
if (previousIndexPath != nil) {
[indexPathsToReload addObject:previousIndexPath];
}
[indexPathsToReload addObject:indexPath];

View File

@@ -89,6 +89,29 @@ NS_ASSUME_NONNULL_BEGIN
screenUrl:(NSString *)screenUrl
contact:(NSString *)contact;
+ (void)emailGetCode:(HttpRequestHelperCompletion)completion emailAddress:(NSString *)emailAddress type:(NSNumber *)type;
+ (void)emailVerify:(HttpRequestHelperCompletion)completion emailAddress:(NSString *)emailAddress code:(NSString *)code;
+ (void)loginWithCode:(HttpRequestHelperCompletion)completion
email:(NSString *)email
code:(NSString *)code
client_secret:(NSString *)client_secret
version:(NSString *)version
client_id:(NSString *)client_id
grant_type:(NSString *)grant_type;
+ (void)userBoundEmail:(HttpRequestHelperCompletion)completion
email:(NSString *)email
code:(NSString *)code;
+ (void)userBoundPhone:(HttpRequestHelperCompletion)completion
phone:(NSString *)email
code:(NSString *)code
phoneAreaCode:(NSString *)phoneAreaCode;
+ (void)resetPasswordWithEmail:(HttpRequestHelperCompletion)completion email:(NSString *)email newPwd:(NSString *)newPwd code:(NSString *)code;
@end
NS_ASSUME_NONNULL_END

View File

@@ -32,7 +32,7 @@
[self makeRequest:fang method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__,phone,password,client_secret,version, client_id, grant_type, nil];
}
///
///
/// @param completion
/// @param phone
/// @param newPwd
@@ -42,6 +42,10 @@
[self makeRequest:fang method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__, phone, newPwd, smsCode,phoneAreaCode, nil];
}
+ (void)resetPasswordWithEmail:(HttpRequestHelperCompletion)completion email:(NSString *)email newPwd:(NSString *)newPwd code:(NSString *)code{
[self makeRequest:@"acc/pwd/resetByEmail" method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__, email, newPwd, code, nil];
}
///
/// @param completion
@@ -100,4 +104,46 @@
completion:completion, __FUNCTION__, type, desc, screenUrl, contact, nil];
}
+ (void)emailGetCode:(HttpRequestHelperCompletion)completion emailAddress:(NSString *)emailAddress type:(NSNumber *)type {
[self makeRequest:@"email/getCode"
method:HttpRequestHelperMethodPOST
completion:completion, __FUNCTION__, emailAddress, type, nil];
}
+ (void)emailVerify:(HttpRequestHelperCompletion)completion emailAddress:(NSString *)emailAddress code:(NSString *)code {
[self makeRequest:@"email/verify"
method:HttpRequestHelperMethodPOST
completion:completion, __FUNCTION__, emailAddress, code, nil];
}
+ (void)loginWithCode:(HttpRequestHelperCompletion)completion
email:(NSString *)email
code:(NSString *)code
client_secret:(NSString *)client_secret
version:(NSString *)version
client_id:(NSString *)client_id
grant_type:(NSString *)grant_type {
NSString * fang = [NSString stringFromBase64String:@"b2F1dGgvdG9rZW4="];///oauth/token
[self makeRequest:fang method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__,email,code,client_secret,version, client_id, grant_type, nil];
}
+ (void)userBoundEmail:(HttpRequestHelperCompletion)completion
email:(NSString *)email
code:(NSString *)code {
[self makeRequest:@"user/boundEmail"
method:HttpRequestHelperMethodPOST
completion:completion, __FUNCTION__, email, code, nil];
}
+ (void)userBoundPhone:(HttpRequestHelperCompletion)completion
phone:(NSString *)email
code:(NSString *)code
phoneAreaCode:(NSString *)phoneAreaCode {
[self makeRequest:@"user/boundPhone"
method:HttpRequestHelperMethodPOST
completion:completion, __FUNCTION__, email, code, nil];
}
@end

View File

@@ -20,6 +20,7 @@
#import "XPLoginAuthCodeVC.h"
@implementation PILoginManager
+(void)loginWithVC:(MvpViewController *)VC isLoginPhone:(BOOL)isLoginPhone{
[XNDJTDDLoadingTool showLoading];
AccountModel *accountModel = [[AccountInfoStorage instance] getCurrentAccountInfo];
HomeUserModel *homeUserModel = [HomeUserModel new];
if (accountModel == nil || accountModel.uid == nil || accountModel.access_token == nil) {

View File

@@ -55,6 +55,18 @@ NS_ASSUME_NONNULL_BEGIN
photoURLString:(nullable NSString *)photoURLString
contact:(nullable NSString *)contact;
- (void)sendMailVerificationCode:(NSString *)emailAddress type:(NSInteger)type;
- (void)loginWithEmail:(NSString *)email code:(NSString *)code;
- (void)bindingNewEmail:(NSString *)email code:(NSString *)code;
- (void)bindingNewPhone:(NSString *)phone code:(NSString *)code areaCode:(NSString *)areaCode;
- (void)resetEmailPassword:(NSString *)email code:(NSString *)code newPassword:(NSString *)newPwd;
- (void)resetPhonePassword:(NSString *)phone code:(NSString *)code newPassword:(NSString *)newPwd areaCode:(NSString *)areaCode;
- (void)checkEmailCode:(NSString *)email code:(NSString *)code;
- (void)checkPhoneCode:(NSString *)phone code:(NSString *)code areaCode:(NSString *)areaCode;
@end
NS_ASSUME_NONNULL_END

View File

@@ -25,6 +25,8 @@
#import "YuMi-swift.h"
#import "FeedBackConfigModel.h"
static NSString *clinet_s = @"uyzjdhds";
@implementation LoginPresenter
- (void)dealloc{
[[NSNotificationCenter defaultCenter]removeObserver:self];
@@ -136,8 +138,6 @@
if (model != nil) {
[[AccountInfoStorage instance] saveAccountInfo:model];
[XNDJTDDLoadingTool hideOnlyView:kWindow];
[[NSUserDefaults standardUserDefaults]setValue:@(type) forKey:@"kLoginSuccessType"];
[[NSUserDefaults standardUserDefaults]synchronize];
[[self getView] loginThirdPartSuccess];
}
} fail:^(NSInteger code, NSString * _Nullable msg) {
@@ -224,8 +224,6 @@
AccountModel * model = [AccountModel modelWithDictionary:data.data];
if (model != nil) {
[[AccountInfoStorage instance] saveAccountInfo:model];
[[NSUserDefaults standardUserDefaults]setValue:@(ThirdLoginType_Gmail) forKey:@"kLoginSuccessType"];
[[NSUserDefaults standardUserDefaults]synchronize];
[[self getView] loginThirdPartSuccess];
}
}fail:^(NSInteger code, NSString * _Nullable msg) {
@@ -247,9 +245,17 @@
- (void)phoneSmsCode:(NSString *)phone type:(GetSmsType)type phoneAreaCode:(NSString *)phoneAreaCode {
NSString * desPhone = [DESEncrypt encryptUseDES:phone key:KeyWithType(KeyType_PasswordEncode)];
@kWeakify(self);
[Api phoneSmsCode:[self createHttpCompletion:^(id _Nonnull data) {
[Api phoneSmsCode:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
@kStrongify(self);
[[self getView] phoneSmsCodeSuccess];
if ([[self getView] respondsToSelector:@selector(phoneSmsCodeSuccess:type:)]) {
NSString *message = data.message;
[[self getView] phoneSmsCodeSuccess:message type:type];
}
} fail:^(NSInteger code, NSString * _Nullable msg) {
@kStrongify(self);
if ([[self getView] respondsToSelector:@selector(phoneSmsCodeFailure)]) {
[[self getView] phoneSmsCodeFailure];
}
} showLoading:YES errorToast:YES] mobile:desPhone type:[NSString stringWithFormat:@"%lu", (unsigned long)type] phoneAreaCode:phoneAreaCode];
}
@@ -269,7 +275,7 @@
} fail:^(NSInteger code, NSString * _Nullable msg) {
@kStrongify(self);
[[self getView] loginFailWithMsg:msg];
} errorToast:NO] phone:desPhone code:code client_secret:@"uyzjdhds" version:@"1" client_id:@"erban-client" grant_type:@"password" phoneAreaCode:phoneAreaCode];
} errorToast:NO] phone:desPhone code:code client_secret:clinet_s version:@"1" client_id:@"erban-client" grant_type:@"password" phoneAreaCode:phoneAreaCode];
}
/// 使
/// @param phone
@@ -288,7 +294,7 @@
} fail:^(NSInteger code, NSString * _Nullable msg) {
@kStrongify(self);
[[self getView] loginFailWithMsg:msg];
} errorToast:YES] phone:desPhone password:desPassword client_secret:@"uyzjdhds" version:@"1" client_id:@"erban-client" grant_type:@"password"];
} showLoading:YES errorToast:YES] phone:desPhone password:desPassword client_secret:clinet_s version:@"1" client_id:@"erban-client" grant_type:@"password"];
}
///
@@ -332,4 +338,125 @@
}
- (void)sendMailVerificationCode:(NSString *)emailAddress type:(NSInteger)type {
NSString * desEmail = [DESEncrypt encryptUseDES:emailAddress key:KeyWithType(KeyType_PasswordEncode)];
@kWeakify(self);
[Api emailGetCode:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
@kStrongify(self);
if ([[self getView] respondsToSelector:@selector(emailCodeSucess:type:)]) {
[[self getView] emailCodeSucess:@"" type:type];
}
} fail:^(NSInteger code, NSString * _Nullable msg) {
@kStrongify(self);
if ([[self getView] respondsToSelector:@selector(emailCodeFailure)]) {
[[self getView] emailCodeFailure];
}
} showLoading:YES errorToast:YES]
emailAddress:desEmail type:@(type)];
}
- (void)loginWithEmail:(NSString *)email code:(NSString *)code {
NSString * desMail = [DESEncrypt encryptUseDES:email key:KeyWithType(KeyType_PasswordEncode)];
@kWeakify(self);
[Api loginWithCode:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
@kStrongify(self);
AccountModel * accountModel = [AccountModel modelWithDictionary:data.data];
if (accountModel && accountModel.access_token.length > 0) {
[[AccountInfoStorage instance] saveAccountInfo:accountModel];
}
if ([[self getView] respondsToSelector:@selector(loginSuccess)]) {
[[self getView] loginSuccess];
}
} fail:^(NSInteger code, NSString * _Nullable msg) {
@kStrongify(self);
[[self getView] loginFailWithMsg:msg];
} errorToast:NO]
email:desMail
code:code
client_secret:clinet_s
version:@"1"
client_id:@"erban-client"
grant_type:@"email"];
}
- (void)bindingNewEmail:(NSString *)email code:(NSString *)code {
NSString *desMail = [DESEncrypt encryptUseDES:email key:KeyWithType(KeyType_PasswordEncode)];
@kWeakify(self);
[Api userBoundEmail:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
@kStrongify(self);
if ([[self getView] respondsToSelector:@selector(bindingNewEmailSuccess:)]) {
[[self getView] bindingNewEmailSuccess:@""];
}
} fail:^(NSInteger code, NSString * _Nullable msg) {
@kStrongify(self);
if ([[self getView] respondsToSelector:@selector(bindingNewEmailFailure:)]) {
[[self getView] bindingNewEmailFailure:msg];
}
} showLoading:YES errorToast:NO] email:desMail code:code];
}
- (void)bindingNewPhone:(NSString *)phone code:(NSString *)code areaCode:(NSString *)areaCode {
NSString * desPhone = [DESEncrypt encryptUseDES:phone key:KeyWithType(KeyType_PasswordEncode)];
@kWeakify(self);
[Api userBoundPhone:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
@kStrongify(self);
if ([[self getView] respondsToSelector:@selector(bindingNewPhoneSuccess:)]) {
[[self getView] bindingNewPhoneSuccess:@""];
}
} fail:^(NSInteger code, NSString * _Nullable msg) {
@kStrongify(self);
if ([[self getView] respondsToSelector:@selector(bindingNewPhoneFailure:)]) {
[[self getView] bindingNewPhoneFailure:msg];
}
} showLoading:YES errorToast:YES] phone:desPhone code:code phoneAreaCode:areaCode];
}
- (void)resetEmailPassword:(NSString *)email code:(NSString *)code newPassword:(NSString *)newPwd {
NSString *desMail = [DESEncrypt encryptUseDES:email key:KeyWithType(KeyType_PasswordEncode)];
NSString *desPassword = [DESEncrypt encryptUseDES:newPwd key:KeyWithType(KeyType_PasswordEncode)];
@kWeakify(self);
[Api resetPasswordWithEmail:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
@kStrongify(self);
if ([[self getView] respondsToSelector:@selector(resetEmailPasswordSuccess)]) {
[[self getView] resetEmailPasswordSuccess];
}
} fail:^(NSInteger code, NSString * _Nullable msg) {
} showLoading:YES errorToast:YES] email:desMail newPwd:desPassword code:code];
}
- (void)resetPhonePassword:(NSString *)phone code:(NSString *)code newPassword:(NSString *)newPwd areaCode:(NSString *)areaCode {
NSString * desPhone = [DESEncrypt encryptUseDES:phone key:KeyWithType(KeyType_PasswordEncode)];
NSString *desPassword = [DESEncrypt encryptUseDES:newPwd key:KeyWithType(KeyType_PasswordEncode)];
@kWeakify(self);
[Api resetPasswordWithPhone:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
@kStrongify(self);
if ([[self getView] respondsToSelector:@selector(resetPhonePasswordSuccess)]) {
[[self getView] resetPhonePasswordSuccess];
}
} fail:^(NSInteger code, NSString * _Nullable msg) {
} showLoading:YES errorToast:YES] phone:desPhone newPwd:desPassword smsCode:code phoneAreaCode:areaCode];
}
- (void)checkEmailCode:(NSString *)email code:(NSString *)code {
NSString *desMail = [DESEncrypt encryptUseDES:email key:KeyWithType(KeyType_PasswordEncode)];
[Api emailVerify:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
[[self getView] checkEmailSuccess];
} fail:^(NSInteger code, NSString * _Nullable msg) {
} showLoading:YES errorToast:YES] emailAddress:desMail code:code];
}
- (void)checkPhoneCode:(NSString *)phone code:(NSString *)code areaCode:(NSString *)areaCode {
NSString * desPhone = [DESEncrypt encryptUseDES:phone key:KeyWithType(KeyType_PasswordEncode)];
NSString * uid = [[AccountInfoStorage instance] getUid];
NSString * ticket = [[AccountInfoStorage instance] getTicket];
[Api checkMoblieCode:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
[[self getView] checkPhoneSuccess];
} fail:^(NSInteger code, NSString * _Nullable msg) {
} showLoading:YES errorToast:YES] mobile:desPhone code:desPhone uid:uid ticket:ticket phoneAreaCode:areaCode];
}
@end

View File

@@ -10,15 +10,33 @@
NS_ASSUME_NONNULL_BEGIN
@protocol LoginProtocol <NSObject>
@optional
- (void)loginThirdPartSuccess;
- (void)loginSuccess;
- (void)emailCodeSucess:(NSString *)message type:(GetSmsType)type;
- (void)emailCodeFailure;
///请求手机号的验证码成功
- (void)phoneSmsCodeSuccess;
- (void)phoneSmsCodeSuccess:(NSString *)message type:(GetSmsType)type;
- (void)phoneSmsCodeFailure;
///手机号登录成功
- (void)loginWithPhoenSuccess;
- (void)loginWithEmailSuccess;
///登录失败
- (void)loginFailWithMsg:(NSString *)msg;
- (void)bindingNewEmailSuccess:(NSString *)message;
- (void)bindingNewEmailFailure:(NSString *)message;
- (void)bindingNewPhoneSuccess:(NSString *)message;
- (void)bindingNewPhoneFailure:(NSString *)message;
- (void)resetEmailPasswordSuccess;
- (void)resetPhonePasswordSuccess;
- (void)checkEmailSuccess;
- (void)checkPhoneSuccess;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,27 @@
//
// AccountBindingViewController.h
// YuMi
//
// Created by P on 2025/3/14.
//
#import "MvpViewController.h"
@class UserInfoModel;
NS_ASSUME_NONNULL_BEGIN
typedef NS_ENUM(NSUInteger, BindingDisplayType) {
BindingDisplayType_email,
BindingDisplayType_phoneNum,
};
@interface AccountBindingViewController : MvpViewController
- (instancetype)initWithType:(BindingDisplayType)type
currentBindingAccount:(NSString *)account
areaCode:(NSString *)areaCode
userInfo:(UserInfoModel *)userInfo;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,444 @@
//
// AccountBindingViewController.m
// YuMi
//
// Created by P on 2025/3/14.
//
#import "AccountBindingViewController.h"
#import "LoginProtocol.h"
#import "LoginPresenter.h"
#import "LoginInputItemView.h"
#import "XPLoginAraeViewController.h"
#import "XPLoginVerifBindPhonePresenter.h"
#import "UserInfoModel.h"
#import "XPMineSettingViewController.h"
#import "XPWebViewController.h"
@interface AccountBindingViewController () <XPLoginAraeViewControllerDelegate, LoginProtocol, XPLoginAraeViewControllerDelegate>
@property(nonatomic, assign) BindingDisplayType type;
@property(nonatomic, copy) NSString *currentAccount;
@property(nonatomic, copy) NSString *currentAreaCode;
@property(nonatomic, strong) UILabel *currentAccountLabel;
@property(nonatomic, strong) UIStackView *stackView;
@property(nonatomic, strong) LoginInputItemView *firstLineInputView;
@property(nonatomic, strong) LoginInputItemView *secondLineInputView;
@property(nonatomic, strong) UIButton *bottomActionButton;
@property(nonatomic, strong) UserInfoModel *userInfo;
@property(nonatomic, strong) XPWebViewController *webVC;
@end
@implementation AccountBindingViewController
- (LoginPresenter *)createPresenter {
return [[LoginPresenter alloc] init];
}
- (instancetype)initWithType:(BindingDisplayType)type
currentBindingAccount:(NSString *)account
areaCode:(NSString *)areaCode
userInfo:(UserInfoModel *)userInfo {
if (self = [super init]) {
self.type = type;
self.currentAccount = account;
self.currentAreaCode = areaCode;
self.userInfo = userInfo;
}
return self;
}
- (void)viewDidLoad {
[super viewDidLoad];
[self setupUI];
}
- (void)setupUI {
[self setupDefaultUI];
if ([NSString isEmpty:self.currentAccount]) {
[self setupNewBindingUI];
} else {
[self setupUpdateBindingUI];
}
}
- (void)setupDefaultUI {
self.view.backgroundColor = [UIColor whiteColor];
self.title = [self displayTitle];
}
- (void)setupNewBindingUI {
[self displayInputArea:25
topView:self.view
isBottom:NO];
}
- (void)setupUpdateBindingUI {
UIImageView *topImageView = [self topImageView];
[self.view addSubview:topImageView];
[topImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.view).offset(16);
make.centerX.mas_equalTo(self.view);
make.size.mas_equalTo(CGSizeMake(170, 170));
}];
UILabel *descLabel = [self descriptionLabel];
[self.view addSubview:descLabel];
[descLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(topImageView.mas_bottom).offset(14);
make.leading.trailing.mas_equalTo(self.view).inset(40);
}];
[self.view addSubview:self.currentAccountLabel];
[self.currentAccountLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(descLabel.mas_bottom).offset(9);
make.centerX.mas_equalTo(self.view);
}];
self.currentAccountLabel.text = self.currentAccount;
[self displayInputArea:25
topView:self.currentAccountLabel
isBottom:YES];
}
#pragma mark -
- (NSString *)displayTitle {
if ([NSString isEmpty:self.currentAccount]) {
if (self.type == BindingDisplayType_email) {
return YMLocalizedString(@"20.20.51_text_13");
} else {
return YMLocalizedString(@"20.20.51_text_14");
}
} else {
return YMLocalizedString(@"20.20.51_text_15");
}
}
- (void)displayInputArea:(NSInteger)topSpace
topView:(UIView *)topView
isBottom:(BOOL)isBottom {
[self.view addSubview:self.stackView];
[self.stackView mas_makeConstraints:^(MASConstraintMaker *make) {
if (isBottom) {
make.top.mas_equalTo(topView.mas_bottom).offset(topSpace);
} else {
make.top.mas_equalTo(topView).offset(topSpace);
}
make.leading.trailing.mas_equalTo(self.view).inset(40);
}];
@kWeakify(self);
if ([NSString isEmpty:self.currentAccount]) {
if (self.type == BindingDisplayType_email) {
self.firstLineInputView = [[LoginInputItemView alloc] initWithType:LoginInputType_email];
} else {
self.firstLineInputView = [[LoginInputItemView alloc] initWithType:LoginInputType_phoneNum];
}
[self.firstLineInputView updateBGColor:UIColorFromRGB(0xf2f3f7)];
[self.firstLineInputView setHandleItemAction:^(LoginInputType inputType) {
@kStrongify(self);
if (inputType == LoginInputType_phoneNum) {
[self handleTapAreaCode];
}
}];
[self.firstLineInputView setHandleFirstInputContentUpdate:^(NSString *inputContent) {
@kStrongify(self);
[self checkActionButtonStatus];
}];
[self.stackView addArrangedSubview:self.firstLineInputView];
}
self.secondLineInputView = [[LoginInputItemView alloc] initWithType:LoginInputType_verificationCode];
[self.secondLineInputView updateBGColor:UIColorFromRGB(0xf2f3f7)];
[self.secondLineInputView setHandleItemAction:^(LoginInputType inputType) {
@kStrongify(self);
if (inputType == LoginInputType_verificationCode) {
if (self.type == BindingDisplayType_phoneNum) {
[self handleTapGetPhoneVerificationCode];
} else if (self.type == BindingDisplayType_email) {
[self handleTapGetMailVerificationCode];
}
}
}];
[self.secondLineInputView setHandleSecondInputContentUpdate:^(NSString *inputContent) {
@kStrongify(self);
[self checkActionButtonStatus];
}];
[self.stackView addArrangedSubview:self.secondLineInputView];
[self.stackView addArrangedSubview:self.bottomActionButton];
[self.firstLineInputView mas_makeConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(46);
}];
[self.secondLineInputView mas_makeConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(46);
}];
[self.bottomActionButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(46);
}];
}
#pragma mark -
- (void)handleTapGetPhoneVerificationCode {
NSString *phone = @"";
NSString *areaCode = @"";
if ([NSString isEmpty:self.currentAccount]) {
phone = [self.firstLineInputView inputContent];
areaCode = [self.firstLineInputView loadAreaCode];
} else {
phone = self.currentAccount;
areaCode = self.currentAreaCode;
}
if (phone.length == 0 ) {
[self showErrorToast:YMLocalizedString(@"XPLoginPhoneViewController0")];
[self.secondLineInputView endVerificationCountDown];
return;
}
@kWeakify(self);
[self loadCaptchaWebView:^{
@kStrongify(self);
[self.presenter phoneSmsCode:[NSString stringWithFormat:@"%@%@", areaCode,phone]
type:[NSString isEmpty:self.currentAccount] ? GetSmsType_Regist : GetSmsType_Unbind_Phone
phoneAreaCode:areaCode];
}];
}
- (void)handleTapGetMailVerificationCode {
NSString *email = @"";
if (![NSString isEmpty:self.currentAccount]) {
email = self.currentAccount;
} else {
email = [self.firstLineInputView inputContent];
}
if (email.length == 0 ) {
// [self showErrorToast:YMLocalizedString(@"20.20.51_text_12")];
[self.secondLineInputView endVerificationCountDown];
return;
}
[self.presenter sendMailVerificationCode:email
type:[NSString isEmpty:self.currentAccount] ? GetSmsType_Regist : GetSmsType_Unbind_Phone];
}
#pragma mark -
- (void)didTapActionButton {
[self.view endEditing:true];
if (self.type == BindingDisplayType_email) {
if ([NSString isEmpty:self.currentAccount]) {
[self.presenter bindingNewEmail:[self.firstLineInputView inputContent]
code:[self.secondLineInputView inputContent]];
} else {
[self.presenter checkEmailCode:self.currentAccount
code:[self.secondLineInputView inputContent]];
}
} else {
if ([NSString isEmpty:self.currentAccount]) {
[self.presenter bindingNewPhone:[self.firstLineInputView inputContent]
code:[self.secondLineInputView inputContent]
areaCode:[self.firstLineInputView loadAreaCode]];
} else {
[self.presenter checkPhoneCode:self.currentAccount
code:[self.secondLineInputView inputContent]
areaCode:self.userInfo.phoneAreaCode];
}
}
}
- (void)handleTapAreaCode {
XPLoginAraeViewController *codeVC = [XPLoginAraeViewController new];
codeVC.delegate = self;
[self.navigationController pushViewController:codeVC animated:YES];
}
- (void)checkActionButtonStatus {
NSString *accountString = [self.firstLineInputView inputContent];
NSString *codeString = [self.secondLineInputView inputContent];
if ([NSString isEmpty:self.currentAccount]) {
if (![NSString isEmpty:accountString] && ![NSString isEmpty:codeString]) {
self.bottomActionButton.enabled = YES;
} else {
self.bottomActionButton.enabled = NO;
}
} else {
if (![NSString isEmpty:codeString]) {
self.bottomActionButton.enabled = YES;
} else {
self.bottomActionButton.enabled = NO;
}
}
}
- (void)loadCaptchaWebView:(void(^)(void))finishBlock {
if ([ClientConfig.shareConfig shouldDisplayCaptcha]) {
[self.view endEditing:YES];
XPWebViewController * webVC =[[XPWebViewController alloc] initWithRoomUID:nil];
webVC.view.frame = CGRectMake(0, 0, KScreenWidth*0.8, KScreenWidth*1.2);
webVC.view.backgroundColor = [UIColor clearColor];
[webVC.view setCornerRadius:12];
webVC.isLoginStatus = NO;
webVC.isPush = NO;
[webVC hideNavigationBar];
webVC.url = URLWithType(kCaptchaSwitchPath);
[webVC setVerifyCaptcha:^(BOOL result) {
if (result == NO) {
return;
}
if (result && finishBlock) {
[TTPopup dismiss];
finishBlock();
}
}];
[TTPopup popupView:webVC.view style:TTPopupStyleAlert];
self.webVC = webVC;
}
}
#pragma mark - API presenter Delegate
- (void)phoneSmsCodeSuccess:(NSString *)message type:(GetSmsType)type{
if (type == GetSmsType_Unbind_Phone) {
XPLoginVerifBindPhonePresenter *presenter = [[XPLoginVerifBindPhonePresenter alloc] init];
[presenter checkMoblieCodeWithMoblie:self.currentAccount
code:[self.secondLineInputView inputContent]
phoneAreaCode:self.userInfo.phoneAreaCode];
} else {
[self showSuccessToast:YMLocalizedString(@"XPLoginPhoneViewController2")];
[self.secondLineInputView startVerificationCountDown];
[self.secondLineInputView displayKeyboard];
}
}
- (void)phoneSmsCodeFailure {
[self.secondLineInputView endVerificationCountDown];
}
- (void)emailCodeSucess:(NSString *)message type:(GetSmsType)type{
[self showSuccessToast:YMLocalizedString(@"XPLoginPhoneViewController2")];
[self.secondLineInputView startVerificationCountDown];
[self.secondLineInputView displayKeyboard];
}
- (void)emailCodeFailure {
[self.secondLineInputView endVerificationCountDown];
[self.navigationController popViewControllerAnimated:YES];
}
- (void)bindingNewEmailSuccess:(NSString *)message {
[self showSuccessToast:YMLocalizedString(@"XPLoginBindSuccessView0")];
for (UIViewController *VC in self.navigationController.viewControllers) {
if ([VC isKindOfClass:[XPMineSettingViewController class]]) {
[self.navigationController popToViewController:VC animated:YES];
return;
}
}
}
- (void)bindingNewEmailFailure:(NSString *)message {
[self showSuccessToast:message];
}
- (void)chooseAreaCodeSuccess:(NSString *)code {
[self.firstLineInputView updateAreaCode:code];
}
- (void)checkEmailSuccess {
AccountBindingViewController *vc = [[AccountBindingViewController alloc] initWithType:self.type
currentBindingAccount:@""
areaCode:@""
userInfo:self.userInfo];
[self.navigationController pushViewController:vc animated:YES];
}
- (void)checkPhoneSuccess {
AccountBindingViewController *vc = [[AccountBindingViewController alloc] initWithType:self.type
currentBindingAccount:@""
areaCode:@""
userInfo:self.userInfo];
[self.navigationController pushViewController:vc animated:YES];
}
- (void)bindingNewPhoneSuccess:(NSString *)message {
[self showSuccessToast:YMLocalizedString(@"XPLoginBindSuccessView0")];
for (UIViewController *VC in self.navigationController.viewControllers) {
if ([VC isKindOfClass:[XPMineSettingViewController class]]) {
[self.navigationController popToViewController:VC animated:YES];
return;
}
}
}
- (void)bindingNewPhoneFailure:(NSString *)message {
[self showSuccessToast:message];
}
#pragma mark -
- (UIStackView *)stackView {
if (!_stackView) {
_stackView = [[UIStackView alloc] init];
_stackView.axis = UILayoutConstraintAxisVertical;
_stackView.spacing = 24;
_stackView.distribution = UIStackViewDistributionFillEqually;
}
return _stackView;
}
- (UIButton *)bottomActionButton {
if (!_bottomActionButton) {
_bottomActionButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_bottomActionButton setCornerRadius:23];
[_bottomActionButton setTitle:YMLocalizedString(@"XPAnchorAudienceUpMicView2") forState:UIControlStateNormal];
[_bottomActionButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
UIImage *normalBG = [UIImage gradientColorImageFromColors:@[
UIColorFromRGB(0xe29030),
UIColorFromRGB(0xfcc074)
]
gradientType:GradientTypeLeftToRight
imgSize:CGSizeMake(KScreenWidth-84, 46)] ;
UIImage *disableBG = [UIImage gradientColorImageFromColors:@[
[UIColor colorWithRed:245/255.0 green:199/255.0 blue:129/255.0 alpha:1],
[UIColor colorWithRed:253/255.0 green:217/255.0 blue:154/255.0 alpha:1],
]
gradientType:GradientTypeLeftToRight
imgSize:CGSizeMake(KScreenWidth-84, 46)] ;
[_bottomActionButton setBackgroundImage:normalBG forState:UIControlStateNormal];
[_bottomActionButton setBackgroundImage:disableBG forState:UIControlStateDisabled];
[_bottomActionButton addTarget:self
action:@selector(didTapActionButton)
forControlEvents:UIControlEventTouchUpInside];
_bottomActionButton.enabled = NO;
}
return _bottomActionButton;
}
- (UIImageView *)topImageView {
UIImageView *imageView = [[UIImageView alloc] initWithImage:kImage(@"binding_page_top")];
imageView.contentMode = UIViewContentModeScaleAspectFit;
return imageView;
}
- (UILabel *)descriptionLabel {
UILabel *label = [UILabel labelInitWithText:YMLocalizedString(@"20.20.51_text_16")
font:kFontRegular(14)
textColor:UIColorFromRGB(0xafb1b3)];
label.textAlignment = NSTextAlignmentCenter;
label.numberOfLines = 0;
return label;
}
- (UILabel *)currentAccountLabel {
if (!_currentAccountLabel) {
_currentAccountLabel = [UILabel labelInitWithText:@""
font:kFontMedium(16)
textColor:UIColorFromRGB(0x313131)];
_currentAccountLabel.textAlignment = NSTextAlignmentCenter;
}
return _currentAccountLabel;
}
@end

View File

@@ -0,0 +1,48 @@
//
// LoginInputItemView.h
// YuMi
//
// Created by P on 2025/3/14.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
typedef NS_ENUM(NSUInteger, LoginInputType) {
LoginInputType_id,
LoginInputType_email,
LoginInputType_phoneNum,
LoginInputType_password,
LoginInputType_createPassword,
LoginInputType_verificationCode,
LoginInputType_confirmPassword,
LoginInputType_forgetPassword,
LoginInputType_login,
LoginInputType_confirm,
LoginInputType_none
};
@interface LoginInputItemView : UIView
@property(nonatomic, copy) void(^handleItemAction)(LoginInputType inputType);
@property(nonatomic, copy) void(^handleFirstInputContentUpdate)(NSString *inputContent);
@property(nonatomic, copy) void(^handleSecondInputContentUpdate)(NSString *inputContent);
@property(nonatomic, copy) void(^handleThirdInputContentUpdate)(NSString *inputContent);
- (instancetype)initWithType:(LoginInputType)type;
- (NSString *)inputContent;
- (void)updateAreaCode:(NSString *)code;
- (NSString *)loadAreaCode;
- (void)startVerificationCountDown;
- (void)endVerificationCountDown;
- (void)updateBGColor:(UIColor *)color;
- (void)displayKeyboard;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,359 @@
//
// LoginInputItemView.m
// YuMi
//
// Created by P on 2025/3/14.
//
#import "LoginInputItemView.h"
static NSString *const kAreaCodePrefix = @"+";
@interface LoginInputItemView() <UITextFieldDelegate>
@property(nonatomic, copy) NSString *placeholderText;
@property(nonatomic, assign) LoginInputType inputType;
@property(nonatomic, strong) UITextField *inputTextField;
@property(nonatomic, strong) UIButton *rightActionButton;
@property(nonatomic, strong) UIButton *areaCodeButton;
@property(nonatomic, strong) UILabel *areaLabel;
@property(nonatomic, strong) UIButton *verificationCodeButton;
@property(nonatomic, assign) NSInteger verificationCountDown;
@property(nonatomic, strong) NSTimer *verificationTimer;
@end
@implementation LoginInputItemView
- (void)deallo {
_verificationTimer = nil;
}
- (instancetype)initWithType:(LoginInputType)type {
if (self = [super init]) {
self.backgroundColor = [UIColor whiteColor];
[self setCornerRadius:23];
[self addSubview:self.inputTextField];
self.inputType = type;
}
return self;
}
- (void)setInputType:(LoginInputType)inputType {
_inputType = inputType;
switch (inputType) {
case LoginInputType_id: {
[self updatePlaceholder:YMLocalizedString(@"20.20.51_text_3")];
self.inputTextField.keyboardType = UIKeyboardTypeNumberPad;
}
break;
case LoginInputType_email: {
[self updatePlaceholder:YMLocalizedString(@"20.20.51_text_4")];
self.inputTextField.keyboardType = UIKeyboardTypeEmailAddress;
}
break;
case LoginInputType_phoneNum: {
[self updatePlaceholder:YMLocalizedString(@"XPMineResetLoginPwdViewController1")];
self.inputTextField.keyboardType = UIKeyboardTypePhonePad;
}
break;
case LoginInputType_password: {
[self updatePlaceholder:YMLocalizedString(@"XPLoginPwdViewController3")];
self.inputTextField.keyboardType = UIKeyboardTypeDefault;
self.inputTextField.secureTextEntry = YES;
}
break;
case LoginInputType_createPassword:
[self updatePlaceholder:YMLocalizedString(@"20.20.51_text_11")];
self.inputTextField.keyboardType = UIKeyboardTypeDefault;
self.inputTextField.secureTextEntry = YES;
break;
case LoginInputType_verificationCode: {
[self updatePlaceholder:YMLocalizedString(@"20.20.51_text_7")];
self.inputTextField.keyboardType = UIKeyboardTypeDefault;
}
break;
case LoginInputType_confirmPassword: {
[self updatePlaceholder:YMLocalizedString(@"20.20.51_text_11")];
self.inputTextField.keyboardType = UIKeyboardTypeDefault;
}
break;
default:
break;
}
[self updateInputLayout];
}
- (void)updatePlaceholder:(NSString *)placeholder {
self.inputTextField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:placeholder attributes:@{
NSFontAttributeName: kFontRegular(14),
NSForegroundColorAttributeName: UIColorFromRGB(0xafb1b3)
}];
}
- (void)updateInputLayout {
switch (self.inputType) {
case LoginInputType_id:
case LoginInputType_email:
case LoginInputType_createPassword:
case LoginInputType_confirmPassword:
{
[self.inputTextField mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(self).insets(UIEdgeInsetsMake(12, 20, 12, 20));
}];
}
break;
case LoginInputType_password: {
[self insertRightActionButton];
[self.inputTextField mas_makeConstraints:^(MASConstraintMaker *make) {
make.leading.mas_equalTo(self).offset(20);
make.bottom.top.mas_equalTo(self).inset(12);
make.trailing
.mas_equalTo(self.rightActionButton.mas_leading)
.offset(-20);
}];
}
break;
case LoginInputType_phoneNum: {
[self insertAreaCodeButton];
[self.inputTextField mas_makeConstraints:^(MASConstraintMaker *make) {
make.leading.mas_equalTo(self.areaCodeButton.mas_trailing).offset(8);
make.bottom.top.mas_equalTo(self).inset(12);
make.trailing.mas_equalTo(self).offset(-12);
}];
}
break;
case LoginInputType_verificationCode: {
[self insertVerificationCodeButton];
[self.inputTextField mas_makeConstraints:^(MASConstraintMaker *make) {
make.leading.mas_equalTo(self).offset(20);
make.bottom.top.mas_equalTo(self).inset(12);
make.trailing
.mas_equalTo(self.verificationCodeButton.mas_leading)
.offset(-20);
}];
}
break;
default:
break;
}
}
- (void)insertAreaCodeButton {
[self addSubview:self.areaCodeButton];
[self.areaCodeButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.mas_equalTo(self);
make.leading.mas_equalTo(13);
make.height.mas_equalTo(20);
make.width.mas_equalTo(60);
}];
UIImageView *image = [[UIImageView alloc] initWithImage:kImage(@"login_page_area_arrow")];
image.contentMode = UIViewContentModeScaleAspectFit;
[self.areaCodeButton addSubview:image];
[self.areaCodeButton addSubview:self.areaLabel];
[self.areaLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.mas_equalTo(self.areaCodeButton);
make.leading.mas_equalTo(self.areaCodeButton);
make.height.mas_equalTo(20);
}];
[image mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.mas_equalTo(self.areaCodeButton);
make.leading.mas_equalTo(self.areaLabel.mas_trailing).offset(4);
make.size.mas_equalTo(CGSizeMake(10, 5));
}];
}
- (void)insertVerificationCodeButton {
[self addSubview:self.verificationCodeButton];
[self.verificationCodeButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.mas_equalTo(self);
make.trailing.mas_equalTo(-23);
make.height.mas_equalTo(20);
if (isMSRTL()) {
make.width.mas_equalTo(80);
} else {
make.width.mas_equalTo(60);
}
}];
}
- (void)insertRightActionButton {
[self addSubview:self.rightActionButton];
[self.rightActionButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.mas_equalTo(self);
make.trailing.mas_equalTo(-20);
make.height.mas_equalTo(24);
make.width.mas_equalTo(24);
}];
}
- (NSString *)inputContent {
return self.inputTextField.text;
}
- (void)updateAreaCode:(NSString *)code {
self.areaLabel.text = [NSString stringWithFormat:@"%@%@", kAreaCodePrefix, code];
// if (_areaCodeButton) {
// [self.areaCodeButton setTitle:[NSString stringWithFormat:@"%@%@", kAreaCodePrefix, code]
// forState:UIControlStateNormal];
// }
}
- (NSString *)loadAreaCode {
NSString *code = [self.areaLabel text];
if ([code hasPrefix:kAreaCodePrefix]) {
[code stringByReplacingOccurrencesOfString:kAreaCodePrefix
withString:@""];
}
return code;
}
- (void)startVerificationCountDown {
self.verificationCountDown = 60;
@kWeakify(self);
self.verificationTimer = [NSTimer scheduledTimerWithTimeInterval:1
repeats:YES
block:^(NSTimer * _Nonnull timer) {
@kStrongify(self);
[self updateVerificationCountDown];
}];
}
- (void)endVerificationCountDown {
if (_verificationTimer) {
[self.verificationTimer invalidate];
}
self.verificationCodeButton.enabled = YES;
}
- (void)updateBGColor:(UIColor *)color {
self.backgroundColor = color;
}
- (void)displayKeyboard {
[self.inputTextField becomeFirstResponder];
}
#pragma mark -
- (void)handleVerificationCountDown {
if (_handleItemAction) {
self.handleItemAction(self.inputType);
}
}
- (void)updateVerificationCountDown {
[self.verificationCodeButton setTitle:[NSString stringWithFormat:YMLocalizedString(@"20.20.51_text_9"), @(self.verificationCountDown)]
forState:UIControlStateDisabled];
self.verificationCodeButton.enabled = NO;
self.verificationCountDown -= 1;
if (self.verificationCountDown < 0) {
[self endVerificationCountDown];
}
}
#pragma mark -
- (void)didTapAreaButton {
if (_handleItemAction) {
self.handleItemAction(self.inputType);
}
}
- (void)didTapVerificationButton {
if (_handleItemAction) {
self.handleItemAction(self.inputType);
}
}
- (void)didTapRightActionButton {
self.rightActionButton.selected = !self.rightActionButton.isSelected;
self.inputTextField.secureTextEntry = !self.rightActionButton.selected;
}
#pragma mark - UITextFieldDelegate
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
NSString *updatedText = [textField.text stringByReplacingCharactersInRange:range withString:string];
NSLog(@"当前文本:%@", updatedText);
switch (self.inputType) {
case LoginInputType_id:
case LoginInputType_email:
case LoginInputType_phoneNum:
if (_handleFirstInputContentUpdate) {
self.handleFirstInputContentUpdate(updatedText);
}
break;
case LoginInputType_password:
case LoginInputType_verificationCode:
if (_handleSecondInputContentUpdate) {
self.handleSecondInputContentUpdate(updatedText);
}
break;
case LoginInputType_confirmPassword:
if (_handleThirdInputContentUpdate) {
self.handleThirdInputContentUpdate(updatedText);
}
break;
default:
break;
}
return YES;
}
#pragma mark -
- (UITextField *)inputTextField {
if (!_inputTextField) {
_inputTextField = [[UITextField alloc] init];
_inputTextField.font = kFontMedium(14);
_inputTextField.textColor = UIColorFromRGB(0x313131);
_inputTextField.delegate = self;
}
return _inputTextField;
}
- (UILabel *)areaLabel {
if (!_areaLabel) {
_areaLabel = [UILabel labelInitWithText:[NSString getCountryCode] font:kFontMedium(14) textColor:UIColorFromRGB(0x313131)];
}
return _areaLabel;
}
- (UIButton *)areaCodeButton {
if (!_areaCodeButton) {
_areaCodeButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_areaCodeButton addTarget:self
action:@selector(didTapAreaButton)
forControlEvents:UIControlEventTouchUpInside];
}
return _areaCodeButton;
}
- (UIButton *)verificationCodeButton {
if (!_verificationCodeButton) {
_verificationCodeButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_verificationCodeButton.titleLabel setFont:kFontMedium(14)];
[_verificationCodeButton setTitle:YMLocalizedString(@"20.20.51_text_8") forState:UIControlStateNormal];
[_verificationCodeButton setTitleColor:UIColorFromRGB(0xff8c03) forState:UIControlStateNormal];
[_verificationCodeButton setTitleColor:UIColorFromRGB(0xafb1b3) forState:UIControlStateDisabled];
[_verificationCodeButton addTarget:self
action:@selector(didTapVerificationButton)
forControlEvents:UIControlEventTouchUpInside];
}
return _verificationCodeButton;
}
- (UIButton *)rightActionButton {
if (!_rightActionButton) {
_rightActionButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_rightActionButton setBackgroundImage:kImage(@"login_page_kaigan") forState:UIControlStateNormal];
[_rightActionButton setBackgroundImage:kImage(@"login_page_eye_close") forState:UIControlStateSelected];
[_rightActionButton addTarget:self
action:@selector(didTapRightActionButton)
forControlEvents:UIControlEventTouchUpInside];
}
return _rightActionButton;
}
@end

View File

@@ -100,6 +100,9 @@
self.inviteCode = config.inviteCode;
config.inviteCode = @"";
}
// loading
[XNDJTDDLoadingTool hideHUD];
}
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {

View File

@@ -0,0 +1,30 @@
//
// LoginTypesViewController.h
// YuMi
//
// Created by P on 2025/3/11.
//
#import "MvpViewController.h"
#import "LoginInputItemView.h"
NS_ASSUME_NONNULL_BEGIN
typedef NS_ENUM(NSUInteger, LoginDisplayType) {
LoginDisplayType_id,
LoginDisplayType_email,
LoginDisplayType_phoneNum,
LoginDisplayType_email_forgetPassword,
LoginDisplayType_phoneNum_forgetPassword,
};
@interface LoginTypesViewController : MvpViewController
@property(nonatomic, assign) BOOL isLogoutAfterRestPassword;
- (void)updateLoginType:(LoginDisplayType)type;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,542 @@
//
// LoginTypesViewController.m
// YuMi
//
// Created by P on 2025/3/11.
//
#import "LoginTypesViewController.h"
#import "LoginPresenter.h"
#import "XPLoginAraeViewController.h"
#import "LoginProtocol.h"
#import "PILoginManager.h"
#import "XPWebViewController.h"
@interface LoginTypesViewController () <XPLoginAraeViewControllerDelegate, LoginProtocol>
@property(nonatomic, assign) LoginDisplayType type;
@property(nonatomic, strong) UILabel *titleLabel;
@property(nonatomic, strong) LoginInputItemView *firstLineInputView;
@property(nonatomic, strong) LoginInputItemView *secondLineInputView;
@property(nonatomic, strong) LoginInputItemView *thirdLineInputView;
@property(nonatomic, strong) UIButton *bottomActionButton;
@property(nonatomic, strong) UIButton *forgotPasswordButton;
@property(nonatomic, strong) UIStackView *stackView;
@property(nonatomic, strong) XPWebViewController *webVC;
@property(nonatomic, strong) UIButton *switchForgotType;
@end
@implementation LoginTypesViewController
- (void)dealloc {
[self.secondLineInputView endVerificationCountDown];
}
- (BOOL)isHiddenNavBar {
return YES;
}
- (LoginPresenter *)createPresenter {
return [[LoginPresenter alloc] init];
}
- (void)viewDidLoad {
[super viewDidLoad];
[self setupUI];
}
- (void)updateLoginType:(LoginDisplayType)type {
self.type = type;
[self setupInputArea];
}
- (void)setupUI {
[self setupDefaultUI];
[self setupNavigationBar];
}
- (void)handleTap {
[self.view endEditing:YES];
}
- (void)setupDefaultUI {
UIImageView *backagroundImageView = [[UIImageView alloc] initWithFrame:self.view.bounds];
backagroundImageView.userInteractionEnabled = YES;
if (isMSRTL()) {
backagroundImageView.image = kImage(@"login_page_backage_ar");
} else {
backagroundImageView.image = kImage(@"login_page_backage");
}
[self.view addSubview:backagroundImageView];
UIImageView *hiImageView = [[UIImageView alloc] initWithImage:kImage(@"login_page_mail_HI")];
[self.view addSubview:hiImageView];
[hiImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.leading.mas_equalTo(45);
make.top.mas_equalTo(111);
make.size.mas_equalTo(CGSizeMake(88, 45));
}];
[self.view addSubview:self.titleLabel];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.leading.mas_equalTo(45);
make.top.mas_equalTo(190);
}];
[self.view addSubview:self.stackView];
[self.stackView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.titleLabel.mas_bottom).offset(22);
make.leading.trailing.mas_equalTo(self.view).inset(40);
}];
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] init];
[tap addTarget:self action:@selector(handleTap)];
[backagroundImageView addGestureRecognizer:tap];
}
- (void)setupNavigationBar {
UIButton *backButton = [self backButton];
[self.view addSubview:backButton];
[backButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.leading.mas_equalTo(self.view).offset(16);
make.top.mas_equalTo(self.view).offset(kStatusBarHeight);
make.size.mas_equalTo(CGSizeMake(22, 22));
}];
}
- (void)setupInputArea {
switch (self.type) {
case LoginDisplayType_id:
[self setupIDInputArea];
break;
case LoginDisplayType_email:
[self setupEmailInputArea];
break;
case LoginDisplayType_phoneNum:
[self setupPhoneInputArea];
break;
case LoginDisplayType_email_forgetPassword:
case LoginDisplayType_phoneNum_forgetPassword:
[self.firstLineInputView removeFromSuperview];
[self.secondLineInputView removeFromSuperview];
[self.thirdLineInputView removeFromSuperview];
[self.bottomActionButton removeFromSuperview];
[self.switchForgotType removeFromSuperview];
[self setupForgotPasswordArea];
break;
default:
break;
}
}
- (void)setupIDInputArea {
[self setupInpuArea:LoginInputType_id
second:LoginInputType_password
third:LoginInputType_none
action:LoginInputType_login
showForgetPassword:YES];
}
- (void)setupEmailInputArea {
[self setupInpuArea:LoginInputType_email
second:LoginInputType_verificationCode
third:LoginInputType_none
action:LoginInputType_login
showForgetPassword:NO];
}
- (void)setupPhoneInputArea {
[self setupInpuArea:LoginInputType_phoneNum
second:LoginInputType_verificationCode
third:LoginInputType_none
action:LoginInputType_login
showForgetPassword:NO];
}
- (void)setupForgotPasswordArea {
[self setupInpuArea:self.type==LoginDisplayType_email_forgetPassword ? LoginInputType_email : LoginInputType_phoneNum
second:LoginInputType_verificationCode
third:LoginInputType_confirmPassword
action:LoginInputType_confirm
showForgetPassword:NO];
}
- (void)setupInpuArea:(LoginInputType)first
second:(LoginInputType)second
third:(LoginInputType)third
action:(LoginInputType)action
showForgetPassword:(BOOL)showForgetPassword {
@kWeakify(self);
_firstLineInputView = [[LoginInputItemView alloc] initWithType:first];
[self.firstLineInputView setHandleItemAction:^(LoginInputType inputType) {
@kStrongify(self);
if (inputType == LoginInputType_phoneNum) {
[self handleTapAreaCode];
}
}];
[self.firstLineInputView setHandleFirstInputContentUpdate:^(NSString *inputContent) {
@kStrongify(self);
[self checkActionButtonStatus];
}];
[self.stackView addArrangedSubview:self.firstLineInputView];
[self.firstLineInputView mas_makeConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(46);
}];
_secondLineInputView = [[LoginInputItemView alloc] initWithType:second];
[self.secondLineInputView setHandleItemAction:^(LoginInputType inputType) {
@kStrongify(self);
if (inputType == LoginInputType_verificationCode) {
if (self.type == LoginDisplayType_phoneNum || self.type == LoginDisplayType_phoneNum_forgetPassword) {
[self handleTapGetPhoneVerificationCode];
} else if (self.type == LoginDisplayType_email || self.type == LoginDisplayType_email_forgetPassword) {
[self handleTapGetMailVerificationCode];
}
}
}];
[self.secondLineInputView setHandleSecondInputContentUpdate:^(NSString *inputContent) {
@kStrongify(self);
[self checkActionButtonStatus];
}];
[self.stackView addArrangedSubview:self.secondLineInputView];
[self.secondLineInputView mas_makeConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(46);
}];
if (third != LoginInputType_none) {
_thirdLineInputView = [[LoginInputItemView alloc] initWithType:third];
[self.thirdLineInputView setHandleThirdInputContentUpdate:^(NSString *inputContent) {
@kStrongify(self);
[self checkActionButtonStatus];
}];
[self.stackView addArrangedSubview:self.thirdLineInputView];
[self.thirdLineInputView mas_makeConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(46);
}];
[self.view addSubview:self.switchForgotType];
[self.switchForgotType mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self.view);
make.bottom.mas_equalTo(self.view).offset(-kSafeAreaBottomHeight - 43);
}];
[self.switchForgotType setTitle: self.type == LoginDisplayType_email_forgetPassword ? YMLocalizedString(@"20.20.51_text_19") : YMLocalizedString(@"20.20.51_text_18")
forState:UIControlStateNormal];
self.titleLabel.text = YMLocalizedString(@"20.20.51_text_20");
}
if (showForgetPassword) {
[self.stackView setCustomSpacing:8 afterView:self.secondLineInputView];
[self.stackView addArrangedSubview:self.forgotPasswordButton];
[self.forgotPasswordButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(30);
}];
[self.stackView setCustomSpacing:8 afterView:self.forgotPasswordButton];
}
if (action != LoginInputType_none) {
if (action == LoginInputType_login) {
[self.bottomActionButton setTitle:YMLocalizedString(@"XPLoginPhoneViewController8") forState:UIControlStateNormal];
[self.bottomActionButton setTitle:YMLocalizedString(@"XPLoginPhoneViewController8") forState:UIControlStateDisabled];
} else if (action == LoginInputType_confirm) {
[self.bottomActionButton setTitle:YMLocalizedString(@"XPAnchorAudienceUpMicView2") forState:UIControlStateNormal];
[self.bottomActionButton setTitle:YMLocalizedString(@"XPAnchorAudienceUpMicView2") forState:UIControlStateDisabled];
}
[self.stackView addArrangedSubview:self.bottomActionButton];
[self.bottomActionButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(46);
}];
}
}
#pragma mark -
- (void)didTapBack {
[self.navigationController popViewControllerAnimated:YES];
}
- (void)didTapActionButton {
[self.view endEditing:true];
switch (self.type) {
case LoginDisplayType_id: {
[self.presenter loginWithPhone:[self.firstLineInputView inputContent]
password:[self.secondLineInputView inputContent]];
}
break;
case LoginDisplayType_phoneNum: {
[self.presenter loginWithPhone:[self.firstLineInputView inputContent]
code:[self.secondLineInputView inputContent]
phoneAreaCode:[self.firstLineInputView loadAreaCode]];
}
break;
case LoginDisplayType_email: {
[self.presenter loginWithEmail:[self.firstLineInputView inputContent]
code:[self.secondLineInputView inputContent]];
}
break;
case LoginDisplayType_email_forgetPassword: {
[self.presenter resetEmailPassword:[self.firstLineInputView inputContent]
code:[self.secondLineInputView inputContent]
newPassword:[self.thirdLineInputView inputContent]];
}
break;
case LoginDisplayType_phoneNum_forgetPassword: {
[self.presenter resetPhonePassword:[self.firstLineInputView inputContent]
code:[self.secondLineInputView inputContent]
newPassword:[self.thirdLineInputView inputContent]
areaCode:[self.firstLineInputView loadAreaCode]];
}
break;
default:
break;
}
}
- (void)didTapForgotPasswordButton {
LoginTypesViewController *vc = [[LoginTypesViewController alloc] init];
[self.navigationController pushViewController:vc animated:YES];
[vc updateLoginType:LoginDisplayType_email_forgetPassword];
}
- (void)didTapSwitchForgotType {
if (self.type == LoginDisplayType_email_forgetPassword) {
[self updateLoginType:LoginDisplayType_phoneNum_forgetPassword];
} else {
[self updateLoginType:LoginDisplayType_email_forgetPassword];
}
}
- (void)handleTapAreaCode {
XPLoginAraeViewController *codeVC = [XPLoginAraeViewController new];
codeVC.delegate = self;
[self.navigationController pushViewController:codeVC animated:YES];
}
- (void)handleTapGetPhoneVerificationCode {
NSString *phone = [self.firstLineInputView inputContent];
if (phone.length == 0 ) {
[self showErrorToast:YMLocalizedString(@"XPLoginPhoneViewController0")];
[self.secondLineInputView endVerificationCountDown];
return;
}
@kWeakify(self);
[self loadCaptchaWebView:^{
@kStrongify(self);
NSString *areaCode = [self.firstLineInputView loadAreaCode];
[self.presenter phoneSmsCode:[NSString stringWithFormat:@"%@%@", areaCode,phone]
type:GetSmsType_Regist
phoneAreaCode:areaCode];
}];
}
- (void)handleTapGetMailVerificationCode {
NSString *email = [self.firstLineInputView inputContent];
if (email.length == 0 ) {
// [self showErrorToast:YMLocalizedString(@"20.20.51_text_12")];
[self.secondLineInputView endVerificationCountDown];
return;
}
[self.presenter sendMailVerificationCode:email type:GetSmsType_Regist];
}
- (void)checkActionButtonStatus {
switch (self.type) {
case LoginDisplayType_id:
case LoginDisplayType_email:
case LoginDisplayType_phoneNum:{
NSString *accountString = [self.firstLineInputView inputContent];
NSString *codeString = [self.secondLineInputView inputContent];
if (![NSString isEmpty:accountString] && ![NSString isEmpty:codeString]) {
self.bottomActionButton.enabled = YES;
} else {
self.bottomActionButton.enabled = NO;
}
}
break;
case LoginDisplayType_email_forgetPassword:
case LoginDisplayType_phoneNum_forgetPassword: {
NSString *accountString = [self.firstLineInputView inputContent];
NSString *codeString = [self.secondLineInputView inputContent];
NSString *passwordString = [self.thirdLineInputView inputContent];
if (![NSString isEmpty:accountString] && ![NSString isEmpty:codeString] && ![NSString isEmpty:passwordString]) {
self.bottomActionButton.enabled = YES;
} else {
self.bottomActionButton.enabled = NO;
}
}
default:
break;
}
}
- (void)loadCaptchaWebView:(void(^)(void))finishBlock {
if ([ClientConfig.shareConfig shouldDisplayCaptcha]) {
[self.view endEditing:YES];
XPWebViewController * webVC =[[XPWebViewController alloc] initWithRoomUID:nil];
webVC.view.frame = CGRectMake(0, 0, KScreenWidth*0.8, KScreenWidth*1.2);
webVC.view.backgroundColor = [UIColor clearColor];
[webVC.view setCornerRadius:12];
webVC.isLoginStatus = NO;
webVC.isPush = NO;
[webVC hideNavigationBar];
webVC.url = URLWithType(kCaptchaSwitchPath);
[webVC setVerifyCaptcha:^(BOOL result) {
if (result == NO) {
return;
}
if (result && finishBlock) {
[TTPopup dismiss];
finishBlock();
}
}];
[TTPopup popupView:webVC.view style:TTPopupStyleAlert];
self.webVC = webVC;
}
}
#pragma mark - XPLoginAraeViewControllerDelegate
- (void)chooseAreaCodeSuccess:(NSString *)code {
[self.firstLineInputView updateAreaCode:code];
}
- (void)loginSuccess {
[self showSuccessToast:YMLocalizedString(@"XPLoginPhoneViewController1")];
[PILoginManager loginWithVC:self isLoginPhone:NO];
}
- (void)loginFailWithMsg:(NSString *)msg {
[self showSuccessToast:msg];
}
#pragma mark - API presenter Delegate
- (void)phoneSmsCodeSuccess:(NSString *)message type:(GetSmsType)type {
[self showSuccessToast:YMLocalizedString(@"XPLoginPhoneViewController2")];
[self.secondLineInputView startVerificationCountDown];
[self.secondLineInputView displayKeyboard];
}
- (void)phoneSmsCodeFailure {
[self.secondLineInputView endVerificationCountDown];
}
- (void)emailCodeSucess:(NSString *)message type:(GetSmsType)type{
[self showSuccessToast:YMLocalizedString(@"XPLoginPhoneViewController2")];
[self.secondLineInputView startVerificationCountDown];
[self.secondLineInputView displayKeyboard];
}
- (void)emailCodeFailure {
[self.secondLineInputView endVerificationCountDown];
}
- (void)resetEmailPasswordSuccess {
if (self.isLogoutAfterRestPassword) {
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC));
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
[self.presenter logout];
});
} else {
[self.navigationController popViewControllerAnimated:YES];
}
}
- (void)resetPhonePasswordSuccess {
if (self.isLogoutAfterRestPassword) {
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC));
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
[self.presenter logout];
});
} else {
[self.navigationController popViewControllerAnimated:YES];
}
}
#pragma mark -
- (UIButton *)backButton {
UIButton *b = [UIButton buttonWithType:UIButtonTypeCustom];
[b setImage:[kImage(@"common_nav_back") ms_SetImageForRTL]
forState:UIControlStateNormal];
[b addTarget:self
action:@selector(didTapBack)
forControlEvents:UIControlEventTouchUpInside];
return b;
}
- (UILabel *)titleLabel {
if (!_titleLabel) {
_titleLabel = [UILabel labelInitWithText:YMLocalizedString(@"20.20.51_text_2")
font:kFontSemibold(20)
textColor:UIColorFromRGB(0x663c22)];
}
return _titleLabel;
}
- (UIButton *)bottomActionButton {
if (!_bottomActionButton) {
_bottomActionButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_bottomActionButton setCornerRadius:23];
[_bottomActionButton setTitle:YMLocalizedString(@"XPLoginPhoneViewController8") forState:UIControlStateNormal];
[_bottomActionButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
UIImage *normalBG = [UIImage gradientColorImageFromColors:@[
UIColorFromRGB(0xe29030),
UIColorFromRGB(0xfcc074)
]
gradientType:GradientTypeLeftToRight
imgSize:CGSizeMake(KScreenWidth-84, 46)] ;
UIImage *disableBG = [UIImage gradientColorImageFromColors:@[
[UIColor colorWithRed:245/255.0 green:199/255.0 blue:129/255.0 alpha:1],
[UIColor colorWithRed:253/255.0 green:217/255.0 blue:154/255.0 alpha:1],
]
gradientType:GradientTypeLeftToRight
imgSize:CGSizeMake(KScreenWidth-84, 46)] ;
[_bottomActionButton setBackgroundImage:normalBG forState:UIControlStateNormal];
[_bottomActionButton setBackgroundImage:disableBG forState:UIControlStateDisabled];
[_bottomActionButton addTarget:self
action:@selector(didTapActionButton)
forControlEvents:UIControlEventTouchUpInside];
_bottomActionButton.enabled = NO;
}
return _bottomActionButton;
}
- (UIButton *)forgotPasswordButton {
if (!_forgotPasswordButton) {
_forgotPasswordButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_forgotPasswordButton.titleLabel setFont:kFontRegular(12)];
[_forgotPasswordButton setTitleColor:UIColorFromRGB(0x313131) forState:UIControlStateNormal];
[_forgotPasswordButton setTitle:YMLocalizedString(@"XPForgetPwdViewController3") forState:UIControlStateNormal];
[_forgotPasswordButton setBackgroundColor:[UIColor clearColor]];
_forgotPasswordButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentRight;
[_forgotPasswordButton addTarget:self
action:@selector(didTapForgotPasswordButton)
forControlEvents:UIControlEventTouchUpInside];
}
return _forgotPasswordButton;
}
- (UIStackView *)stackView {
if (!_stackView) {
_stackView = [[UIStackView alloc] init];
_stackView.axis = UILayoutConstraintAxisVertical;
_stackView.spacing = 24;
_stackView.distribution = UIStackViewDistributionFillProportionally;
}
return _stackView;
}
- (UIButton *)switchForgotType {
if (!_switchForgotType) {
_switchForgotType = [UIButton buttonWithType:UIButtonTypeCustom];
[_switchForgotType.titleLabel setFont:kFontRegular(12)];
[_switchForgotType setTitle:YMLocalizedString(@"20.20.51_text_19") forState:UIControlStateNormal];
[_switchForgotType setTitleColor:UIColorFromRGB(0x7b7b7d) forState:UIControlStateNormal];
[_switchForgotType addTarget:self action:@selector(didTapSwitchForgotType) forControlEvents:UIControlEventTouchUpInside];
}
return _switchForgotType;
}
@end

View File

@@ -0,0 +1,16 @@
//
// LoginViewController.h
// YuMi
//
// Created by P on 2025/3/10.
//
#import "MvpViewController.h"
NS_ASSUME_NONNULL_BEGIN
@interface LoginViewController : MvpViewController
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,483 @@
//
// LoginViewController.m
// YuMi
//
// Created by P on 2025/3/10.
//
#import "LoginViewController.h"
#import "XPWebViewController.h"
#import "LoginPresenter.h"
#import "AESUtils.h"
#import "LoginTypesViewController.h"
#import "LoginProtocol.h"
#import "PILoginManager.h"
#import "PISwitchingEnvironmentVC.h"
#import "FeedBackViewController.h"
NSString * const HadAgreePrivacy = @"HadAgreePrivacy";
typedef NS_ENUM(NSUInteger, LoginType) {
LoginType_ID = 101,
LoginType_Email = 102,
LoginType_Google = 103,
LoginType_Apple = 104
};
@interface LoginViewController () <LoginProtocol>
@property(nonatomic, strong) UIImageView *logoImageView;
@property(nonatomic, assign) BOOL lastPolicySelectedStatus;
@property(nonatomic, strong) UIButton *agreeButton;
@property(nonatomic, strong) YYLabel *policyLabel;
@property(nonatomic, strong) UIView *policyTips;
///
@property (nonatomic,strong) GIDConfiguration *configuration;
@end
@implementation LoginViewController
- (LoginPresenter *)createPresenter {
return [[LoginPresenter alloc] init];
}
- (BOOL)isHiddenNavBar {
return YES;
}
- (void)viewDidLoad {
[super viewDidLoad];
[self loadPolicySelectedStatus];
[self setupUI];
}
- (void)setupUI {
[self setupBackground];
[self setupNavigationBar];
[self setupBottomPolicy];
[self setupSMSLoginEntrcy];
[self setupEntrcyButtons];
}
- (void)setupBackground {
[self.view addGradientBackgroundWithColors:@[
UIColorFromRGB(0xfcf4df),
UIColorFromRGB(0xffd374)
]
startPoint:CGPointMake(0.5, 0)
endPoint:CGPointMake(0.5, 1)
cornerRadius:0];
UIImageView *topImageView = [[UIImageView alloc] initWithImage:kImage(@"login_page_top")];
topImageView.contentMode = UIViewContentModeScaleAspectFit;
[self.view addSubview:topImageView];
[topImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.leading.trailing.mas_equalTo(self.view);
make.height.mas_equalTo(kGetScaleWidth(326));
}];
[self.view addSubview:self.logoImageView];
if (iPhoneXSeries) {
[self.logoImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self.view);
make.centerY.mas_equalTo(topImageView.mas_bottom);
make.size.mas_equalTo(CGSizeMake(124, 48));
}];
} else {
[self.logoImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self.view);
make.top.mas_equalTo(160);
make.size.mas_equalTo(CGSizeMake(124, 48));
}];
}
}
- (void)setupNavigationBar {
#if DEBUG
UIButton *debugButton = [self debugButton];
[self.view addSubview:debugButton];
[debugButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.leading.mas_equalTo(self.view).offset(16);
make.top.mas_equalTo(self.view).offset(kStatusBarHeight);
make.height.mas_equalTo(22);
make.width.mas_greaterThanOrEqualTo(84);
}];
#endif
UIButton *feedBackButton = [self feedBackButton];
[self.view addSubview:feedBackButton];
[feedBackButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.trailing.mas_equalTo(self.view).offset(-16);
make.top.mas_equalTo(self.view).offset(kStatusBarHeight);
make.height.mas_equalTo(22);
make.width.mas_greaterThanOrEqualTo(84);
}];
}
- (void)setupBottomPolicy {
UIStackView *stackView = [[UIStackView alloc] initWithArrangedSubviews:@[
self.agreeButton,
self.policyLabel,
]];
stackView.alignment = UIStackViewAlignmentCenter;
stackView.distribution = UIStackViewDistributionFill;
[self.view addSubview:stackView];
[stackView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self.view);
if (isMSRTL()) {
make.width.mas_equalTo(290);
}
make.bottom.mas_equalTo(self.view).offset(-44);
make.height.mas_equalTo(34);
}];
[self.agreeButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(18,18));
}];
}
- (void)setupSMSLoginEntrcy {
UIButton *smsLogin = [UIButton buttonWithType:UIButtonTypeCustom];
[smsLogin setBackgroundImage:kImage(@"login_page_phone") forState:UIControlStateNormal];
[smsLogin addTarget:self action:@selector(didTapSMS) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:smsLogin];
[smsLogin mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self.view);
make.bottom.mas_equalTo(self.view).offset(-104);
make.size.mas_equalTo(CGSizeMake(48, 48));
}];
}
- (void)setupEntrcyButtons {
UIButton *idBUtton = [self entrcyButton:LoginType_ID tapSelector:@selector(didTapEntrcyButton:)];
UIStackView *stackView = [[UIStackView alloc] initWithArrangedSubviews:@[
idBUtton,
[self entrcyButton:LoginType_Email tapSelector:@selector(didTapEntrcyButton:)],
[self entrcyButton:LoginType_Google tapSelector:@selector(didTapEntrcyButton:)],
[self entrcyButton:LoginType_Apple tapSelector:@selector(didTapEntrcyButton:)],
]];
stackView.axis = UILayoutConstraintAxisVertical;
stackView.distribution = UIStackViewDistributionFillEqually;
stackView.spacing = 14;
[self.view addSubview:stackView];
[stackView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self.view);
make.top.mas_equalTo(self.logoImageView.mas_bottom).offset(34);
}];
[idBUtton mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(294, 46));
}];
}
- (UIButton *)entrcyButton:(LoginType)type tapSelector:(SEL)selector {
UIImageView *icon = [[UIImageView alloc] init];
icon.contentMode = UIViewContentModeScaleAspectFill;
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
button.frame = CGRectMake(0, 0, 294, 46);
button.tag = type;
[button addTarget:self action:selector forControlEvents:UIControlEventTouchUpInside];
[button setCornerRadius:23];
[button setBackgroundColor:[UIColor whiteColor]];
[button.titleLabel setFont:kFontSemibold(14)];
[button setTitleColor:UIColorFromRGB(0x313131) forState:UIControlStateNormal];
switch (type) {
case LoginType_ID:{
[button setTitle:YMLocalizedString(@"1.0.37_text_26") forState:UIControlStateNormal];
[icon setImage:kImage(@"login_page_id")];
}
break;
case LoginType_Email:{
[button setTitle:YMLocalizedString(@"20.20.51_text_1") forState:UIControlStateNormal];
[icon setImage:kImage(@"login_page_mail")];
}
break;
case LoginType_Google:{
[button setTitle:YMLocalizedString(@"XPLoginViewController13") forState:UIControlStateNormal];
[icon setImage:kImage(@"login_gmail")];
}
break;
case LoginType_Apple:{
[button setTitle:YMLocalizedString(@"XPLoginViewController12") forState:UIControlStateNormal];
[icon setImage:kImage(@"mine_noble_center_apple")];
}
break;
default:
break;
}
[button addSubview:icon];
[icon mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.mas_equalTo(button);
make.leading.mas_equalTo(15);
make.size.mas_equalTo(CGSizeMake(24, 24));
}];
return button;
}
#pragma mark -
- (void)didTapPolice:(NSString *)url {
XPWebViewController * webVC = [[XPWebViewController alloc] initWithRoomUID:nil];
webVC.url = url;
[self.navigationController pushViewController:webVC animated:YES];
}
- (void)didTapAgreeButton {
self.agreeButton.selected = !self.agreeButton.isSelected;
[self updatePolicySelectedStatus:self.agreeButton.isSelected];
[self hidePolicyTips];
}
- (void)didTapSMS {
if (self.lastPolicySelectedStatus == NO) {
[self displayPolicyTips];
return;
}
LoginTypesViewController *vc = [[LoginTypesViewController alloc] init];
[self.navigationController pushViewController:vc animated:YES];
[vc updateLoginType:LoginDisplayType_phoneNum];
}
- (void)didTapEntrcyButton:(UIButton *)sender {
if (self.lastPolicySelectedStatus == NO) {
[self displayPolicyTips];
return;
}
switch (sender.tag) {
case LoginType_ID:{
LoginTypesViewController *vc = [[LoginTypesViewController alloc] init];
[self.navigationController pushViewController:vc animated:YES];
[vc updateLoginType:LoginDisplayType_id];
}
break;
case LoginType_Email: {
LoginTypesViewController *vc = [[LoginTypesViewController alloc] init];
[self.navigationController pushViewController:vc animated:YES];
[vc updateLoginType:LoginDisplayType_email];
}
break;
case LoginType_Google:
[self.presenter thirdLoginByGoogleWithPresentingViewController:self
configuration:self.configuration];
break;
case LoginType_Apple:
[self.presenter thirdLoginWithType:ThirdLoginType_Apple];
break;
default:
break;
}
}
- (void)didTapFeedback {
FeedBackViewController *vc = [[FeedBackViewController alloc] init];
[self.navigationController pushViewController:vc animated:YES];
}
#ifdef DEBUG
- (void)switchEnvironments {
PISwitchingEnvironmentVC *vc = [PISwitchingEnvironmentVC new];
[self.navigationController pushViewController:vc animated:YES];
}
#endif
#pragma mark - LoginProtocol
- (void)loginThirdPartSuccess {
[self showSuccessToast:YMLocalizedString(@"XPLoginViewController4")];
[PILoginManager loginWithVC:self isLoginPhone:NO];
}
#pragma mark - Polisy Status
- (void)loadPolicySelectedStatus {
// YES
[self updatePolicySelectedStatus:YES];
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
self.lastPolicySelectedStatus = [defaults boolForKey:HadAgreePrivacy];
self.agreeButton.selected = self.lastPolicySelectedStatus;
}
- (void)updatePolicySelectedStatus:(BOOL)isSelected {
self.lastPolicySelectedStatus = isSelected;
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[defaults setBool:isSelected forKey:HadAgreePrivacy];
}
- (void)displayPolicyTips {
[self.view addSubview:self.policyTips];
[self.policyTips mas_makeConstraints:^(MASConstraintMaker *make) {
make.bottom.mas_equalTo(self.view).offset(-82);
make.leading.trailing.mas_equalTo(self.view).inset(22);
make.height.mas_equalTo(64);
}];
}
- (void)hidePolicyTips {
[self.policyTips removeFromSuperview];
}
#pragma mark - Lazy init
- (UIButton *)agreeButton {
if(!_agreeButton) {
_agreeButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_agreeButton setImage:[UIImage imageNamed:@"login_page_privacy_selected"] forState:UIControlStateSelected];
[_agreeButton setImage:[UIImage imageNamed:@"login_page_privacy_unselected"] forState:UIControlStateNormal];
[_agreeButton setEnlargeEdgeWithTop:10 right:10 bottom:10 left:10];
[_agreeButton addTarget:self action:@selector(didTapAgreeButton) forControlEvents:UIControlEventTouchUpInside];
// NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
// NSString *hadAgree = [defaults objectForKey:HadAgreePrivacy];
// if (hadAgree.length > 0) {
// _agreeBtn.selected = YES;
// }
_agreeButton.selected = YES;
}
return _agreeButton;
}
- (YYLabel *)policyLabel {
if (!_policyLabel) {
_policyLabel = [[YYLabel alloc] init];
_policyLabel.font = kFontRegular(12);
_policyLabel.numberOfLines = 0;
NSMutableAttributedString *attString = [[NSMutableAttributedString alloc] initWithString:YMLocalizedString(@"XPLoginViewController6")];
attString.yy_color = UIColorFromRGB(0x7B7B7D);
NSRange userRange = [attString.string rangeOfString:YMLocalizedString(@"XPLoginViewController7")];
[attString addAttributes:@{NSForegroundColorAttributeName:UIColorFromRGB(0x313131)} range:userRange];
@kWeakify(self);
[attString yy_setTextHighlightRange:userRange color:nil backgroundColor:nil userInfo:nil tapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) {
@kStrongify(self);
//
[self didTapPolice:URLWithType(kUserProtocalURL)];
} longPressAction:nil];
NSRange andRange = [attString.string rangeOfString:YMLocalizedString(@"XPLoginViewController8")];
[attString addAttributes:@{NSForegroundColorAttributeName:UIColorFromRGB(0x7B7B7D)} range:andRange];
NSRange protocolRange = [attString.string rangeOfString:YMLocalizedString(@"XPLoginViewController9")];
[attString addAttributes:@{NSForegroundColorAttributeName:UIColorFromRGB(0x313131)} range:protocolRange];
[attString yy_setTextHighlightRange:protocolRange color:nil backgroundColor:nil userInfo:nil tapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) {
@kStrongify(self);
//
[self didTapPolice:URLWithType(kPrivacyURL)];
} longPressAction:nil];
_policyLabel.attributedText = attString;
}
return _policyLabel;
}
- (UIView *)policyTips {
if (!_policyTips) {
_policyTips = [[UIView alloc] init];
[_policyTips setCornerRadius:8];
[_policyTips setBackgroundColor:[UIColor colorWithWhite:0 alpha:0.5]];
UILabel *_policyTipsLabel = [[UILabel alloc] init];
_policyTipsLabel.text = YMLocalizedString(@"XPLoginViewController11");
_policyTipsLabel.font = kFontRegular(12);
_policyTipsLabel.textColor = UIColor.whiteColor;
_policyTipsLabel.numberOfLines = 0;
_policyTipsLabel.textAlignment = NSTextAlignmentCenter;
[_policyTips addSubview:_policyTipsLabel];
[_policyTipsLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(_policyTips).insets(UIEdgeInsetsMake(8, 12, 8, 12));
}];
}
return _policyTips;
}
- (GIDConfiguration *)configuration{
if (!_configuration){
static dispatch_once_t onceToken;
static NSString *decryptedNumber;
dispatch_once(&onceToken, ^{
decryptedNumber = [AESUtils aesDecrypt:@"ScLBu7ctIiyGCKPro3Jj6XMdsdCCpNT9L4wyjHEF+bguqubkXNSayFBGMKmoDwe1hjfAc958XSaBdMyEaFXLO38Bwq3xURYVNpgEM4b14zg="];
});
_configuration = [[GIDConfiguration alloc] initWithClientID:decryptedNumber];
}
return _configuration;
}
- (UIImageView *)logoImageView {
if (!_logoImageView) {
_logoImageView = [[UIImageView alloc] initWithImage:kImage(@"login_page_logo")];
}
return _logoImageView;
}
- (UIButton *)feedBackButton {
UIButton *feedBackButton = [UIButton buttonWithType:UIButtonTypeCustom];
[feedBackButton setTitle:YMLocalizedString(@"XPMineFeedbackViewController0") forState:UIControlStateNormal];
[feedBackButton setTitleColor:UIColorFromRGB(0x313131) forState:UIControlStateNormal];
feedBackButton.titleLabel.font = kFontRegular(12);
[feedBackButton setBackgroundImage:[[UIImage imageWithColor:[UIColor whiteColor]] imageByApplyingAlpha:0.5]
forState:UIControlStateNormal];
[feedBackButton setCornerRadius:10.5];
[feedBackButton addTarget:self
action:@selector(didTapFeedback)
forControlEvents:UIControlEventTouchUpInside];
[feedBackButton enlargeTouchArea:UIEdgeInsetsMake(10, 10, 10, 10)];
return feedBackButton;
}
#if DEBUG
- (UIButton *)debugButton {
UIButton *b = [UIButton buttonWithType:UIButtonTypeCustom];
b.frame = CGRectMake(0, 0, 84, 22);
[b setTitle:@"切换环境" forState:UIControlStateNormal];
[b setTitleColor:[UIColor blueColor] forState:UIControlStateNormal];
[self.view addSubview:b];
[b addTarget:self action:@selector(switchEnvironments) forControlEvents:UIControlEventTouchUpInside];
CAGradientLayer *gradientLayer = [CAGradientLayer layer];
gradientLayer.frame = b.bounds;
gradientLayer.colors = @[
(id)[UIColor redColor].CGColor,
(id)[UIColor blueColor].CGColor,
(id)[UIColor greenColor].CGColor
];
gradientLayer.startPoint = CGPointMake(0, 0.5);
gradientLayer.endPoint = CGPointMake(1, 0.5);
[b.layer addSublayer:gradientLayer];
@kWeakify(self);
[NSTimer scheduledTimerWithTimeInterval:0.1
repeats:YES
block:^(NSTimer * _Nonnull timer) {
@kStrongify(self);
if (!self) {
return;
}
NSArray *fromColors = gradientLayer.colors;
NSArray *toColors = [self shiftedColorsFromColors:fromColors];
CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"colors"];
animation.fromValue = fromColors;
animation.toValue = toColors;
animation.duration = 0.1;
animation.fillMode = kCAFillModeForwards;
animation.removedOnCompletion = NO;
[gradientLayer addAnimation:animation forKey:@"colorChange"];
gradientLayer.colors = toColors;
}];
return b;
}
- (NSArray *)shiftedColorsFromColors:(NSArray *)colors {
NSMutableArray *mutableColors = [colors mutableCopy];
id firstColor = [mutableColors firstObject];
[mutableColors removeObjectAtIndex:0];
[mutableColors addObject:firstColor];
return [mutableColors copy];
}
#endif
@end

View File

@@ -227,14 +227,11 @@
#pragma mark - LoginVerifCodeProtocol
- (void)loginWithPhoenSuccess{
[XNDJTDDLoadingTool hideOnlyView:self.view];
[[NSUserDefaults standardUserDefaults]setValue:@(ThirdLoginType_Phone) forKey:@"kLoginSuccessType"];
[[NSUserDefaults standardUserDefaults]synchronize];
[self showSuccessToast:YMLocalizedString(@"XPLoginPhoneViewController1")];
[PILoginManager loginWithVC:self isLoginPhone:YES];
}
- (void)loginSuccess {
[XNDJTDDLoadingTool hideOnlyView:self.view];
[[NSUserDefaults standardUserDefaults]removeObjectForKey:@"kLoginSuccessType"];
[self showSuccessToast:YMLocalizedString(@"XPLoginPhoneViewController1")];
[PILoginManager loginWithVC:self isLoginPhone:NO];
}

View File

@@ -1,16 +0,0 @@
//
// YMLoginViewController.h
// YUMI
//
// Created by XY on 2023/2/13.
//
#import "MvpViewController.h"
NS_ASSUME_NONNULL_BEGIN
@interface XPLoginViewController : MvpViewController
@end
NS_ASSUME_NONNULL_END

View File

@@ -1,903 +0,0 @@
//
// 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 "XNDJTDDLoadingTool.h"
#import "XPWebViewController.h"
#import "XPLoginPhoneViewController.h"
#import "UserPrivacyView.h"
#import "AESUtils.h"
#import "LoginPresenter.h"
#import "LoginProtocol.h"
#import "PILoginManager.h"
#import "XPLoginInputView.h"
#import "XPLoginAraeViewController.h"
#import "XPForgetPwdViewController.h"
#import "PISwitchingEnvironmentVC.h"
#import "FeedBackViewController.h"
#import "IAPManager.h"
UIKIT_EXTERN NSString * const kYouMiNumberCountKey;
NSString * const HadAgreePrivacy = @"HadAgreePrivacy";
@interface XPLoginViewController ()<LoginProtocol,XPLoginInputViewDelegate,XPLoginAraeViewControllerDelegate>
///
@property(nonatomic,strong) UIImageView *bgImageView;
///logo
@property(nonatomic,strong) UIImageView *logoView;
///
@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;
///
@property(nonatomic,strong) UIButton *currentLoginWayButton;
///
@property(nonatomic,strong) UIButton *otherLoginWayButton;
///
@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;
///,01.
@property(nonatomic,assign) int loginType;
@property (nonatomic, strong) UIButton *feedBackButton;
@end
@implementation XPLoginViewController
- (LoginPresenter *)createPresenter {
return [[LoginPresenter alloc] init];
}
- (BOOL)isHiddenNavBar {
return YES;
}
- (void)viewDidLoad {
[super viewDidLoad];
[self createUI];
[self racBind];
#ifdef DEBUG
[self setSwitchingEnvironmentVC];
#endif
[self setupDefaultLoginType];
[[IAPManager sharedManager] handleLogout];
}
- (void)setupDefaultLoginType {
self.loginType = 0;
NSString *code = [NSString getCountryCode];
self.pi_phoneAreaCode = [code stringByReplacingOccurrencesOfString:@"+" withString:@""];
[[NSNotificationCenter defaultCenter] postNotificationName:@"kInLoginVC" object:nil];
}
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
[self.view endEditing:YES];
}
- (void)racBind {
@weakify(self);
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){
@strongify(self);
if(self.loginType == 0){
return @(account.length > 0 && accountPwd.length >= 6);
} else {
return @((phone.length > 0) && smsCode.length > 0);
}
}]
takeUntil:self.rac_willDeallocSignal];
}
- (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.feedBackButton];
[self.view addSubview:self.currentLoginWayButton];
[self.view addSubview:self.otherLoginWayButton];
[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];
[self.view addSubview:self.stackView];
[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.leading.trailing.top.equalTo(self.view);
make.height.mas_equalTo(kGetScaleWidth(111));
}];
[self.logoView mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_offset(kGetScaleWidth(162));
make.height.mas_equalTo(kGetScaleWidth(32));
make.centerX.equalTo(self.view);
make.top.equalTo(self.bgImageView.mas_bottom).mas_offset(-16);
}];
CGFloat width = KScreenWidth/2;
[self.currentLoginWayButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self.view);
make.height.mas_equalTo(kGetScaleWidth(22));
make.width.mas_equalTo(width);
make.top.equalTo(self.logoView.mas_bottom).mas_offset(kGetScaleWidth(15));
}];
[self.accountView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self.view);
make.width.mas_equalTo(kGetScaleWidth(303));
make.top.mas_equalTo(self.currentLoginWayButton.mas_bottom).offset(kGetScaleWidth(13));
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);
}];
[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));
}];
[self.stackView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.loginBtn.mas_bottom).offset(kGetScaleWidth(23));
make.centerX.mas_equalTo(self.view);
}];
[self.otherLoginWayButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(kGetScaleWidth(22));
make.width.mas_equalTo(width);
make.top.equalTo(self.stackView.mas_bottom).mas_offset(kGetScaleWidth(23));
make.centerX.mas_equalTo(self.stackView);
}];
CGFloat left = isMSRTL() ? -11 : 11;
CGFloat protocolWidth = 204;
if (isMSRTL()){
protocolWidth = 250;
}else if (isMSEN()){
protocolWidth = 270;
}
[self.protocolLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self.view).offset(left);
make.height.mas_greaterThanOrEqualTo(22);
make.width.mas_equalTo(protocolWidth);
make.bottom.mas_equalTo(-kGetScaleWidth(35));
}];
[self.agreeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.trailing.mas_equalTo(self.protocolLabel.mas_leading).offset(0);
make.top.mas_equalTo(self.protocolLabel.mas_top);
make.width.height.mas_equalTo(22);
}];
[self.authBubbleView mas_makeConstraints:^(MASConstraintMaker *make) {
make.leading.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.leading.mas_equalTo(8);
make.trailing.mas_equalTo(-8);
make.bottom.mas_equalTo(self.authBubbleView).mas_offset(isMSZH() ? -6:0);
}];
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.fbButtonView.hidden = YES;
self.lineButtonView.hidden = YES;
[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);
// }];
}
[self.feedBackButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.trailing.mas_equalTo(-15);
make.top.mas_equalTo(kStatusBarHeight+20);
}];
}
-(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) {
make.leading.mas_equalTo(kGetScaleWidth(30));
make.top.mas_equalTo(kStatusBarHeight+20);
}];
}
-(void)switchingEnvironmentVCAction{
#ifdef DEBUG
PISwitchingEnvironmentVC *vc = [PISwitchingEnvironmentVC new];
[self.navigationController pushViewController:vc animated:YES];
#else
#endif
}
- (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];
} 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];
} else {
[UIView animateWithDuration:0.5 animations:^{
self.authBubbleView.alpha = 1.0;
}];
}
}
///
- (void)loginBtnClicked {
[self.view endEditing:true];
if (!self.agreeBtn.selected) {
[UIView animateWithDuration:0.5 animations:^{
self.authBubbleView.alpha = 1.0;
}];
return;
}
[XNDJTDDLoadingTool showOnlyView:self.view];
if(self.loginType == 0){
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];
}
- (void)didTapFeedback {
FeedBackViewController *vc = [[FeedBackViewController alloc] init];
[self.navigationController pushViewController:vc animated:YES];
}
#pragma mark - LoginProtocol
- (void)loginThirdPartSuccess {
[self.codeInputView cancelTimer];
[PILoginManager loginWithVC:self isLoginPhone:NO];
[self showSuccessToast:YMLocalizedString(@"XPLoginViewController4")];
}
-(void)chooseAccountAction{
// self.loginType = self.loginType == 0 ? 1 : 0;
}
-(void)chooseSMSAction{
self.loginType = self.loginType == 0 ? 1 : 0;
}
-(void)setLoginType:(int)selectType{
_loginType = selectType;
_forgetBtn.hidden = _loginType != 0;
_accountView.hidden = _loginType != 0;
_accountPwdView.hidden = _loginType != 0;
_phoneInputView.hidden = _loginType == 0;
_codeInputView.hidden = _loginType == 0;
switch (selectType) {
case 0:
[_currentLoginWayButton setTitle:YMLocalizedString(@"1.0.37_text_26") forState:UIControlStateNormal];
[_otherLoginWayButton setTitle:YMLocalizedString(@"1.0.37_text_27")forState:UIControlStateNormal];
break;
case 1:
[_currentLoginWayButton setTitle:YMLocalizedString(@"1.0.37_text_27") forState:UIControlStateNormal];
[_otherLoginWayButton setTitle:YMLocalizedString(@"1.0.37_text_26")forState:UIControlStateNormal];
break;
default:
break;
}
}
#pragma mark - XPLoginInputViewDelegate
- (void)smsCodeAction {
NSString *phone = self.phoneInputView.inputTextField.text;
if (phone.length == 0 ) {
[self showErrorToast:YMLocalizedString(@"XPLoginPhoneViewController0")];
return;
}
[self.presenter phoneSmsCode:[NSString stringWithFormat:@"%@%@", self.pi_phoneAreaCode,phone]
type:GetSmsType_Regist
phoneAreaCode:self.pi_phoneAreaCode];
}
- (void)areaListAction {
XPLoginAraeViewController *codeVC = [XPLoginAraeViewController new];
codeVC.delegate = self;
[self.navigationController pushViewController:codeVC animated:YES];
}
#pragma mark - XPLoginAraeViewControllerDelegate
- (void)chooseAreaCodeSuccess:(NSString *)code {
if (code.length > 0) {
self.pi_phoneAreaCode = code;
[self.phoneInputView.areaCodeBtn setTitle:[NSString stringWithFormat:@"+%@", code] forState:UIControlStateNormal];
}
}
#pragma mark - LoginVerifCodeProtocol
- (void)loginWithPhoenSuccess{
[XNDJTDDLoadingTool hideOnlyView:self.view];
[[NSUserDefaults standardUserDefaults]setValue:@(ThirdLoginType_Phone) forKey:@"kLoginSuccessType"];
[[NSUserDefaults standardUserDefaults]synchronize];
[self showSuccessToast:YMLocalizedString(@"XPLoginPhoneViewController1")];
[PILoginManager loginWithVC:self isLoginPhone:YES];
}
- (void)loginSuccess {
[self.codeInputView cancelTimer];
[XNDJTDDLoadingTool hideOnlyView:self.view];
[[NSUserDefaults standardUserDefaults]removeObjectForKey:@"kLoginSuccessType"];
[self showSuccessToast:YMLocalizedString(@"XPLoginPhoneViewController1")];
[PILoginManager loginWithVC:self isLoginPhone:NO];
}
- (void)loginFailWithMsg:(NSString *)msg{
[self showErrorToast:msg];
[XNDJTDDLoadingTool hideOnlyView:self.view];
}
- (void)phoneSmsCodeSuccess {
[self showSuccessToast:YMLocalizedString(@"XPLoginPhoneViewController2")];
[self.codeInputView fireTimer];
}
#pragma mark -
- (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);
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) {
@strongify(self);
//
XPWebViewController * webVC = [[XPWebViewController alloc] initWithRoomUID:nil];
webVC.url = URLWithType(kUserProtocalURL);
[self.navigationController pushViewController:webVC animated:YES];
} longPressAction:nil];
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) {
@strongify(self);
//
XPWebViewController * webVC = [[XPWebViewController alloc] initWithRoomUID:nil];
webVC.url = URLWithType(kPrivacyURL);
[self.navigationController pushViewController:webVC animated:YES];
} longPressAction:nil];
_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:9];
_authBubbleLabel.textColor = UIColor.whiteColor;
_authBubbleLabel.numberOfLines = 2;
}
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(@"Login_top_bg");
_bgImageView.contentMode = UIViewContentModeScaleAspectFill;
}
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;
}
- (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];
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))];
[_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;
}
- (UIButton *)currentLoginWayButton{
if(!_currentLoginWayButton){
_currentLoginWayButton = [UIButton new];
[_currentLoginWayButton setTitle:YMLocalizedString(@"1.0.37_text_26") forState:UIControlStateNormal];
[_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];
}
return _otherLoginWayButton;
}
- (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;
}
- (UIButton *)feedBackButton {
if (!_feedBackButton) {
_feedBackButton = [UIButton buttonWithType:UIButtonTypeCustom];
// [_feedBackButton setBackgroundImage:kImage(@"login_custom_servise") forState:UIControlStateNormal];
[_feedBackButton setTitle:YMLocalizedString(@"XPMineFeedbackViewController0") forState:UIControlStateNormal];
[_feedBackButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
_feedBackButton.titleLabel.font = [UIFont systemFontOfSize:14 weight:UIFontWeightBold];
[_feedBackButton addTarget:self
action:@selector(didTapFeedback)
forControlEvents:UIControlEventTouchUpInside];
[_feedBackButton enlargeTouchArea:UIEdgeInsetsMake(10, 10, 10, 10)];
}
return _feedBackButton;
}
@end

View File

@@ -46,7 +46,7 @@
self.title = YMLocalizedString(@"XPLoginBindPhoneResultViewController0");
NSMutableAttributedString *titleAtt = [[NSMutableAttributedString alloc]initWithString:YMLocalizedString(@"XPLoginBindPhoneResultViewController1") attributes:@{NSFontAttributeName:kFontSemibold(16),NSForegroundColorAttributeName:[DJDKMIMOMColor inputTextColor]}];
NSString *phone = self.userInfo.phone.length > 0 ? self.userInfo.phone : @"";
NSAttributedString *phoneAtt = [[NSAttributedString alloc]initWithString:[NSString stringWithFormat:@"\n%@ %@",self.userInfo.pi_phoneAreaCode, phone] attributes:@{NSFontAttributeName:kFontSemibold(16),NSForegroundColorAttributeName:UIColorFromRGB(0x9168FA)}];
NSAttributedString *phoneAtt = [[NSAttributedString alloc]initWithString:[NSString stringWithFormat:@"\n%@ %@",self.userInfo.phoneAreaCode, phone] attributes:@{NSFontAttributeName:kFontSemibold(16),NSForegroundColorAttributeName:UIColorFromRGB(0x9168FA)}];
[titleAtt appendAttributedString:phoneAtt];
self.phoneLabel.attributedText = titleAtt;
}

View File

@@ -30,7 +30,7 @@
#import "NetImageView.h"
#import "DJDKMIMOMColor.h"
#import "PLTimeUtil.h"
#import "XPSkillCardPlayerManager.h"
#import "YUMIMacroUitls.h"
#import <Masonry/Masonry.h>
@@ -208,9 +208,9 @@
self.currentModel = model;
self.currentMessage = message;
NSString * avatarUrl = [[NIMSDK sharedSDK].userManager userInfo:message.from].userInfo.avatarUrl;
avatarUrl = [avatarUrl stringByReplacingOccurrencesOfString:@"https" withString:@"http"];
BOOL isSelf = [[NIMSDK sharedSDK].loginManager.currentAccount isEqualToString:message.from];
if (isSelf) {
avatarUrl = [[[XPSkillCardPlayerManager shareInstance] userInfoModel] avatar];
self.leftAvatar.hidden = YES;
self.rightAvatar.hidden = NO;
[self.messageBackgroundLeft uninstall];

View File

@@ -363,6 +363,11 @@ NS_ASSUME_NONNULL_BEGIN
+(void)blockUser:(HttpRequestHelperCompletion)completion uid:(NSNumber *)uid hours:(NSNumber *)hours blockReason:(NSString *)blockReason;
+ (void)userDetailMine:(HttpRequestHelperCompletion)completion;
+ (void)userV2UploadAvatar:(HttpRequestHelperCompletion)completion avatarUrl:(NSString *)avatarUrl needPay:(NSNumber *)needPay;
+ (void)fansFriendList:(HttpRequestHelperCompletion)completion pageNo:(NSNumber *)pageNo pageSize:(NSNumber *)pageSize;
@end
NS_ASSUME_NONNULL_END

View File

@@ -295,6 +295,11 @@
[self makeRequest:fang method:HttpRequestHelperMethodGET completion:completion, __FUNCTION__, uids, nil];
}
+ (void)fansFriendList:(HttpRequestHelperCompletion)completion pageNo:(NSNumber *)pageNo pageSize:(NSNumber *)pageSize {
[self makeRequest:@"fans/friend/list" method:HttpRequestHelperMethodGET completion:completion,
__FUNCTION__, pageNo, pageSize, nil];
}
///
/// @param completion
/// @param uid uid
@@ -472,4 +477,13 @@
[self makeRequest:@"user/block" method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__, uid, hours, blockReason, nil];
}
+ (void)userDetailMine:(HttpRequestHelperCompletion)completion {
[self makeRequest:@"user/detail/mine" method:HttpRequestHelperMethodGET completion:completion, __FUNCTION__, nil];
}
+ (void)userV2UploadAvatar:(HttpRequestHelperCompletion)completion avatarUrl:(NSString *)avatarUrl needPay:(NSNumber *)needPay {
[self makeRequest:@"user/v2/uploadAvatar" method:HttpRequestHelperMethodPOST completion:completion,
__FUNCTION__, avatarUrl, needPay, nil];
}
@end

View File

@@ -10,6 +10,7 @@
NS_ASSUME_NONNULL_BEGIN
typedef NS_ENUM(NSInteger, XPMineSettingItemType){
XPMineSettingItemType_Email, ///邮箱
XPMineSettingItemType_Phone, ///手机号
XPMineSettingItemType_Pay_Password,///支付密码
///登录密码

View File

@@ -11,6 +11,7 @@ NS_ASSUME_NONNULL_BEGIN
@interface XPMineFriendPresenter : BaseMvpPresenter
- (void)getUserListInfo:(NSArray *)array;
- (void)getFriends:(NSInteger)page;
@end
NS_ASSUME_NONNULL_END

View File

@@ -23,4 +23,15 @@
}] uids:uids];
}
- (void)getFriends:(NSInteger)page {
@kWeakify(self);
[Api fansFriendList:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
@kStrongify(self);
[[self getView] getFriendsList:[UserInfoModel modelsWithArray:data.data]];
} fail:^(NSInteger code, NSString * _Nullable msg) {
@kStrongify(self);
[[self getView] getFriendsFailure];
} showLoading:NO errorToast:YES] pageNo:@(page) pageSize:@(20)];
}
@end

View File

@@ -28,6 +28,9 @@ NS_ASSUME_NONNULL_BEGIN
///获取个人中心banner
- (void)getMineBannerList;
- (void)visitUserPageSuccess:(void(^)(NSNumber *browseNum, NSNumber *friendCount, NSNumber *browseNumTip, NSNumber *visitListVipLimit))success failure:(void(^)(NSError *error))failure;
@end
NS_ASSUME_NONNULL_END

View File

@@ -129,4 +129,21 @@
} errorToast:NO] uid:uid type:@"10"];
}
- (void)visitUserPageSuccess:(void(^)(NSNumber *browseNum, NSNumber *friendCount, NSNumber *browseNumTip, NSNumber *visitListVipLimit))success
failure:(void(^)(NSError *error))failure {
[Api userDetailMine:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
if (success) {
NSNumber *browseNum = [data.data objectForKey:@"browseNum"];
NSNumber *friendCount = [data.data objectForKey:@"friendCount"];
NSNumber *browseNumTip = [data.data objectForKey:@"browseNumTip"];
NSNumber *vipLimit = [data.data objectForKey:@"visitListVipLimit"];
success(browseNum, friendCount, browseNumTip, vipLimit);
}
} fail:^(NSInteger code, NSString * _Nullable msg) {
if (failure) {
failure([NSError errorWithDomain:[NSString isEmpty:msg] ? @"" : msg code:code userInfo:nil]);
}
} showLoading:NO errorToast:NO]];
}
@end

View File

@@ -29,6 +29,7 @@
@interface XPMineSettingPresent ()
///
@property (nonatomic,strong) XPMineSettingItemModel *phoneItem;
@property (nonatomic,strong) XPMineSettingItemModel *emailItem;
///
@property (nonatomic,strong) XPMineSettingItemModel *payItem;
///
@@ -52,8 +53,14 @@
self.phoneItem.subTitle = userinfo.isBindPhone ? userinfo.phone : YMLocalizedString(@"XPMineSettingPresent0");
self.payItem.subTitle = userinfo.isBindPaymentPwd ? YMLocalizedString(@"XPMineSettingPresent26") : YMLocalizedString(@"XPMineSettingPresent2");
} else {
XPMineSettingItemModel *emailItem = [[XPMineSettingItemModel alloc] init];
emailItem.title = YMLocalizedString(@"20.20.51_text_13");
emailItem.subTitle = ![NSString isEmpty:userinfo.email] ? userinfo.email : YMLocalizedString(@"XPMineSettingPresent4");
emailItem.type = XPMineSettingItemType_Email;
self.emailItem = emailItem;
XPMineSettingItemModel * phoneItem = [[XPMineSettingItemModel alloc] init];
phoneItem.title = YMLocalizedString(@"XPMineSettingPresent3");
phoneItem.title = YMLocalizedString(@"20.20.51_text_14");
phoneItem.subTitle = userinfo.isBindPhone ? userinfo.phone : YMLocalizedString(@"XPMineSettingPresent4");
phoneItem.type = XPMineSettingItemType_Phone;
self.phoneItem = phoneItem;
@@ -125,10 +132,10 @@
vipItem.subTitle = @"";
vipItem.type = XPMineSettingItemType_VIP;
NSArray * oneSection = @[phoneItem];
NSArray * twoSection = @[loginItem, payItem, vipItem, notificaItem, shieldItem, blackListItem, languageItem];
NSArray * threeSection = @[privacyItem];
NSArray * fourthSection = @[helperItem, clearMemoryItem, updateItem, aboutusItem];
NSArray * oneSection = @[emailItem, phoneItem, loginItem, payItem];
NSArray * twoSection = @[vipItem, notificaItem, languageItem];
NSArray * threeSection = @[shieldItem, blackListItem];
NSArray * fourthSection = @[privacyItem, helperItem, clearMemoryItem, updateItem, aboutusItem];
self.datasouce = @[oneSection, twoSection, threeSection, fourthSection];
}
@@ -144,7 +151,7 @@
@kStrongify(self);
UserInfoModel * infoModel = [UserInfoModel modelWithDictionary:data.data];
[[self getView] onGetUserInfoSuccess:infoModel];
}] uid:uid];
} showLoading:YES] uid:uid];
}

View File

@@ -34,6 +34,11 @@ NS_ASSUME_NONNULL_BEGIN
-(void)getAreaList;
///保存地区列表
-(void)saveAreaConfigWithArea:(LocationModel *)area;
- (void)uploadAvatarV2:(NSString *)avatarPath needPay:(BOOL)needPay;
- (void)checkMoney:(void(^)(NSInteger currentMoney))success failure:(void(^)(NSString *message))failure;
@end
NS_ASSUME_NONNULL_END

View File

@@ -15,6 +15,7 @@
#import "XPMineUserInfoEditModel.h"
#import "UserInfoModel.h"
#import "LocationModel.h"
#import "WalletInfoModel.h"
///P
#import "XPMineUserInfoEditProtocol.h"
@interface XPMineUserInfoEditPresenter ()
@@ -52,6 +53,21 @@
}] uid:uid];
}
- (void)checkMoney:(void(^)(NSInteger currentMoney))success failure:(void(^)(NSString *message))failure {
NSString * uid = [AccountInfoStorage instance].getUid;
NSString * ticket = [[AccountInfoStorage instance] getTicket];
[Api getUserWalletInfo:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
if (success) {
WalletInfoModel * model = [WalletInfoModel modelWithDictionary:data.data];
success(model.diamonds);
}
} fail:^(NSInteger code, NSString * _Nullable msg) {
if (failure) {
failure(msg);
}
} showLoading:YES errorToast:YES] uid:uid ticket:ticket];
}
///
- (void)getUserInfoEditDataSourceWithUserInfo:(UserInfoModel *)userInfo {
///
@@ -163,6 +179,17 @@
[[self getView] saveAreaSuccess];
}showLoading:YES errorToast:YES] id:@(area.id).stringValue];
}
- (void)uploadAvatarV2:(NSString *)avatarPath needPay:(BOOL)needPay {
@kWeakify(self);
[Api userV2UploadAvatar:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
@kStrongify(self);
[[self getView] uploadGifAvatarSuccess:avatarPath];
} fail:^(NSInteger code, NSString * _Nullable msg) {
} showLoading:YES errorToast:YES] avatarUrl:avatarPath needPay:@(needPay)];
}
#pragma mark - Getters And Setters
- (XPMineUserInfoEditModel *)nickItem {
if (!_nickItem) {

View File

@@ -104,6 +104,7 @@
-(void)deleteSound{
@kWeakify(self);
[Api deleteSoundCardInfo:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
@kStrongify(self);
[[self getView]deleteSoundSuccess];
} showLoading:YES]];
}

View File

@@ -6,7 +6,7 @@
//
#import "BaseMvpPresenter.h"
#import "UserInfoModel.h"
NS_ASSUME_NONNULL_BEGIN
@interface XPMineVisitorPresenter : BaseMvpPresenter

View File

@@ -18,7 +18,7 @@
/// @param pageSize
- (void)getVisitorList:(int)page pageSize:(int)pageSize state:(int)state {
[Api getVisitorListCompletion:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
NSArray *array = [XPMineVisitorItemModel modelsWithArray:data.data];
NSArray *array = [UserInfoModel modelsWithArray:data.data];
[[self getView] onGetVisitorListSuccess:array state:state];
} fail:^(NSInteger code, NSString * _Nullable msg) {
[[self getView] getVisitorListFail:state];

View File

@@ -10,7 +10,10 @@
NS_ASSUME_NONNULL_BEGIN
@protocol XPMineFriendProtocol <NSObject>
@optional
- (void)getUserListInfoSuccess:(NSArray *)list;
- (void)getFriendsList:(NSArray *)list;
- (void)getFriendsFailure;
@end
NS_ASSUME_NONNULL_END

View File

@@ -23,6 +23,8 @@ NS_ASSUME_NONNULL_BEGIN
-(void)getAreaListSuccess:(NSArray *)list;
///保存地区列表
-(void)saveAreaSuccess;
- (void)uploadGifAvatarSuccess:(NSString *)url;
@end
NS_ASSUME_NONNULL_END

View File

@@ -6,7 +6,6 @@
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@protocol XPMineVisitorProtocol <NSObject>

View File

@@ -8,7 +8,7 @@
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@class XPMineVisitorTableViewCell, XPMineVisitorItemModel;
@class XPMineVisitorTableViewCell, XPMineVisitorItemModel, UserInfoModel;
@protocol XPMineVisitorTableViewCellDelegate <NSObject>
@@ -25,7 +25,7 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, assign) BOOL isFirstItem;
@property (nonatomic, assign) BOOL isLastItem;
@property (nonatomic, strong) XPMineVisitorItemModel *item;
@property (nonatomic, strong) UserInfoModel *item;
@property (nonatomic, weak) id<XPMineVisitorTableViewCellDelegate> delegate;

View File

@@ -12,17 +12,21 @@
#import "DJDKMIMOMColor.h"
#import "NetImageView.h"
#import "XPMineVisitorItemModel.h"
#import "UserInfoModel.h"
@interface XPMineVisitorTableViewCell()
@property (nonatomic, strong) UIView *bgView;
@property (nonatomic ,strong) NetImageView *avaterImgView;
@property (nonatomic, strong) UIButton *genderImageView;
@property(nonatomic, strong) UIStackView *nameStackView;
@property (nonatomic, strong) UIImageView *genderImageView;
@property (nonatomic, strong) UILabel *nickLabel;
@property(nonatomic, strong) NetImageView *regionImageView;
@property(nonatomic, strong) NetImageView *charmImageView;
@property(nonatomic, strong) NetImageView *experImageView;
@property(nonatomic, strong) NetImageView *nameplateImageView;
@property (nonatomic ,strong) UILabel *memberIdLabel;
@property (nonatomic ,strong) UIButton *tagPic;
@property (nonatomic ,strong) UILabel *timeLabel;
@property (nonatomic, strong) UIView *lineView;
@end
@@ -36,121 +40,78 @@
return self;
}
- (void)drawRect:(CGRect)rect {
if (self.isLastItem && self.isFirstItem) {
UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:self.bgView.bounds byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight | UIRectCornerBottomLeft | UIRectCornerBottomRight cornerRadii:CGSizeMake(12, 12)];
CAShapeLayer *maskLayer = [CAShapeLayer layer];
maskLayer.path = path.CGPath;
self.bgView.layer.mask = maskLayer;
} else if (self.isFirstItem) {
UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:self.bgView.bounds byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight cornerRadii:CGSizeMake(12, 12)];
CAShapeLayer *maskLayer = [CAShapeLayer layer];
maskLayer.path = path.CGPath;
self.bgView.layer.mask = maskLayer;
} else if (self.isLastItem) {
UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:self.bgView.bounds byRoundingCorners:UIRectCornerBottomLeft | UIRectCornerBottomRight cornerRadii:CGSizeMake(12, 12)];
CAShapeLayer *maskLayer = [CAShapeLayer layer];
maskLayer.path = path.CGPath;
self.bgView.layer.mask = maskLayer;
} else {
UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:self.bgView.bounds byRoundingCorners:UIRectCornerBottomLeft | UIRectCornerBottomRight cornerRadii:CGSizeMake(0, 0)];
CAShapeLayer *maskLayer = [CAShapeLayer layer];
maskLayer.path = path.CGPath;
self.bgView.layer.mask = maskLayer;
}
}
- (void)layoutSubviews {
[super layoutSubviews];
[self updateBgViewConstraints];
}
#pragma mark - lifeCycle
- (void)setUpUI {
self.backgroundColor = [UIColor clearColor];
self.selectionStyle = UITableViewCellSelectionStyleNone;
[self.contentView addSubview:self.bgView];
[self.bgView addSubview:self.avaterImgView];
[self.bgView addSubview:self.nickLabel];
[self.bgView addSubview:self.genderImageView];
[self.bgView addSubview:self.memberIdLabel];
[self.bgView addSubview:self.tagPic];
[self.bgView addSubview:self.timeLabel];
[self.bgView addSubview:self.lineView];
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onCliekAvatar:)];
[self.avaterImgView addGestureRecognizer:tap];
[self.contentView addSubview:self.avaterImgView];
UIView *spaceView = [[UIView alloc] init];
_nameStackView = [[UIStackView alloc] initWithArrangedSubviews:@[
self.nickLabel,
self.genderImageView,
self.regionImageView,
self.charmImageView,
self.experImageView,
self.nameplateImageView,
spaceView
]];
_nameStackView.spacing = 4;
_nameStackView.alignment = UIStackViewAlignmentCenter;
_nameStackView.distribution = UIStackViewDistributionFill;
[self.contentView addSubview:self.nameStackView];
[self.contentView addSubview:self.memberIdLabel];
[self.contentView addSubview:self.timeLabel];
}
#pragma mark - Constraints
- (void)setUpConstraints {
[self.bgView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(0);
make.trailing.mas_equalTo(-15);
make.leading.mas_equalTo(15);
make.height.mas_equalTo(70);
make.bottom.mas_equalTo(0);
}];
[self.avaterImgView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(25);
make.leading.mas_equalTo(15);
make.width.height.mas_equalTo(40);
make.centerY.mas_equalTo(self.bgView.mas_centerY);
make.width.height.mas_equalTo(56);
}];
[self.nickLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.leading.mas_equalTo(self.avaterImgView.mas_trailing).mas_offset(10);
make.bottom.mas_equalTo(self.avaterImgView.mas_centerY).mas_offset(-4);
[self.nameStackView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.avaterImgView).offset(-4);
make.leading.mas_equalTo(self.avaterImgView.mas_trailing).offset(6);
make.trailing.mas_equalTo(-8);
make.height.mas_equalTo(22);
}];
[self.genderImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.mas_equalTo(self.nickLabel.mas_centerY);
make.height.mas_equalTo(14);
make.width.mas_equalTo(28);
make.leading.mas_equalTo(self.nickLabel.mas_trailing).mas_offset(5);
make.trailing.mas_lessThanOrEqualTo(self.tagPic.mas_leading).mas_offset(-5);
make.width.mas_equalTo(14);
}];
[self.tagPic mas_makeConstraints:^(MASConstraintMaker *make) {
make.bottom.mas_equalTo(self.timeLabel.mas_top).mas_offset((-1));
make.trailing.mas_equalTo(-15);
make.width.height.mas_equalTo(22);
[self.regionImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(14);
make.width.mas_equalTo(18);
}];
[self.charmImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(18);
make.width.mas_equalTo(40);
}];
[self.experImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(18);
make.width.mas_equalTo(40);
}];
[self.nameplateImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(18);
make.width.mas_equalTo(40);
}];
[self.memberIdLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.avaterImgView.mas_centerY).mas_offset(4);
make.leading.mas_equalTo(self.nickLabel);
make.centerY.mas_equalTo(self.avaterImgView);
make.leading.mas_equalTo(self.nameStackView);
}];
[self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.trailing.mas_equalTo(-15);
make.centerY.mas_equalTo(self.memberIdLabel.mas_centerY);
make.height.mas_equalTo(11);
make.leading.mas_equalTo(self.nameStackView);
make.bottom.mas_equalTo(self.avaterImgView);
}];
[self.lineView mas_makeConstraints:^(MASConstraintMaker *make) {
make.bottom.mas_equalTo(0);
make.leading.mas_equalTo(self.avaterImgView);
make.trailing.mas_equalTo(-15);
make.height.mas_equalTo(0.5);
}];
}
- (void)updateBgViewConstraints {
if (self.isFirstItem) {
[self.bgView mas_updateConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(10);
make.trailing.mas_equalTo(-15);
make.leading.mas_equalTo(15);
make.height.mas_equalTo(70);
make.bottom.mas_equalTo(0);
}];
} else {
[self.bgView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(0);
make.trailing.mas_equalTo(-15);
make.leading.mas_equalTo(15);
make.height.mas_equalTo(70);
make.bottom.mas_equalTo(0);
}];
}
}
#pragma mark - event
@@ -175,36 +136,80 @@
_isLastItem = isLastItem;
}
- (void)setItem:(XPMineVisitorItemModel *)item {
- (void)setItem:(UserInfoModel *)item {
_item = item;
self.nickLabel.text = item.nick;
self.avaterImgView.imageUrl = item.avatar;
self.memberIdLabel.text = [NSString stringWithFormat:@"ID%zd", item.erbanNo];
self.timeLabel.text = item.visitTimeDesc;
self.timeLabel.text = [NSString stringWithFormat:YMLocalizedString(@"20.20.51_text_28"), item.visitTimeDesc];
[self.genderImageView setImage:item.gender == GenderType_Male ? kImage(@"common_male") : kImage(@"common_female")];
#if DEBUG
item.regionIcon = @"";
#endif
self.regionImageView.imageUrl = item.regionIcon;
self.regionImageView.hidden = [NSString isEmpty:item.regionIcon];
[self.genderImageView setTitle:[NSString getAgeWithBirth:_item.birth] forState:UIControlStateNormal];
self.genderImageView.backgroundColor = item.gender == GenderType_Male ? UIColorFromRGB(0x6BB3FF) :UIColorFromRGB(0xFF80CC);
self.genderImageView.selected = item.gender != GenderType_Male;
self.genderImageView.titleEdgeInsets = item.gender != GenderType_Male ? UIEdgeInsetsMake(0, 2, 0, 0):UIEdgeInsetsMake(0, -1, 0, 0);
if (item.userLevelVo) {
self.experImageView.hidden = NO;
self.charmImageView.hidden = NO;
self.experImageView.imageUrl = item.userLevelVo.experUrl;
self.charmImageView.imageUrl = item.userLevelVo.charmUrl;
}else {
self.experImageView.hidden = YES;
self.charmImageView.hidden = YES;
}
if (item.userVipInfoVO) {
self.nameplateImageView.hidden = NO;
self.nameplateImageView.imageUrl = item.userVipInfoVO.nameplateUrl;
}else {
self.nameplateImageView.hidden = YES;
}
}
- (NetImageView *)avaterImgView {
if (!_avaterImgView) {
_avaterImgView = [[NetImageView alloc] init];
_avaterImgView.contentMode = UIViewContentModeScaleAspectFit;
_avaterImgView.layer.cornerRadius = 20;
_avaterImgView.layer.masksToBounds = YES;
_avaterImgView.userInteractionEnabled = YES;
_avaterImgView.contentMode = UIViewContentModeScaleAspectFill;
[_avaterImgView setCornerRadius:56/2];
}
return _avaterImgView;
}
- (UIView *)bgView {
if (!_bgView) {
_bgView = [[UIView alloc] init];
_bgView.backgroundColor = UIColorFromRGB(0xFFFFFF);
- (NetImageView *)regionImageView {
if (!_regionImageView) {
_regionImageView = [[NetImageView alloc] init];
_regionImageView.contentMode = UIViewContentModeScaleAspectFit;
[_regionImageView setContentCompressionResistancePriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal];
[_regionImageView setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal];
}
return _bgView;
return _regionImageView;
}
- (NetImageView *)charmImageView {
if (!_charmImageView) {
_charmImageView = [[NetImageView alloc] init];
_charmImageView.contentMode = UIViewContentModeScaleAspectFit;
[_charmImageView setContentCompressionResistancePriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal];
[_charmImageView setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal];
}
return _charmImageView;
}
- (NetImageView *)experImageView {
if (!_experImageView) {
_experImageView = [[NetImageView alloc] init];
_experImageView.contentMode = UIViewContentModeScaleAspectFit;
[_experImageView setContentCompressionResistancePriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal];
[_experImageView setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal];
}
return _experImageView;
}
- (NetImageView *)nameplateImageView {
if (!_nameplateImageView) {
_nameplateImageView = [[NetImageView alloc] init];
_nameplateImageView.contentMode = UIViewContentModeScaleAspectFit;
[_nameplateImageView setContentCompressionResistancePriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal];
[_nameplateImageView setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal];
}
return _nameplateImageView;
}
- (UILabel *)nickLabel {
@@ -213,20 +218,17 @@
_nickLabel.textColor = UIColorFromRGB(0x333333);
_nickLabel.font = [UIFont systemFontOfSize:13];
_nickLabel.text = YMLocalizedString(@"XPMineVisitorTableViewCell0");
_nickLabel.translatesAutoresizingMaskIntoConstraints = NO;
[_nickLabel setContentCompressionResistancePriority:UILayoutPriorityDefaultLow forAxis:UILayoutConstraintAxisHorizontal];
[_nickLabel setContentHuggingPriority:UILayoutPriorityDefaultLow forAxis:UILayoutConstraintAxisHorizontal];
}
return _nickLabel;
}
- (UIButton *)genderImageView {
- (UIImageView *)genderImageView {
if (!_genderImageView) {
_genderImageView = [[UIButton alloc] init];
[_genderImageView setImage:kImage(@"home_age_boy_icon") forState:UIControlStateNormal];
[_genderImageView setImage:kImage(@"home_age_girl_icon") forState:UIControlStateSelected];
_genderImageView.titleLabel.font = [UIFont systemFontOfSize:10 weight:UIFontWeightMedium];
[_genderImageView setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
_genderImageView.imageEdgeInsets = UIEdgeInsetsMake(0, 0, 0, 0);
_genderImageView.layer.cornerRadius = 14/2;
_genderImageView.layer.masksToBounds = YES;
_genderImageView = [[UIImageView alloc] init];
_genderImageView.contentMode = UIViewContentModeScaleAspectFill;
}
return _genderImageView;
}
@@ -234,38 +236,21 @@
- (UILabel *)memberIdLabel {
if (!_memberIdLabel) {
_memberIdLabel = [[UILabel alloc] init];
_memberIdLabel.textColor = UIColorFromRGB(0x999999);
_memberIdLabel.font = [UIFont systemFontOfSize:13];
_memberIdLabel.textColor = UIColorFromRGB(0x7b7b7d);
_memberIdLabel.font = kFontRegular(13);
_memberIdLabel.text = @"";
}
return _memberIdLabel;
}
- (UIButton *)tagPic {
if (!_tagPic) {
_tagPic = [[UIButton alloc] init];
[_tagPic setImage:[UIImage imageNamed:@"visitor_record_letter"] forState:UIControlStateNormal];
[_tagPic addTarget:self action:@selector(onChatButtonClick:) forControlEvents:UIControlEventTouchUpInside];
}
return _tagPic;
}
- (UILabel *)timeLabel {
if (!_timeLabel) {
_timeLabel = [[UILabel alloc] init];
_timeLabel.text = @"0";
_timeLabel.textColor = UIColorFromRGB(0x999999);
_timeLabel.font = [UIFont boldSystemFontOfSize:10];
_timeLabel.text = @"";
_timeLabel.textColor = UIColorFromRGB(0x7b7b7d);
_timeLabel.font = kFontRegular(13);
}
return _timeLabel;
}
- (UIView *)lineView {
if (!_lineView) {
_lineView = [[UIView alloc] init];
_lineView.backgroundColor = UIColorFromRGB(0xf5f5f5);
}
return _lineView;
}
@end

View File

@@ -13,6 +13,8 @@ NS_ASSUME_NONNULL_BEGIN
///数据源
@property (nonatomic,strong) XPMineSettingItemModel *itemModel;
- (void)setTopCorner:(BOOL)setTop bottomCorner:(BOOL)setBottom;
@end
NS_ASSUME_NONNULL_END

View File

@@ -22,6 +22,9 @@
@property (nonatomic,strong) UILabel *subTitleLabel;
///
@property (nonatomic,strong) UIImageView *arrowImageView;
@property(nonatomic, strong) UIView *line;
@end
@implementation XPMineSettingTableViewCell
@@ -37,13 +40,15 @@
#pragma mark - Private Method
- (void)initSubViews {
self.contentView.backgroundColor = [DJDKMIMOMColor appCellBackgroundColor];
self.contentView.backgroundColor = UIColorFromRGB(0xf2f3f7);
self.selectionStyle = UITableViewCellSelectionStyleNone;
[self.contentView addSubview:self.stackView];
[self.stackView addArrangedSubview:self.titleLabel];
[self.stackView addArrangedSubview:self.subTitleLabel];
[self.stackView addArrangedSubview:self.arrowImageView];
[self.contentView addSubview:self.line];
}
- (void)initSubViewConstraints {
@@ -52,6 +57,23 @@
make.top.bottom.mas_equalTo(self.contentView);
}];
[self.line mas_makeConstraints:^(MASConstraintMaker *make) {
make.leading.trailing.mas_equalTo(self.contentView).inset(15);
make.height.mas_equalTo(0.5);
make.bottom.mas_equalTo(self.contentView);
}];
}
- (void)setTopCorner:(BOOL)setTop bottomCorner:(BOOL)setBottom {
self.line.hidden = NO;
if (setTop) {
[self setCornerRadius:8 corners:kCALayerMinXMinYCorner | kCALayerMaxXMinYCorner];
} else if (setBottom) {
self.line.hidden = YES;
[self setCornerRadius:8 corners:kCALayerMinXMaxYCorner | kCALayerMaxXMaxYCorner];
} else {
[self setCornerRadius:0 corners:kCALayerMinXMaxYCorner | kCALayerMaxXMaxYCorner | kCALayerMinXMinYCorner | kCALayerMaxXMinYCorner];
}
}
#pragma mark - Getters And Setters
@@ -75,8 +97,8 @@
- (UILabel *)titleLabel {
if (!_titleLabel) {
_titleLabel = [[UILabel alloc] init];
_titleLabel.font = [UIFont systemFontOfSize:16];
_titleLabel.textColor = [DJDKMIMOMColor secondTextColor];
_titleLabel.font = kFontRegular(14);
_titleLabel.textColor = UIColorFromRGB(0x313131);
[_titleLabel setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal];
}
return _titleLabel;
@@ -84,8 +106,8 @@
- (UILabel *)subTitleLabel {
if (!_subTitleLabel) {
_subTitleLabel = [[UILabel alloc] init];
_subTitleLabel.font = [UIFont systemFontOfSize:12];
_subTitleLabel.textColor = [DJDKMIMOMColor textThirdColor];
_subTitleLabel.font = kFontRegular(14);
_subTitleLabel.textColor = UIColorFromRGB(0x7b7b7d);
_subTitleLabel.textAlignment = NSTextAlignmentRight;
}
return _subTitleLabel;
@@ -103,4 +125,12 @@
}
- (UIView *)line {
if (!_line) {
_line = [[UIView alloc] init];
_line.backgroundColor = UIColorFromRGB(0xe4e4e4);
}
return _line;
}
@end

Some files were not shown because too many files have changed in this diff Show More