完成 2.7.32 需求

This commit is contained in:
edwinQQQ
2025-03-21 16:19:07 +08:00
parent d6e13ac0fe
commit e27b564fdc
126 changed files with 16692 additions and 60702 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

@@ -24,7 +24,8 @@
#import "SessionViewController.h"
#import "LoginFullInfoViewController.h"
#import "UIView+VAP.h"
//@import Firebase;
#import "SocialShareManager.h"
UIKIT_EXTERN NSString * const kOpenRoomNotification;
@interface AppDelegate ()<IMLSDKRestoreDelegate>
@@ -75,7 +76,6 @@ void qg_VAP_Logger_handler(VAPLogLevel level, const char* file, int line, const
[self loadMainPage];
[self setupLaunchADView];
});
}];
return YES;
@@ -89,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];
}
@@ -200,49 +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;
}
}
[[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,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" : [
{
"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" : [
{
"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

@@ -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

@@ -91,7 +91,7 @@ NS_ASSUME_NONNULL_BEGIN
+ (void)emailGetCode:(HttpRequestHelperCompletion)completion emailAddress:(NSString *)emailAddress type:(NSNumber *)type;
+ (void)emailLogin:(HttpRequestHelperCompletion)completion emailAddress:(NSString *)emailAddress code:(NSNumber *)code;
+ (void)emailVerify:(HttpRequestHelperCompletion)completion emailAddress:(NSString *)emailAddress code:(NSString *)code;
+ (void)loginWithCode:(HttpRequestHelperCompletion)completion
@@ -102,6 +102,16 @@ NS_ASSUME_NONNULL_BEGIN
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
@@ -108,7 +112,7 @@
}
+ (void)emailLogin:(HttpRequestHelperCompletion)completion emailAddress:(NSString *)emailAddress code:(NSNumber *)code {
+ (void)emailVerify:(HttpRequestHelperCompletion)completion emailAddress:(NSString *)emailAddress code:(NSString *)code {
[self makeRequest:@"email/verify"
method:HttpRequestHelperMethodPOST
completion:completion, __FUNCTION__, emailAddress, code, nil];
@@ -125,4 +129,21 @@
[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

@@ -56,7 +56,17 @@ NS_ASSUME_NONNULL_BEGIN
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];
@@ -245,11 +247,10 @@
@kWeakify(self);
[Api phoneSmsCode:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
@kStrongify(self);
if ([[self getView] respondsToSelector:@selector(phoneSmsCodeSuccess:)]) {
if ([[self getView] respondsToSelector:@selector(phoneSmsCodeSuccess:type:)]) {
NSString *message = data.message;
[[self getView] phoneSmsCodeSuccess:message];
[[self getView] phoneSmsCodeSuccess:message type:type];
}
} fail:^(NSInteger code, NSString * _Nullable msg) {
@kStrongify(self);
if ([[self getView] respondsToSelector:@selector(phoneSmsCodeFailure)]) {
@@ -274,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
@@ -293,7 +294,7 @@
} fail:^(NSInteger code, NSString * _Nullable msg) {
@kStrongify(self);
[[self getView] loginFailWithMsg:msg];
} showLoading:YES 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"];
}
///
@@ -342,8 +343,8 @@
@kWeakify(self);
[Api emailGetCode:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
@kStrongify(self);
if ([[self getView] respondsToSelector:@selector(emailCodeSucess:)]) {
[[self getView] emailCodeSucess:@""];
if ([[self getView] respondsToSelector:@selector(emailCodeSucess:type:)]) {
[[self getView] emailCodeSucess:@"" type:type];
}
} fail:^(NSInteger code, NSString * _Nullable msg) {
@kStrongify(self);
@@ -372,10 +373,90 @@
} errorToast:NO]
email:desMail
code:code
client_secret:@"uyzjdhds"
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

@@ -13,16 +13,30 @@ NS_ASSUME_NONNULL_BEGIN
@optional
- (void)loginThirdPartSuccess;
- (void)loginSuccess;
- (void)emailCodeSucess:(NSString *)message;
- (void)emailCodeSucess:(NSString *)message type:(GetSmsType)type;
- (void)emailCodeFailure;
///请求手机号的验证码成功
- (void)phoneSmsCodeSuccess:(NSString *)message;
- (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

@@ -6,7 +6,7 @@
//
#import "MvpViewController.h"
@class UserInfoModel;
NS_ASSUME_NONNULL_BEGIN
typedef NS_ENUM(NSUInteger, BindingDisplayType) {
@@ -17,7 +17,9 @@ typedef NS_ENUM(NSUInteger, BindingDisplayType) {
@interface AccountBindingViewController : MvpViewController
- (instancetype)initWithType:(BindingDisplayType)type
currentBindingAccount:(NSString *)account;
currentBindingAccount:(NSString *)account
areaCode:(NSString *)areaCode
userInfo:(UserInfoModel *)userInfo;
@end

View File

@@ -10,25 +10,40 @@
#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>
@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 {
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;
}
@@ -82,6 +97,7 @@
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
@@ -114,45 +130,251 @@
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];
self.secondLineInputView = [[LoginInputItemView alloc] initWithType:LoginInputType_verificationCode];
} else {
self.firstLineInputView = [[LoginInputItemView alloc] initWithType:LoginInputType_phoneNum];
self.secondLineInputView = [[LoginInputItemView alloc] initWithType:LoginInputType_verificationCode];
}
[self.stackView addArrangedSubview:self.firstLineInputView];
[self.stackView addArrangedSubview:self.secondLineInputView];
[self.firstLineInputView updateBGColor:UIColorFromRGB(0xf2f3f7)];
} else {
if (self.type == BindingDisplayType_email) {
self.secondLineInputView = [[LoginInputItemView alloc] initWithType:LoginInputType_verificationCode];
} else {
self.secondLineInputView = [[LoginInputItemView alloc] initWithType:LoginInputType_verificationCode];
[self.firstLineInputView setHandleItemAction:^(LoginInputType inputType) {
@kStrongify(self);
if (inputType == LoginInputType_phoneNum) {
[self handleTapAreaCode];
}
[self.stackView addArrangedSubview:self.secondLineInputView];
}];
[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.stackView addArrangedSubview:self.bottomActionButton];
[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)didTapActionButton {
- (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 -
@@ -170,7 +392,7 @@
if (!_bottomActionButton) {
_bottomActionButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_bottomActionButton setCornerRadius:23];
[_bottomActionButton setTitle:YMLocalizedString(@"XPLoginPhoneViewController8") forState:UIControlStateNormal];
[_bottomActionButton setTitle:YMLocalizedString(@"XPAnchorAudienceUpMicView2") forState:UIControlStateNormal];
[_bottomActionButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
UIImage *normalBG = [UIImage gradientColorImageFromColors:@[
UIColorFromRGB(0xe29030),

View File

@@ -26,14 +26,7 @@ typedef NS_ENUM(NSUInteger, LoginInputType) {
@interface LoginInputItemView : UIView
@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) UIButton *verificationCodeButton;
@property(nonatomic, assign) NSInteger verificationCountDown;
@property(nonatomic, strong) NSTimer *verificationTimer;
@property(nonatomic, copy) void(^handleItemAction)(LoginInputType inputType);
@property(nonatomic, copy) void(^handleFirstInputContentUpdate)(NSString *inputContent);
@@ -48,6 +41,8 @@ typedef NS_ENUM(NSUInteger, LoginInputType) {
- (void)endVerificationCountDown;
- (void)updateBGColor:(UIColor *)color;
- (void)displayKeyboard;
@end
NS_ASSUME_NONNULL_END

View File

@@ -11,18 +11,30 @@ 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;
@@ -34,30 +46,28 @@ static NSString *const kAreaCodePrefix = @"+";
case LoginInputType_id: {
[self updatePlaceholder:YMLocalizedString(@"20.20.51_text_3")];
self.inputTextField.keyboardType = UIKeyboardTypeNumberPad;
#if DEBUG
self.inputTextField.text = @"2356814";
#endif
}
break;
case LoginInputType_email: {
[self updatePlaceholder:YMLocalizedString(@"20.20.51_text_4")];
self.inputTextField.keyboardType = UIKeyboardTypeEmailAddress;
#if DEBUG
self.inputTextField.text = @"exzero@126.com";
#endif
}
break;
case LoginInputType_phoneNum: {
[self updatePlaceholder:YMLocalizedString(@"20.20.51_text_5")];
[self updatePlaceholder:YMLocalizedString(@"XPMineResetLoginPwdViewController1")];
self.inputTextField.keyboardType = UIKeyboardTypePhonePad;
}
break;
case LoginInputType_password: {
[self updatePlaceholder:YMLocalizedString(@"20.20.51_text_6")];
[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")];
@@ -67,7 +77,6 @@ static NSString *const kAreaCodePrefix = @"+";
case LoginInputType_confirmPassword: {
[self updatePlaceholder:YMLocalizedString(@"20.20.51_text_11")];
self.inputTextField.keyboardType = UIKeyboardTypeDefault;
self.inputTextField.secureTextEntry = YES;
}
break;
default:
@@ -88,14 +97,25 @@ static NSString *const kAreaCodePrefix = @"+";
switch (self.inputType) {
case LoginInputType_id:
case LoginInputType_email:
case LoginInputType_password:
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) {
@@ -127,7 +147,24 @@ static NSString *const kAreaCodePrefix = @"+";
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 {
@@ -136,6 +173,21 @@ static NSString *const kAreaCodePrefix = @"+";
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);
}];
}
@@ -144,14 +196,15 @@ static NSString *const kAreaCodePrefix = @"+";
}
- (void)updateAreaCode:(NSString *)code {
if (_areaCodeButton) {
[self.areaCodeButton setTitle:[NSString stringWithFormat:@"%@%@", kAreaCodePrefix, code]
forState:UIControlStateNormal];
}
self.areaLabel.text = [NSString stringWithFormat:@"%@%@", kAreaCodePrefix, code];
// if (_areaCodeButton) {
// [self.areaCodeButton setTitle:[NSString stringWithFormat:@"%@%@", kAreaCodePrefix, code]
// forState:UIControlStateNormal];
// }
}
- (NSString *)loadAreaCode {
NSString *code = [[self.areaCodeButton titleLabel] text];
NSString *code = [self.areaLabel text];
if ([code hasPrefix:kAreaCodePrefix]) {
[code stringByReplacingOccurrencesOfString:kAreaCodePrefix
withString:@""];
@@ -173,7 +226,6 @@ static NSString *const kAreaCodePrefix = @"+";
- (void)endVerificationCountDown {
if (_verificationTimer) {
[self.verificationTimer invalidate];
self.verificationTimer = nil;
}
self.verificationCodeButton.enabled = YES;
}
@@ -182,6 +234,10 @@ static NSString *const kAreaCodePrefix = @"+";
self.backgroundColor = color;
}
- (void)displayKeyboard {
[self.inputTextField becomeFirstResponder];
}
#pragma mark -
- (void)handleVerificationCountDown {
if (_handleItemAction) {
@@ -212,6 +268,11 @@ static NSString *const kAreaCodePrefix = @"+";
}
}
- (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];
@@ -252,21 +313,19 @@ static NSString *const kAreaCodePrefix = @"+";
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.titleLabel setFont:kFontMedium(14)];
[_areaCodeButton setTitle:[NSString getCountryCode] forState:UIControlStateNormal];
[_areaCodeButton setTitleColor:UIColorFromRGB(0x313131) forState:UIControlStateNormal];
[_areaCodeButton setImage:kImage(@"login_page_area_arrow") forState:UIControlStateNormal];
[_areaCodeButton addTarget:self
action:@selector(didTapAreaButton)
forControlEvents:UIControlEventTouchUpInside];
if (isMSRTL()) {
[_areaCodeButton setSemanticContentAttribute:UISemanticContentAttributeForceRightToLeft];
} else {
[_areaCodeButton setSemanticContentAttribute:UISemanticContentAttributeForceLeftToRight];
}
}
return _areaCodeButton;
}
@@ -285,5 +344,16 @@ static NSString *const kAreaCodePrefix = @"+";
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

@@ -19,8 +19,12 @@ typedef NS_ENUM(NSUInteger, LoginDisplayType) {
@interface LoginTypesViewController : MvpViewController
@property(nonatomic, assign) BOOL isLogoutAfterRestPassword;
- (void)updateLoginType:(LoginDisplayType)type;
@end
NS_ASSUME_NONNULL_END

View File

@@ -10,6 +10,7 @@
#import "XPLoginAraeViewController.h"
#import "LoginProtocol.h"
#import "PILoginManager.h"
#import "XPWebViewController.h"
@interface LoginTypesViewController () <XPLoginAraeViewControllerDelegate, LoginProtocol>
@@ -21,6 +22,8 @@
@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
@@ -54,8 +57,13 @@
[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 {
@@ -82,6 +90,10 @@
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 {
@@ -107,6 +119,11 @@
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:
@@ -139,7 +156,7 @@
}
- (void)setupForgotPasswordArea {
[self setupInpuArea:LoginInputType_phoneNum
[self setupInpuArea:self.type==LoginDisplayType_email_forgetPassword ? LoginInputType_email : LoginInputType_phoneNum
second:LoginInputType_verificationCode
third:LoginInputType_confirmPassword
action:LoginInputType_confirm
@@ -153,7 +170,6 @@
showForgetPassword:(BOOL)showForgetPassword {
@kWeakify(self);
_firstLineInputView = [[LoginInputItemView alloc] initWithType:first];
[self.firstLineInputView setHandleItemAction:^(LoginInputType inputType) {
@kStrongify(self);
@@ -174,9 +190,9 @@
[self.secondLineInputView setHandleItemAction:^(LoginInputType inputType) {
@kStrongify(self);
if (inputType == LoginInputType_verificationCode) {
if (self.type == LoginDisplayType_phoneNum) {
if (self.type == LoginDisplayType_phoneNum || self.type == LoginDisplayType_phoneNum_forgetPassword) {
[self handleTapGetPhoneVerificationCode];
} else if (self.type == LoginDisplayType_email) {
} else if (self.type == LoginDisplayType_email || self.type == LoginDisplayType_email_forgetPassword) {
[self handleTapGetMailVerificationCode];
}
}
@@ -200,25 +216,40 @@
[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) {
[_bottomActionButton setTitle:YMLocalizedString(@"XPLoginPhoneViewController8") forState:UIControlStateNormal];
[_bottomActionButton setTitle:YMLocalizedString(@"XPLoginPhoneViewController8") forState:UIControlStateDisabled];
[self.bottomActionButton setTitle:YMLocalizedString(@"XPLoginPhoneViewController8") forState:UIControlStateNormal];
[self.bottomActionButton setTitle:YMLocalizedString(@"XPLoginPhoneViewController8") forState:UIControlStateDisabled];
} else if (action == LoginInputType_confirm) {
[_bottomActionButton setTitle:YMLocalizedString(@"20.20.51_text_10") forState:UIControlStateNormal];
[_bottomActionButton setTitle:YMLocalizedString(@"20.20.51_text_10") forState:UIControlStateDisabled];
[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);
}];
}
if (showForgetPassword) {
[self.stackView addArrangedSubview:self.forgotPasswordButton];
}
}
#pragma mark -
@@ -245,7 +276,20 @@
[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;
}
@@ -254,7 +298,15 @@
- (void)didTapForgotPasswordButton {
LoginTypesViewController *vc = [[LoginTypesViewController alloc] init];
[self.navigationController pushViewController:vc animated:YES];
[vc updateLoginType:LoginDisplayType_phoneNum_forgetPassword];
[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 {
@@ -270,17 +322,20 @@
[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 showErrorToast:YMLocalizedString(@"20.20.51_text_12")];
[self.secondLineInputView endVerificationCountDown];
return;
}
@@ -318,6 +373,31 @@
}
}
- (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];
@@ -329,28 +409,52 @@
}
- (void)loginFailWithMsg:(NSString *)msg {
[self showSuccessToast:msg];
}
#pragma mark - API presenter Delegate
- (void)phoneSmsCodeSuccess:(NSString *)message {
- (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 {
- (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];
@@ -406,6 +510,7 @@
[_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];
@@ -418,10 +523,20 @@
_stackView = [[UIStackView alloc] init];
_stackView.axis = UILayoutConstraintAxisVertical;
_stackView.spacing = 24;
_stackView.distribution = UIStackViewDistributionFillEqually;
_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

@@ -79,11 +79,19 @@ typedef NS_ENUM(NSUInteger, LoginType) {
}];
[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 {
@@ -109,14 +117,19 @@ typedef NS_ENUM(NSUInteger, LoginType) {
}
- (void)setupBottomPolicy {
UIStackView *stackView = [[UIStackView alloc] initWithArrangedSubviews:@[
self.agreeButton,
self.policyLabel
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);
}];
@@ -281,6 +294,8 @@ typedef NS_ENUM(NSUInteger, LoginType) {
#pragma mark - Polisy Status
- (void)loadPolicySelectedStatus {
// YES
[self updatePolicySelectedStatus:YES];
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
self.lastPolicySelectedStatus = [defaults boolForKey:HadAgreePrivacy];
self.agreeButton.selected = self.lastPolicySelectedStatus;
@@ -318,6 +333,7 @@ typedef NS_ENUM(NSUInteger, LoginType) {
// if (hadAgree.length > 0) {
// _agreeBtn.selected = YES;
// }
_agreeButton.selected = YES;
}
return _agreeButton;
}

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,879 +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;
}
- (instancetype)init
{
self = [super init];
if (self) {
}
return self;
}
- (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));
}];
[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];
[self showSuccessToast:YMLocalizedString(@"XPLoginPhoneViewController1")];
[PILoginManager loginWithVC:self isLoginPhone:YES];
}
- (void)loginSuccess {
[self.codeInputView cancelTimer];
[XNDJTDDLoadingTool hideOnlyView:self.view];
[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

@@ -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

@@ -59,7 +59,6 @@
emailItem.type = XPMineSettingItemType_Email;
self.emailItem = emailItem;
XPMineSettingItemModel * phoneItem = [[XPMineSettingItemModel alloc] init];
phoneItem.title = YMLocalizedString(@"20.20.51_text_14");
phoneItem.subTitle = userinfo.isBindPhone ? userinfo.phone : YMLocalizedString(@"XPMineSettingPresent4");
@@ -133,10 +132,10 @@
vipItem.subTitle = @"";
vipItem.type = XPMineSettingItemType_VIP;
NSArray * oneSection = @[emailItem, 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];
}
@@ -152,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

View File

@@ -17,6 +17,7 @@ NS_ASSUME_NONNULL_BEGIN
@end
@interface XPMineFriendViewController : MvpViewController<JXPagerViewListViewDelegate,JXCategoryListContentViewDelegate>
@property(nonatomic, assign) BOOL isFromMineTab;
///类型
@property (nonatomic,assign) ContactUseingType type;
///背景色是否为透明

View File

@@ -18,6 +18,7 @@
#import "XPMineFriendEmptyTableViewCell.h"
#import "XPMineFriendTableViewCell.h"
#import "SessionViewController.h"
#import "XPMineUserInfoViewController.h"
///P
#import "XPMineFriendPresenter.h"
#import "XPMineFriendProtocol.h"
@@ -26,7 +27,7 @@
///
@property (nonatomic,strong) UITableView *tableView;
///
@property (nonatomic,strong) NSArray *datasource;
@property (nonatomic,strong) NSMutableArray *datasource;
///
@property (nonatomic,assign) int page;
///
@@ -46,18 +47,23 @@
- (void)viewDidLoad {
[super viewDidLoad];
NSArray * array = [[NIMSDK sharedSDK].userManager myFriends];
if (array.count > 0) {
NSMutableArray * uids = [NSMutableArray array];
for (int i = 0; i< array.count; i++) {
NIMUser * user = [array xpSafeObjectAtIndex:i];
[uids addObject:user.userId];
}
[self.presenter getUserListInfo:uids];
}
self.title = YMLocalizedString(@"XPTreasureFairyFriendView0");
self.datasource = @[].mutableCopy;
[self initSubViews];
[self initSubViewConstraints];
[self addRefreshControl];
[self addLoadControl];
self.page = 1;
if (self.isHiddenNavBar) {
[self loadData];
}else {
[self.tableView.mj_header beginRefreshing];
}
}
#pragma mark - Private Method
- (void)initSubViews {
if (self.isClearColor){
@@ -73,6 +79,55 @@
make.edges.mas_equalTo(self.view);
}];
}
- (void)addRefreshControl {
MJRefreshNormalHeader *header = [MJRefreshNormalHeader headerWithRefreshingTarget:self refreshingAction:@selector(handlePullToRefresh)];
header.stateLabel.font = [UIFont systemFontOfSize:10.0];
header.lastUpdatedTimeLabel.font = [UIFont systemFontOfSize:10.0];
header.stateLabel.textColor = [DJDKMIMOMColor secondTextColor];
header.lastUpdatedTimeLabel.textColor = [DJDKMIMOMColor secondTextColor];
self.tableView.mj_header = header;
}
- (void)addLoadControl {
MJRefreshBackNormalFooter *footer = [MJRefreshBackNormalFooter footerWithRefreshingTarget:self refreshingAction:@selector(footerRefresh)];
footer.stateLabel.textColor = [DJDKMIMOMColor secondTextColor];
footer.stateLabel.font = [UIFont systemFontOfSize:10.0];
self.tableView.mj_footer = footer;
}
- (void)handlePullToRefresh {
self.page = 1;
[self loadData];
[self.tableView.mj_footer resetNoMoreData];
}
- (void)footerRefresh {
self.page += 1;
[self loadData];
}
- (void)loadData {
[self.presenter getFriends:self.page];
}
- (void)getFriendsList:(NSArray *)list {
if (self.page == 1) {
self.datasource = list.mutableCopy;
} else {
[self.datasource addObjectsFromArray:list];
}
[self.tableView reloadData];
[self.tableView.mj_header endRefreshing];
[self.tableView.mj_footer endRefreshing];
}
- (void)getFriendsFailure {
[self.tableView.mj_header endRefreshing];
[self.tableView.mj_footer endRefreshing];
}
#pragma mark - UITableViewDelegate And UITableViewDataSource
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return self.datasource.count > 0 ? self.datasource.count : 1;
@@ -82,7 +137,6 @@
return self.datasource.count > 0 ? 92 : self.type == ContactUseingType_In_Room ? (KScreenHeight - kNavigationHeight) : (KScreenHeight - 200 - kNavigationHeight);
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
if (self.datasource.count > 0) {
XPMineFriendTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMineFriendTableViewCell class])];
@@ -105,6 +159,11 @@
[tableView deselectRowAtIndexPath:indexPath animated:YES];
if (self.datasource.count > 0) {
UserInfoModel * userInfo = [self.datasource xpSafeObjectAtIndex:indexPath.row];
if (self.isFromMineTab) {
XPMineUserInfoViewController * userInfoVC = [[XPMineUserInfoViewController alloc] init];
userInfoVC.uid = userInfo.uid;
[self.navigationController pushViewController:userInfoVC animated:YES];
}else {
if (self.type == ContactUseingType_Share) {
if (self.delegate && [self.delegate respondsToSelector:@selector(xPMineFriendViewController:didSelectItem:)]) {
[self.delegate xPMineFriendViewController:self didSelectItem:userInfo];
@@ -122,16 +181,15 @@
[self.mainController.view addSubview:sessionVC.view];
} else {
SessionViewController * sessionVC = [[SessionViewController alloc] initWithSession:[NIMSession session:[NSString stringWithFormat:@"%ld", userInfo.uid] type:NIMSessionTypeP2P]];
if (self.type == ContactUseingType_Normal) {
sessionVC.openType = SessionListOpenTypeRoom;
} else {
sessionVC.openType = self.type == ContactUseingType_In_Session ? SessionListOpenTypeDefault : SessionListOpenTypeRoom;
}
[self.navigationController pushViewController:sessionVC animated:YES];
}
}
}
#pragma mark - XPMineFriendProtocol
- (void)getUserListInfoSuccess:(NSArray *)list {
self.datasource = list;
[self.tableView reloadData];
}
}
#pragma mark - JXCategoryListContentViewDelegate

View File

@@ -21,12 +21,15 @@
return ((id<XPIncomeRecordProtocol>) [super getView]);
}
-(void)requestQueryWithRoomType{
@kWeakify(self);
[Api requestQueryWithRoomType:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
@kStrongify(self);
XPIncomeRecordModel *model = [XPIncomeRecordModel modelWithDictionary:data.data];
[[self getView]getRecordIncomeSuccess:model];
}fail:^(NSInteger code, NSString * _Nullable msg) {
@kStrongify(self);
[[self getView]requestQueryWithRoomTypeFail];
} showLoading:NO errorToast:NO]];
} showLoading:YES errorToast:NO]];
}
-(void)requestRecordIncome{
[Api requestRecordIncome:[self createHttpCompletion:^(BaseModel * _Nonnull data) {

View File

@@ -14,6 +14,7 @@
@interface XPExchangeDiamondsView()
@property (nonatomic,strong) XPExchangeDiamondsItemView *myGoldView;
@property (nonatomic,strong) XPExchangeDiamondsItemView *myDiamondsView;
@property(nonatomic, strong) UILabel *descLabel;
@property (nonatomic,strong) UIButton *confirmBtn;
///
@property (nonatomic,copy) NSString *goldNum;
@@ -43,8 +44,8 @@
[self addSubview:self.myDiamondsView];
[self addSubview:self.myGoldView];
[self addSubview:self.confirmBtn];
[self addSubview:self.descLabel];
@kWeakify(self)
self.myDiamondsView.inputCounthandle = ^(NSString *_Nonnull goldNum,NSString *_Nonnull diamondNum) {
@@ -83,6 +84,11 @@
make.height.mas_equalTo(kGetScaleWidth(48));
make.centerX.equalTo(self);
}];
[self.descLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.myGoldView.mas_bottom).offset(4);
make.leading.mas_equalTo(self.myGoldView).offset(15);
}];
}
///
- (void)backBtnAction {
@@ -140,6 +146,14 @@
}
return _confirmBtn;
}
- (UILabel *)descLabel {
if (!_descLabel) {
_descLabel = [UILabel labelInitWithText:YMLocalizedString(@"20.20.51_text_29") font:kFontSemibold(14) textColor:[UIColor lightGrayColor]];
}
return _descLabel;
}
@end
@@ -249,7 +263,7 @@
}
NSInteger count = textField.text.integerValue;
NSString *diamondNum = [NSString stringWithFormat:@"%.0f",floorf(count * _model.rate)];
if (count < 1000) {
if (count < 1000 || count % 1000 != 0) {
diamondNum = @"0";
}
if(self.inputCounthandle){
@@ -312,4 +326,6 @@
}
@end

View File

@@ -54,8 +54,7 @@
[super viewDidLoad];
[self initSubViews];
[self initSubViewConstraints];
[self showLoading];
[self.presenter requestQueryWithRoomType];
// [self showLoading];
}
- (void)viewWillDisappear:(BOOL)animated {
@@ -63,6 +62,11 @@
[self hideHUD];
}
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[self.presenter requestQueryWithRoomType];
}
- (BOOL)isHiddenNavBar {
return YES;
}
@@ -147,17 +151,6 @@
self.recordModel = model;
self.goldView.number = @(model.diamonds).stringValue;
self.diamondView.number = [NSString stringWithFormat:@"%.2f",model.golds];
// NSString * myUid = [AccountInfoStorage instance].getUid;
// if(![self.clanInfo.clan.elderUid isEqualToString:myUid]){
// self.goldView.isClanPresident = !self.recordModel.hasGoldExchangeAuth;
// if(self.recordModel.hasGoldExchangeAuth == YES){
// [self.goldView mas_updateConstraints:^(MASConstraintMaker *make) {
// make.height.mas_equalTo(kGetScaleWidth( 144));
// }];
// }
// }
}
#pragma mark - XPIncomeRecordViewDelegate

View File

@@ -135,27 +135,59 @@ TZImagePickerControllerDelegate>
}];
}];
if (self.userInfo.userVipInfoVO.uploadGifAvatar) {
// if (self.userInfo.userVipInfoVO.uploadGifAvatar) {
if (![self.userInfo isEnglish]) {
TTActionSheetConfig *gifLibraryConfig = [TTActionSheetConfig normalTitle:YMLocalizedString(@"UserInfoEdit_1.0.17_0") clickAction:^{
[YYUtility checkAssetsLibrayAvailable:^{
@strongify(self);
[self presentViewController:[self photoPickerWillDisplayGIF: YES]
animated:YES
completion:nil];
} denied:^{
@strongify(self);
[self showNotPhoto:YMLocalizedString(@"XPMineUserInfoEditViewController7") content:YMLocalizedString(@"XPMineUserInfoEditViewController8")];
} restriction:^{
@strongify(self);
[self showNotPhoto:YMLocalizedString(@"XPMineUserInfoEditViewController9") content:YMLocalizedString(@"XPMineUserInfoEditViewController10")];
if (self.userInfo.uploadGifAvatarPrice == 0) {
[self displayGifPhotoBroswer];
} else {
TTAlertConfig *config = [[TTAlertConfig alloc] init];
config.actionStyle = TTAlertActionBothStyle;
config.title = YMLocalizedString(@"AnchorPKStageView0");
config.titleFont = kFontMedium(15);
config.titleColor = UIColorFromRGB(0x313131);
config.messageTextAlignment = NSTextAlignmentLeft;
config.message = [NSString stringWithFormat:YMLocalizedString(@"20.20.51_text_27"), @(self.userInfo.uploadGifAvatarPrice), @(self.userInfo.uploadGifAvatarPrice)];
@kWeakify(self);
[TTPopup alertWithConfig:config
confirmHandler:^{
@kStrongify(self);
[self.presenter checkMoney:^(NSInteger currentMoney){
if (currentMoney < self.userInfo.uploadGifAvatarPrice) {
[XNDJTDDLoadingTool showErrorWithMessage:YMLocalizedString(@"XPTreasureFairyViewController5")];
} else {
[self displayGifPhotoBroswer];
}
} failure:^(NSString * _Nonnull message) {
}];
} cancelHandler:^{
}];
}
}];
gifLibraryConfig.displayMoliCoin = self.userInfo.uploadGifAvatarPrice > 0;
[TTPopup actionSheetWithItems:@[cameraConfig, photoLibraryConfig, gifLibraryConfig]];
} else {
[TTPopup actionSheetWithItems:@[cameraConfig, photoLibraryConfig]];
}
}
- (void)displayGifPhotoBroswer {
@kWeakify(self);
[YYUtility checkAssetsLibrayAvailable:^{
@kStrongify(self);
[self presentViewController:[self photoPickerWillDisplayGIF: YES]
animated:YES
completion:nil];
} denied:^{
@kStrongify(self);
[self showNotPhoto:YMLocalizedString(@"XPMineUserInfoEditViewController7") content:YMLocalizedString(@"XPMineUserInfoEditViewController8")];
} restriction:^{
@kStrongify(self);
[self showNotPhoto:YMLocalizedString(@"XPMineUserInfoEditViewController9") content:YMLocalizedString(@"XPMineUserInfoEditViewController10")];
}];
}
- (TZImagePickerController *)photoPickerWillDisplayGIF:(BOOL)displayGIF {
self.isPhotoPickerDisplayGIF = displayGIF;
@@ -164,6 +196,9 @@ TZImagePickerControllerDelegate>
imagePickerVc.modalPresentationStyle = UIModalPresentationOverFullScreen;
imagePickerVc.allowPickingVideo = NO;
imagePickerVc.allowTakeVideo = NO;
if (displayGIF) {
imagePickerVc.allowTakePicture = NO;
}
imagePickerVc.allowPickingGif = displayGIF;
imagePickerVc.allowCrop = YES;
CGFloat cropWidth = KScreenWidth;
@@ -388,13 +423,6 @@ TZImagePickerControllerDelegate>
} else {
return ![[asset valueForKey:@"filename"] containsString:@"GIF"];
}
// if ([[asset valueForKey:@"filename"] containsString:@"GIF"]) {
// // TODO: GIF
// if (self.userInfo.userVipInfoVO.vipLevel > 2) {
// return NO;
// }
// }
// return YES; //
}
- (void)imagePickerController:(TZImagePickerController *)picker
@@ -506,9 +534,27 @@ TZImagePickerControllerDelegate>
dispatch_async(dispatch_get_main_queue(), ^{
@kStrongify(self);
[self hideHUD];
if (self.isPhotoPickerDisplayGIF) {
[self uploadGiftAvatar:url];
} else {
[self.presenter complectionInfoWithAvatar:url nick:nil birth:nil userDesc:nil];
}
});
}
- (void)uploadGiftAvatar:(NSString *)url {
[self.presenter uploadAvatarV2:url needPay:self.userInfo.uploadGifAvatarPrice > 0];
}
- (void)uploadGifAvatarSuccess:(NSString *)url {
self.userInfo.avatar = url;
XPMineUserInfoEditModel *model = [self.dataSource firstObject];
if (model) {
model.avatarUrl = url;
}
[self.tableView reloadData];
}
#pragma mark - XPMineUserInfoEditPickView
- (void)didClickSureActionWithArea:(LocationModel *)area{
self.selectedArea = area;

View File

@@ -141,12 +141,6 @@ HWDMP4PlayDelegate>
self.playVapCount = 0;
[self initSubViews];
[self initSubViewConstraints];
///访
NSString *uid = [NSString stringWithFormat:@"%ld", self.uid];
if (![uid isEqualToString:[[AccountInfoStorage instance] getUid]]) {
[self.presenter visitUser:uid];
}
}
- (void)viewDidLayoutSubviews {
@@ -305,11 +299,6 @@ HWDMP4PlayDelegate>
}
- (id<JXPagerViewListViewDelegate>)pagerView:(JXPagerView *)pagerView initListAtIndex:(NSInteger)index {
// if (index == 0) {
// return self.userDataVC;
// } else {
// return self.userMomentVC;
// }
if (index == 0) {
return isMSRTL() ? self.userMomentVC : self.userDataVC;
} else {
@@ -377,6 +366,7 @@ HWDMP4PlayDelegate>
- (void)onGetDetailInfoSuccess:(UserInfoModel *)userInfo {
self.userInfo.uploadGifAvatarPrice = userInfo.uploadGifAvatarPrice;
self.userInfo.usingPersonalBackground = userInfo.usingPersonalBackground;
self.userInfo.infoCardVo = userInfo.infoCardVo;
self.headView.userInfo = self.userInfo;
@@ -402,6 +392,13 @@ HWDMP4PlayDelegate>
self.headerHeight = [XPMineUserInfoHeaderView headerHeight:userInfo];
[self.pagingView reloadData];
///访
NSString *uid = [NSString stringWithFormat:@"%ld", self.uid];
if (userInfo.uid != [AccountInfoStorage instance].getUid.integerValue &&
[XPSkillCardPlayerManager shareInstance].userInfoModel.userVipInfoVO.visitListView == NO) {
[self.presenter visitUser:uid];
}
if(isMSRTL()){
self.userMomentVC.view.hidden = YES;
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{

View File

@@ -65,6 +65,8 @@ NS_ASSUME_NONNULL_BEGIN
+ (void)changePreventKickCompletion:(HttpRequestHelperCompletion)completion open:(NSString *)open;
+ (void)changePrivateChatLimitCompletion:(HttpRequestHelperCompletion)completion open:(NSString *)open;
+ (void)changeVisitHideCompletion:(HttpRequestHelperCompletion)completion open:(NSString *)open;
@end
NS_ASSUME_NONNULL_END

View File

@@ -94,4 +94,9 @@
[self makeRequest:@"vip/changePrivateChatLimit" method:HttpRequestHelperMethodGET completion:completion, __FUNCTION__,open, nil];
}
+ (void)changeVisitHideCompletion:(HttpRequestHelperCompletion)completion open:(NSString *)open {
[self makeRequest:@"vip/visitHide" method:HttpRequestHelperMethodGET
completion:completion, __FUNCTION__, open, nil];
}
@end

View File

@@ -51,6 +51,7 @@ NS_ASSUME_NONNULL_BEGIN
- (void)changePreventTrace:(BOOL)preventTrace; // 跟随
- (void)changePreventKick:(BOOL)preventKick;
- (void)changePrivateChatLimit:(BOOL)chatLimit;
- (void)changeVisitHide:(BOOL)chatLimit;
@end
NS_ASSUME_NONNULL_END

View File

@@ -191,5 +191,16 @@
} showLoading:YES errorToast:YES] open:[NSString stringWithFormat:@"%d", chatLimit]];
}
- (void)changeVisitHide:(BOOL)chatLimit {
@kWeakify(self);
[Api changeVisitHideCompletion:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
@kStrongify(self);
[[self getView] changeVisitHideSuccess:chatLimit];
} fail:^(NSInteger code, NSString * _Nullable msg) {
@kStrongify(self);
[[self getView] changeVisitHideLimitFail];
} showLoading:YES errorToast:YES] open:[NSString stringWithFormat:@"%d", chatLimit]];
}
@end

View File

@@ -52,6 +52,10 @@
- (void)changePrivateChatLimitSuccess:(BOOL)switchStatus;
///VIP 請勿打擾开关修改失败
- (void)changePrivateChatLimitFail;
///VIP 無痕瀏覽开关修改成功
- (void)changeVisitHideSuccess:(BOOL)switchStatus;
///VIP 無痕瀏覽开关修改失败
- (void)changeVisitHideLimitFail;
///钻石开通会员成功
-(void)openVipWithDiamondSuccess;
///钻石开通会员失败

View File

@@ -9,6 +9,7 @@
#import "XPAdImageTool.h"
#import "BaseNavigationController.h"
#import "XPMineSwitchLanguageVC.h"
@interface PISwitchingEnvironmentVC ()
@property(nonatomic,strong) UILabel *titleView;
@@ -30,23 +31,33 @@
[self.view addSubview:self.titleView];
UILabel *switchTitle = [UILabel labelInitWithText:@"切换环境" font:kFontMedium(15) textColor:[DJDKMIMOMColor secondTextColor]];
[self.view addSubview:switchTitle];
UISwitch *switchView = [[UISwitch alloc]init];
[switchView setOn:[isProduction isEqualToString:@"YES"]];
[self.view addSubview:switchView];
[switchView addTarget:self action:@selector(switchEnvironmentAction:) forControlEvents:UIControlEventValueChanged];
if (@available(iOS 14.0, *)) {
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(switchLanguage:) name:@"kSwitchLanguage" object:nil];
UIButton *toSwithLanguage = [UIButton buttonWithType:UIButtonTypeInfoLight
primaryAction:[UIAction actionWithHandler:^(__kindof UIAction * _Nonnull action) {
XPMineSwitchLanguageVC*languageVC = [XPMineSwitchLanguageVC new];
[self.navigationController pushViewController:languageVC animated:YES];
}]];
[self.view addSubview:toSwithLanguage];
[toSwithLanguage mas_makeConstraints:^(MASConstraintMaker *make) {
make.center.mas_equalTo(self.view);
make.size.mas_equalTo(CGSizeMake(60, 60));
}];
}
UIButton *realBtn = [UIButton new];
[realBtn setTitle:@"调试捉包工具" forState:UIControlStateNormal];
realBtn.titleLabel.font = kFontMedium(16);
[realBtn setTitleColor:[UIColor blueColor] forState:UIControlStateNormal];
[realBtn addTarget:self action:@selector(showRealTimeView) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:realBtn];
[self.titleView mas_makeConstraints:^(MASConstraintMaker *make) {
make.leading.mas_equalTo(kGetScaleWidth(30));
make.top.mas_equalTo(kGetScaleWidth(100));
@@ -64,12 +75,18 @@
make.top.equalTo(switchTitle.mas_bottom).mas_offset(kGetScaleWidth(30));
}];
}
-(void)switchLanguage:(NSNotification *)not{
exit(0);
}
-(void)showRealTimeView{
[BSNetListenModel initRealTimeView];
UIWindow * window = [UIApplication sharedApplication].keyWindow;
[BSNetListenModel sharedInstance:window];
}
-(void)switchEnvironmentAction:(UISwitch *)sender{
TTAlertConfig *config = [[TTAlertConfig alloc]init];
@@ -96,14 +113,5 @@
-(void)logoutAction{
exit(0);
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end

View File

@@ -22,7 +22,7 @@
#import "XPMineLoginPasswordProtocol.h"
///VC
#import "XPMineSettingViewController.h"
#import "LoginForgetPasswordViewController.h"
#import "LoginTypesViewController.h"
@interface XPMineLoginPasswordViewController ()<XPMineLoginPasswordProtocol>
@@ -117,7 +117,6 @@
return;
}
[self.navigationController popViewControllerAnimated:YES];
}
- (void)modifyLoginPasswordSuccess {
@@ -127,11 +126,10 @@
#pragma mark - Event Response
- (void)forgetButtonAction:(UIButton *)sender {
LoginForgetPasswordViewController *forgetPawVC = [LoginForgetPasswordViewController new];
forgetPawVC.isLogout = YES;
[self.navigationController pushViewController:forgetPawVC animated:YES];
LoginTypesViewController *vc = [[LoginTypesViewController alloc] init];
[self.navigationController pushViewController:vc animated:YES];
[vc updateLoginType:LoginDisplayType_email_forgetPassword];
vc.isLogoutAfterRestPassword = YES;
}
- (void)submitButtonAction:(UIButton *)sender {

View File

@@ -183,7 +183,7 @@
_submitBtn = [UIButton buttonWithType:UIButtonTypeCustom];
[_submitBtn setTitleColor:[DJDKMIMOMColor disableButtonTextColor] forState:UIControlStateDisabled];
[_submitBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[_submitBtn setTitle:YMLocalizedString(@"XPMineModifPayPwdViewController7") forState:UIControlStateNormal];
[_submitBtn setTitle:YMLocalizedString(@"XPAnchorAudienceUpMicView2") forState:UIControlStateNormal];
_submitBtn.titleLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightRegular];
_submitBtn.layer.masksToBounds = YES;
_submitBtn.layer.cornerRadius = 45/2;

View File

@@ -199,7 +199,7 @@
_submitButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_submitButton setTitleColor:[DJDKMIMOMColor disableButtonTextColor] forState:UIControlStateDisabled];
[_submitButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[_submitButton setTitle:YMLocalizedString(@"XPMineModifPayPwdViewController7") forState:UIControlStateNormal];
[_submitButton setTitle:YMLocalizedString(@"XPAnchorAudienceUpMicView2") forState:UIControlStateNormal];
_submitButton.titleLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightRegular];
_submitButton.layer.masksToBounds = YES;
_submitButton.layer.cornerRadius = 45/2;

View File

@@ -46,8 +46,9 @@
#import "XPLoginVerifBindPhoneViewController.h"
#import "AccountBindingViewController.h"
#import "VipSettingViewController.h"
#import "BaseNavigationController.h"
#import "LoginViewController.h"
#import "SocialShareManager.h"
@interface XPMineSettingViewController ()<UITableViewDelegate, UITableViewDataSource, XPMineSettingProtocol>
///
@@ -71,12 +72,18 @@
- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = [UIColor whiteColor];
[self initSubViews];
[self initSubViewConstraints];
[self.presenter getMineSettingDataSourceWith:self.userInfo];
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(switchLanguage:) name:@"kSwitchLanguage" object:nil];
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(setNavView) name:@"kNavViewUpdateWhenLanguageUpdate" object:nil];
}
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
}
-(void)setNavView{
UIBarButtonItem *leftBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[[UIImage imageNamed:@"common_nav_back"] ms_SetImageForRTL]
style:UIBarButtonItemStyleDone
@@ -99,7 +106,6 @@
[self initSubViews];
[self initSubViewConstraints];
[self.presenter getMineSettingDataSourceWith:self.userInfo];
}
-(void)backClick{
[self.navigationController popViewControllerAnimated:YES];
@@ -120,23 +126,34 @@
- (void)initSubViewConstraints {
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
make.leading.trailing.bottom.mas_equalTo(self.view);
make.top.mas_equalTo(0);
make.leading.trailing.bottom.mas_equalTo(self.view).inset(14);
make.top.mas_equalTo(12);
}];
[self.logoutButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.center.mas_equalTo(self.footerView);
make.size.mas_equalTo(CGSizeMake(KScreenWidth - 32* 2, 50));
}];
}
- (void)toBindEmail {
AccountBindingViewController *bindingVC = [[AccountBindingViewController alloc] initWithType:BindingDisplayType_email
currentBindingAccount:self.userInfo.email
areaCode:@""
userInfo:self.userInfo];
[self.navigationController pushViewController:bindingVC animated:YES];
}
- (void)pushViewControllerWithType:(XPMineSettingItemType)type {
switch (type) {
case XPMineSettingItemType_Email:{
AccountBindingViewController *bindingVC = [[AccountBindingViewController alloc] initWithType:BindingDisplayType_email
currentBindingAccount:self.userInfo.email];
[self.navigationController pushViewController:bindingVC animated:YES];
}
case XPMineSettingItemType_Email:
[self toBindEmail];
break;
case XPMineSettingItemType_Phone:
{
AccountBindingViewController *bindingVC = [[AccountBindingViewController alloc] initWithType:BindingDisplayType_phoneNum
currentBindingAccount:self.userInfo.phone];
currentBindingAccount:self.userInfo.phone
areaCode:self.userInfo.phoneAreaCode
userInfo:self.userInfo];
[self.navigationController pushViewController:bindingVC animated:YES];
//
// if (self.userInfo.isBindPhone) { //
@@ -171,11 +188,8 @@
break;
case XPMineSettingItemType_Login_Password:
{
if (!self.userInfo.isBindPhone) {
XPLoginVerifBindPhoneViewController *vc = [[XPLoginVerifBindPhoneViewController alloc] init];
vc.bindingPhoneNumType = XPBindingPhoneNumTypeNormal;
vc.userInfo = _userInfo;
[self.navigationController pushViewController:vc animated:YES];
if ([NSString isEmpty:self.userInfo.email] && [NSString isEmpty:self.userInfo.phone]) {
[self toBindEmail];
return;
}
//
@@ -295,6 +309,35 @@
return self.datasource[section].count;
}
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
NSArray * array = [self.datasource xpSafeObjectAtIndex:indexPath.section];
XPMineSettingItemModel *model = [array xpSafeObjectAtIndex:indexPath.row];
switch (model.type) {
case XPMineSettingItemType_Email:
case XPMineSettingItemType_VIP:
case XPMineSettingItemType_Shield_management:
case XPMineSettingItemType_Permission:
[(XPMineSettingTableViewCell *)cell setTopCorner:YES bottomCorner:NO];
break;
case XPMineSettingItemType_Pay_Password:
case XPMineSettingItemType_Language:
case XPMineSettingItemType_Black_Manager:
case XPMineSettingItemType_About_Us:
[(XPMineSettingTableViewCell *)cell setTopCorner:NO bottomCorner:YES];
break;
default:
[(XPMineSettingTableViewCell *)cell setTopCorner:NO bottomCorner:NO];
break;
}
// if (indexPath.row == 0) {
// [(XPMineSettingTableViewCell *)cell setTopCorner:YES bottomCorner:NO];
// } else if (indexPath.row == self.datasource[indexPath.section].count-1) {
// [(XPMineSettingTableViewCell *)cell setTopCorner:NO bottomCorner:YES];
// } else {
// [(XPMineSettingTableViewCell *)cell setTopCorner:NO bottomCorner:NO];
// }
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
XPMineSettingTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMineSettingTableViewCell class])];
if (cell == nil) {
@@ -351,7 +394,11 @@
}
- (void)logoutCurrentAccountSuccess {
[self.navigationController popToRootViewControllerAnimated:NO];
[[SocialShareManager sharedManager] reset];
LoginViewController *lvc = [[LoginViewController alloc] init];
BaseNavigationController * navigationController = [[BaseNavigationController alloc] initWithRootViewController:lvc];
kWindow.rootViewController = navigationController;
}
- (void)getVersionUpdateFail{
@@ -389,20 +436,16 @@
config.title = YMLocalizedString(@"XPMineSettingViewController9");
config.message = YMLocalizedString(@"XPMineSettingViewController10");
[TTPopup alertWithConfig:config confirmHandler:^{
// if (!self.userInfo.isBindPhone) {
// XPLoginVerifBindPhoneViewController *vc = [[XPLoginVerifBindPhoneViewController alloc] init];
// vc.bindingPhoneNumType = XPBindingPhoneNumTypeNormal;
// vc.userInfo = self.userInfo;
// vc.isLogout = YES;
// [self.navigationController pushViewController:vc animated:YES];
// return;
// }
if (!self.userInfo.isBindPhone) {
XPLoginVerifBindPhoneViewController *vc = [[XPLoginVerifBindPhoneViewController alloc] init];
vc.bindingPhoneNumType = XPBindingPhoneNumTypeNormal;
vc.userInfo = self.userInfo;
vc.isLogout = YES;
[self.navigationController pushViewController:vc animated:YES];
return;
}
XPMineLoginPasswordViewController *vc = [[XPMineLoginPasswordViewController alloc] init];
vc.userInfo = self.userInfo;
vc.isModifiPwd = NO;
[self.navigationController pushViewController:vc animated:YES];
[self logoutCurrentAccountSuccess];
} cancelHandler:^{
[self.presenter logoutCurrentAccount];
}];
@@ -410,7 +453,6 @@
}
[self.presenter logoutCurrentAccount];
}
#pragma mark - Getters And Setters
@@ -429,7 +471,7 @@
- (UIView *)footerView {
if (!_footerView) {
_footerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, 168)];
_footerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, 88)];
}
return _footerView;
}
@@ -443,8 +485,8 @@
_logoutButton.titleLabel.font = [UIFont systemFontOfSize:16];
[_logoutButton addTarget:self action:@selector(logoutButtonAction:) forControlEvents:UIControlEventTouchUpInside];
[_logoutButton setTitle:YMLocalizedString(@"XPMineSettingViewController7") forState:UIControlStateNormal];
_logoutButton.backgroundColor = [DJDKMIMOMColor appCellBackgroundColor];
[_logoutButton setTitleColor:[DJDKMIMOMColor mainTextColor] forState:UIControlStateNormal];
_logoutButton.backgroundColor = UIColorFromRGB(0xF2F3F7);
[_logoutButton setTitleColor:UIColorFromRGB(0x313131) forState:UIControlStateNormal];
}
return _logoutButton;
}

