跟随进房的公屏显示以及进房添加跟随来源

This commit is contained in:
fengshuo
2022-03-15 17:56:25 +08:00
parent 759b9e4ca6
commit 19f5da68fe
11 changed files with 74 additions and 21 deletions

View File

@@ -92,6 +92,11 @@ NS_ASSUME_NONNULL_BEGIN
///技能卡图标列表 ///技能卡图标列表
@property (nonatomic, strong) NSArray *absCardPics; @property (nonatomic, strong) NSArray *absCardPics;
///跟随的 本地添加的字段
@property (nonatomic,copy) NSString *fromNick;
@property (nonatomic,assign) UserEnterRoomFromType fromType;
@property (nonatomic,copy) NSString *fromUid;
@end @end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END

View File

@@ -42,4 +42,15 @@ typedef NS_ENUM(NSInteger, GroupType) {
GroupType_Blue = 1,//蓝队 男神 GroupType_Blue = 1,//蓝队 男神
GroupTyp_red = 2, //红队 女神 GroupTyp_red = 2, //红队 女神
}; };
typedef NS_ENUM(NSInteger, UserEnterRoomFromType) {
///首页推荐
UserEnterRoomFromType_Home_Recommend = 1,
///跟随用户
UserEnterRoomFromType_Follow_User = 2,
///赛事详情
UserEnterRoomFromType_Follow_Game_Detail = 8,
///跨房PK
UserEnterRoomFromType_Cross_Room_PK = 9
};
#endif /* XPEnum_h */ #endif /* XPEnum_h */

View File

@@ -217,7 +217,7 @@ UIKIT_EXTERN NSString * kHomeMoreScrollPageKey;
HomeMenuSourceModel * sourceModel = [HomeMenuSourceModel modelWithDictionary:data.data]; HomeMenuSourceModel * sourceModel = [HomeMenuSourceModel modelWithDictionary:data.data];
if (sourceModel.isPick) { if (sourceModel.isPick) {
if (sourceModel.uid.integerValue > 0) { if (sourceModel.uid.integerValue > 0) {
[XPRoomViewController openRoom:sourceModel.uid viewController:self.currenViewController]; [XPRoomViewController openRoom:sourceModel.uid fromNick:nil fromType:UserEnterRoomFromType_Home_Recommend fromUid:nil viewController:self.currenViewController];
} }
} else { } else {
XPHomeRecommendOtherRoomView * recommendView = [[XPHomeRecommendOtherRoomView alloc] init]; XPHomeRecommendOtherRoomView * recommendView = [[XPHomeRecommendOtherRoomView alloc] init];
@@ -258,14 +258,14 @@ UIKIT_EXTERN NSString * kHomeMoreScrollPageKey;
#pragma mark - XPHomeHotRoomTableViewCellDelegate #pragma mark - XPHomeHotRoomTableViewCellDelegate
- (void)xPHomeHotRoomTableViewCell:(XPHomeHotRoomTableViewCell *)view didClickItem:(HomeRecommendRoomModel *)roomInfo { - (void)xPHomeHotRoomTableViewCell:(XPHomeHotRoomTableViewCell *)view didClickItem:(HomeRecommendRoomModel *)roomInfo {
if (roomInfo.uid.length > 0) { if (roomInfo.uid.length > 0) {
[XPRoomViewController openRoom:roomInfo.uid viewController:self.currenViewController]; [XPRoomViewController openRoom:roomInfo.uid fromNick:nil fromType:UserEnterRoomFromType_Home_Recommend fromUid:nil viewController:self.currenViewController];
} }
} }
#pragma mark - XPHomeRecommendTableViewCellDelegate #pragma mark - XPHomeRecommendTableViewCellDelegate
- (void)xPHomeRecommendTableViewCell:(XPHomeRecommendTableViewCell *)view didClickItem:(HomeRecommendRoomModel *)roomInfo { - (void)xPHomeRecommendTableViewCell:(XPHomeRecommendTableViewCell *)view didClickItem:(HomeRecommendRoomModel *)roomInfo {
if (roomInfo.roomUid.length > 0) { if (roomInfo.roomUid.length > 0) {
[XPRoomViewController openRoom:roomInfo.roomUid viewController:self.currenViewController]; [XPRoomViewController openRoom:roomInfo.roomUid fromNick:nil fromType:UserEnterRoomFromType_Home_Recommend fromUid:nil viewController:self.currenViewController];
} }
} }
@@ -280,7 +280,7 @@ UIKIT_EXTERN NSString * kHomeMoreScrollPageKey;
#pragma mark - XPHomeRecommendOtherRoomViewDelegate #pragma mark - XPHomeRecommendOtherRoomViewDelegate
- (void)xPHomeRecommendOtherRoomView:(XPHomeRecommendOtherRoomView *)view didClickEnterRoom:(HomeMenuSourceModel *)model { - (void)xPHomeRecommendOtherRoomView:(XPHomeRecommendOtherRoomView *)view didClickEnterRoom:(HomeMenuSourceModel *)model {
if (model.uid.integerValue > 0) { if (model.uid.integerValue > 0) {
[XPRoomViewController openRoom:model.uid viewController:self.currenViewController]; [XPRoomViewController openRoom:model.uid fromNick:nil fromType:UserEnterRoomFromType_Home_Recommend fromUid:nil viewController:self.currenViewController];
} }
} }

View File

@@ -108,7 +108,7 @@
if (self.roomList.count > 0) { if (self.roomList.count > 0) {
HomePlayRoomModel * model = [self.roomList objectAtIndex:indexPath.row]; HomePlayRoomModel * model = [self.roomList objectAtIndex:indexPath.row];
if (!model.isBanner && model.uid.integerValue > 0) { if (!model.isBanner && model.uid.integerValue > 0) {
[XPRoomViewController openRoom:model.uid viewController:self]; [XPRoomViewController openRoom:model.uid fromNick:nil fromType:UserEnterRoomFromType_Home_Recommend fromUid:nil viewController:self];
} }
} }
} }

