更多操作按钮添加开启关闭相亲模式

This commit is contained in:
fengshuo
2022-01-06 18:48:57 +08:00
parent d0e6052995
commit 6af1cc36fa
14 changed files with 146 additions and 2 deletions

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "room_more_menu_dating_close@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "room_more_menu_dating_close@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 808 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "room_more_menu_dating_open@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "room_more_menu_dating_open@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

@@ -63,7 +63,6 @@ typedef NS_ENUM(NSInteger, RoomPlayDateingType) {
@property (nonatomic , assign) RoomType type;
@property (nonatomic , strong) NSArray <NSString *> * speakTemplate;
@property (nonatomic , assign) NSInteger tagId;
@property (nonatomic , assign) BOOL canOpenBlindDate;
@property (nonatomic , assign) BOOL isExceptionClose;
@property (nonatomic , assign) NSInteger recomSeq;
@property (nonatomic , assign) BOOL redEnvelopeOpen;
@@ -101,6 +100,8 @@ typedef NS_ENUM(NSInteger, RoomPlayDateingType) {
@property(nonatomic, assign) BOOL isRoomFans;
///当前相亲所进行到什么模式
@property (nonatomic,assign) RoomPlayDateingType blindDateState;
///能否开启相亲
@property (nonatomic,assign) BOOL canOpenBlindDate;
///本地字段 判断是否开启了 相亲模式
@property (nonatomic,assign) BOOL isOpenRoomDating;
@end

View File

@@ -39,6 +39,16 @@ NS_ASSUME_NONNULL_BEGIN
/// @param roomUid 房间的uid
+ (void)checkInviteRoomFans:(HttpRequestHelperCompletion)completion roomUid:(NSString *)roomUid;
/// 开启相亲模式
/// @param completion 完成
/// @param roomUid 房主的uid
+ (void)openRoomDating:(HttpRequestHelperCompletion)completion roomUid:(NSString *)roomUid;
/// 关闭相亲模式
/// @param completion 完成
/// @param roomUid 房主的uid
+ (void)closeRoomDating:(HttpRequestHelperCompletion)completion roomUid:(NSString *)roomUid;
@end
NS_ASSUME_NONNULL_END

View File

@@ -49,4 +49,18 @@
[self makeRequest:@"room/inviteFans" method:HttpRequestHelperMethodGET completion:completion, __FUNCTION__, roomUid, nil];
}
///
/// @param completion
/// @param roomUid uid
+ (void)openRoomDating:(HttpRequestHelperCompletion)completion roomUid:(NSString *)roomUid {
[self makeRequest:@"blind-date/enable" method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__, roomUid, nil];
}
///
/// @param completion
/// @param roomUid uid
+ (void)closeRoomDating:(HttpRequestHelperCompletion)completion roomUid:(NSString *)roomUid {
[self makeRequest:@"blind-date/disable" method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__, roomUid, nil];
}
@end

View File

@@ -26,6 +26,10 @@ typedef NS_ENUM(NSInteger, RoomMoreMenuType) {
RoomMoreMenuType_Room_Setting = 7,
///邀请粉丝
RoomMoreMenuType_Invite_Fans = 8,
///开启相亲
RoomMoreMenuType_Room_Dating_Open = 9,
///关闭相亲
RoomMoreMenuType_Room_Dating_Close = 10,
};
@interface XPRoomMoreItemModel : NSObject

View File

@@ -26,6 +26,14 @@ NS_ASSUME_NONNULL_BEGIN
/// @param isCloseScreen 是否关闭公屏
/// @param roomId 房间的id
- (void)updateRoomMessageScreenState:(BOOL)isCloseScreen roomId:(NSString *)roomId;
/// 开启相亲模式
/// @param roomUid 房主的uid
- (void)openRoomDating:(NSString *)roomUid;
/// 关闭相亲模式
/// @param roomUid 房主的uid
- (void)closeRoomDating:(NSString *)roomUid;
@end
NS_ASSUME_NONNULL_END

View File

@@ -29,12 +29,17 @@
giftEffect.type = roomInfo.hasAnimationEffect ? RoomMoreMenuType_Gift_Effect_Close : RoomMoreMenuType_Gift_Effect_Open;
giftEffect.titleColor = roomInfo.hasAnimationEffect ? [ThemeColor roomMoreMenuTextColor] : nil;
XPRoomMoreItemModel * dating = [[XPRoomMoreItemModel alloc] init];
dating.title = roomInfo.roomModeType == RoomModeType_Open_Blind ? @"相亲中.." : @"相亲模式";
dating.imageName = roomInfo.roomModeType == RoomModeType_Open_Blind ? @"room_more_menu_dating_close" : @"room_more_menu_dating_open";
dating.type = roomInfo.roomModeType == RoomModeType_Open_Blind ? RoomMoreMenuType_Room_Dating_Close : RoomMoreMenuType_Room_Dating_Open;
dating.titleColor = roomInfo.isCloseScreen ? nil : [ThemeColor roomMoreMenuTextColor];
XPRoomMoreItemModel * messageScreen = [[XPRoomMoreItemModel alloc] init];
messageScreen.title = roomInfo.isCloseScreen ? @"开启公屏" : @"关闭公屏";
messageScreen.imageName = roomInfo.isCloseScreen ? @"room_more_menu_message_open" : @"room_more_menu_message_close";
messageScreen.type = roomInfo.isCloseScreen ? RoomMoreMenuType_Message_Screen_Open : RoomMoreMenuType_Message_Screen_Close;
messageScreen.titleColor = roomInfo.isCloseScreen ? nil : [ThemeColor roomMoreMenuTextColor];
XPRoomMoreItemModel * roomSetting = [[XPRoomMoreItemModel alloc] init];
roomSetting.title = @"房间设置";
@@ -60,7 +65,12 @@
NIMChatroomMember * member = members.firstObject;
BOOL isCreator = member.type == NIMChatroomMemberTypeCreator;
BOOL isManager = member.type == NIMChatroomMemberTypeManager;
if (isCreator || isManager) {
if (roomInfo.canOpenBlindDate) {
[array addObject:dating];
}
[array addObject:messageScreen];
[array addObject:giftValue];
[array addObject:roomSetting];
@@ -105,4 +115,20 @@
}] roomId:roomId isCloseScreen:isCleScreenStr ticket:ticket uid:uid];
}
///
/// @param roomUid uid
- (void)openRoomDating:(NSString *)roomUid {
[Api openRoomDating:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
[[self getView] openRoomDatingSuccess];
}] roomUid:roomUid];
}
///
/// @param roomUid uid
- (void)closeRoomDating:(NSString *)roomUid {
[Api closeRoomDating:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
[[self getView] closeRoomDatingSuccess];
}] roomUid:roomUid];
}
@end

