登录优化

This commit is contained in:
liyuhua
2023-10-07 18:42:30 +08:00
parent 7dfc5a6569
commit c1de3b4b24
14 changed files with 78 additions and 88 deletions

View File

@@ -31,7 +31,7 @@
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
buildConfiguration = "Release"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"

View File

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

View File

@@ -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=";//

View File

@@ -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 tabbaritem
[[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];

View File

@@ -183,15 +183,9 @@ UIKIT_EXTERN NSString *kRequestRicket;
if (@available(iOS 15.0, *)) {//iOS1522
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);

View File

@@ -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"];
}
///

View File

@@ -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"];
}
///

View File

@@ -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"];
}
///

View File

@@ -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];
}

View File

@@ -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];
}

View File

@@ -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];
}

View File

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

View File

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

View File

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