View File

@@ -86,28 +86,18 @@
if (isVisitor) {
[self addSubview:self.unReadLabel];
[self.unReadLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.leading.mas_equalTo(self.numberLabel.mas_trailing).mas_offset(5);
make.trailing.mas_equalTo(self).mas_offset(-12);
make.height.mas_equalTo(15);
make.width.mas_equalTo(15);
make.top.mas_equalTo(self.numberLabel);
make.top.mas_equalTo(self.numberLabel).offset(-10);
}];
}
}
- (void)setVisitorNum:(NSInteger)visitorNum {
if (visitorNum > 0) {
[self setIsVisitor:YES];
self.unReadLabel.hidden = NO;
self.unReadLabel.attributedText = [self attributedStringWithLineSpace:10 str:[NSString stringWithFormat:@"%zd", visitorNum]];
CGFloat width = [self getWidthWithContent:[NSString stringWithFormat:@"%zd", visitorNum] height:15 font:11];
if (visitorNum < 10) {
width = 7;
}
[self.unReadLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
make.leading.mas_equalTo(self.numberLabel.mas_trailing).mas_offset(5);
make.width.mas_equalTo(width + 8);
make.top.mas_equalTo(self.numberLabel);
make.height.mas_equalTo(15);
}];
self.unReadLabel.text = [NSString stringWithFormat:@"+%@", @(visitorNum)];
} else {
self.unReadLabel.hidden = YES;
}
@@ -136,11 +126,9 @@
- (UILabel *)unReadLabel {
if (!_unReadLabel) {
_unReadLabel = [[UILabel alloc] init];
_unReadLabel.font = [UIFont systemFontOfSize:11];
_unReadLabel.textColor = [UIColor whiteColor];
_unReadLabel.backgroundColor = UIColorFromRGB(0xFF5B55);
_unReadLabel.layer.cornerRadius = 7.5;
_unReadLabel.layer.masksToBounds = YES;
_unReadLabel.font = kFontSemibold(12);
_unReadLabel.textColor = UIColorFromRGB(0xff6868);
_unReadLabel.backgroundColor = [UIColor clearColor];
_unReadLabel.textAlignment = NSTextAlignmentCenter;
[_unReadLabel sizeToFit];
_unReadLabel.hidden = YES;

View File

@@ -24,6 +24,9 @@ typedef void(^CompletionHandler)(NSMutableAttributedString *);
- (void)xPMineHeadViewClickNobleCenter;
///点击了工会
- (void)xPMineHeadViewClickAgency;
- (void)xPMineHeadViewClickVisitors;
- (void)xPMineHeadViewClickFriends;
@end
@interface XPMineHeadView : UIView
///用户信息
@@ -41,6 +44,7 @@ typedef void(^CompletionHandler)(NSMutableAttributedString *);
- (void)createNamePlateLevelAttribute:(UserInfoModel *)userInfo;// complete:(CompletionHandler)complete;
///id
- (NSMutableAttributedString *)createNamePlateIdLabelAttribute:(UserInfoModel *)userInfo ;
- (void)updateFriendsCount:(NSNumber *)fCount browseCount:(NSNumber *)bCount browseCountTip:(NSNumber *)tCount;
@end
NS_ASSUME_NONNULL_END

View File

@@ -48,9 +48,13 @@
///
@property (nonatomic,strong) UIStackView *attentionStackView;
///
@property (nonatomic,strong) XPMineFriendNumberView *attentionView;
@property (nonatomic,strong) XPMineFriendNumberView *followingView;
///
@property (nonatomic,strong) XPMineFriendNumberView *fansView;
@property (nonatomic,strong) XPMineFriendNumberView *friendsView;
@property (nonatomic,strong) XPMineFriendNumberView *visitorView;
///
@property (nonatomic, strong) XPMineAccountView *accountView;
///VIP
@@ -89,18 +93,34 @@
[self addSubview:self.levelLabel];
[self addSubview:self.attentionStackView];
[self.attentionStackView addArrangedSubview:self.attentionView];
[self.attentionStackView addArrangedSubview:self.followingView];
[self.attentionStackView addArrangedSubview:self.fansView];
[self.attentionStackView addArrangedSubview:self.friendsView];
[self.attentionStackView addArrangedSubview:self.visitorView];
UIView *line = [[UIView alloc] init];
line.backgroundColor = UIColorFromRGB(0x989898);
line.alpha = 0.3;
[self.attentionStackView addSubview:line];
[line mas_makeConstraints:^(MASConstraintMaker *make) {
UIView *line_1 = [self createLine];
UIView *line_2 = [self createLine];
UIView *line_3 = [self createLine];
[self.attentionStackView addSubview:line_1];
[self.attentionStackView addSubview:line_2];
[self.attentionStackView addSubview:line_3];
[line_1 mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.mas_equalTo(self.attentionStackView);
make.centerX.mas_equalTo(self.attentionStackView).multipliedBy(0.5);
make.width.mas_equalTo(1);
make.height.mas_equalTo(20);
}];
[line_2 mas_makeConstraints:^(MASConstraintMaker *make) {
make.center.mas_equalTo(self.attentionStackView);
make.width.mas_equalTo(1);
make.height.mas_equalTo(20);
}];
[line_3 mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.mas_equalTo(self.attentionStackView);
make.centerX.mas_equalTo(self.attentionStackView).multipliedBy(1.5);
make.width.mas_equalTo(1);
make.height.mas_equalTo(20);
}];
_stackView = [[UIStackView alloc] init];
_stackView.distribution = UIStackViewDistributionFillEqually;
@@ -119,6 +139,13 @@
[self.avatarImageView addGestureRecognizer:tap];
}
- (UIView *)createLine {
UIView *line = [[UIView alloc] init];
line.backgroundColor = UIColorFromRGB(0x989898);
line.alpha = 0.3;
return line;
}
- (void)initSubViewConstraints {
[self.avatarImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(70, 70));
@@ -195,7 +222,7 @@
}
}
///
- (void)tapAttentionRecognizer {
- (void)tapFollowingRecognizer {
if (self.delegate && [self.delegate respondsToSelector:@selector(xpMineHeadViewClickAttention)]) {
[self.delegate xpMineHeadViewClickAttention];
}
@@ -219,6 +246,18 @@
}
}
- (void)didTapFriends {
if (self.delegate && [self.delegate respondsToSelector:@selector(xPMineHeadViewClickFriends)]) {
[self.delegate xPMineHeadViewClickFriends];
}
}
- (void)didTapVisitor {
if (self.delegate && [self.delegate respondsToSelector:@selector(xPMineHeadViewClickVisitors)]) {
[self.delegate xPMineHeadViewClickVisitors];
}
}
#pragma mark - NSMutableAttributedString
-(NSInteger) getMonth:(long )time
{
@@ -354,6 +393,12 @@
return textAtt;
}
- (void)updateFriendsCount:(NSNumber *)fCount browseCount:(NSNumber *)bCount browseCountTip:(NSNumber *)tCount {
self.friendsView.number = fCount.stringValue;
self.visitorView.number = bCount.stringValue;
self.visitorView.visitorNum = tCount.integerValue;
}
///
- (void)createNamePlateLevelAttribute:(UserInfoModel *)userInfo {// complete:(nonnull CompletionHandler)complete{
NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] init];
@@ -417,12 +462,8 @@
self.sexImageView.selected = _userInfo.gender != GenderType_Male;
self.sexImageView.titleEdgeInsets = _userInfo.gender != GenderType_Male ? UIEdgeInsetsMake(0, 2, 0, 0):UIEdgeInsetsMake(0, -1, 0, 0);
// self.levelLabel.attributedText = _userInfo.levelAtt;
self.fansView.number = [NSString stringWithFormat:@"%ld",_userInfo.fansNum];
self.attentionView.number = [NSString stringWithFormat:@"%ld",_userInfo.followNum];
// self.nameplateImageView.imageUrl = _userInfo.nameplatePic;
self.followingView.number = [NSString stringWithFormat:@"%ld",_userInfo.followNum];
@kWeakify(self);
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.25 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
@@ -590,15 +631,15 @@
return _attentionStackView;
}
- (XPMineFriendNumberView *)attentionView {
if (!_attentionView) {
_attentionView = [[XPMineFriendNumberView alloc] init];
_attentionView.title = YMLocalizedString(@"XPMineHeadView4");
_attentionView.number = @"0";
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapAttentionRecognizer)];
[_attentionView addGestureRecognizer:tap];
- (XPMineFriendNumberView *)followingView {
if (!_followingView) {
_followingView = [[XPMineFriendNumberView alloc] init];
_followingView.title = YMLocalizedString(@"XPMineHeadView4");
_followingView.number = @"0";
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapFollowingRecognizer)];
[_followingView addGestureRecognizer:tap];
}
return _attentionView;
return _followingView;
}
- (XPMineFriendNumberView *)fansView {
@@ -612,6 +653,28 @@
return _fansView;
}
- (XPMineFriendNumberView *)friendsView {
if (!_friendsView) {
_friendsView = [[XPMineFriendNumberView alloc] init];
_friendsView.title = YMLocalizedString(@"20.20.51_text_23");
_friendsView.number = @"0";
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didTapFriends)];
[_friendsView addGestureRecognizer:tap];
}
return _friendsView;
}
- (XPMineFriendNumberView *)visitorView {
if (!_visitorView) {
_visitorView = [[XPMineFriendNumberView alloc] init];
_visitorView.title = YMLocalizedString(@"20.20.51_text_24");
_visitorView.number = @"0";
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didTapVisitor)];
[_visitorView addGestureRecognizer:tap];
}
return _visitorView;
}
- (XPMineAccountView *)accountView {
if (!_accountView) {
_accountView = [[XPMineAccountView alloc] init];

View File

@@ -12,6 +12,16 @@
#import "XPNobleCenterProtocol.h"
#import "XPNobleCenterPresenter.h"
typedef NS_ENUM(NSUInteger, VIP_Settings) {
VIP_Settings_PreventFollow = 0,
VIP_Settings_PreventTrace,
VIP_Settings_VisitHide,
VIP_Settings_PrivateChatLimit,
VIP_Settings_EnterHide,
VIP_Settings_PreventKick,
VIP_Settings_Num
};
@interface VipSettingCell : UITableViewCell
@property (nonatomic, copy) NSString *title;
@@ -222,23 +232,27 @@
- (void)handleSwitchUpdate:(BOOL)switchStatus atIndex:(NSInteger)index {
self.tableView.userInteractionEnabled = false;
switch (index) {
case 0:
case VIP_Settings_PreventFollow:
///
[self.presenter changePreventFollow:switchStatus];
break;
case 1:
case VIP_Settings_PreventTrace:
///
[self.presenter changePreventTrace:switchStatus];
break;
case 2:
case VIP_Settings_VisitHide:
//
[self.presenter changeVisitHide:switchStatus];
break;
case VIP_Settings_PrivateChatLimit:
///
[self.presenter changePrivateChatLimit:switchStatus];
break;
case 3:
case VIP_Settings_EnterHide:
///
[self.presenter changeEnterHide:switchStatus];
break;
case 4:
case VIP_Settings_PreventKick:
///
[self.presenter changePreventKick:switchStatus];
break;
@@ -302,6 +316,15 @@
[self switchUpdateEnd];
}
- (void)changeVisitHideSuccess:(BOOL)switchStatus {
[self.userInfo.userVipInfoVO setVisitListView:switchStatus];
[self switchUpdateEnd];
}
- (void)changeVisitHideLimitFail {
[self switchUpdateEnd];
}
- (void)switchUpdateEnd {
[self.tableView reloadData];
self.tableView.userInteractionEnabled = YES;
@@ -325,37 +348,42 @@
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return 5;
return VIP_Settings_Num;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
VipSettingCell *cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([VipSettingCell class])];
switch (indexPath.row) {
case 0:
case VIP_Settings_PreventFollow:
//
cell.title = YMLocalizedString(@"VipSettin_1.0.17_2");
cell.switchStatus = self.userInfo.userVipInfoVO.preventFollow;
cell.minLevel = 5;
break;
case 1:
case VIP_Settings_PreventTrace:
//
cell.title = YMLocalizedString(@"VipSettin_1.0.17_3");
cell.switchStatus = self.userInfo.userVipInfoVO.preventTrace;
cell.minLevel = 6;
break;
case 2:
case VIP_Settings_VisitHide:
cell.title = YMLocalizedString(@"20.20.51_text_17");
cell.switchStatus = self.userInfo.userVipInfoVO.visitListView;
cell.minLevel = 6;
break;
case VIP_Settings_PrivateChatLimit:
//
cell.title = YMLocalizedString(@"1.0.18_25");
cell.switchStatus = self.userInfo.userVipInfoVO.privateChatLimit;
cell.minLevel = 7;
break;
case 3:
case VIP_Settings_EnterHide:
//
cell.title = YMLocalizedString(@"VipSettin_1.0.17_4");
cell.switchStatus = self.userInfo.userVipInfoVO.enterHide;
cell.minLevel = 7;
break;
case 4:
case VIP_Settings_PreventKick:
//
cell.title = YMLocalizedString(@"VipSettin_1.0.17_5");
cell.switchStatus = self.userInfo.userVipInfoVO.preventKick;

View File

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

View File

@@ -0,0 +1,76 @@
//
// VisitorListViewController.m
// YuMi
//
// Created by P on 2025/3/18.
//
#import "VisitorListViewController.h"
#import "XPMineVisitorPresenter.h"
@interface VisitorListCell : UITableViewCell
@property(nonatomic, strong) NetImageView *avatarImageView;
@property(nonatomic, strong) UILabel *nameLabel;
@property(nonatomic, strong) NetImageView *regionImageView;
@property(nonatomic, strong) NetImageView *charmImageView;
@property(nonatomic, strong) NetImageView *experImageView;
@property(nonatomic, strong) NetImageView *nameplateImageView;
@property(nonatomic, strong) UILabel *idLabel;
@property(nonatomic, strong) UILabel *descriptionLabel;
@end
@implementation VisitorListCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
}
return self;
}
@end
@interface VisitorListViewController ()
@property(nonatomic, strong) UITableView *listTableView;
@property(nonatomic, strong) UIVisualEffectView *visualEffectView;
@end
@implementation VisitorListViewController
- (__kindof id)presenter {
return [[XPMineVisitorPresenter alloc] init];
}
- (void)viewDidLoad {
[super viewDidLoad];
}
#pragma mark -
- (UITableView *)listTableView {
if (!_listTableView) {
_listTableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
}
return _listTableView;
}
- (UIImageView *)lockImageView {
return [[UIImageView alloc] initWithImage:kImage(@"visitor_lock")];
}
- (UILabel *)lockTipsLabel {
return [UILabel labelInitWithText:YMLocalizedString(@"20.20.51_text_25") font:kFontMedium(14) textColor:UIColorFromRGB(0x313131)];
}
- (UIButton *)lockToVipButton {
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
return button;
}
@end

View File

@@ -70,6 +70,7 @@
#import "VipSettingViewController.h"
#import "XPSkillCardPlayerManager.h"
#import "XPMineFriendViewController.h"
UIKIT_EXTERN NSString *kRequestTicket;
@@ -94,6 +95,8 @@ UIKIT_EXTERN NSString *kRequestTicket;
///
@property (nonatomic,assign) BOOL isRefreshRoomInfo;
@property(nonatomic, assign) NSInteger visitorVipLimit;
@end
@implementation XPMineViewController
@@ -559,7 +562,6 @@ UIKIT_EXTERN NSString *kRequestTicket;
[self pushViewControllerWithType:XPMineItemType_Skill_Card functionItem:nil];
}
///
- (void)xpMineHeadViewClickAccount {
[self pushViewControllerWithType:XPMineItemType_Account functionItem:nil];
@@ -574,6 +576,19 @@ UIKIT_EXTERN NSString *kRequestTicket;
[self clickHallAction];
}
- (void)xPMineHeadViewClickVisitors {
self.headView.visitorUnReadCount = 0;
XPMineVisitorViewController *visitorVC = [[XPMineVisitorViewController alloc] initWithVIPVisible:self.userInfo.userVipInfoVO.visitHide
vipLimit:self.visitorVipLimit];
[self.navigationController pushViewController:visitorVC animated:YES];
}
- (void)xPMineHeadViewClickFriends {
XPMineFriendViewController *vc = [[XPMineFriendViewController alloc] init];
vc.isFromMineTab = YES;
[self.navigationController pushViewController:vc animated:YES];
}
#pragma mark - XPMineProtocol
///
- (void)onGetMineFuntionItemSuccess:(NSArray<XPMineFunctionItemModel *> *)items {
@@ -660,6 +675,14 @@ UIKIT_EXTERN NSString *kRequestTicket;
[self.presenter getClanDetailInfo];
[self.presenter getUserWalletInfo];
[self.presenter getNobleInfo];
@kWeakify(self);
[self.presenter visitUserPageSuccess:^(NSNumber * _Nonnull browseNum, NSNumber * _Nonnull friendCount, NSNumber * _Nonnull browseNumTip, NSNumber * _Nonnull visitListVipLimit) {
@kStrongify(self);
[self.headView updateFriendsCount:friendCount browseCount:browseNum browseCountTip:browseNumTip];
self.visitorVipLimit = visitListVipLimit.integerValue;
} failure:^(NSError * _Nonnull error) {
}];
}
- (void)getUserWalletInfo:(WalletInfoModel *)balanceInfo{

View File

@@ -11,6 +11,8 @@ NS_ASSUME_NONNULL_BEGIN
@interface XPMineVisitorViewController : MvpViewController
- (instancetype)initWithVIPVisible:(BOOL)visible vipLimit:(NSInteger)visitListVipLimit;
@end
NS_ASSUME_NONNULL_END

View File

@@ -25,6 +25,9 @@
#import "XPMineUserInfoViewController.h"
#import "SessionViewController.h"
#import "VIPCenterViewController.h"
#import "XCCurrentVCStackManager.h"
@interface XPMineVisitorViewController ()<UITableViewDelegate,UITableViewDataSource, XPMineVisitorProtocol, XPMineVisitorTableViewCellDelegate>
///
@@ -35,19 +38,76 @@
@property (nonatomic,assign) int page;
///
@property (nonatomic,assign) BOOL hasNoMoreData;
@property(nonatomic, strong) UIVisualEffectView *blurEffectView;
@property(nonatomic, assign) BOOL vipVisible;
@property(nonatomic, assign) NSInteger vipLimit;
@end
@implementation XPMineVisitorViewController
- (instancetype)initWithVIPVisible:(BOOL)visit vipLimit:(NSInteger)visitListVipLimit {
if (self = [super init]) {
self.vipVisible = visit;
self.vipLimit = visitListVipLimit;
}
return self;
}
- (XPMineVisitorPresenter *)createPresenter {
return [[XPMineVisitorPresenter alloc] init];
}
- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = [UIColor whiteColor];
[self initHeaderAndFooterRrfresh];
[self initSubViews];
[self initSubViewConstraints];
[self addBlurEffect];
}
- (void)addBlurEffect {
if (self.vipVisible) {
return;
}
UIVisualEffect *blurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight];
self.blurEffectView = [[UIVisualEffectView alloc] initWithEffect:blurEffect];
self.blurEffectView.backgroundColor = [UIColor clearColor];
[self.view addSubview:self.blurEffectView];
[self.blurEffectView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(self.view);
}];
UIView *container = [[UIView alloc] init];
[self.view addSubview:container];
[container mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(self.view);
}];
UIImageView *lock = [self lockImageView];
[container addSubview:lock];
UILabel *tipsLabel = [self lockTipsLabel];
[container addSubview:tipsLabel];
UIButton *lockButton = [self lockToVipButton];
[container addSubview:lockButton];
[tipsLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.center.mas_equalTo(self.view);
}];
[lock mas_makeConstraints:^(MASConstraintMaker *make) {
make.bottom.mas_equalTo(tipsLabel.mas_top).offset(-6);
make.centerX.mas_equalTo(self.view);
make.size.mas_equalTo(CGSizeMake(36, 36));
}];
[lockButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(tipsLabel.mas_bottom).offset(16);
make.centerX.mas_equalTo(self.view);
make.size.mas_equalTo(CGSizeMake(150, 38));
}];
}
#pragma mark -
@@ -146,11 +206,14 @@
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
if (indexPath.row == 0) {
return 85;
} else {
return 70;
}
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
XPMineVisitorItemModel *item = [self.datasource xpSafeObjectAtIndex:indexPath.row];
XPMineUserInfoViewController * userInfoVC = [[XPMineUserInfoViewController alloc] init];
userInfoVC.uid = item.uid;
[self.navigationController pushViewController:userInfoVC animated:YES];
}
#pragma mark - TTVisitorRecordCellDelegate
@@ -171,6 +234,13 @@
[self.navigationController pushViewController:sessionVC animated:YES];
}
- (void)didTapVIPButton {
[self.navigationController popViewControllerAnimated:NO];
VIPCenterViewController *vc = [[VIPCenterViewController alloc] initWithRoomUid:-1];
[[XCCurrentVCStackManager shareManager].currentNavigationController pushViewController:vc animated:NO];
[vc jumpToTargetVIP:self.vipLimit];
}
#pragma mark - Getters And Setters
- (UITableView *)tableView {
if (!_tableView) {
@@ -197,4 +267,29 @@
return _datasource;
}
- (UIImageView *)lockImageView {
return [[UIImageView alloc] initWithImage:kImage(@"visitor_lock")];
}
- (UILabel *)lockTipsLabel {
return [UILabel labelInitWithText:[NSString stringWithFormat:YMLocalizedString(@"20.20.51_text_25"),
@(self.vipLimit)]
font:kFontMedium(14)
textColor:UIColorFromRGB(0x313131)];
}
- (UIButton *)lockToVipButton {
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
[button.titleLabel setFont:kFontMedium(16)];
[button setTitle:[NSString stringWithFormat:YMLocalizedString(@"20.20.51_text_26"),
@(self.vipLimit)]
forState:UIControlStateNormal];
[button setBackgroundImage:[UIImage gradientColorImageFromColors:@[
UIColorFromRGB(0xe28939), UIColorFromRGB(0xfcc074)
] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(150, 40)] forState:UIControlStateNormal];
[button addTarget:self action:@selector(didTapVIPButton) forControlEvents:UIControlEventTouchUpInside];
[button setCornerRadius:20];
return button;
}
@end

View File

@@ -29,7 +29,7 @@
}fail:^(NSInteger code, NSString * _Nullable msg) {
@kStrongify(self);
[[self getView] getHomeRecommendRoomListFail:msg ];
}]
} showLoading:NO]
pageNum:[NSString stringWithFormat:@"%ld", page]
pageSize:@"50"
tabId:tabId];
@@ -37,14 +37,14 @@
- (void)loadSecondBanner {
@kWeakify(self);
[Api getHomeSecondBannerCompletion:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
[Api getHomeSecondBannerCompletion:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
@kStrongify(self);
NSArray * array = @[];
if (code == 200) {
array = [HomeBannerInfoModel modelsWithArray:data.data];
}
[[self getView] getHomeSecondBannerSuccess:array];
} uid:[AccountInfoStorage instance].getUid type:@"1"];
} fail:^(NSInteger code, NSString * _Nullable msg) {
[XNDJTDDLoadingTool hideHUD];
} showLoading:NO] uid:[AccountInfoStorage instance].getUid type:@"1"];
}
///