View File

@@ -19,6 +19,10 @@ NS_ASSUME_NONNULL_BEGIN
- (void)closeRoomGiftValueSuccess;
///更新房间信息 成功 公屏的开启和关闭
- (void)updateRoomMessageScreenStateSuccess:(RoomInfoModel * )roomInfo;
///开启相亲成功
- (void)openRoomDatingSuccess;
///关闭相亲成功
- (void)closeRoomDatingSuccess;
@end
NS_ASSUME_NONNULL_END

View File

@@ -129,6 +129,14 @@ UIKIT_EXTERN NSString * const kRoomGiftEffectUpdateNotificationKey;
[self dismissViewControllerAnimated:YES completion:nil];
}
- (void)openRoomDatingSuccess {
[self dismissViewControllerAnimated:YES completion:nil];
}
- (void)closeRoomDatingSuccess {
[self dismissViewControllerAnimated:YES completion:nil];
}
#pragma mark - UICollectionViewDelegate And UICollectionViewDatasource
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
return self.datasource.count;
@@ -200,6 +208,31 @@ UIKIT_EXTERN NSString * const kRoomGiftEffectUpdateNotificationKey;
[self dismissViewControllerAnimated:YES completion:nil];
[[NSNotificationCenter defaultCenter] postNotificationName:kRoomRoomSettingNotificationKey object:nil];
}
break;
case RoomMoreMenuType_Room_Dating_Open:
{
TTAlertConfig *config = [[TTAlertConfig alloc] init];
config.message = @"开启相亲模式?开启同时现有礼物值将被清空";
config.confirmButtonConfig.title = @"开启";
[TTPopup alertWithConfig:config confirmHandler:^{
[self.presenter openRoomDating:roomUid];
} cancelHandler:^{
}];
}
break;
case RoomMoreMenuType_Room_Dating_Close:
{
TTAlertConfig * config = [[TTAlertConfig alloc] init];
config.title = @"提示";
config.message = @"关闭相亲模式?";
config.confirmButtonConfig.title = @"关闭";
[TTPopup alertWithConfig:config confirmHandler:^{
[self.presenter closeRoomDating:roomUid];
} cancelHandler:^{
}];
}
break;
default:
break;
}