移除与心愿礼物相关的代码和引用,简化房间功能模块,更新房间更多菜单的 Action 类以集成 PK 相关功能,提升代码可维护性和扩展性。
This commit is contained in:
@@ -161,10 +161,6 @@ typedef NS_ENUM(NSInteger, RoomDatingStateChangeType) {
|
||||
@property (nonatomic, assign) long long pkBeginTime;
|
||||
///个播随机PK匹配结束时间
|
||||
@property (nonatomic, assign) long long pkMatchStartTime;
|
||||
/// 是否有心愿礼物权限
|
||||
@property (nonatomic,assign) BOOL hasWishGiftPermit;
|
||||
///是否已经开启心愿礼物
|
||||
@property (nonatomic,assign) BOOL hasOpenWishGift;
|
||||
///寻爱之旅的配置
|
||||
@property (nonatomic,strong) CandyTreeSwitchModel *findLoveDrawSwitchVo;
|
||||
///夺宝精灵的配置
|
||||
|
@@ -29,7 +29,6 @@
|
||||
#import "XPRoomMiniManager.h"
|
||||
#import "Api+RoomPK.h"
|
||||
#import "Api+Room.h"
|
||||
#import "Api+WishGift.h"
|
||||
#import "NSObject+MJExtension.h"
|
||||
#import "NSArray+Safe.h"
|
||||
#import "NSMutableDictionary+Saft.h"
|
||||
@@ -51,8 +50,6 @@
|
||||
#import "GiftInfoModel.h"
|
||||
#import "RoomPKTeamModel.h"
|
||||
#import "RoomNewUserGreetModel.h"
|
||||
#import "WishGiftInfoModel.h"
|
||||
#import "WishGiftInfoUpdateModel.h"
|
||||
///View
|
||||
#import "XPRoomHalfWebView.h"
|
||||
#import "XPAnchorAudienceUpMicView.h"
|
||||
@@ -80,8 +77,6 @@
|
||||
#import "XPRoomHalfMessageView.h"
|
||||
#import "XPAcrossRoomPKCountDownView.h"
|
||||
#import "XPNewUserRoomGiftView.h"
|
||||
#import "XPWishGiftViewController.h"
|
||||
#import "XPWishGiftEnterView.h"
|
||||
///个播PK
|
||||
#import "XPAnchorFansTeamEntranceView.h"
|
||||
#import "XPAnchorFansTeamViewController.h"
|
||||
|
@@ -17,7 +17,6 @@
|
||||
#import "XPGiftStorage.h"
|
||||
#import "XPRoomFaceTool.h"
|
||||
#import "TTPopup.h"
|
||||
#import "Api+WishGift.h"
|
||||
#import "NSArray+Safe.h"
|
||||
#import "ClientConfig.h"
|
||||
///Model
|
||||
|
53
YuMi/Modules/YMRoom/View/MoreView/Action/XPPKAction.h
Normal file
53
YuMi/Modules/YMRoom/View/MoreView/Action/XPPKAction.h
Normal file
@@ -0,0 +1,53 @@
|
||||
//
|
||||
// XPPKAction.h
|
||||
// YUMI
|
||||
//
|
||||
// Created by YUMI on 2024/01/01.
|
||||
//
|
||||
|
||||
#import "XPRoomMoreMenuAction.h"
|
||||
|
||||
@class RoomInfoModel;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface XPPKAction : XPRoomMoreMenuAction
|
||||
|
||||
// MARK: - 同房PK模式
|
||||
/// 开启同房PK模式
|
||||
+ (instancetype)roomPKOpenAction;
|
||||
|
||||
/// 关闭同房PK模式
|
||||
+ (instancetype)roomPKCloseAction;
|
||||
|
||||
// MARK: - 跨房PK
|
||||
/// 开启跨房PK
|
||||
+ (instancetype)acrossRoomPKOpenAction;
|
||||
|
||||
/// 关闭跨房PK
|
||||
+ (instancetype)acrossRoomPKCloseAction;
|
||||
|
||||
// MARK: - 主播PK
|
||||
/// 开启主播PK
|
||||
+ (instancetype)anchorPKOpenAction;
|
||||
|
||||
/// 关闭主播PK
|
||||
+ (instancetype)anchorPKCloseAction;
|
||||
|
||||
// MARK: - 相亲模式
|
||||
/// 开启相亲模式
|
||||
+ (instancetype)datingOpenAction;
|
||||
|
||||
/// 关闭相亲模式
|
||||
+ (instancetype)datingCloseAction;
|
||||
|
||||
// MARK: - 根据房间信息创建对应的Action
|
||||
/// 根据房间信息创建对应的PK Action
|
||||
/// @param roomInfo 房间信息
|
||||
+ (instancetype)roomPKActionWithRoomInfo:(RoomInfoModel *)roomInfo;
|
||||
+ (instancetype)corssPKActionWithRoomInfo:(RoomInfoModel *)roomInfo;
|
||||
+ (instancetype)blindActionWithRoomInfo:(RoomInfoModel *)roomInfo;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
325
YuMi/Modules/YMRoom/View/MoreView/Action/XPPKAction.m
Normal file
325
YuMi/Modules/YMRoom/View/MoreView/Action/XPPKAction.m
Normal file
@@ -0,0 +1,325 @@
|
||||
//
|
||||
// XPPKAction.m
|
||||
// YUMI
|
||||
//
|
||||
// Created by YUMI on 2024/01/01.
|
||||
//
|
||||
|
||||
#import "XPPKAction.h"
|
||||
#import "XPRoomMoreMenuActionContext.h"
|
||||
#import "RoomInfoModel.h"
|
||||
#import "DJDKMIMOMColor.h"
|
||||
#import "TTPopup.h"
|
||||
#import "BaseViewController.h"
|
||||
#import "XPRoomPKViewController.h"
|
||||
#import "XPAcrossRoomPKViewController.h"
|
||||
#import "XPAnchorPKViewController.h"
|
||||
#import "AccountInfoStorage.h"
|
||||
|
||||
@implementation XPPKAction
|
||||
|
||||
#pragma mark - 同房PK模式
|
||||
|
||||
+ (instancetype)roomPKOpenAction {
|
||||
XPPKAction *action = [[XPPKAction alloc] init];
|
||||
action.title = YMLocalizedString(@"XPMoreMenuPresenter1");
|
||||
action.imageName = @"room_pk_menu_icon";
|
||||
action.type = RoomMoreMenuType_Room_PK_Open;
|
||||
action.titleColor = [DJDKMIMOMColor appCellBackgroundColor];
|
||||
return action;
|
||||
}
|
||||
|
||||
+ (instancetype)roomPKCloseAction {
|
||||
XPPKAction *action = [[XPPKAction alloc] init];
|
||||
action.title = YMLocalizedString(@"XPMoreMenuPresenter26");
|
||||
action.imageName = @"room_pk_menu_icon";
|
||||
action.type = RoomMoreMenuType_Room_PK_Close;
|
||||
action.titleColor = [DJDKMIMOMColor appCellBackgroundColor];
|
||||
return action;
|
||||
}
|
||||
|
||||
#pragma mark - 跨房PK
|
||||
|
||||
+ (instancetype)acrossRoomPKOpenAction {
|
||||
XPPKAction *action = [[XPPKAction alloc] init];
|
||||
action.title = YMLocalizedString(@"XPMoreMenuPresenter31");
|
||||
action.imageName = @"crossroom_pk_menu_icon";
|
||||
action.type = RoomMoreMenuType_Room_Across_PK_Open;
|
||||
action.titleColor = [DJDKMIMOMColor appCellBackgroundColor];
|
||||
return action;
|
||||
}
|
||||
|
||||
+ (instancetype)acrossRoomPKCloseAction{
|
||||
XPPKAction *action = [[XPPKAction alloc] init];
|
||||
action.title = YMLocalizedString(@"XPMoreMenuPresenter31");
|
||||
action.imageName = @"crossroom_pk_menu_icon";
|
||||
action.type = RoomMoreMenuType_Room_Across_PK_Close;
|
||||
action.titleColor = [DJDKMIMOMColor appCellBackgroundColor];
|
||||
return action;
|
||||
}
|
||||
|
||||
#pragma mark - 主播PK
|
||||
|
||||
+ (instancetype)anchorPKOpenAction {
|
||||
XPPKAction *action = [[XPPKAction alloc] init];
|
||||
action.title = YMLocalizedString(@"XPMoreMenuPresenter33");
|
||||
action.imageName = @"room_more_menu_anchor_pk";
|
||||
action.type = RoomMoreMenuType_Room_Anchor_PK_Open;
|
||||
action.titleColor = [DJDKMIMOMColor appCellBackgroundColor];
|
||||
return action;
|
||||
}
|
||||
|
||||
+ (instancetype)anchorPKCloseAction {
|
||||
XPPKAction *action = [[XPPKAction alloc] init];
|
||||
action.title = YMLocalizedString(@"XPMoreMenuPresenter32");
|
||||
action.imageName = @"room_more_menu_anchor_pk";
|
||||
action.type = RoomMoreMenuType_Room_Anchor_PK_Close;
|
||||
action.titleColor = [DJDKMIMOMColor appCellBackgroundColor];
|
||||
return action;
|
||||
}
|
||||
|
||||
#pragma mark - 相亲模式
|
||||
|
||||
+ (instancetype)datingOpenAction {
|
||||
XPPKAction *action = [[XPPKAction alloc] init];
|
||||
action.title = YMLocalizedString(@"XPMoreMenuPresenter8");
|
||||
action.imageName = @"room_more_menu_dating";
|
||||
action.type = RoomMoreMenuType_Room_Dating_Open;
|
||||
action.titleColor = [DJDKMIMOMColor appCellBackgroundColor];
|
||||
return action;
|
||||
}
|
||||
|
||||
+ (instancetype)datingCloseAction {
|
||||
XPPKAction *action = [[XPPKAction alloc] init];
|
||||
action.title = YMLocalizedString(@"XPMoreMenuPresenter29");
|
||||
action.imageName = @"room_more_menu_dating";
|
||||
action.type = RoomMoreMenuType_Room_Dating_Close;
|
||||
action.titleColor = [DJDKMIMOMColor appCellBackgroundColor];
|
||||
return action;
|
||||
}
|
||||
|
||||
#pragma mark - 根据房间信息创建Action
|
||||
+ (instancetype)roomPKActionWithRoomInfo:(RoomInfoModel *)roomInfo {
|
||||
return roomInfo.roomModeType == RoomModeType_Open_PK_Mode ? [self roomPKOpenAction] : [self roomPKCloseAction];
|
||||
}
|
||||
|
||||
+ (instancetype)corssPKActionWithRoomInfo:(RoomInfoModel *)roomInfo {
|
||||
return roomInfo.roomModeType == RoomModeType_Open_AcrossRoomPK_mode ? [self acrossRoomPKCloseAction] : [self acrossRoomPKOpenAction];
|
||||
}
|
||||
|
||||
+ (instancetype)blindActionWithRoomInfo:(RoomInfoModel *)roomInfo {
|
||||
return roomInfo.roomModeType == RoomModeType_Open_Blind ? [self datingCloseAction] : [self datingOpenAction];
|
||||
}
|
||||
|
||||
#pragma mark - XPRoomMoreMenuAction
|
||||
|
||||
- (BOOL)canExecuteWithContext:(XPRoomMoreMenuActionContext *)context {
|
||||
NSLog(@"=== XPPKAction canExecuteWithContext ===");
|
||||
NSLog(@"Action 类型: %ld, 标题: %@", (long)self.type, self.title);
|
||||
|
||||
// 所有PK相关的Action都可以执行
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)executeWithContext:(XPRoomMoreMenuActionContext *)context {
|
||||
NSLog(@"=== XPPKAction executeWithContext ===");
|
||||
NSLog(@"Action 类型: %ld, 标题: %@", (long)self.type, self.title);
|
||||
|
||||
switch (self.type) {
|
||||
case RoomMoreMenuType_Room_PK_Open:
|
||||
[self executeRoomPKOpen:context];
|
||||
break;
|
||||
case RoomMoreMenuType_Room_PK_Close:
|
||||
[self executeRoomPKClose:context];
|
||||
break;
|
||||
case RoomMoreMenuType_Room_Across_PK_Open:
|
||||
[self executeAcrossRoomPKOpen:context];
|
||||
break;
|
||||
case RoomMoreMenuType_Room_Across_PK_Close:
|
||||
[self executeAcrossRoomPKClose:context];
|
||||
break;
|
||||
case RoomMoreMenuType_Room_Anchor_PK_Open:
|
||||
[self executeAnchorPKOpen:context];
|
||||
break;
|
||||
case RoomMoreMenuType_Room_Anchor_PK_Close:
|
||||
[self executeAnchorPKClose:context];
|
||||
break;
|
||||
case RoomMoreMenuType_Room_Dating_Open:
|
||||
[self executeDatingOpen:context];
|
||||
break;
|
||||
case RoomMoreMenuType_Room_Dating_Close:
|
||||
[self executeDatingClose:context];
|
||||
break;
|
||||
default:
|
||||
NSLog(@"❌ 未知的PK Action类型: %ld", (long)self.type);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - 私有执行方法
|
||||
|
||||
- (void)executeRoomPKOpen:(XPRoomMoreMenuActionContext *)context {
|
||||
NSLog(@"执行开启同房PK模式");
|
||||
|
||||
// 检查房间模式冲突
|
||||
if (context.roomInfo.roomModeType == RoomModeType_Open_Blind) {
|
||||
[self showErrorToast:YMLocalizedString(@"XPRoomMoreMenuViewController20") context:context];
|
||||
[self dismissViewController:context];
|
||||
return;
|
||||
}
|
||||
|
||||
if (context.roomInfo.roomModeType == RoomModeType_Open_AcrossRoomPK_mode) {
|
||||
[self showErrorToast:YMLocalizedString(@"XPRoomMoreMenuViewController21") context:context];
|
||||
[self dismissViewController:context];
|
||||
return;
|
||||
}
|
||||
|
||||
// 跳转到同房PK页面
|
||||
[self dismissViewController:context];
|
||||
XPRoomPKViewController *roomPKVC = [[XPRoomPKViewController alloc] initWithDelegate:context.hostDelegate];
|
||||
[context.hostDelegate.getCurrentNav pushViewController:roomPKVC animated:YES];
|
||||
}
|
||||
|
||||
- (void)executeRoomPKClose:(XPRoomMoreMenuActionContext *)context {
|
||||
NSLog(@"执行关闭同房PK模式");
|
||||
|
||||
// 跳转到同房PK页面
|
||||
[self dismissViewController:context];
|
||||
XPRoomPKViewController *roomPKVC = [[XPRoomPKViewController alloc] initWithDelegate:context.hostDelegate];
|
||||
[context.hostDelegate.getCurrentNav pushViewController:roomPKVC animated:YES];
|
||||
}
|
||||
|
||||
- (void)executeAcrossRoomPKOpen:(XPRoomMoreMenuActionContext *)context {
|
||||
NSLog(@"执行开启跨房PK");
|
||||
|
||||
// 检查房间模式冲突
|
||||
if (context.roomInfo.roomModeType == RoomModeType_Open_Blind) {
|
||||
[self showErrorToast:YMLocalizedString(@"XPRoomMoreMenuViewController13") context:context];
|
||||
[self dismissViewController:context];
|
||||
return;
|
||||
}
|
||||
|
||||
if (context.roomInfo.roomModeType == RoomModeType_Open_PK_Mode) {
|
||||
[self showErrorToast:YMLocalizedString(@"XPRoomMoreMenuViewController14") context:context];
|
||||
[self dismissViewController:context];
|
||||
return;
|
||||
}
|
||||
|
||||
// 跳转到跨房PK页面
|
||||
[self dismissViewController:context];
|
||||
NSString *roomUid = [NSString stringWithFormat:@"%ld", context.roomInfo.uid];
|
||||
XPAcrossRoomPKViewController *acrossRoomPKVC = [[XPAcrossRoomPKViewController alloc] initWithRoomUid:roomUid];
|
||||
[context.hostDelegate.getCurrentNav presentViewController:acrossRoomPKVC animated:YES completion:nil];
|
||||
}
|
||||
|
||||
- (void)executeAcrossRoomPKClose:(XPRoomMoreMenuActionContext *)context {
|
||||
NSLog(@"执行关闭跨房PK");
|
||||
|
||||
[self showErrorToast:YMLocalizedString(@"XPRoomMoreMenuViewController15") context:context];
|
||||
[self dismissViewController:context];
|
||||
}
|
||||
|
||||
- (void)executeAnchorPKOpen:(XPRoomMoreMenuActionContext *)context {
|
||||
NSLog(@"执行开启主播PK");
|
||||
|
||||
if (context.hostDelegate.getRoomInfo.pkMatchStartTime) {
|
||||
// PK匹配中,显示取消匹配确认框
|
||||
TTAlertConfig *config = [[TTAlertConfig alloc] init];
|
||||
config.message = YMLocalizedString(@"XPRoomMoreMenuViewController16");
|
||||
[TTPopup alertWithConfig:config confirmHandler:^{
|
||||
NSString *roomUid = [NSString stringWithFormat:@"%ld", context.roomInfo.uid];
|
||||
// [context.hostDelegate requestCancelMatchRandomPK:roomUid];
|
||||
} cancelHandler:^{
|
||||
}];
|
||||
} else {
|
||||
// 跳转到主播PK页面
|
||||
[self dismissViewController:context];
|
||||
NSString *roomUid = [NSString stringWithFormat:@"%ld", context.roomInfo.uid];
|
||||
XPAnchorPKViewController *anchorPKVC = [[XPAnchorPKViewController alloc] initWithRoomUid:roomUid];
|
||||
[context.hostDelegate.getCurrentNav presentViewController:anchorPKVC animated:YES completion:nil];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)executeAnchorPKClose:(XPRoomMoreMenuActionContext *)context {
|
||||
NSLog(@"执行关闭主播PK");
|
||||
|
||||
if (context.roomInfo.pkState == AcrossRoomPkStateTypePenalty) {
|
||||
if ([context.roomInfo.winUid isEqualToString:[AccountInfoStorage instance].getUid]) {
|
||||
// 赢
|
||||
if (context.roomInfo.roundId) {
|
||||
// [context.hostDelegate requestFinishAnchorPK:[NSString stringWithFormat:@"%ld", context.roomInfo.roundId]];
|
||||
}
|
||||
} else if ([context.roomInfo.winUid isEqualToString:context.roomInfo.pkUid]) {
|
||||
// 输,不需要操作
|
||||
} else {
|
||||
// 平局
|
||||
if (context.roomInfo.roundId) {
|
||||
// [context.hostDelegate requestFinishAnchorPK:[NSString stringWithFormat:@"%ld", context.roomInfo.roundId]];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (context.roomInfo.roundId) {
|
||||
// [context.hostDelegdate requestFinishAnchorPK:[NSString stringWithFormat:@"%ld", context.roomInfo.roundId]];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)executeDatingOpen:(XPRoomMoreMenuActionContext *)context {
|
||||
NSLog(@"执行开启相亲模式");
|
||||
|
||||
// 检查房间模式冲突
|
||||
if (context.roomInfo.roomModeType == RoomModeType_Open_AcrossRoomPK_mode) {
|
||||
[self showErrorToast:YMLocalizedString(@"XPRoomMoreMenuViewController6") context:context];
|
||||
[self dismissViewController:context];
|
||||
return;
|
||||
}
|
||||
|
||||
if (context.roomInfo.roomModeType == RoomModeType_Open_PK_Mode) {
|
||||
[self showErrorToast:YMLocalizedString(@"XPRoomMoreMenuViewController7") context:context];
|
||||
[self dismissViewController:context];
|
||||
return;
|
||||
}
|
||||
|
||||
// 显示确认框
|
||||
TTAlertConfig *config = [[TTAlertConfig alloc] init];
|
||||
config.message = YMLocalizedString(@"XPRoomMoreMenuViewController8");
|
||||
config.confirmButtonConfig.title = YMLocalizedString(@"XPRoomMoreMenuViewController9");
|
||||
[TTPopup alertWithConfig:config confirmHandler:^{
|
||||
NSString *roomUid = [NSString stringWithFormat:@"%ld", context.roomInfo.uid];
|
||||
// [context.hostDelegate openRoomDating:roomUid];
|
||||
} cancelHandler:^{
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)executeDatingClose:(XPRoomMoreMenuActionContext *)context {
|
||||
NSLog(@"执行关闭相亲模式");
|
||||
|
||||
// 显示确认框
|
||||
TTAlertConfig *config = [[TTAlertConfig alloc] init];
|
||||
config.title = YMLocalizedString(@"XPRoomMoreMenuViewController10");
|
||||
config.message = YMLocalizedString(@"XPRoomMoreMenuViewController11");
|
||||
config.confirmButtonConfig.title = YMLocalizedString(@"XPRoomMoreMenuViewController12");
|
||||
[TTPopup alertWithConfig:config confirmHandler:^{
|
||||
NSString *roomUid = [NSString stringWithFormat:@"%ld", context.roomInfo.uid];
|
||||
// [context.hostDelegate closeRoomDating:roomUid];
|
||||
} cancelHandler:^{
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - 辅助方法
|
||||
|
||||
- (void)showErrorToast:(NSString *)message context:(XPRoomMoreMenuActionContext *)context {
|
||||
if (context.presentingViewController && [context.presentingViewController respondsToSelector:@selector(showErrorToast:)]) {
|
||||
BaseViewController *viewController = (BaseViewController *)context.presentingViewController;
|
||||
[viewController showErrorToast:message];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)dismissViewController:(XPRoomMoreMenuActionContext *)context {
|
||||
if (context.presentingViewController && [context.presentingViewController respondsToSelector:@selector(dismissViewControllerAnimated:completion:)]) {
|
||||
BaseViewController *viewController = (BaseViewController *)context.presentingViewController;
|
||||
[viewController dismissViewControllerAnimated:NO completion:nil];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
@@ -11,6 +11,7 @@
|
||||
#import "XPGiftEffectAction.h"
|
||||
#import "XPRoomSettingAction.h"
|
||||
#import "XPSocialAction.h"
|
||||
#import "XPPKAction.h"
|
||||
#import "RoomInfoModel.h"
|
||||
|
||||
@implementation XPRoomMoreMenuActionFactory
|
||||
@@ -28,13 +29,23 @@
|
||||
[actions addObject:[XPRoomSettingAction action]];
|
||||
|
||||
// 3. 社交功能 - 所有用户都可以使用
|
||||
[actions addObject:[XPSocialAction inviteFansAction]];
|
||||
[actions addObject:[XPSocialAction releaseRadioAction]];
|
||||
// [actions addObject:[XPSocialAction inviteFansAction]];
|
||||
// [actions addObject:[XPSocialAction releaseRadioAction]];
|
||||
[actions addObject:[XPSocialAction trumpetAction]];
|
||||
[actions addObject:[XPSocialAction reportAction]];
|
||||
|
||||
// 4. PK相关功能 - 根据房间状态显示对应的Action
|
||||
[actions addObject:[XPPKAction roomPKActionWithRoomInfo:context.roomInfo]];
|
||||
XPPKAction *crossAction = [XPPKAction corssPKActionWithRoomInfo:context.roomInfo];
|
||||
if (crossAction) {
|
||||
[actions addObject:crossAction];
|
||||
}
|
||||
XPPKAction *blindAction = [XPPKAction blindActionWithRoomInfo:context.roomInfo];
|
||||
if (blindAction) {
|
||||
[actions addObject:blindAction];
|
||||
}
|
||||
|
||||
// TODO: 后续添加更多操作
|
||||
// [actions addObject:[XPPKAction action]];
|
||||
// 等等...
|
||||
|
||||
return actions;
|
||||
|
@@ -53,7 +53,7 @@ typedef NS_ENUM(NSInteger, RoomMoreMenuType) {
|
||||
///扬声器
|
||||
RoomMoreMenuType_Room_Voice = 21,
|
||||
///心愿礼物
|
||||
RoomMoreMenuType_Room_Wish_Gift = 22,
|
||||
// RoomMoreMenuType_Room_Wish_Gift = 22,
|
||||
///举报
|
||||
RoomMoreMenuType_Room_report = 23,
|
||||
///房间相册
|
||||
|
@@ -44,13 +44,14 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
* 便利构造方法
|
||||
*/
|
||||
+ (instancetype)contextWithRoomInfo:(RoomInfoModel *)roomInfo
|
||||
userInfo:(UserInfoModel *)userInfo
|
||||
hostDelegate:(id<RoomHostDelegate>)hostDelegate
|
||||
presentingViewController:(id)presentingViewController
|
||||
userInfo:(UserInfoModel * _Nullable)userInfo
|
||||
hostDelegate:(id<RoomHostDelegate> _Nullable)hostDelegate
|
||||
presentingViewController:(id _Nullable)presentingViewController
|
||||
isOnMic:(BOOL)isOnMic
|
||||
isSuperAdmin:(BOOL)isSuperAdmin
|
||||
isAppSuperAdmin:(BOOL)isAppSuperAdmin;
|
||||
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -6,13 +6,14 @@
|
||||
//
|
||||
|
||||
#import "XPRoomMoreMenuActionContext.h"
|
||||
#import "XPMoreMenuPresenter.h"
|
||||
|
||||
@implementation XPRoomMoreMenuActionContext
|
||||
|
||||
+ (instancetype)contextWithRoomInfo:(RoomInfoModel *)roomInfo
|
||||
userInfo:(UserInfoModel *)userInfo
|
||||
hostDelegate:(id<RoomHostDelegate>)hostDelegate
|
||||
presentingViewController:(id)presentingViewController
|
||||
userInfo:(UserInfoModel * _Nullable)userInfo
|
||||
hostDelegate:(id<RoomHostDelegate> _Nullable)hostDelegate
|
||||
presentingViewController:(id _Nullable)presentingViewController
|
||||
isOnMic:(BOOL)isOnMic
|
||||
isSuperAdmin:(BOOL)isSuperAdmin
|
||||
isAppSuperAdmin:(BOOL)isAppSuperAdmin {
|
||||
@@ -29,4 +30,5 @@
|
||||
return context;
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
@@ -28,11 +28,34 @@
|
||||
|
||||
@implementation XPMoreMenuPresenter
|
||||
|
||||
- (void)loadNIMMemberData:(void(^)(NSArray<NIMChatroomMember *> * _Nullable members))finish withRoomInfo:(RoomInfoModel *)roomInfo{
|
||||
if (!finish) {
|
||||
return;
|
||||
}
|
||||
|
||||
NSString * uid = [AccountInfoStorage instance].getUid;
|
||||
if (uid.length <= 0) {
|
||||
finish(nil);
|
||||
return;
|
||||
}
|
||||
NSString * roomId = [NSString stringWithFormat:@"%ld", roomInfo.roomId];
|
||||
NIMChatroomMembersByIdsRequest *request = [[NIMChatroomMembersByIdsRequest alloc]init];
|
||||
request.roomId = roomId;
|
||||
request.userIds = @[uid];
|
||||
|
||||
[[NIMSDK sharedSDK].chatroomManager fetchChatroomMembersByIds:request completion:^(NSError * _Nullable error, NSArray<NIMChatroomMember *> * _Nullable members) {
|
||||
if (members) {
|
||||
finish(members);
|
||||
} else {
|
||||
finish(nil);
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)getMoreMenuDataSourceWithNewArchitecture:(RoomInfoModel *)roomInfo
|
||||
isSuperAdmin:(BOOL)isSuperAdmin
|
||||
isOnMic:(BOOL)isOnMic
|
||||
isAppSuperAdmin:(BOOL)isAppSuperAdmin {
|
||||
|
||||
// 创建上下文
|
||||
XPRoomMoreMenuActionContext *context = [XPRoomMoreMenuActionContext
|
||||
contextWithRoomInfo:roomInfo
|
||||
@@ -46,15 +69,74 @@
|
||||
// 使用工厂创建 Action 列表
|
||||
NSArray<XPRoomMoreMenuAction *> *actions = [XPRoomMoreMenuActionFactory
|
||||
createActionsWithContext:context];
|
||||
|
||||
// 转换为数据模型
|
||||
NSMutableArray *models = [NSMutableArray array];
|
||||
for (XPRoomMoreMenuAction *action in actions) {
|
||||
[models addObject:[action toItemModel]];
|
||||
}
|
||||
// for (XPRoomMoreMenuAction *action in actions) {
|
||||
// [models addObject:[action toItemModel]];
|
||||
// }
|
||||
|
||||
// 调用原有的成功回调
|
||||
[[self getView] getMoreMenuDataSuccess:models];
|
||||
if (isAppSuperAdmin) {
|
||||
// TODO: 超管直接回使用固定组合 models (trumpet, giftEffect, appManager, report)
|
||||
// 调用原有的成功回调
|
||||
[[self getView] getMoreMenuDataSuccess:models];
|
||||
} else {
|
||||
[self loadNIMMemberData:^(NSArray<NIMChatroomMember *> * _Nullable members) {
|
||||
BOOL isCreator = NO;
|
||||
BOOL isManager = NO;
|
||||
if (members) {
|
||||
NIMChatroomMember * member = members.firstObject;
|
||||
if (member) {
|
||||
isCreator = member.type == NIMChatroomMemberTypeCreator;
|
||||
isManager = member.type == NIMChatroomMemberTypeManager;
|
||||
|
||||
if ((isCreator || isManager || isSuperAdmin) && roomInfo.type != RoomType_MiniGame && roomInfo.type != RoomType_Anchor) {
|
||||
// TODO: models 增加 roomPK
|
||||
}
|
||||
if (isCreator && roomInfo.type != RoomType_MiniGame) {
|
||||
if(roomInfo.type != RoomType_Anchor){
|
||||
// TODO: models 增加 acrossRoomPK
|
||||
}
|
||||
}
|
||||
if (isOnMic) {
|
||||
// TODO: models 增加 musicPanel
|
||||
}
|
||||
if (isCreator && roomInfo.type == RoomType_Anchor) {
|
||||
// TODO: models 增加 anchorRoomPK
|
||||
}
|
||||
if (isCreator || isManager || isSuperAdmin) {
|
||||
if (roomInfo.canOpenBlindDate && roomInfo.type != RoomType_Anchor && roomInfo.type != RoomType_MiniGame) {
|
||||
// TODO: models 增加 dating,并指定插入到 index = 1 的位置
|
||||
}
|
||||
// TODO: models 增加 trumpet、giftEffect、roomSetting、bgValue、clearScreen
|
||||
} else {
|
||||
// TODO: models 增加 trumpet、giftEffect
|
||||
}
|
||||
} else {
|
||||
// TODO: models 只有 report 和 giftEffect
|
||||
}
|
||||
} else {
|
||||
// TODO: models 只有 report 和 giftEffect
|
||||
}
|
||||
|
||||
if ((isCreator || isManager || isSuperAdmin) && // 房主 & 管理
|
||||
roomInfo.isPermitRoom != PermitRoomType_License && // 非牌照
|
||||
roomInfo.roomModeType != RoomModeType_Open_Blind && // 非相亲
|
||||
roomInfo.type != RoomType_MiniGame && // 非 10/15 麦
|
||||
roomInfo.type != RoomType_Anchor) {
|
||||
// TODO: models 增加 roomTypeSetting
|
||||
}
|
||||
|
||||
if(roomInfo.hasRoomAlbum == YES){
|
||||
// TODO: models 增加 roomPhotoAlbum
|
||||
}
|
||||
if ([ClientConfig shareConfig].configInfo.redEnvelopeConfig.open &&
|
||||
roomInfo.redEnvelopeOpen) {
|
||||
// TODO: models 增加 redPacket,并指定位置为 index = 1
|
||||
}
|
||||
|
||||
[[self getView] getMoreMenuDataSuccess:models];
|
||||
} withRoomInfo:roomInfo];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)getMoreMenuDataSource:(RoomInfoModel *)roomInfo isSuperAdmin:(BOOL)isSuperAdmin isOnMic:(BOOL)isOnMic isAppSuperAdmin:(BOOL)isAppSuperAdmin{
|
||||
@@ -81,12 +163,6 @@
|
||||
giftEffect.imageName = @"room_more_menu_gift_effect";
|
||||
giftEffect.type = roomInfo.hasAnimationEffect ? RoomMoreMenuType_Gift_Effect_Close : RoomMoreMenuType_Gift_Effect_Open;
|
||||
giftEffect.titleColor = [DJDKMIMOMColor roomMoreMenuTextColor];
|
||||
|
||||
XPRoomMoreItemModel * wishGift = [[XPRoomMoreItemModel alloc] init];
|
||||
wishGift.title = YMLocalizedString(@"XPMoreMenuPresenter6");
|
||||
wishGift.imageName = @"room_more_menu_wish_gift";
|
||||
wishGift.type = RoomMoreMenuType_Room_Wish_Gift;
|
||||
wishGift.titleColor = [DJDKMIMOMColor roomMoreMenuTextColor];
|
||||
|
||||
XPRoomMoreItemModel * dating = [[XPRoomMoreItemModel alloc] init];
|
||||
dating.title = roomInfo.roomModeType == RoomModeType_Open_Blind ? YMLocalizedString(@"XPMoreMenuPresenter29") : YMLocalizedString(@"XPMoreMenuPresenter8");
|
||||
@@ -125,18 +201,6 @@
|
||||
roomSetting.imageName = @"room_more_menu_setting";
|
||||
roomSetting.type = RoomMoreMenuType_Room_Setting;
|
||||
roomSetting.titleColor = [DJDKMIMOMColor roomMoreMenuTextColor];
|
||||
|
||||
XPRoomMoreItemModel * inviteFriend = [[XPRoomMoreItemModel alloc] init];
|
||||
inviteFriend.title = YMLocalizedString(@"XPMoreMenuPresenter22");
|
||||
inviteFriend.imageName = @"room_more_menu_invite_friend";
|
||||
inviteFriend.type = RoomMoreMenuType_Invite_Fans;
|
||||
inviteFriend.titleColor = [DJDKMIMOMColor roomMoreMenuTextColor];
|
||||
|
||||
XPRoomMoreItemModel * releaseRadio = [[XPRoomMoreItemModel alloc] init];
|
||||
releaseRadio.title = YMLocalizedString(@"XPMoreMenuPresenter23");
|
||||
releaseRadio.imageName = @"room_more_menu_release_radio";
|
||||
releaseRadio.type = RoomMoreMenuType_Release_Radio;
|
||||
releaseRadio.titleColor = [DJDKMIMOMColor roomMoreMenuTextColor];
|
||||
|
||||
XPRoomMoreItemModel * trumpet = [[XPRoomMoreItemModel alloc] init];
|
||||
trumpet.title = YMLocalizedString(@"XPMoreMenuPresenter35");
|
||||
@@ -230,10 +294,6 @@
|
||||
[array addObject:anchorRoomPK];
|
||||
indexOfRoomAlbum += 1;
|
||||
}
|
||||
|
||||
if ((isCreator || isManager || isSuperAdmin) && roomInfo.hasWishGiftPermit) {
|
||||
[array addObject:wishGift];
|
||||
}
|
||||
|
||||
if (isCreator || isManager || isSuperAdmin) {
|
||||
if (roomInfo.canOpenBlindDate && roomInfo.type != RoomType_Anchor && roomInfo.type != RoomType_MiniGame) {
|
||||
|
@@ -34,7 +34,6 @@
|
||||
#import "XPReleaseRadioViewController.h"
|
||||
#import "XPRoomPKViewController.h"
|
||||
#import "BaseNavigationController.h"
|
||||
#import "XPWishGiftCreateViewController.h"
|
||||
#import "XPAnchorPKSelectTypeController.h"
|
||||
#import "XPRoomTrumpetViewController.h"
|
||||
#import "XPWebViewController.h"
|
||||
@@ -49,6 +48,9 @@
|
||||
#import "RoomModeViewController.h"
|
||||
|
||||
#import "XPRoomMoreMenuActionTest.h"
|
||||
#import "XPRoomMoreMenuActionFactory.h"
|
||||
#import "XPRoomMoreMenuAction.h"
|
||||
#import "XPPKAction.h"
|
||||
|
||||
UIKIT_EXTERN NSString * const kRoomGiftEffectUpdateNotificationKey;
|
||||
|
||||
@@ -93,7 +95,7 @@ UIKIT_EXTERN NSString * const kRoomGiftEffectUpdateNotificationKey;
|
||||
[self initSubViewConstraints];
|
||||
|
||||
// 测试新的架构实现
|
||||
// [self testNewArchitecture];
|
||||
[self testNewArchitecture];
|
||||
|
||||
///自己是公会超管
|
||||
BOOL meIsSuperAdmin = NO;
|
||||
@@ -578,14 +580,6 @@ UIKIT_EXTERN NSString * const kRoomGiftEffectUpdateNotificationKey;
|
||||
item.isSelected = [RtcManager instance].isRemoteMuted;
|
||||
}
|
||||
break;
|
||||
case RoomMoreMenuType_Room_Wish_Gift:
|
||||
{
|
||||
[self dismissViewControllerAnimated:YES completion:nil];
|
||||
|
||||
XPWishGiftCreateViewController *wishGiftVC = [[XPWishGiftCreateViewController alloc] initWithDelegate:self.hostDelegate];
|
||||
[self.hostDelegate.getCurrentNav pushViewController:wishGiftVC animated:YES];
|
||||
}
|
||||
break;
|
||||
case RoomMoreMenuType_Room_report:
|
||||
{
|
||||
[self dismissViewControllerAnimated:YES completion:nil];
|
||||
|
Reference in New Issue
Block a user