登录优化
This commit is contained in:
@@ -31,7 +31,7 @@
|
||||
</Testables>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
buildConfiguration = "Release"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
|
@@ -17,6 +17,8 @@
|
||||
#import <GoogleSignIn/GoogleSignIn.h>
|
||||
#import "GULAppDelegateSwizzler.h"
|
||||
#import <GoogleSignIn/GoogleSignIn.h>
|
||||
#import "XPLoginViewController.h"
|
||||
#import "AccountModel.h"
|
||||
@import Firebase;
|
||||
UIKIT_EXTERN NSString * const kOpenRoomNotification;
|
||||
|
||||
@@ -27,10 +29,22 @@ UIKIT_EXTERN NSString * const kOpenRoomNotification;
|
||||
@implementation AppDelegate
|
||||
|
||||
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
|
||||
TabbarViewController *vc = [[TabbarViewController alloc] init];
|
||||
BaseNavigationController *bnc = [[BaseNavigationController alloc] initWithRootViewController:vc];
|
||||
|
||||
|
||||
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
|
||||
self.window.rootViewController = bnc;
|
||||
|
||||
AccountModel *accountModel = [[AccountInfoStorage instance] getCurrentAccountInfo];
|
||||
if (accountModel == nil || accountModel.uid == nil || accountModel.access_token == nil) {
|
||||
XPLoginViewController *lvc = [[XPLoginViewController alloc] init];
|
||||
BaseNavigationController * nav = [[BaseNavigationController alloc] initWithRootViewController:lvc];
|
||||
nav.modalPresentationStyle = UIModalPresentationFullScreen;
|
||||
self.window.rootViewController = nav;
|
||||
}else{
|
||||
TabbarViewController *vc = [[TabbarViewController alloc] init];
|
||||
BaseNavigationController *bnc = [[BaseNavigationController alloc] initWithRootViewController:vc];
|
||||
self.window.rootViewController = bnc;
|
||||
}
|
||||
|
||||
[self.window makeKeyAndVisible];
|
||||
///设置广告页
|
||||
[self setupLaunchADView];
|
||||
|
@@ -17,7 +17,6 @@ NSString * const kRoomBackMusicCaptureVolumeKey = @"9N5Ei+Ch6nkmH1LzZET4ZjYSzXKF
|
||||
NSString * const kRoomBackMusicAudioMixingVolumeKey = @"JuJZKfNgZQ7s25PjQcGG97za686ecXI1lylS9PSLrayNeY2l1me4NyyYUXHGaJP0";///房间背景音乐 背景音乐的大小
|
||||
NSString * const kRoomBackMusicPlayMusicOrderKey = @"xjtpOpnLgX00F9HgwT1FISMQPkxXj5cpE2vYc2acOR0=";///房间背景音乐 播放顺序 单曲 顺序 1 0
|
||||
NSString * const kRoomBackMusicPlayMusicFinishKey = @"xjtpOpnLgX00F9HgwT1FIf5yt3rZb+KP9BT0F9AgD7I8M+2JTSYq+jDIEx1e6qdC";///房间背景音乐 播放完毕的key
|
||||
NSString * const kUserCompleteInfoFinishKey = @"0g1ARAbys7hdfKcXF32WZAASQwkJH//glyiNAZOS5Co=";///补全资料完成
|
||||
NSString * const kHadShowNewUserGiftKey = @"OHIPXsTBvyt1zwNqr4f6YJkIycUshwhKIpC5Pm2nVVU=";//新用户房间礼物
|
||||
NSString * const kNewUserRechargeKey = @"fmslcb104aFPWxdSGkMg6lmyehgB3uCu9V/FqzVpL+8=";//新用户充值优惠 不同于房间内首充
|
||||
NSString * const kFromSearchToHomeViewKey = @"pr5yHog50uSsZLKj2nA6Ono3Mq/bLTDyngBNDVRkhgg=";//用户第一次从搜索页返回首页
|
||||
|
@@ -23,8 +23,8 @@
|
||||
///P
|
||||
#import "LoginFullInfoPresenter.h"
|
||||
#import "LoginFullInfoProtocol.h"
|
||||
#import "PILoginManager.h"
|
||||
|
||||
UIKIT_EXTERN NSString * kUserCompleteInfoFinishKey;
|
||||
|
||||
@interface LoginFullInfoViewController ()<LoginFullInfoProtocol>
|
||||
|
||||
@@ -261,15 +261,10 @@ UIKIT_EXTERN NSString * kUserCompleteInfoFinishKey;
|
||||
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventLoginRepariSuccess];
|
||||
///需要重新加载一次 ticket 刷新tabbar的item
|
||||
[[AccountInfoStorage instance] saveTicket:nil];
|
||||
UIViewController *vc = self.presentingViewController;
|
||||
while (vc.presentingViewController) {
|
||||
vc = vc.presentingViewController;
|
||||
}
|
||||
[vc dismissViewControllerAnimated:YES completion:^{
|
||||
}];
|
||||
|
||||
[XPAdjustEvent registeringEvent];
|
||||
NSString * inviteCode = self.codeTextField.text.length > 0 ? self.codeTextField.text : @"";
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:kUserCompleteInfoFinishKey object:inviteCode];
|
||||
[PILoginManager jumpToHomeVCWithInviteCode:inviteCode];
|
||||
}
|
||||
-(void)complementInfoFail{
|
||||
[XNDJTDDLoadingTool hideOnlyView:self.view];
|
||||
|
@@ -183,15 +183,9 @@ UIKIT_EXTERN NSString *kRequestRicket;
|
||||
if (@available(iOS 15.0, *)) {//移除iOS15列表头默认增加的22高度
|
||||
self.tableView.sectionHeaderTopPadding = 0;
|
||||
}
|
||||
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(requestRicketSuccess:) name:kRequestRicket object:nil];
|
||||
}
|
||||
-(void)requestRicketSuccess:(NSNotification *)not{
|
||||
if([not.object isKindOfClass:[NSDictionary class]])return;
|
||||
BOOL is = [not.object boolValue];
|
||||
if(is == YES){
|
||||
[self.presenter getUserInfo];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
[self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.top.mas_equalTo(0);
|
||||
|
@@ -26,7 +26,7 @@
|
||||
[[self getView] getMonentsAttentionListSuccess:listInfo state:state];
|
||||
} fail:^(NSInteger code, NSString * _Nullable msg) {
|
||||
[[self getView] getMonentsAttentionListFail:msg state:state];
|
||||
} showLoading:YES] dynamicId:dynamicId pageSize:pageSizeStr types:@"0,2"];
|
||||
} showLoading:NO] dynamicId:dynamicId pageSize:pageSizeStr types:@"0,2"];
|
||||
}
|
||||
|
||||
/// 动态点赞
|
||||
|
@@ -26,7 +26,7 @@
|
||||
[[self getView] getMonentsLatestListSuccess:listInfo state:state];
|
||||
} fail:^(NSInteger code, NSString * _Nullable msg) {
|
||||
[[self getView] getMonentsLatestListFail:msg state:state];
|
||||
} showLoading:YES] dynamicId:dynamicId pageSize:pageSizeStr types:@"0,2"];
|
||||
} showLoading:NO] dynamicId:dynamicId pageSize:pageSizeStr types:@"0,2"];
|
||||
}
|
||||
|
||||
/// 动态点赞
|
||||
|
@@ -26,7 +26,7 @@
|
||||
[[self getView] getMonentsRecommendListSuccess:array state:state];
|
||||
} fail:^(NSInteger code, NSString * _Nullable msg) {
|
||||
[[self getView] getMonentsRecommendListFail:msg state:state];
|
||||
} showLoading:YES] page:pageStr pageSize:pageSizeStr types:@"0,2"];
|
||||
} showLoading:NO] page:pageStr pageSize:pageSizeStr types:@"0,2"];
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
[Api monentsTopicList:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
NSArray * array = [MonentsTopicModel modelsWithArray:data.data[@"records"]];
|
||||
[[self getView] monentsTopicListSuccess:array];
|
||||
}] uid:uid page:pageStr pageSize:pageSizeStr worldTypeId:@"1"];
|
||||
}showLoading:NO] uid:uid page:pageStr pageSize:pageSizeStr worldTypeId:@"1"];
|
||||
}
|
||||
|
||||
/// 动态点赞
|
||||
|
@@ -58,17 +58,11 @@ UIKIT_EXTERN NSString *kRequestRicket;
|
||||
#pragma mark - Private Method
|
||||
- (void)initSubViews {
|
||||
[self.view addSubview:self.tableView];
|
||||
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(requestRicketSuccess:) name:kRequestRicket object:nil];
|
||||
}
|
||||
-(void)requestRicketSuccess:(NSNotification *)not{
|
||||
if([not.object isKindOfClass:[NSDictionary class]])return;
|
||||
BOOL is = [not.object boolValue];
|
||||
if(is == YES){
|
||||
[self headerRefresh];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.mas_equalTo(self.view);
|
||||
@@ -88,7 +82,7 @@ UIKIT_EXTERN NSString *kRequestRicket;
|
||||
footer.stateLabel.textColor = [DJDKMIMOMColor secondTextColor];
|
||||
footer.stateLabel.font = [UIFont systemFontOfSize:10.0];
|
||||
self.tableView.mj_footer = footer;
|
||||
|
||||
[self.tableView.mj_header beginRefreshing];
|
||||
[self headerRefresh];
|
||||
}
|
||||
|
||||
|
@@ -64,16 +64,10 @@ UIKIT_EXTERN NSString *kRequestRicket;
|
||||
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.mas_equalTo(self.view);
|
||||
}];
|
||||
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(requestRicketSuccess:) name:kRequestRicket object:nil];
|
||||
}
|
||||
-(void)requestRicketSuccess:(NSNotification *)not{
|
||||
if([not.object isKindOfClass:[NSDictionary class]])return;
|
||||
BOOL is = [not.object boolValue];
|
||||
if(is == YES){
|
||||
[self headerRefresh];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - 下拉刷新
|
||||
- (void)initHeaderAndFooterRrfresh {
|
||||
MJRefreshNormalHeader *header = [MJRefreshNormalHeader headerWithRefreshingTarget:self refreshingAction:@selector(headerRefresh)];
|
||||
@@ -87,7 +81,7 @@ UIKIT_EXTERN NSString *kRequestRicket;
|
||||
footer.stateLabel.textColor = [DJDKMIMOMColor secondTextColor];
|
||||
footer.stateLabel.font = [UIFont systemFontOfSize:10.0];
|
||||
self.tableView.mj_footer = footer;
|
||||
|
||||
[self.tableView.mj_header beginRefreshing];
|
||||
[self headerRefresh];
|
||||
}
|
||||
|
||||
|
@@ -71,18 +71,10 @@ UIKIT_EXTERN NSString *kRequestRicket;
|
||||
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.mas_equalTo(self.view);
|
||||
}];
|
||||
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(requestRicketSuccess:) name:kRequestRicket object:nil];
|
||||
|
||||
|
||||
}
|
||||
-(void)requestRicketSuccess:(NSNotification *)not{
|
||||
if([not.object isKindOfClass:[NSDictionary class]])return;
|
||||
BOOL is = [not.object boolValue];
|
||||
if(is == YES){
|
||||
[self headerRefresh];
|
||||
}else{
|
||||
[XNDJTDDLoadingTool hideOnlyView:self.tabBarController.view];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - 下拉刷新
|
||||
- (void)initHeaderAndFooterRrfresh {
|
||||
@@ -97,13 +89,13 @@ UIKIT_EXTERN NSString *kRequestRicket;
|
||||
footer.stateLabel.textColor = [DJDKMIMOMColor secondTextColor];
|
||||
footer.stateLabel.font = [UIFont systemFontOfSize:10.0];
|
||||
self.tableView.mj_footer = footer;
|
||||
|
||||
[self.tableView.mj_header beginRefreshing];
|
||||
[self headerRefresh];
|
||||
}
|
||||
|
||||
#pragma mark - 刷新的fangfa
|
||||
- (void)headerRefresh {
|
||||
[XNDJTDDLoadingTool showOnlyView:self.tabBarController.view];
|
||||
|
||||
if([AccountInfoStorage instance].isRequestRicket == YES){
|
||||
return;
|
||||
}
|
||||
@@ -249,7 +241,6 @@ UIKIT_EXTERN NSString *kRequestRicket;
|
||||
}
|
||||
[self.tableView.mj_footer endRefreshing];
|
||||
}
|
||||
[XNDJTDDLoadingTool hideOnlyView:self.tabBarController.view];
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
|
||||
|
@@ -83,7 +83,6 @@
|
||||
#import "PIFullScreenBannerAnimation.h"
|
||||
#import <SVGA.h>
|
||||
#import "Api+Gift.h"
|
||||
UIKIT_EXTERN NSString * kUserCompleteInfoFinishKey;
|
||||
NSString * const kUserFirstLoginKey = @"kUserFirstLoginKey";
|
||||
NSString * const kHadLaunchApp = @"kHadLaunchApp";
|
||||
NSString * const kLastShowAnchorCardTime = @"kLastShowAnchorCardTime";
|
||||
@@ -96,7 +95,7 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
|
||||
NSTimer * timer;
|
||||
}
|
||||
///用户信息
|
||||
@property (nonatomic,strong) HomeUserModel *userInfo;
|
||||
@property (nonatomic,strong) UserInfoModel *userInfo;
|
||||
@property (nonatomic, strong) MainPresenter *presenter;
|
||||
///房间最小化
|
||||
@property (nonatomic,strong) XPMiniRoomView *roomMineView;
|
||||
@@ -147,18 +146,17 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
|
||||
[self.presenter juliandAdCallBackApi];
|
||||
[self networkReachability];
|
||||
[self.view addSubview:self.roomMineView];
|
||||
@kWeakify(self);
|
||||
[[NSNotificationCenter defaultCenter] addObserverForName:kRoomMiniNotificationKey object:nil queue:nil usingBlock:^(NSNotification * _Nonnull note) {
|
||||
@kStrongify(self);
|
||||
[self configRoomMiniNView:note.userInfo];
|
||||
}];
|
||||
[[NSNotificationCenter defaultCenter] addObserverForName:@"kLogout" object:nil queue:nil usingBlock:^(NSNotification * _Nonnull note) {
|
||||
self.isInitReload = NO;
|
||||
self.isReload = NO;
|
||||
}];
|
||||
[[NSNotificationCenter defaultCenter] addObserverForName:kUserCompleteInfoFinishKey object:nil queue:nil usingBlock:^(NSNotification * _Nonnull note) {
|
||||
[self completeUserInfoFinish:note.object];
|
||||
}];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserverForName:@"reloadnewtab" object:nil queue:nil usingBlock:^(NSNotification * _Nonnull note) {
|
||||
@kStrongify(self);
|
||||
if (self.isInitReload == NO) {
|
||||
[self initTabs:YES];
|
||||
self.isReload = YES;
|
||||
@@ -276,18 +274,7 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
|
||||
self.inviteCode = nil;
|
||||
}
|
||||
[self monentsUnReadCount];
|
||||
NSArray *recentList = [[NIMSDK sharedSDK].conversationManager.allRecentSessions mutableCopy];
|
||||
__block NSInteger unreadCount = 0;
|
||||
NSMutableArray<NSString *> * uids = [[NSMutableArray alloc] init];
|
||||
[recentList enumerateObjectsUsingBlock:^(NIMRecentSession * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
[uids addObject:obj.session.sessionId];
|
||||
unreadCount += obj.unreadCount;
|
||||
}];
|
||||
if(unreadCount > 0){
|
||||
NSUInteger index = 2;
|
||||
UITabBarItem *item = self.tabBar.items.count > index ? self.tabBar.items[index] : nil;
|
||||
[item setBadgeValue:[NSString stringWithFormat:@"%ld",unreadCount]];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -297,14 +284,20 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
|
||||
[self completeUserInfo];
|
||||
return;
|
||||
}
|
||||
[self initTabs:YES];
|
||||
if (self.inviteCode.length <= 0) {
|
||||
[self initQuickEnterRoom];
|
||||
if(self.isReload == NO){
|
||||
[self initTabs:YES];
|
||||
self.isInitReload = YES;
|
||||
}
|
||||
if (self.inviteCode) {
|
||||
self.inviteCode = nil;
|
||||
if ([ClientConfig shareConfig].canOpen) {
|
||||
if (self.inviteCode.length <= 0) {
|
||||
[self initQuickEnterRoom];
|
||||
}
|
||||
if (self.inviteCode) {
|
||||
self.inviteCode = nil;
|
||||
}
|
||||
[self monentsUnReadCount];
|
||||
|
||||
}
|
||||
[self monentsUnReadCount];
|
||||
}
|
||||
- (void)getAuthorizationCodeInfoWithPhonefail{
|
||||
[self completeUserInfo];
|
||||
@@ -412,8 +405,10 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
|
||||
}
|
||||
#pragma mark - 网络状态监听
|
||||
- (void)networkReachability{
|
||||
@kWeakify(self);
|
||||
[[AFNetworkReachabilityManager sharedManager] startMonitoring];
|
||||
[[AFNetworkReachabilityManager sharedManager] setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status) {
|
||||
@kStrongify(self);
|
||||
switch (status) {
|
||||
case AFNetworkReachabilityStatusUnknown:
|
||||
self.isFirstReachability = YES;
|
||||
@@ -440,7 +435,8 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
|
||||
|
||||
#pragma mark - BaseMvpProtocol
|
||||
- (void)tokenInvalid {
|
||||
[[NSNotificationCenter defaultCenter]postNotificationName:@"kLogout" object:nil];
|
||||
|
||||
|
||||
XPLoginViewController *lvc = [[XPLoginViewController alloc] init];
|
||||
BaseNavigationController * nav = [[BaseNavigationController alloc] initWithRootViewController:lvc];
|
||||
nav.modalPresentationStyle = UIModalPresentationFullScreen;
|
||||
@@ -452,7 +448,7 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
|
||||
LoginFullInfoViewController * bindPhoneVC = [[LoginFullInfoViewController alloc] init];
|
||||
BaseNavigationController * nav = [[BaseNavigationController alloc] initWithRootViewController:bindPhoneVC];
|
||||
nav.modalPresentationStyle = UIModalPresentationFullScreen;
|
||||
[self.navigationController presentViewController:nav animated:YES completion:nil];
|
||||
kWindow.rootViewController = nav;
|
||||
}
|
||||
|
||||
///获取主播卡片信息成功
|
||||
@@ -772,6 +768,18 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
|
||||
[item setBadgeValue:badge];
|
||||
}
|
||||
} uid:[AccountInfoStorage instance].getUid];
|
||||
NSArray *recentList = [[NIMSDK sharedSDK].conversationManager.allRecentSessions mutableCopy];
|
||||
__block NSInteger unreadCount = 0;
|
||||
NSMutableArray<NSString *> * uids = [[NSMutableArray alloc] init];
|
||||
[recentList enumerateObjectsUsingBlock:^(NIMRecentSession * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
[uids addObject:obj.session.sessionId];
|
||||
unreadCount += obj.unreadCount;
|
||||
}];
|
||||
if(unreadCount > 0){
|
||||
NSUInteger index = 2;
|
||||
UITabBarItem *item = self.tabBar.items.count > index ? self.tabBar.items[index] : nil;
|
||||
[item setBadgeValue:[NSString stringWithFormat:@"%ld",unreadCount]];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - 房间最小化
|
||||
|
@@ -26,6 +26,6 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@property (nonatomic,assign)BOOL isBindPhone;
|
||||
@property (nonatomic,copy) NSString *ticket;
|
||||
@property (nonatomic,assign) BOOL isGetUserInfoSuccess;
|
||||
@property (nonatomic,assign) BOOL isRequestRicketSuccess;
|
||||
|
||||
@end
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -42,7 +42,8 @@
|
||||
}
|
||||
|
||||
- (void)tokenInvalid {
|
||||
[[NSNotificationCenter defaultCenter]postNotificationName:@"kLogout" object:nil];
|
||||
|
||||
|
||||
XPLoginViewController *loginVC = [[XPLoginViewController alloc] init];
|
||||
BaseNavigationController * nav = [[BaseNavigationController alloc] initWithRootViewController:loginVC];
|
||||
nav.modalPresentationStyle = UIModalPresentationFullScreen;
|
||||
|
Reference in New Issue
Block a user