diff --git a/Podfile.lock b/Podfile.lock index e166c20d..72548075 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -201,4 +201,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: 1fa9307cda450b37197ea1356c5e0679d82d1d41 -COCOAPODS: 1.11.0 +COCOAPODS: 1.11.2 diff --git a/xplan-ios.xcodeproj/project.pbxproj b/xplan-ios.xcodeproj/project.pbxproj index 0871b7b6..2648299d 100644 --- a/xplan-ios.xcodeproj/project.pbxproj +++ b/xplan-ios.xcodeproj/project.pbxproj @@ -110,6 +110,8 @@ 18F404C3276098F100A6C548 /* Api+Message.m in Sources */ = {isa = PBXBuildFile; fileRef = 18F404C2276098F100A6C548 /* Api+Message.m */; }; 18F404C927609A4300A6C548 /* MessagePresenter.m in Sources */ = {isa = PBXBuildFile; fileRef = 18F404C827609A4300A6C548 /* MessagePresenter.m */; }; 73FFADDC93E195344047A2EC /* Pods_xplan_ios.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CACF623970097D653132D69A /* Pods_xplan_ios.framework */; }; + 9B0086C627BA392B0032BD2B /* AnchorStageView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B0086C527BA392B0032BD2B /* AnchorStageView.m */; }; + 9B0086CA27BA4F570032BD2B /* AnchorMicroView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B0086C927BA4F570032BD2B /* AnchorMicroView.m */; }; 9B0E1C5926E77022005D4442 /* BaseNavigationController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B0E1C5826E77022005D4442 /* BaseNavigationController.m */; }; 9B7D804A2753783D003DAC0C /* SessionViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B7D80492753783D003DAC0C /* SessionViewController.m */; }; 9B7D804D27537950003DAC0C /* MessageCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B7D804C27537950003DAC0C /* MessageCell.m */; }; @@ -629,6 +631,10 @@ 18F404C727609A4300A6C548 /* MessagePresenter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MessagePresenter.h; sourceTree = ""; }; 18F404C827609A4300A6C548 /* MessagePresenter.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MessagePresenter.m; sourceTree = ""; }; 7DB00EC07F1D0ADFF900B38D /* Pods-xplan-ios.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-xplan-ios.debug.xcconfig"; path = "Target Support Files/Pods-xplan-ios/Pods-xplan-ios.debug.xcconfig"; sourceTree = ""; }; + 9B0086C427BA392B0032BD2B /* AnchorStageView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AnchorStageView.h; sourceTree = ""; }; + 9B0086C527BA392B0032BD2B /* AnchorStageView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AnchorStageView.m; sourceTree = ""; }; + 9B0086C827BA4F570032BD2B /* AnchorMicroView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AnchorMicroView.h; sourceTree = ""; }; + 9B0086C927BA4F570032BD2B /* AnchorMicroView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AnchorMicroView.m; sourceTree = ""; }; 9B0E1C5726E77022005D4442 /* BaseNavigationController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BaseNavigationController.h; sourceTree = ""; }; 9B0E1C5826E77022005D4442 /* BaseNavigationController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BaseNavigationController.m; sourceTree = ""; }; 9B7D80482753783D003DAC0C /* SessionViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SessionViewController.h; sourceTree = ""; }; @@ -1911,6 +1917,15 @@ path = Protocol; sourceTree = ""; }; + 9B0086C727BA4F4A0032BD2B /* Anchor */ = { + isa = PBXGroup; + children = ( + 9B0086C827BA4F570032BD2B /* AnchorMicroView.h */, + 9B0086C927BA4F570032BD2B /* AnchorMicroView.m */, + ); + path = Anchor; + sourceTree = ""; + }; 9B7D804727537819003DAC0C /* Session */ = { isa = PBXGroup; children = ( @@ -2540,6 +2555,7 @@ E8680707271959090024F48F /* MicroView */ = { isa = PBXGroup; children = ( + 9B0086C727BA4F4A0032BD2B /* Anchor */, E8899C7C27853B46007944BE /* Dating */, 180806DA27297269001FD836 /* MicroViewProtocol.h */, E8680716271967B00024F48F /* MicroView.h */, @@ -3073,6 +3089,8 @@ 181D7F202727D9DB00B7C059 /* SocialStageView.m */, E877A7E92783E24700EFACED /* DatingStageView.h */, E877A7EA2783E24700EFACED /* DatingStageView.m */, + 9B0086C427BA392B0032BD2B /* AnchorStageView.h */, + 9B0086C527BA392B0032BD2B /* AnchorStageView.m */, ); path = StageView; sourceTree = ""; @@ -3748,6 +3766,7 @@ E8E70D8926F2F58F00F03460 /* XPMineMatchTableViewCell.m in Sources */, E88B5CA826FB089C00DA9178 /* XPMineTeenagePwdViewController.m in Sources */, E81C1B2F277071670020D1E4 /* XPArrangeMicInfoModel.m in Sources */, + 9B0086CA27BA4F570032BD2B /* AnchorMicroView.m in Sources */, E81C279626EB39CC0031E639 /* LoginForgetPasswordPresent.m in Sources */, 18EE3FF42750FA3700A452BF /* UIView+NIM.m in Sources */, E8A03DFF27635F960098D9EA /* XPRoomCandyGiftView.m in Sources */, @@ -4019,6 +4038,7 @@ E88B5CB826FB325200DA9178 /* XPMineTeenagerPwdPresenter.m in Sources */, E84B0E462727EF9D008818C6 /* XPRoomMessageParser.m in Sources */, E838D9A0275E1BF60079E0B5 /* XPRoomAnimationView.m in Sources */, + 9B0086C627BA392B0032BD2B /* AnchorStageView.m in Sources */, E874B88827215D39003954B9 /* MicroStateModel.m in Sources */, E877A7F427842EF800EFACED /* XPRoomDatingVipUpMicView.m in Sources */, E896EF9F2771AE7B00AD2CC1 /* XPMineAttentionViewController.m in Sources */, @@ -4178,7 +4198,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 4.1.0; + MARKETING_VERSION = 4.2.0; PRODUCT_BUNDLE_IDENTIFIER = com.yinyou.enterprise.ios; PRODUCT_NAME = "$(TARGET_NAME)"; TARGETED_DEVICE_FAMILY = 1; @@ -4208,7 +4228,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 4.1.0; + MARKETING_VERSION = 4.2.0; PRODUCT_BUNDLE_IDENTIFIER = com.yinyou.enterprise.ios; PRODUCT_NAME = "$(TARGET_NAME)"; TARGETED_DEVICE_FAMILY = 1; diff --git a/xplan-ios/Assets.xcassets/Room/Anchor/Contents.json b/xplan-ios/Assets.xcassets/Room/Anchor/Contents.json new file mode 100644 index 00000000..73c00596 --- /dev/null +++ b/xplan-ios/Assets.xcassets/Room/Anchor/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/xplan-ios/Assets.xcassets/Room/Anchor/room_game_position_boss.imageset/Contents.json b/xplan-ios/Assets.xcassets/Room/Anchor/room_game_position_boss.imageset/Contents.json new file mode 100644 index 00000000..00d9a725 --- /dev/null +++ b/xplan-ios/Assets.xcassets/Room/Anchor/room_game_position_boss.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "room_game_position_boss@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "room_game_position_boss@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/xplan-ios/Assets.xcassets/Room/Anchor/room_game_position_boss.imageset/room_game_position_boss@2x.png b/xplan-ios/Assets.xcassets/Room/Anchor/room_game_position_boss.imageset/room_game_position_boss@2x.png new file mode 100644 index 00000000..ae896870 Binary files /dev/null and b/xplan-ios/Assets.xcassets/Room/Anchor/room_game_position_boss.imageset/room_game_position_boss@2x.png differ diff --git a/xplan-ios/Assets.xcassets/Room/Anchor/room_game_position_boss.imageset/room_game_position_boss@3x.png b/xplan-ios/Assets.xcassets/Room/Anchor/room_game_position_boss.imageset/room_game_position_boss@3x.png new file mode 100644 index 00000000..408827bf Binary files /dev/null and b/xplan-ios/Assets.xcassets/Room/Anchor/room_game_position_boss.imageset/room_game_position_boss@3x.png differ diff --git a/xplan-ios/Main/IM/Model/AttachmentModel.h b/xplan-ios/Main/IM/Model/AttachmentModel.h index 6db202bb..348a0a02 100644 --- a/xplan-ios/Main/IM/Model/AttachmentModel.h +++ b/xplan-ios/Main/IM/Model/AttachmentModel.h @@ -42,6 +42,8 @@ typedef NS_ENUM(NSUInteger, CustomMessageType) { CustomMessageType_RoomPlay_Dating = 72, ///首充奖励 CustomMessageType_First_Recharge_Reward = 76, + ///个播房观众点击空坑位,房主收到请求上麦提示 + Custom_Noti_Header_AnchorRoom_AudienceUpMic = 86, }; diff --git a/xplan-ios/Main/Room/Model/RoomInfoModel.h b/xplan-ios/Main/Room/Model/RoomInfoModel.h index fb92a8dc..08778165 100644 --- a/xplan-ios/Main/Room/Model/RoomInfoModel.h +++ b/xplan-ios/Main/Room/Model/RoomInfoModel.h @@ -10,7 +10,8 @@ NS_ASSUME_NONNULL_BEGIN typedef NS_ENUM(NSInteger, RoomType) { - RoomType_Game = 3, + RoomType_Game = 3, + RoomType_Anchor = 6 // 个播房 }; typedef NS_ENUM(NSInteger, RoomModeType){ diff --git a/xplan-ios/Main/Room/View/MoreView/Presenter/XPMoreMenuPresenter.m b/xplan-ios/Main/Room/View/MoreView/Presenter/XPMoreMenuPresenter.m index 36975cef..7ba213bf 100644 --- a/xplan-ios/Main/Room/View/MoreView/Presenter/XPMoreMenuPresenter.m +++ b/xplan-ios/Main/Room/View/MoreView/Presenter/XPMoreMenuPresenter.m @@ -68,7 +68,7 @@ if (isCreator || isManager) { - if (roomInfo.canOpenBlindDate) { + if (roomInfo.canOpenBlindDate && roomInfo.type != RoomType_Anchor) { [array addObject:dating]; } [array addObject:messageScreen]; diff --git a/xplan-ios/Main/Room/View/StageView/AnchorStageView.h b/xplan-ios/Main/Room/View/StageView/AnchorStageView.h new file mode 100644 index 00000000..3696cbe1 --- /dev/null +++ b/xplan-ios/Main/Room/View/StageView/AnchorStageView.h @@ -0,0 +1,16 @@ +// +// AnchorStageView.h +// xplan-ios +// +// Created by GreenLand on 2022/2/14. +// + +#import "StageView.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface AnchorStageView : StageView + +@end + +NS_ASSUME_NONNULL_END diff --git a/xplan-ios/Main/Room/View/StageView/AnchorStageView.m b/xplan-ios/Main/Room/View/StageView/AnchorStageView.m new file mode 100644 index 00000000..f56c6a31 --- /dev/null +++ b/xplan-ios/Main/Room/View/StageView/AnchorStageView.m @@ -0,0 +1,241 @@ +// +// AnchorStageView.m +// xplan-ios +// +// Created by GreenLand on 2022/2/14. +// + +#import "AnchorStageView.h" +///Third +#import +#import +///Tool +#import "AccountInfoStorage.h" +#import "XCHudTool.h" +#import "XPMacro.h" +#import "TTPopup.h" +#import "Api+Room.h" +///Model +#import "RoomInfoModel.h" +#import "MicroExtModel.h" +#import "XPUserCardInfoModel.h" +#import "AttachmentModel.h" +///View +#import "AnchorMicroView.h" +#import "XPUserCardViewController.h" +#import "XPRoomInviteUserViewController.h" + +// 房主头像宽 150 + 光圈 5 +#define ownerWidth (150 + 5) +// 昵称高12,距离头像间距 6 +#define ownerHeight (ownerWidth + 6 + 12) +// 右边 3 个坑位宽40 + 光圈 5 +#define mcWidth (40 + 5) +#define mcHeight (mcWidth + 6 + 12) +// 右 padding 20 +#define paddingH 20 +// 右边坑位的上下间距 +#define marginV2 15 + +@implementation AnchorStageView + +- (NSInteger)countOfMircoView { + return 4; +} + +- (UIView *)microViewForIndex:(NSInteger)index { + UIView * microView = [super microViewForIndex:index]; + if (microView) { + return microView; + } + return [[AnchorMicroView alloc]init]; +} + +/** + * | ◯ | * 房主头像宽 150 + 光圈 5 + * | 20 ◯ ◯ ◯ ◯ 20 | * 左右 padding 20 + * | 15 | * 上下两排间距 15 + * | ◯ ◯ ◯ ◯ | * 右边 3 个坑位宽40 + 光圈 5 + * * 昵称高12,距离头像间距 6 + */ +- (CGRect)rectForViewAtIndex:(NSInteger)index { + if (index == 0) { + return CGRectMake(KScreenWidth / 2 - ownerWidth / 2, (360 - ownerWidth) * 0.5, ownerWidth, ownerHeight); + } + if (index >= 1 && index <= 3) { + CGFloat firstMarginTop = (360 - marginV2 * 2 - mcHeight * 3) * 0.5; + return CGRectMake(KScreenWidth - mcWidth - paddingH, firstMarginTop + (index - 1) * (mcHeight + marginV2), mcWidth, mcHeight); + } + + return [super rectForViewAtIndex:index]; +} + +- (CGFloat)hightForStageView { + return 360; +} + +- (CGPoint)animationPointAtStageViewByUid:(NSString *)uid { + NSInteger index = [self getIndexByUid:uid]; + CGPoint point = CGPointZero; + if (index == 0) { + point = CGPointMake(KScreenWidth / 2, ownerWidth / 2 - 10); + } + + if (index >= 1 && index <= 3) { + CGFloat firstMarginTop = (360 - 15 * 2 - mcHeight * 3) * 0.5; + point = CGPointMake(KScreenWidth - mcWidth * 0.5 - paddingH, firstMarginTop + (index - 1) * mcHeight - 10); + } + + point = [self convertPoint:point toView:nil]; + return point; +} + +- (void)onRoomEntered { + [super onRoomEntered]; + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + [self autoUpMicAtIndex:-1]; + }); +} + +- (void)autoUpMicAtIndex:(NSInteger)index { + NIMChatroomQueueUpdateRequest *request = [[NIMChatroomQueueUpdateRequest alloc]init]; + request.key = [NSString stringWithFormat:@"%zd", index]; + UserInfoModel* userInfo = self.hostDelegate.getUserInfo; + RoomInfoModel* roomInfo = self.hostDelegate.getRoomInfo; + if (roomInfo.uid != [[AccountInfoStorage instance].getUid integerValue]) { + return; + } + NSString* roomId = [NSString stringWithFormat:@"%ld", roomInfo.roomId]; + request.value = [[self userInfoToQueueExt:userInfo] toJSONString]; + request.roomId = roomId; + request.transient = YES; + [[NIMSDK sharedSDK].chatroomManager updateChatroomQueueObject:request completion:^(NSError * _Nullable error) { + }]; +} + +/** + * index 处的坑位点击事件 + */ +- (void)didSelectAtIndex:(NSInteger)index { + MicroQueueModel* micModel = [self.getMicroQueue objectForKey:[self indexToPosition:index]]; + UserInfoModel* userInfo = self.hostDelegate.getUserInfo; + RoomInfoModel* roomInfo = self.hostDelegate.getRoomInfo; + NSString* position = [self indexToPosition:index]; + NSString* uid = [NSString stringWithFormat:@"%ld", userInfo.uid]; + NSString* roomId = [NSString stringWithFormat:@"%ld", roomInfo.roomId]; + + // 1. 麦位上有人,弹窗用户资料卡 + NSString * targetUid; + if (roomInfo.leaveMode && [position isEqualToString:@"-1"]) { + targetUid = [NSString stringWithFormat:@"%ld", roomInfo.uid]; + } + if (micModel.userInfo && micModel.userInfo.uid > 0) { + targetUid = [NSString stringWithFormat:@"%ld", micModel.userInfo.uid]; + } + + if (targetUid && targetUid.length > 0) { + XPUserCardInfoModel * model = [[XPUserCardInfoModel alloc] init]; + model.uid = targetUid; + model.position = position; + model.posState = micModel.microState.posState; + model.micState = micModel.microState.micState; + model.nick = userInfo.nick; + model.roomInfo = roomInfo; + model.micQueue = self.getMicroQueue; + model.delegate = self.hostDelegate; + XPUserCardViewController * userCardVC = [[XPUserCardViewController alloc] initWithUser:model]; + [self.hostDelegate.getCurrentNav presentViewController:userCardVC animated:YES completion:nil]; + return; + } + + // 2. 空麦位,上麦逻辑 + NIMChatroomMembersByIdsRequest *request = [[NIMChatroomMembersByIdsRequest alloc]init]; + request.roomId = roomId; + request.userIds = @[uid]; + [[NIMSDK sharedSDK].chatroomManager fetchChatroomMembersByIds:request completion:^(NSError * _Nullable error, NSArray * _Nullable members) { + NIMChatroomMember * member = members.firstObject; + if (!member) return; + // 2.1 房主点击了空麦位 + if (member.type == NIMTeamMemberTypeOwner) { + // 2.1.2 锁麦/解锁 + NSString * lockTitle; + if (roomInfo.roomModeType == RoomModeType_Open_Micro_Mode || roomInfo.roomModeType == RoomModeType_Open_Blind) { + lockTitle = micModel.microState.posState == MicroPosStateType_Free ? @"切换为排麦" : @"切换为自由麦"; + } else { + lockTitle = micModel.microState.posState == MicroPosStateType_Free ? @"锁麦" : @"解锁"; + } + TTActionSheetConfig *lockMic = [TTActionSheetConfig normalTitle:lockTitle clickAction:^{ + NSString * roomUid = [NSString stringWithFormat:@"%ld", self.hostDelegate.getRoomInfo.uid]; + NSString * state = micModel.microState.posState == MicroPosStateType_Free ? @"1" : @"0"; + NSString * ticket = [[AccountInfoStorage instance] getTicket]; + NSString * uid = [[AccountInfoStorage instance] getUid]; + [Api microLockCompletion:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) { + + } roomUid:roomUid state:state position:position ticket:ticket uid:uid]; + }]; + + // 2.1.3 闭麦/开麦 + NSString * muteTitle = micModel.microState.micState == MicroMicStateType_Open ? @"闭麦" : @"开麦"; + TTActionSheetConfig *muteMic = [TTActionSheetConfig normalTitle:muteTitle clickAction:^{ + NSString * roomUid = [NSString stringWithFormat:@"%ld", self.hostDelegate.getRoomInfo.uid]; + NSString * state = micModel.microState.micState == MicroMicStateType_Open ? @"1" : @"0"; + NSString * ticket = [[AccountInfoStorage instance] getTicket]; + NSString * uid = [[AccountInfoStorage instance] getUid]; + [Api microMuteCompletion:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) { + + } roomUid:roomUid state:state position:position ticket:ticket uid:uid]; + }]; + + // 抱Ta上麦 + TTActionSheetConfig *inviteMic = [TTActionSheetConfig normalTitle:@"抱Ta上麦" clickAction:^{ + XPRoomInviteUserViewController * inviteUserMicVC = [[XPRoomInviteUserViewController alloc] init]; + inviteUserMicVC.roomId = roomId; + inviteUserMicVC.position = position; + inviteUserMicVC.blindDateVipUid = roomInfo.blindDateVipUid; + [self.hostDelegate.getCurrentNav pushViewController:inviteUserMicVC animated:YES]; + }]; + + [TTPopup actionSheetWithItems:@[inviteMic, lockMic, muteMic]]; + } else { + // 2.2 非房主点击了空麦位 + NSString* selfUid = [NSString stringWithFormat:@"%ld", (long)self.hostDelegate.getUserInfo.uid]; + UIView* microView = [self findMicroViewByUid:selfUid]; + if (microView) { + [XCHUDTool showErrorWithMessage:@"你已经在麦上了喔"]; + } else { + [XCHUDTool showErrorWithMessage:@"让主播抱你上麦进行更多互动吧~"]; + [self sendMessageToRoomOwnerWithUserModel:self.hostDelegate.getUserInfo]; + } + } + }]; +} + +- (void)sendMessageToRoomOwnerWithUserModel:(UserInfoModel *)userInfo { + NIMMessage * message = [[NIMMessage alloc] init]; + AttachmentModel * attachMent = [[AttachmentModel alloc] init]; + attachMent.first = Custom_Noti_Header_AnchorRoom_AudienceUpMic; + attachMent.data = [userInfo model2dictionary]; + NIMCustomObject *object = [[NIMCustomObject alloc] init]; + object.attachment = attachMent; + message.messageObject = object; + //构造会话 + NSString * sessionId = [NSString stringWithFormat:@"%ld", self.hostDelegate.getRoomInfo.roomId]; + NIMSession *session = [NIMSession session:sessionId type:NIMSessionTypeChatroom]; + [[NIMSDK sharedSDK].chatManager sendMessage:message toSession:session error:nil]; +} + +#pragma mark - private utils function +/** + * 麦位更新扩展字段。 + */ +- (NSDictionary *)userInfoToQueueExt:(UserInfoModel *)userInfo { + MicroExtModel * extModel = [[MicroExtModel alloc] init]; + extModel.gender = userInfo.gender; + extModel.avatar = userInfo.avatar; + extModel.uid = userInfo.uid; + extModel.nick = userInfo.nick; + extModel.headWearUrl = userInfo.headwearEffect.length > 0 ? userInfo.headwearEffect : userInfo.headwearPic; + return [extModel model2dictionary]; +} + +@end diff --git a/xplan-ios/Main/Room/View/StageView/MicroView/Anchor/AnchorMicroView.h b/xplan-ios/Main/Room/View/StageView/MicroView/Anchor/AnchorMicroView.h new file mode 100644 index 00000000..58a0baff --- /dev/null +++ b/xplan-ios/Main/Room/View/StageView/MicroView/Anchor/AnchorMicroView.h @@ -0,0 +1,16 @@ +// +// AnchorMicroView.h +// xplan-ios +// +// Created by GreenLand on 2022/2/14. +// + +#import "MicroView.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface AnchorMicroView : MicroView + +@end + +NS_ASSUME_NONNULL_END diff --git a/xplan-ios/Main/Room/View/StageView/MicroView/Anchor/AnchorMicroView.m b/xplan-ios/Main/Room/View/StageView/MicroView/Anchor/AnchorMicroView.m new file mode 100644 index 00000000..a9e8d40b --- /dev/null +++ b/xplan-ios/Main/Room/View/StageView/MicroView/Anchor/AnchorMicroView.m @@ -0,0 +1,56 @@ +// +// AnchorMicroView.m +// xplan-ios +// +// Created by GreenLand on 2022/2/14. +// + +#import "AnchorMicroView.h" +///Third +#import + +@implementation AnchorMicroView + +#pragma mark - MicroViewProtocol +- (void)showGiftValueMode:(BOOL)isGiftValue { + self.giftValueView.hidden = YES; +} + +- (void)showLeaveMode:(BOOL)isLeaveMode { +} + +- (void)configMicroView:(MicroQueueModel *)model { + [super configMicroView:model]; + UserInfoModel * userInfo = model.userInfo; + int position = model.microState.position; + if (position != -1 && userInfo == nil) { + self.nickLabel.text = @"号嘉宾"; + } + if (position == 0) { + UIImage *image = [UIImage imageNamed:@"room_game_position_boss"]; + CGSize scaledToSize = CGSizeMake(self.frame.size.width, self.frame.size.width); + UIGraphicsBeginImageContextWithOptions(scaledToSize, false, 0.0); + // 缩小 “1” 点儿,防止默认背景的边缘被裁减。 + [image drawInRect:CGRectMake(1, 1, scaledToSize.width - 2, scaledToSize.height - 2)]; + UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext(); + UIGraphicsEndImageContext(); + self.avatarImageView.backgroundColor = [UIColor colorWithPatternImage:newImage]; + } + ///更新离开模式蒙层 + if (userInfo) { + if ([self.subviews containsObject:self.leaveLabel]) { + [self.leaveLabel removeFromSuperview]; + } + } else { + if (![self.subviews containsObject:self.leaveLabel]) { + [self insertSubview:self.leaveLabel belowSubview:self.giftValueView]; + [self.leaveLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.edges.mas_equalTo(self.avatarImageView); + }]; + self.leaveLabel.layer.cornerRadius = 150 * 0.5; + self.leaveLabel.layer.masksToBounds = YES; + } + } +} + +@end diff --git a/xplan-ios/Main/Room/View/StageView/MicroView/MicroView.h b/xplan-ios/Main/Room/View/StageView/MicroView/MicroView.h index 05f51785..834b3513 100644 --- a/xplan-ios/Main/Room/View/StageView/MicroView/MicroView.h +++ b/xplan-ios/Main/Room/View/StageView/MicroView/MicroView.h @@ -9,6 +9,9 @@ #import #import "MicroViewProtocol.h" #import "NetImageView.h" +#import "MicroGiftValueView.h" + +@class MicroGiftValueView; NS_ASSUME_NONNULL_BEGIN @interface MicroView : UIView ///头像 @@ -19,6 +22,11 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic,strong, readonly) UILabel *nickLabel; ///头饰 @property (nonatomic,strong, readonly) YYAnimatedImageView *headWearImageView; +///礼物值 +@property (nonatomic,strong, readonly) MicroGiftValueView *giftValueView; +///离开模式 +@property (nonatomic,strong) UILabel *leaveLabel; + @end NS_ASSUME_NONNULL_END diff --git a/xplan-ios/Main/Room/View/StageView/MicroView/MicroView.m b/xplan-ios/Main/Room/View/StageView/MicroView/MicroView.m index e43d31b7..5a51f409 100644 --- a/xplan-ios/Main/Room/View/StageView/MicroView/MicroView.m +++ b/xplan-ios/Main/Room/View/StageView/MicroView/MicroView.m @@ -11,7 +11,6 @@ ///View #import "MicroWaveView.h" -#import "MicroGiftValueView.h" #import "NetImageView.h" #import "XPHtmlUrl.h" @@ -34,8 +33,6 @@ @property (nonatomic,strong) UILabel *nickLabel; ///声波动画 @property (nonatomic,strong) MicroWaveView *animationView; -///离开模式 -@property (nonatomic,strong) UILabel *leaveLabel; ///礼物值 @property (nonatomic,strong) MicroGiftValueView *giftValueView; ///麦序的信息 diff --git a/xplan-ios/Main/Room/View/UserCard/Presenter/XPUserCardPresenter.m b/xplan-ios/Main/Room/View/UserCard/Presenter/XPUserCardPresenter.m index 67ee52da..b8be96bf 100644 --- a/xplan-ios/Main/Room/View/UserCard/Presenter/XPUserCardPresenter.m +++ b/xplan-ios/Main/Room/View/UserCard/Presenter/XPUserCardPresenter.m @@ -193,6 +193,9 @@ if (member.type == NIMTeamMemberTypeOwner || member.type == NIMChatroomMemberTypeManager) { if (userInfo.roomInfo.leaveMode && userInfo.uid.integerValue == userInfo.roomInfo.uid && [userInfo.position isEqualToString:@"-1"]) { [array addObject:muteItem]; + if (userInfo.roomInfo.type != RoomType_Anchor) {//个播房房主自己不能自行下麦 + [array addObject:upDownItem]; + } [array addObject:lockItem]; } else { if (userInfo.position.length > 0) { @@ -228,7 +231,9 @@ [array addObject:muteItem]; [array addObject:upDownItem]; [array addObject:lockItem]; - [array addObject:giftValueItem]; + if (userInfo.roomInfo.type != RoomType_Anchor) {//非个播房显示清除礼物值 + [array addObject:giftValueItem]; + } } } else { [array addObject:upDownItem]; @@ -255,7 +260,9 @@ [array addObject:muteItem]; [array addObject:upDownItem]; [array addObject:lockItem]; - [array addObject:giftValueItem]; + if (userInfo.roomInfo.type != RoomType_Anchor) {//非个播房显示清除礼物值 + [array addObject:giftValueItem]; + } } } else { [array addObject:upDownItem]; diff --git a/xplan-ios/Main/Room/View/XPRoomViewController.m b/xplan-ios/Main/Room/View/XPRoomViewController.m index 00e4b61e..ad7ad7d4 100644 --- a/xplan-ios/Main/Room/View/XPRoomViewController.m +++ b/xplan-ios/Main/Room/View/XPRoomViewController.m @@ -32,6 +32,7 @@ #import "RoomHeaderView.h" #import "SocialStageView.h" #import "DatingStageView.h" +#import "AnchorStageView.h" #import "XPRoomAnimationView.h" #import "XPRoomFunctionContainerView.h" #import "XPArrangeMicViewController.h" @@ -220,7 +221,13 @@ UIKIT_EXTERN NSString * const kRoomMiniNotificationKey; self.stageView = nil; self.stageView = [[SocialStageView alloc] initWithDelegate:self]; } else { - return; + if (self.roomInfo.type == RoomType_Anchor) { + [self.stageView removeFromSuperview]; + self.stageView = nil; + self.stageView = [[AnchorStageView alloc] initWithDelegate:self]; + } else { + return; + } } if (!self.stageView.superview) { [self.view insertSubview:self.stageView aboveSubview:self.roomHeaderView];