chore: Initial clean commit
- Removed YuMi/Library/ (138 MB, not tracked) - Removed YuMi/Resources/ (23 MB, not tracked) - Removed old version assets (566 files, not tracked) - Excluded Pods/, xcuserdata/ and other build artifacts - Clean repository optimized for company server deployment
This commit is contained in:
105
YuMi/Modules/YMLogin/Api/PILoginManager.m
Normal file
105
YuMi/Modules/YMLogin/Api/PILoginManager.m
Normal file
@@ -0,0 +1,105 @@
|
||||
//
|
||||
// PILoginManager.m
|
||||
// YuMi
|
||||
//
|
||||
// Created by duoban on 2023/10/7.
|
||||
//
|
||||
|
||||
#import "PILoginManager.h"
|
||||
///api
|
||||
#import "Api+Main.h"
|
||||
///vc
|
||||
#import "LoginFullInfoViewController.h"
|
||||
#import "TabbarViewController.h"
|
||||
#import "BaseNavigationController.h"
|
||||
#import "LoginVerifCodeViewController.h"
|
||||
///Model
|
||||
#import "ThirdUserInfo.h"
|
||||
#import "AccountModel.h"
|
||||
#import "UserInfoModel.h"
|
||||
#import "XPLoginAuthCodeVC.h"
|
||||
///Manager
|
||||
#import "TurboModeStateManager.h"
|
||||
#import "FirstRechargeManager.h"
|
||||
#import "PublicRoomManager.h"
|
||||
///Tool
|
||||
#import "XNDJTDDLoadingTool.h"
|
||||
#import "AccountInfoStorage.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) {
|
||||
[XNDJTDDLoadingTool hideOnlyView:VC.view];
|
||||
[XNDJTDDLoadingTool showErrorWithMessage:YMLocalizedString(@"LoginPresenter1")];
|
||||
return;
|
||||
}
|
||||
__block UserInfoModel *userInfo;
|
||||
dispatch_group_t group = dispatch_group_create();
|
||||
dispatch_queue_t queue =dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT,0);
|
||||
dispatch_group_enter(group);
|
||||
dispatch_async(queue, ^{
|
||||
[Api requestTicket:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
||||
if(code == 200){
|
||||
NSArray *tickets = [data.data valueForKey:@"tickets"];
|
||||
NSString *ticket = [tickets[0] valueForKey:@"ticket"];
|
||||
homeUserModel.ticket = ticket;
|
||||
[[AccountInfoStorage instance] saveTicket:ticket];
|
||||
|
||||
[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;
|
||||
}
|
||||
dispatch_group_leave(group);
|
||||
} uid:accountModel.uid];
|
||||
return;
|
||||
}
|
||||
dispatch_group_leave(group);
|
||||
} access_token:accountModel.access_token issue_type:@"multi"];
|
||||
});
|
||||
|
||||
dispatch_group_notify(group, dispatch_get_main_queue(), ^{
|
||||
[XNDJTDDLoadingTool hideOnlyView:VC.view];
|
||||
if ([[AccountInfoStorage instance] getTicket].length <= 0 || userInfo == nil) {
|
||||
[XNDJTDDLoadingTool showErrorWithMessage:YMLocalizedString(@"LoginPresenter1")];
|
||||
return;
|
||||
}
|
||||
[[AccountInfoStorage instance]saveHomeUserInfo:homeUserModel];
|
||||
if (userInfo.nick == nil || userInfo.avatar == nil) {
|
||||
LoginFullInfoViewController * FullVC = [[LoginFullInfoViewController alloc] init];
|
||||
[VC.navigationController pushViewController:FullVC animated:YES];
|
||||
return;
|
||||
}
|
||||
[XNDJTDDLoadingTool showSuccessWithMessage:YMLocalizedString(@"PKIDLoginViewController0")];
|
||||
|
||||
[PILoginManager jumpToHomeVCWithInviteCode:@""];
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
+(void)jumpToHomeVCWithInviteCode:(NSString *)inviteCode{
|
||||
TabbarViewController *vc = [[TabbarViewController alloc] init];
|
||||
vc.isFormLogin = YES;
|
||||
vc.inviteCode = inviteCode;
|
||||
BaseNavigationController *bnc = [[BaseNavigationController alloc] initWithRootViewController:vc];
|
||||
kWindow.rootViewController = bnc;
|
||||
|
||||
// 登录成功并进入主页后,启动首充监控
|
||||
[[FirstRechargeManager sharedManager] startMonitoring];
|
||||
|
||||
// 初始化公共房间管理器
|
||||
[[PublicRoomManager sharedManager] initialize];
|
||||
|
||||
// 🔧 新增:启动 TurboModeStateManager
|
||||
NSString *userId = [[AccountInfoStorage instance] getUid];
|
||||
if (userId) {
|
||||
[[TurboModeStateManager sharedManager] startupWithCurrentUser:userId];
|
||||
}
|
||||
}
|
||||
@end
|
Reference in New Issue
Block a user