View File

@@ -23,6 +23,7 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, copy) NSArray<HomeBannerInfoModel *> *bannerInfoList;
- (void)starBeginHeaderRefresh;
@end

View File

@@ -127,6 +127,10 @@
[self initSubViewConstraints];
}
- (void)starBeginHeaderRefresh {
}
#pragma mark - Private Method
- (void)initSubViews {
self.view.backgroundColor = [UIColor clearColor];
@@ -154,6 +158,7 @@
} else if([self.tagModel.id isEqualToString:@"-1"]){
[self.presenter getHomePersonalRoomList];
} else{
[XNDJTDDLoadingTool showLoading];
[self.presenter loadSecondBanner];
}
}
@@ -275,6 +280,10 @@
[self.collectionView reloadData];
[[NSNotificationCenter defaultCenter]postNotificationName:@"khomeVCRefreshComplete" object:nil];
[self.collectionView.mj_footer endRefreshing];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[XNDJTDDLoadingTool hideHUD];
});
}
- (void)getHomeSecondBannerSuccess:(NSArray *)banners {
@@ -287,6 +296,10 @@
self.page--;
[self.collectionView.mj_footer endRefreshing];
[[NSNotificationCenter defaultCenter]postNotificationName:@"khomeVCRefreshComplete" object:nil];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[XNDJTDDLoadingTool hideHUD];
});
}
- (void)getMineCollectRoomsSuccess:(NSArray *)rooms {

View File

@@ -74,7 +74,6 @@ UIKIT_EXTERN NSString * const kOpenRoomNotification;
{
if (self = [super initWithFrame:frame]) {
self.backgroundColor = [UIColor clearColor];
[self.contentView setCornerRadius:15];
self.contentView.backgroundColor = [UIColor whiteColor];
[self.contentView addSubview:self.selectedBackground];
@@ -136,6 +135,7 @@ UIKIT_EXTERN NSString * const kOpenRoomNotification;
@property(nonatomic, copy) NSArray <PIHomeCategoryTitleModel*> *tabArray;
@property(nonatomic, copy) void(^didTapCategoryModel)(PIHomeCategoryTitleModel *model);
@property(nonatomic, copy) void(^didTapArrow)(void);
@property(nonatomic, assign) BOOL firstLoad;
- (void)closeArrow;
- (void)updateIndex:(NSInteger)index;
@@ -148,6 +148,7 @@ UIKIT_EXTERN NSString * const kOpenRoomNotification;
if (self = [super init]) {
self.backgroundColor = [[ClientConfig shareConfig] bgColor];
self.lastSelectedIndex = -1;
self.firstLoad = YES;
[self addSubview:self.tabCollectionView];
[self addSubview:self.arrowButton];
@@ -210,6 +211,14 @@ UIKIT_EXTERN NSString * const kOpenRoomNotification;
self.arrowButton.hidden = YES;
}
[self.tabCollectionView reloadData];
if (tabArray.count > 0 && self.firstLoad == YES) {
self.firstLoad = NO;
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self.tabCollectionView selectItemAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]
animated:NO
scrollPosition:UICollectionViewScrollPositionNone];
});
}
@kWeakify(self);
dispatch_async(dispatch_get_main_queue(), ^{
@@ -225,10 +234,6 @@ UIKIT_EXTERN NSString * const kOpenRoomNotification;
scrollPosition:UICollectionViewScrollPositionNone];
} else {
// index
// [self.tabCollectionView selectItemAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]
// animated:NO
// scrollPosition:UICollectionViewScrollPositionNone];
if (isMSRTL()) {
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self.tabCollectionView scrollToItemAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]
@@ -385,6 +390,10 @@ XPHomeRecommendOtherRoomViewDelegate>
}
}
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
}
- (void)tokenInvalid {
[[AccountInfoStorage instance] saveAccountInfo:nil];
[[AccountInfoStorage instance] saveTicket:nil];
@@ -632,6 +641,7 @@ XPHomeRecommendOtherRoomViewDelegate>
}
}];
[self.validListDict setObject:homeVC forKey:@(index)];
return homeVC;
}

View File

@@ -229,6 +229,9 @@ NS_ASSUME_NONNULL_BEGIN
/// @param completion 完成
/// @param roomUid 房间id
+(void)getKickUserList:(HttpRequestHelperCompletion)completion roomUid:(NSString *)roomUid;
+ (void)shareGen:(HttpRequestHelperCompletion)completion targetUid:(NSString *)targetUid;
@end
NS_ASSUME_NONNULL_END

View File

@@ -318,4 +318,8 @@
+(void)getKickUserList:(HttpRequestHelperCompletion)completion roomUid:(NSString *)roomUid{
[self makeRequest:@"room/kick/" method:HttpRequestHelperMethodGET completion:completion, __FUNCTION__,roomUid,nil];
}
+ (void)shareGen:(HttpRequestHelperCompletion)completion targetUid:(NSString *)targetUid {
[self makeRequest:@"share/gen" method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__, targetUid, nil];
}
@end

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