修复bug
This commit is contained in:
@@ -31,7 +31,7 @@
|
||||
</Testables>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Release"
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
|
@@ -47,6 +47,7 @@
|
||||
[Api getUserInfo:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
||||
if(code == 200){
|
||||
userInfo = [UserInfoModel modelWithDictionary:data.data];
|
||||
[AccountInfoStorage instance].name = userInfo.nick;
|
||||
homeUserModel.nick = userInfo.nick;
|
||||
homeUserModel.avatar = userInfo.avatar;
|
||||
homeUserModel.isBindPhone = userInfo.isBindPhone;
|
||||
@@ -55,37 +56,19 @@
|
||||
} uid:accountModel.uid];
|
||||
});
|
||||
|
||||
__block NSString *isFlag = @"";
|
||||
|
||||
|
||||
if(isLoginPhone == YES){
|
||||
dispatch_group_enter(group);
|
||||
dispatch_async(queue, ^{
|
||||
[Api requestAuthorizationCodeInfo:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
||||
if(code == 200){
|
||||
isFlag = [data.data boolValue] == YES ? @"1" : @"0" ;
|
||||
}else{
|
||||
isFlag = @"2";
|
||||
}
|
||||
dispatch_group_leave(group);
|
||||
}];
|
||||
});
|
||||
}
|
||||
|
||||
dispatch_group_notify(group, dispatch_get_main_queue(), ^{
|
||||
[XNDJTDDLoadingTool hideOnlyView:VC.view];
|
||||
if ([[AccountInfoStorage instance] getTicket].length <= 0 || userInfo == nil || [isFlag isEqualToString:@"2"]) {
|
||||
if ([[AccountInfoStorage instance] getTicket].length <= 0 || userInfo == nil) {
|
||||
[XNDJTDDLoadingTool showErrorWithMessage:YMLocalizedString(@"LoginPresenter1")];
|
||||
return;
|
||||
}
|
||||
[[AccountInfoStorage instance]saveHomeUserInfo:homeUserModel];
|
||||
if (userInfo.nick == nil || userInfo.avatar == nil) {
|
||||
if([isFlag isEqualToString:@"0"]){
|
||||
XPLoginAuthCodeVC *vc = [[XPLoginAuthCodeVC alloc]init];
|
||||
vc.pi_isPush = YES;
|
||||
[VC.navigationController pushViewController:vc animated:YES];
|
||||
}else{
|
||||
LoginFullInfoViewController * FullVC = [[LoginFullInfoViewController alloc] init];
|
||||
[VC.navigationController pushViewController:FullVC animated:YES];
|
||||
}
|
||||
return;
|
||||
}
|
||||
[XNDJTDDLoadingTool showSuccessWithMessage:YMLocalizedString(@"PKIDLoginViewController0")];
|
||||
|
@@ -80,7 +80,7 @@ NSString * const HadAgreePrivacy = @"HadAgreePrivacy";
|
||||
|
||||
[super viewDidLoad];
|
||||
[self createUI];
|
||||
|
||||
[[NSNotificationCenter defaultCenter]postNotificationName:@"kInLoginVC" object:nil];
|
||||
}
|
||||
|
||||
- (void)viewWillAppear:(BOOL)animated {
|
||||
|
@@ -121,6 +121,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
+ (void)homeChatPick:(HttpRequestHelperCompletion)completion;
|
||||
///发现新朋友
|
||||
+(void)requsetFriendListComplection:(HttpRequestHelperCompletion)complection;
|
||||
///ip检测
|
||||
+(void)checkIpRegionComplection:(HttpRequestHelperCompletion)complection;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -155,5 +155,8 @@
|
||||
+(void)requsetFriendListComplection:(HttpRequestHelperCompletion)complection{
|
||||
[self makeRequest:@"home/newFriend" method:HttpRequestHelperMethodGET completion:complection, __FUNCTION__, nil];
|
||||
}
|
||||
|
||||
///ip检测
|
||||
+(void)checkIpRegionComplection:(HttpRequestHelperCompletion)complection{
|
||||
[self makeRequest:@"ipRegion/check" method:HttpRequestHelperMethodPOST completion:complection, __FUNCTION__, nil];
|
||||
}
|
||||
@end
|
||||
|
@@ -17,7 +17,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
///首页改版资源位
|
||||
-(void)getCurrentResourceList;
|
||||
- (void)homeChatPick;
|
||||
|
||||
///ip检测
|
||||
-(void)checkIpRegionAction;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -60,5 +60,19 @@
|
||||
[[self getView] homeChatPickFail:msg];
|
||||
} showLoading:YES errorToast:YES]];
|
||||
}
|
||||
|
||||
///ip检测
|
||||
-(void)checkIpRegionAction{
|
||||
[Api checkIpRegionComplection:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
||||
if(code == 200){
|
||||
if(data.data != nil){
|
||||
NSInteger time = [data.data integerValue]/1000;
|
||||
[[self getView]checkIpRegionSuccess:time];
|
||||
}
|
||||
return;
|
||||
}
|
||||
if(code == 401){
|
||||
[[self getView]checkIpRegionFailWithMsg:msg];
|
||||
}
|
||||
}];
|
||||
}
|
||||
@end
|
||||
|
@@ -10,7 +10,7 @@
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
@class HomeTagModel;
|
||||
@protocol XPHomeContainerProtocol <NSObject>
|
||||
|
||||
@optional
|
||||
///获取所有的tag成功
|
||||
- (void)getHomeTagListSuccess:(NSArray<HomeTagModel *> *)array;
|
||||
///获取首页轮播图列表成功
|
||||
@@ -21,7 +21,9 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
- (void)homeChatPickSuccess:(NSString *)uid;
|
||||
///一键匹配失败
|
||||
- (void)homeChatPickFail:(NSString *)msg;
|
||||
|
||||
///
|
||||
-(void)checkIpRegionFailWithMsg:(NSString *)msg;
|
||||
-(void)checkIpRegionSuccess:(NSInteger)seconds;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -79,6 +79,7 @@ UIKIT_EXTERN NSString * const kOpenRoomNotification;
|
||||
@property(nonatomic,strong) XPHomePartyViewController * homeVC;
|
||||
@property(nonatomic,strong) XPHomeRecommendViewController * recommendVC;
|
||||
@property(nonatomic,assign) NSInteger type;
|
||||
@property(nonatomic,assign) BOOL isCheckIp;
|
||||
@end
|
||||
|
||||
@implementation XPNewHomeViewController
|
||||
@@ -93,6 +94,7 @@ UIKIT_EXTERN NSString * const kOpenRoomNotification;
|
||||
[[NSNotificationCenter defaultCenter]removeObserver:self];
|
||||
[timer fire];
|
||||
timer = nil;
|
||||
|
||||
}
|
||||
- (BOOL)isHiddenNavBar {
|
||||
return YES;
|
||||
@@ -143,7 +145,9 @@ UIKIT_EXTERN NSString * const kOpenRoomNotification;
|
||||
}
|
||||
#pragma mark - Private Method
|
||||
- (void)addTimer {
|
||||
@kWeakify(self);
|
||||
timer = [XPWeakTimer scheduledTimerWithTimeInterval:15 block:^(id userInfo) {
|
||||
@kStrongify(self);
|
||||
[self.homeVC headerRefresh];
|
||||
[self.recommendVC headerRefresh];
|
||||
} userInfo:nil repeats:YES];
|
||||
@@ -199,7 +203,14 @@ UIKIT_EXTERN NSString * const kOpenRoomNotification;
|
||||
} ];
|
||||
};
|
||||
|
||||
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(logOut) name:@"kInLoginVC" object:nil];
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
-(void)logOut{
|
||||
[NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(requestCheckIp) object:nil];
|
||||
}
|
||||
-(void)headerRefresh{
|
||||
[self initHttp];
|
||||
@@ -256,6 +267,8 @@ UIKIT_EXTERN NSString * const kOpenRoomNotification;
|
||||
- (void)initHttp {
|
||||
[self.presenter getHomeTopBannerList];
|
||||
[self.presenter getCurrentResourceList];
|
||||
[self requestCheckIp];
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -397,6 +410,21 @@ UIKIT_EXTERN NSString * const kOpenRoomNotification;
|
||||
}
|
||||
|
||||
#pragma mark - XPNewHomeHeadViewDelegate
|
||||
///
|
||||
-(void)checkIpRegionSuccess:(NSInteger)seconds{
|
||||
if(seconds <= 0)return;
|
||||
[self performSelector:@selector(requestCheckIp) withObject:nil afterDelay:seconds];
|
||||
}
|
||||
- (void)checkIpRegionFailWithMsg:(NSString *)msg{
|
||||
[self tokenInvalid];
|
||||
[self showErrorToast:msg];
|
||||
}
|
||||
-(void)requestCheckIp{
|
||||
if([AccountInfoStorage instance].getTicket.length > 0 && [AccountInfoStorage instance].name.length > 0){
|
||||
[self.presenter checkIpRegionAction];
|
||||
}
|
||||
|
||||
}
|
||||
///选择
|
||||
-(void)selectItemWithModel:(PIHomeItemModel *)model{
|
||||
if (model.resourceType == HomeMenuResourceType_H5) {
|
||||
|
@@ -379,7 +379,7 @@ UIKIT_EXTERN NSString *kShowFirstRechargeView;
|
||||
if([getInfo.bannerPic isEqualToString:pic]){
|
||||
info = getInfo;
|
||||
}
|
||||
if([getInfo.bannerPic hasPrefix:@"http"]){
|
||||
if(getInfo.skipType == 3){
|
||||
[inftList addObject:getInfo];
|
||||
}
|
||||
}
|
||||
@@ -406,7 +406,10 @@ UIKIT_EXTERN NSString *kShowFirstRechargeView;
|
||||
}else {
|
||||
if (info.skipType == ActivitySkipType_Room) {
|
||||
[self.hostDelegate exitRoom];
|
||||
[XPRoomViewController openRoom:info.skipUri viewController:self.hostDelegate.getCurrentNav];
|
||||
|
||||
[XPRoomViewController openRoom:info.skipUri viewController:kWindow.rootViewController];
|
||||
|
||||
|
||||
} else if(info.skipType == ActivitySkipType_Web) {
|
||||
|
||||
PIRoomActivityWebView * webView = [[PIRoomActivityWebView alloc]initWithFrame:CGRectMake(0, KScreenHeight, KScreenWidth, KScreenHeight)];
|
||||
|
@@ -655,6 +655,7 @@ UIKIT_EXTERN NSString * const kRoomReceivedCandyNotificationKey;
|
||||
- (UIButton *)fristLoveBtn{
|
||||
if(!_fristLoveBtn){
|
||||
_fristLoveBtn = [UIButton new];
|
||||
_fristLoveBtn.yn_acceptEventInterval = 1;
|
||||
[_fristLoveBtn setBackgroundImage:kImage(@"room_candy_tree_frist_tap_bg") forState:UIControlStateNormal];
|
||||
[_fristLoveBtn addTarget:self action:@selector(fineLoveAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
@@ -663,6 +664,7 @@ UIKIT_EXTERN NSString * const kRoomReceivedCandyNotificationKey;
|
||||
- (UIButton *)tenthLoveBtn{
|
||||
if(!_tenthLoveBtn){
|
||||
_tenthLoveBtn = [UIButton new];
|
||||
_tenthLoveBtn.yn_acceptEventInterval = 1;
|
||||
[_tenthLoveBtn setBackgroundImage:kImage(@"room_candy_tree_ten_tap_bg") forState:UIControlStateNormal];
|
||||
[_tenthLoveBtn addTarget:self action:@selector(fineLoveAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
@@ -671,6 +673,7 @@ UIKIT_EXTERN NSString * const kRoomReceivedCandyNotificationKey;
|
||||
- (UIButton *)hundredthLoveBtn{
|
||||
if(!_hundredthLoveBtn){
|
||||
_hundredthLoveBtn = [UIButton new];
|
||||
_hundredthLoveBtn.yn_acceptEventInterval = 1;
|
||||
[_hundredthLoveBtn setBackgroundImage:kImage(@"room_candy_tree_hundredth_tap_bg") forState:UIControlStateNormal];
|
||||
[_hundredthLoveBtn addTarget:self action:@selector(fineLoveAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
|
@@ -343,6 +343,7 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
|
||||
///执行插入动画并滚动
|
||||
- (void)scrollToBottom:(BOOL)animated {
|
||||
if(self.datasource.count > 0){
|
||||
[self.messageTableView.superview layoutIfNeeded];
|
||||
CGPoint point = CGPointMake(0, self.messageTableView.contentSize.height - self.messageTableView.frame.size.height);
|
||||
[self.messageTableView setContentOffset:point];
|
||||
self.atCount = 0;
|
||||
|
@@ -105,7 +105,7 @@
|
||||
#pragma mark - Getters And Setters
|
||||
- (void)setWeekStarGiftList:(NSArray *)weekStarGiftList {
|
||||
_weekStarGiftList = weekStarGiftList;
|
||||
if (_weekStarGiftList.count > 0) {
|
||||
if (_weekStarGiftList.count > 0 && self.selectGiftInfo == nil) {
|
||||
self.selectGiftInfo = _weekStarGiftList.firstObject;
|
||||
}
|
||||
NSInteger page = 0;
|
||||
|
@@ -827,6 +827,7 @@
|
||||
- (UIButton *)oneButton {
|
||||
if (!_oneButton) {
|
||||
_oneButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
_oneButton.yn_acceptEventInterval = 1;
|
||||
[_oneButton setImage:[UIImage imageNamed:@"room_treasure_fairy_one_bg"] forState:UIControlStateNormal];
|
||||
[_oneButton setImage:[UIImage imageNamed:@"room_treasure_fairy_one_bg"] forState:UIControlStateSelected];
|
||||
[_oneButton addTarget:self action:@selector(oneButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
@@ -838,6 +839,7 @@
|
||||
- (UIButton *)tenButton {
|
||||
if (!_tenButton) {
|
||||
_tenButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
_tenButton.yn_acceptEventInterval = 1;
|
||||
[_tenButton setImage:[UIImage imageNamed:@"room_treasure_fairy_ten_bg"] forState:UIControlStateNormal];
|
||||
[_tenButton setImage:[UIImage imageNamed:@"room_treasure_fairy_ten_bg"] forState:UIControlStateSelected];
|
||||
[_tenButton addTarget:self action:@selector(tenButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
@@ -849,6 +851,7 @@
|
||||
- (UIButton *)hundredButton {
|
||||
if (!_hundredButton) {
|
||||
_hundredButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
_hundredButton.yn_acceptEventInterval = 1;
|
||||
[_hundredButton setImage:[UIImage imageNamed:@"room_treasure_fairy_hundred_bg"] forState:UIControlStateNormal];
|
||||
[_hundredButton setImage:[UIImage imageNamed:@"room_treasure_fairy_hundred_bg"] forState:UIControlStateSelected];
|
||||
[_hundredButton addTarget:self action:@selector(hundredButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
|
@@ -58,8 +58,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/// @param completion 完成
|
||||
+(void)requestAuthorizationCodeInfo:(HttpRequestHelperCompletion)completion;
|
||||
+(void)requestMineChannel:(HttpRequestHelperCompletion)completion;
|
||||
///ip检测
|
||||
+(void)checkIpRegionComplection:(HttpRequestHelperCompletion)complection;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -121,8 +121,5 @@
|
||||
+(void)requestMineChannel:(HttpRequestHelperCompletion)completion{
|
||||
[self makeRequest:@"charge/guide/channel" method:HttpRequestHelperMethodGET completion:completion,__FUNCTION__, nil];
|
||||
}
|
||||
///ip检测
|
||||
+(void)checkIpRegionComplection:(HttpRequestHelperCompletion)complection{
|
||||
[self makeRequest:@"ipRegion/check" method:HttpRequestHelperMethodPOST completion:complection, __FUNCTION__, nil];
|
||||
}
|
||||
|
||||
@end
|
||||
|
@@ -45,8 +45,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
- (void)clientStartApp;
|
||||
///判断是否绑定授权码
|
||||
-(void)getAuthorizationCodeInfo;
|
||||
///ip检测
|
||||
-(void)checkIpRegionAction;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
@@ -237,19 +237,5 @@ static NSString * kUpdateVersionNum = @"kUpdateVersionNum";
|
||||
[[self getView]getAuthorizationCodeInfoWithPhonefail];
|
||||
} errorToast:NO]];
|
||||
}
|
||||
///ip检测
|
||||
-(void)checkIpRegionAction{
|
||||
[Api checkIpRegionComplection:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
||||
if(code == 200){
|
||||
if(data.data != nil){
|
||||
NSInteger time = [data.data integerValue]/1000;
|
||||
[[self getView]checkIpRegionSuccess:time];
|
||||
}
|
||||
return;
|
||||
}
|
||||
if(code == 401){
|
||||
[[self getView]checkIpRegionFailWithMsg:msg];
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
@end
|
||||
|
@@ -34,9 +34,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
-(void)getAuthorizationCodeInfoWithPhoneSuccess:(BOOL)flag;
|
||||
//////判断是否绑定授权码
|
||||
-(void)getAuthorizationCodeInfoWithPhonefail;
|
||||
///
|
||||
-(void)checkIpRegionFailWithMsg:(NSString *)msg;
|
||||
-(void)checkIpRegionSuccess:(NSInteger)seconds;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -213,7 +213,6 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
|
||||
- (void)autoLoginSuccess {
|
||||
[self.presenter loginNIM];
|
||||
[self.presenter getUserInfo];
|
||||
[self.presenter checkIpRegionAction];
|
||||
///登录成功之后 在验证是否有漏单的行为
|
||||
[self.presenter checkTranscation];
|
||||
///检查更新
|
||||
@@ -262,6 +261,7 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
|
||||
return;
|
||||
}
|
||||
self.userInfo = userInfo;
|
||||
[AccountInfoStorage instance].name = self.userInfo.nick;
|
||||
if ((userInfo.nick == nil || userInfo.avatar == nil) && self.isFormLogin == NO) {
|
||||
[self completeUserInfo];
|
||||
return;
|
||||
@@ -327,18 +327,7 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
|
||||
- (void)bindCodeSuccess{
|
||||
[self completeUserInfo];
|
||||
}
|
||||
///
|
||||
-(void)checkIpRegionSuccess:(NSInteger)seconds{
|
||||
if(seconds <= 0)return;
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(seconds * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
[self.presenter checkIpRegionAction];
|
||||
});
|
||||
}
|
||||
- (void)checkIpRegionFailWithMsg:(NSString *)msg{
|
||||
[self tokenInvalid];
|
||||
[self showErrorToast:msg];
|
||||
|
||||
}
|
||||
|
||||
///
|
||||
-(void)requestGiftList{
|
||||
[self dealWithDefaultSvga];
|
||||
@@ -719,10 +708,13 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
|
||||
UIViewController *me;
|
||||
UIViewController * home;
|
||||
UIViewController * monents;
|
||||
///取消检查ip定时器,释放XPNewHomeViewController
|
||||
[[NSNotificationCenter defaultCenter]postNotificationName:@"kInLoginVC" object:nil];
|
||||
if (logined) {
|
||||
msg = [[XPSessionMainViewController alloc] init];
|
||||
|
||||
if ([ClientConfig shareConfig].canOpen) {
|
||||
|
||||
home = [[XPNewHomeViewController alloc] init];
|
||||
monents = [[XPMonentsViewController alloc] init];
|
||||
me = [[XPMineViewController alloc] init];
|
||||
|
@@ -12,7 +12,7 @@
|
||||
@interface AccountInfoStorage : NSObject
|
||||
|
||||
@property (nonatomic, strong, readonly) AccountModel *accountModel;
|
||||
|
||||
@property(nonatomic,copy) NSString *name;///判断帐号是否填写资料
|
||||
///判断是否正在请求ticket,yes的话,不能用ticket请求数据,不然会出现401,要重新登录
|
||||
@property (nonatomic,assign) BOOL isRequestRicket;
|
||||
///如果是第三方登录的话 保存一下用户信息
|
||||
|
Reference in New Issue
Block a user