View File

@@ -97,7 +97,7 @@
if (self.roomList.count > 0) { if (self.roomList.count > 0) {
HomePlayRoomModel * model = [self.roomList objectAtIndex:indexPath.row]; HomePlayRoomModel * model = [self.roomList objectAtIndex:indexPath.row];
if (!model.isBanner && model.uid.integerValue > 0) { if (!model.isBanner && model.uid.integerValue > 0) {
[XPRoomViewController openRoom:model.uid viewController:self]; [XPRoomViewController openRoom:model.uid fromNick:model.title fromType:UserEnterRoomFromType_Home_Recommend fromUid:nil viewController:self];
} }
} }
} }

View File

@@ -257,7 +257,7 @@
#pragma mark - XPHomeAttentionTableViewCellDelegate #pragma mark - XPHomeAttentionTableViewCellDelegate
- (void)xPHomeAttentionTableViewCell:(XPHomeAttentionTableViewCell *)view didClickItem:(HomeLiveRoomModel *)model { - (void)xPHomeAttentionTableViewCell:(XPHomeAttentionTableViewCell *)view didClickItem:(HomeLiveRoomModel *)model {
if (model.roomUid > 0) { if (model.roomUid > 0) {
[XPRoomViewController openRoom:[NSString stringWithFormat:@"%ld", model.uid] viewController:self]; [XPRoomViewController openRoom:[NSString stringWithFormat:@"%ld", model.uid] fromNick:model.nick fromType:UserEnterRoomFromType_Follow_User fromUid:[NSString stringWithFormat:@"%ld", model.roomUid] viewController:self];
} else { } else {
if (model.uid > 0) { if (model.uid > 0) {
XPMineUserInfoViewController * userInfoVC = [[XPMineUserInfoViewController alloc] init]; XPMineUserInfoViewController * userInfoVC = [[XPMineUserInfoViewController alloc] init];

View File

@@ -69,6 +69,9 @@
extModel.experUrl = userInfo.userLevelVo.experUrl; extModel.experUrl = userInfo.userLevelVo.experUrl;
extModel.newUser = userInfo.newUser; extModel.newUser = userInfo.newUser;
extModel.vipIcon = userInfo.userVipInfoVO.vipIcon; extModel.vipIcon = userInfo.userVipInfoVO.vipIcon;
extModel.fromUid = userInfo.fromUid;
extModel.fromType = userInfo.fromType;
extModel.fromNick = userInfo.fromNick;
NSMutableDictionary *ext = [NSMutableDictionary dictionaryWithObject:extModel.model2dictionary forKey:[NSString stringWithFormat:@"%ld", userInfo.uid]]; NSMutableDictionary *ext = [NSMutableDictionary dictionaryWithObject:extModel.model2dictionary forKey:[NSString stringWithFormat:@"%ld", userInfo.uid]];
request.roomExt = [ext toJSONString]; request.roomExt = [ext toJSONString];

View File

@@ -7,6 +7,7 @@
#import "NSObject+MJExtension.h" #import "NSObject+MJExtension.h"
#import "UserLevelVo.h" #import "UserLevelVo.h"
#import "XPEnum.h"
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@interface XPMessageRemoteExtModel : NSObject @interface XPMessageRemoteExtModel : NSObject
@@ -29,7 +30,7 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic,assign) NSInteger experLevelSeq; @property (nonatomic,assign) NSInteger experLevelSeq;
///跟随的 ///跟随的
@property (nonatomic,copy) NSString *fromNick; @property (nonatomic,copy) NSString *fromNick;
@property (nonatomic,copy) NSString *fromType; @property (nonatomic,assign) UserEnterRoomFromType fromType;
@property (nonatomic,copy) NSString *fromUid; @property (nonatomic,copy) NSString *fromUid;
///名牌的 ///名牌的
@property (nonatomic,copy) NSString *inRoomNameplatePic; @property (nonatomic,copy) NSString *inRoomNameplatePic;

View File

@@ -173,16 +173,26 @@
[attribute appendAttributedString:[self createNameplateAttibute:extModel.inRoomNameplateWord image:extModel.inRoomNameplatePic textFont:[UIFont systemFontOfSize:9]]]; [attribute appendAttributedString:[self createNameplateAttibute:extModel.inRoomNameplateWord image:extModel.inRoomNameplatePic textFont:[UIFont systemFontOfSize:9]]];
[attribute appendAttributedString:[self createSapceAttribute:2]]; [attribute appendAttributedString:[self createSapceAttribute:2]];
} }
[attribute appendAttributedString:[self createNickAtrribute:nick uid:message.from.integerValue]];
[attribute appendAttributedString:[self createTextAttribute:nick color:[ThemeColor messageNickColor] font:kRoomMessageDefalutFont]];
if (extModel.carName.length > 0) { if (extModel.carName.length > 0) {
[attribute appendAttributedString:[self createTextAttribute:@" 驾着 " color:[ThemeColor messageDefaultTextColor] font:kRoomMessageDefalutFont]]; [attribute appendAttributedString:[self createTextAttribute:@" 驾着 " color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
[attribute appendAttributedString:[self createTextAttribute:extModel.carName color:[ThemeColor messageNickColor] font:kRoomMessageDefalutFont]]; [attribute appendAttributedString:[self createTextAttribute:extModel.carName color:[ThemeColor messageNickColor] font:kRoomMessageDefalutFont]];
[attribute appendAttributedString:[self createSapceAttribute:2]]; [attribute appendAttributedString:[self createSapceAttribute:2]];
} }
[attribute appendAttributedString:[self createTextAttribute:@"进入了房间" color:[ThemeColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
[self attributeAddHihtLight:attribute uid:message.from.integerValue]; if (extModel.fromType > 0) {
if (extModel.fromType == UserEnterRoomFromType_Home_Recommend) {
[attribute appendAttributedString:[self createTextAttribute:@"根据首页推荐" color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
} else if(extModel.fromType == UserEnterRoomFromType_Follow_User) {
[attribute appendAttributedString:[self createTextAttribute:@"跟随" color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
[attribute appendAttributedString:[self createNickAtrribute:extModel.fromNick uid:extModel.fromUid.integerValue]];
} else if(extModel.fromType == UserEnterRoomFromType_Follow_Game_Detail) {
[attribute appendAttributedString:[self createTextAttribute:@"接受" color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
[attribute appendAttributedString:[self createNickAtrribute:extModel.fromNick uid:extModel.fromUid.integerValue]];
[attribute appendAttributedString:[self createTextAttribute:@"的邀请" color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
}
}
[attribute appendAttributedString:[self createTextAttribute:@"进入了房间" color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
return attribute; return attribute;
} }
break; break;

View File

@@ -6,7 +6,7 @@
// //
#import "MvpViewController.h" #import "MvpViewController.h"
#import "XPMessageRemoteExtModel.h"
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@interface XPRoomViewController : MvpViewController @interface XPRoomViewController : MvpViewController
@@ -17,6 +17,15 @@ NS_ASSUME_NONNULL_BEGIN
*/ */
+ (BOOL)openRoom:(NSString*)roomUid viewController:(UIViewController*)viewController; + (BOOL)openRoom:(NSString*)roomUid viewController:(UIViewController*)viewController;
/** 跟随进房
* @params roomUid 房主uid
* @params fromNick 跟随的人用户昵称
* @params fromType 跟随的类型
* @params fromUid 跟随人的uid
* @params viewController 启动方
*/
+ (BOOL)openRoom:(NSString*)roomUid fromNick:(NSString * __nullable)fromNick fromType:(UserEnterRoomFromType)fromType fromUid:(NSString * __nullable)fromUid viewController:(UIViewController*)viewController;
- (instancetype)init NS_UNAVAILABLE; - (instancetype)init NS_UNAVAILABLE;
+ (instancetype)new NS_UNAVAILABLE; + (instancetype)new NS_UNAVAILABLE;
- (id)copy NS_UNAVAILABLE; - (id)copy NS_UNAVAILABLE;

View File

@@ -78,17 +78,28 @@ UIKIT_EXTERN NSString * const kRoomMiniNotificationKey;
@property (nonatomic,strong) RoomInfoModel *roomInfo; @property (nonatomic,strong) RoomInfoModel *roomInfo;
/// ///
@property (nonatomic,assign) BOOL hasAnimationEffect; @property (nonatomic,assign) BOOL hasAnimationEffect;
///
@property (nonatomic,copy) NSString *fromNick;
@property (nonatomic,assign) UserEnterRoomFromType fromType;
@property (nonatomic,copy) NSString *fromUid;
@end @end
@implementation XPRoomViewController @implementation XPRoomViewController
+ (BOOL)openRoom:(NSString *)roomUid viewController:(UIViewController *)viewController { + (BOOL)openRoom:(NSString *)roomUid viewController:(UIViewController *)viewController {
XPRoomViewController * roomVC = [[self alloc] init]; return [self openRoom:roomUid fromNick:nil fromType:0 fromUid:nil viewController:viewController];
roomVC.roomUid = roomUid; }
BaseNavigationController * baseNav = [[BaseNavigationController alloc] initWithRootViewController:roomVC];
baseNav.modalPresentationStyle = UIModalPresentationFullScreen; + (BOOL)openRoom:(NSString*)roomUid fromNick:(NSString * __nullable)fromNick fromType:(UserEnterRoomFromType)fromType fromUid:(NSString * __nullable)fromUid viewController:(UIViewController*)viewController {
[viewController presentViewController:baseNav animated:YES completion:nil]; XPRoomViewController * roomVC = [[self alloc] init];
return YES; roomVC.roomUid = roomUid;
roomVC.fromUid = fromUid;
roomVC.fromType = fromType;
roomVC.fromNick = fromNick;
BaseNavigationController * baseNav = [[BaseNavigationController alloc] initWithRootViewController:roomVC];
baseNav.modalPresentationStyle = UIModalPresentationFullScreen;
[viewController presentViewController:baseNav animated:YES completion:nil];
return YES;
} }
- (void)dealloc { - (void)dealloc {
@@ -309,6 +320,9 @@ UIKIT_EXTERN NSString * const kRoomMiniNotificationKey;
#pragma mark - XPRoomProtocol #pragma mark - XPRoomProtocol
- (void)initEnterRoomSuccess:(RoomInfoModel *)roomInfo user:(UserInfoModel *)userInfo { - (void)initEnterRoomSuccess:(RoomInfoModel *)roomInfo user:(UserInfoModel *)userInfo {
userInfo.fromUid = self.fromUid;
userInfo.fromType = self.fromType;
userInfo.fromNick = self.fromNick;
self.hasAnimationEffect = roomInfo.hasAnimationEffect; self.hasAnimationEffect = roomInfo.hasAnimationEffect;
self.roomInfo = roomInfo; self.roomInfo = roomInfo;
self.userInfo = userInfo; self.userInfo = userInfo;