优化
This commit is contained in:
@@ -95,12 +95,11 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
|
||||
{
|
||||
NSTimer * timer;
|
||||
}
|
||||
|
||||
///用户信息
|
||||
@property (nonatomic,strong) HomeUserModel *userInfo;
|
||||
@property (nonatomic, strong) MainPresenter *presenter;
|
||||
///房间最小化
|
||||
@property (nonatomic,strong) XPMiniRoomView *roomMineView;
|
||||
///邀请码
|
||||
@property (nonatomic,copy) NSString *inviteCode;
|
||||
///需要显示新用户充值优惠弹窗
|
||||
@property (nonatomic, assign) BOOL needShowNewUserRecharge;
|
||||
///需要展示主播卡片(首次)
|
||||
@@ -113,8 +112,6 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
|
||||
@property (nonatomic, strong) XPTaskCompleteTipView *taskTipView;
|
||||
///全服广播 年度飘屏
|
||||
@property (nonatomic,strong) NSMutableArray<GiftReceiveInfoModel *> *giftBroadcastQueue;
|
||||
///青少年模式
|
||||
@property (nonatomic, assign) BOOL parentMode;
|
||||
///是否是的第一次链接网络
|
||||
@property (nonatomic,assign) BOOL isFirstReachability;
|
||||
///是否刷新了
|
||||
@@ -128,7 +125,13 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
|
||||
@end
|
||||
|
||||
@implementation TabbarViewController
|
||||
|
||||
- (void)dealloc{
|
||||
[[NSNotificationCenter defaultCenter]removeObserver:self];
|
||||
[[NIMSDK sharedSDK].loginManager removeDelegate:self];
|
||||
[[NIMSDK sharedSDK].chatManager removeDelegate:self];
|
||||
[[NIMSDK sharedSDK].systemNotificationManager removeDelegate:self];
|
||||
[[NIMSDK sharedSDK].broadcastManager removeDelegate:self];
|
||||
}
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
|
||||
@@ -163,7 +166,6 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
|
||||
}];
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(showNewUserRecharge) name:kNewUserRechargeKey object:nil];
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(showAnchorCardKey:) name:kTabShowAnchorCardKey object:nil];
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(teenagerStatusChange:) name:kTeenagerStatusChange object:nil];
|
||||
|
||||
|
||||
|
||||
@@ -232,7 +234,7 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
|
||||
}
|
||||
});
|
||||
}
|
||||
if (self.needShowAnchorCard && !self.delayShowAnchorCard && !self.parentMode) {
|
||||
if (self.needShowAnchorCard && !self.delayShowAnchorCard) {
|
||||
[self.presenter getAnchorCardInfo];
|
||||
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:kHadLaunchApp];///第一次弹主播卡片
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
@@ -251,7 +253,8 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
|
||||
[self.navigationController presentViewController:nav animated:YES completion:nil];
|
||||
return;
|
||||
}
|
||||
if (userInfo.nick == nil || userInfo.avatar == nil) {
|
||||
self.userInfo = userInfo;
|
||||
if ((userInfo.nick == nil || userInfo.avatar == nil) && self.isFormLogin == NO) {
|
||||
id type = [[NSUserDefaults standardUserDefaults]valueForKey:@"kLoginSuccessType"];
|
||||
if(type != nil && [type intValue] == ThirdLoginType_Phone){
|
||||
[self.presenter getAuthorizationCodeInfo];
|
||||
@@ -286,10 +289,22 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
|
||||
[item setBadgeValue:[NSString stringWithFormat:@"%ld",unreadCount]];
|
||||
}
|
||||
}
|
||||
self.parentMode = userInfo.parentMode;
|
||||
for (BaseViewController *vc in self.viewControllers) {
|
||||
vc.parentMode = self.parentMode;
|
||||
|
||||
|
||||
}
|
||||
-(void)loginIng{
|
||||
if ((self.userInfo.nick == nil || self.userInfo.avatar == nil) && self.isFormLogin == NO) {
|
||||
[self completeUserInfo];
|
||||
return;
|
||||
}
|
||||
[self initTabs:YES];
|
||||
if (self.inviteCode.length <= 0) {
|
||||
[self initQuickEnterRoom];
|
||||
}
|
||||
if (self.inviteCode) {
|
||||
self.inviteCode = nil;
|
||||
}
|
||||
[self monentsUnReadCount];
|
||||
}
|
||||
- (void)getAuthorizationCodeInfoWithPhonefail{
|
||||
[self completeUserInfo];
|
||||
@@ -378,7 +393,7 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
|
||||
}
|
||||
|
||||
- (void)checkInviteUserInfoSuccess:(InviteUserInfoModel *)inviteInfo {
|
||||
if (inviteInfo && inviteInfo.isInRoom && !self.parentMode) {
|
||||
if (inviteInfo && inviteInfo.isInRoom) {
|
||||
[XPRoomViewController openRoom:inviteInfo.roomUid fromNick:inviteInfo.inviteNick fromType:inviteInfo.fromType fromUid:inviteInfo.inviteUid viewController:self];
|
||||
} else { //不在房间
|
||||
[self.presenter getShortCutRecommendRoom];
|
||||
@@ -386,9 +401,6 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
|
||||
}
|
||||
|
||||
- (void)getShortCutRecommendRoomSuccces:(NSString *)roomUid {
|
||||
if (self.parentMode) {
|
||||
return;
|
||||
}
|
||||
if (roomUid.length > 0) {
|
||||
[XPRoomViewController openRoom:roomUid viewController:self];
|
||||
}
|
||||
@@ -432,7 +444,7 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
|
||||
XPLoginViewController *lvc = [[XPLoginViewController alloc] init];
|
||||
BaseNavigationController * nav = [[BaseNavigationController alloc] initWithRootViewController:lvc];
|
||||
nav.modalPresentationStyle = UIModalPresentationFullScreen;
|
||||
[self.navigationController presentViewController:nav animated:YES completion:nil];
|
||||
kWindow.rootViewController = nav;
|
||||
XPAdImageTool.shareImageTool.isImLogin = NO;
|
||||
}
|
||||
|
||||
@@ -445,9 +457,7 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
|
||||
|
||||
///获取主播卡片信息成功
|
||||
- (void)getAnchorCardInfoSuccess:(XPTabAnchorCardModel *)cardInfo {
|
||||
if (self.parentMode) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!self.anchorCardView.superview && cardInfo && self.isViewLoaded && self.view.window) {
|
||||
self.anchorCardView.frame = CGRectMake(0, -90-kStatusBarHeight, KScreenWidth, 90);
|
||||
[UIView animateWithDuration:0.5 animations:^{
|
||||
@@ -541,7 +551,7 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
|
||||
#pragma mark - NIMChatManagerDelegate
|
||||
|
||||
- (void)onRecvMessages:(NSArray<NIMMessage *> *)messages {
|
||||
if (self.parentMode || ![ClientConfig shareConfig].canOpen || [AccountInfoStorage instance].getTicket.length == 0) {
|
||||
if (![ClientConfig shareConfig].canOpen || [AccountInfoStorage instance].getTicket.length == 0) {
|
||||
return;
|
||||
}
|
||||
for (NIMMessage * message in messages) {
|
||||
@@ -571,7 +581,7 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
|
||||
|
||||
|
||||
- (void)onReceiveBroadcastMessage:(NIMBroadcastMessage *)broadcastMessage {
|
||||
if (![ClientConfig shareConfig].canOpen) {
|
||||
if (![ClientConfig shareConfig].canOpen || [AccountInfoStorage instance].getUid.length == 0) {
|
||||
return;
|
||||
}
|
||||
if (broadcastMessage.content) {
|
||||
@@ -788,9 +798,7 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
|
||||
}
|
||||
#pragma mark -NIMSystemNotificationManagerDelegate
|
||||
- (void)onReceiveCustomSystemNotification:(NIMCustomSystemNotification *)notification {
|
||||
if (self.parentMode) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (notification.receiverType == NIMSessionTypeP2P) {
|
||||
if (notification.content != nil) {
|
||||
NSData *jsonData = [notification.content dataUsingEncoding:NSUTF8StringEncoding];
|
||||
@@ -834,19 +842,7 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
|
||||
return [[NSUserDefaults standardUserDefaults] valueForKey:kHadLaunchApp];
|
||||
}
|
||||
|
||||
///青少年模式改变
|
||||
- (void)teenagerStatusChange:(NSNotification *)noti {
|
||||
NSDictionary * dic = noti.object;
|
||||
self.parentMode = [[dic objectForKey:@"parentMode"] boolValue];
|
||||
for (BaseViewController *vc in self.viewControllers) {
|
||||
vc.parentMode = self.parentMode;
|
||||
}
|
||||
if ([XPRoomMiniManager shareManager].getRoomInfo && self.parentMode) {
|
||||
[[RtcManager instance] exitRoom];
|
||||
[[NIMSDK sharedSDK].chatroomManager exitChatroom:[NSString stringWithFormat:@"%ld", [XPRoomMiniManager shareManager].getRoomInfo.roomId] completion:nil];
|
||||
[self.roomMineView hiddenRoomMiniView];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
- (BOOL)canShowAnchorCard {
|
||||
if ([[XPRoomMiniManager shareManager] getRoomInfo]) {//在房间时不弹
|
||||
|
Reference in New Issue
Block a user