diff --git a/xplan-ios.xcodeproj/project.pbxproj b/xplan-ios.xcodeproj/project.pbxproj index 30808ea7..3b3abafe 100644 --- a/xplan-ios.xcodeproj/project.pbxproj +++ b/xplan-ios.xcodeproj/project.pbxproj @@ -123,6 +123,7 @@ 9B7D804D27537950003DAC0C /* MessageCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B7D804C27537950003DAC0C /* MessageCell.m */; }; 9B7D80502753AA9D003DAC0C /* UITableView+NIMScrollToBottom.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B7D804E2753AA9D003DAC0C /* UITableView+NIMScrollToBottom.m */; }; 9B7D80562753C595003DAC0C /* SendMessageView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B7D80552753C595003DAC0C /* SendMessageView.m */; }; + 9B93598B27BDF2C300852475 /* anchor_room_speak.svga in Resources */ = {isa = PBXBuildFile; fileRef = 9B93598A27BDF2C300852475 /* anchor_room_speak.svga */; }; 9BAA5FED277A1BBE007453F3 /* XPPrivacyViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BAA5FEC277A1BBE007453F3 /* XPPrivacyViewController.m */; }; 9BAA5FF0277A23F4007453F3 /* XPPermissionsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BAA5FEF277A23F4007453F3 /* XPPermissionsViewController.m */; }; E80487652717DDD9008595F2 /* XPRoomMenuItem.m in Sources */ = {isa = PBXBuildFile; fileRef = E80487642717DDD9008595F2 /* XPRoomMenuItem.m */; }; @@ -662,6 +663,7 @@ 9B7D804F2753AA9D003DAC0C /* UITableView+NIMScrollToBottom.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UITableView+NIMScrollToBottom.h"; sourceTree = ""; }; 9B7D80542753C595003DAC0C /* SendMessageView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SendMessageView.h; sourceTree = ""; }; 9B7D80552753C595003DAC0C /* SendMessageView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SendMessageView.m; sourceTree = ""; }; + 9B93598A27BDF2C300852475 /* anchor_room_speak.svga */ = {isa = PBXFileReference; lastKnownFileType = file; path = anchor_room_speak.svga; sourceTree = ""; }; 9BAA5FEB277A1BBE007453F3 /* XPPrivacyViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPPrivacyViewController.h; sourceTree = ""; }; 9BAA5FEC277A1BBE007453F3 /* XPPrivacyViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPPrivacyViewController.m; sourceTree = ""; }; 9BAA5FEE277A23F4007453F3 /* XPPermissionsViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPPermissionsViewController.h; sourceTree = ""; }; @@ -3012,6 +3014,7 @@ E8A1E45F276220DA00B294CA /* candyTree_light.svga */, E8A1E45E276220DA00B294CA /* candyTree.svga */, 9B17F71927BD16CD00440843 /* anchor_room_bg.svga */, + 9B93598A27BDF2C300852475 /* anchor_room_speak.svga */, ); path = Sources; sourceTree = ""; @@ -3660,6 +3663,7 @@ E8937AC8276C3EDE00B2C7E1 /* svga_member_in_lv70.svga in Resources */, 9B17F71A27BD16CD00440843 /* anchor_room_bg.svga in Resources */, E8DEC98B27637EA50078CB70 /* candyTree_open.svga in Resources */, + 9B93598B27BDF2C300852475 /* anchor_room_speak.svga in Resources */, E8A1E460276220DA00B294CA /* candyTree_banner.svga in Resources */, E8937ACA276C3EDE00B2C7E1 /* svga_member_in_lv50.svga in Resources */, E8937ACD276C3EDE00B2C7E1 /* svga_member_in_lv30.svga in Resources */, diff --git a/xplan-ios/Main/Room/View/BaseUIContainerView/XPRoomFunctionContainerView.m b/xplan-ios/Main/Room/View/BaseUIContainerView/XPRoomFunctionContainerView.m index 76721f59..f45e25cc 100644 --- a/xplan-ios/Main/Room/View/BaseUIContainerView/XPRoomFunctionContainerView.m +++ b/xplan-ios/Main/Room/View/BaseUIContainerView/XPRoomFunctionContainerView.m @@ -147,16 +147,8 @@ NIMCustomObject *obj = (NIMCustomObject *)message.messageObject; if (obj.attachment != nil && [obj.attachment isKindOfClass:[AttachmentModel class]]) { AttachmentModel *attachment = (AttachmentModel *)obj.attachment; - if (attachment.first == CustomMessageType_AnchorRoom_AudienceUpMic) { - UserInfoModel *model = [UserInfoModel modelWithJSON:attachment.data]; - XPAnchorAudienceUpMicView *upMicView = [[XPAnchorAudienceUpMicView alloc] initWithFrame:CGRectMake(0, 0, 300, 226) delegate:self.delegate]; - upMicView.info = model; - TTPopupConfig *config = [[TTPopupConfig alloc] init]; - config.filterIdentifier = @"audienceRequestUpMic"; - config.shouldFilterPopup = YES; - config.contentView = upMicView; - config.style = TTPopupStyleAlert; - [TTPopup popupWithConfig:config]; + if (attachment.first == CustomMessageType_AnchorRoom_AudienceUpMic) { + [self showAskForUpMic:attachment.data]; } else if(attachment.first == CustomMessageType_Room_GiftValue && attachment.second == Custom_Message_Sub_Room_GiftValue_Sync) { [self handleAnchorGiftValue:attachment.data]; } else if(attachment.first == CustomMessageType_Gift && (attachment.second == Custom_Message_Sub_Gift_Send || attachment.second == Custom_Message_Sub_Gift_LuckySend || attachment.second == Custom_Message_Sub_Gift_ChannelNotify)) { @@ -262,6 +254,23 @@ } uid:roomUid]; } +///个播房用户请求上麦弹窗 +- (void)showAskForUpMic:(NSDictionary *)dict { + NSString *roomUid = [NSString stringWithFormat:@"%zd", self.delegate.getRoomInfo.uid]; + if (![roomUid isEqualToString:[AccountInfoStorage instance].getUid]) { + return; + } + UserInfoModel *model = [UserInfoModel modelWithJSON:dict]; + XPAnchorAudienceUpMicView *upMicView = [[XPAnchorAudienceUpMicView alloc] initWithFrame:CGRectMake(0, 0, 300, 226) delegate:self.delegate]; + upMicView.info = model; + TTPopupConfig *config = [[TTPopupConfig alloc] init]; + config.filterIdentifier = @"audienceRequestUpMic"; + config.shouldFilterPopup = YES; + config.contentView = upMicView; + config.style = TTPopupStyleAlert; + [TTPopup popupWithConfig:config]; +} + - (void)handleAnchorGiftValue:(NSDictionary *)dict { if (self.delegate.getRoomInfo.type != RoomType_Anchor) {//个播房房主位置魅力值刷新 return; diff --git a/xplan-ios/Main/Room/View/StageView/MicroView/Anchor/AnchorMicroView.m b/xplan-ios/Main/Room/View/StageView/MicroView/Anchor/AnchorMicroView.m index 1f8c9837..27cc754a 100644 --- a/xplan-ios/Main/Room/View/StageView/MicroView/Anchor/AnchorMicroView.m +++ b/xplan-ios/Main/Room/View/StageView/MicroView/Anchor/AnchorMicroView.m @@ -8,9 +8,38 @@ #import "AnchorMicroView.h" ///Third #import +#import +//SVGA动画播放 +#import "SVGA.h" +#import "SVGAParserManager.h" +///View +#import "MicroWaveView.h" + +@interface AnchorMicroView () + +///个播主播的动画 +@property (nonatomic, strong) SVGAImageView *svgDisplayView; +@property (nonatomic, strong) SVGAParserManager *parserManager; +///当前坑位 +@property (nonatomic, assign) NSInteger position; + +@end @implementation AnchorMicroView +- (void)initSubViews { + [super initSubViews]; + [self insertSubview:self.svgDisplayView belowSubview:self.avatarImageView]; +} + +- (void)initSubViewConstraints { + [super initSubViewConstraints]; + [self.svgDisplayView mas_makeConstraints:^(MASConstraintMaker *make) { + make.width.height.mas_equalTo(196); + make.center.equalTo(self.avatarImageView); + }]; +} + #pragma mark - MicroViewProtocol - (void)showGiftValueMode:(BOOL)isGiftValue { self.giftValueView.hidden = YES; @@ -24,6 +53,7 @@ [super configMicroView:model]; UserInfoModel * userInfo = model.userInfo; int position = model.microState.position; + self.position = position; if (position != -1 && userInfo == nil) { self.nickLabel.text = @"号嘉宾"; } @@ -49,7 +79,7 @@ [self.leaveLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.edges.mas_equalTo(self.avatarImageView); }]; - self.leaveLabel.layer.cornerRadius = 150 * 0.5; + self.leaveLabel.layer.cornerRadius = self.frame.size.width * 0.5; self.leaveLabel.layer.masksToBounds = YES; } } @@ -59,7 +89,48 @@ make.right.mas_equalTo(self.avatarImageView).mas_offset(-(150 / 4) +11); make.width.height.mas_equalTo(22); }]; + ///主播添加光圈动画 + self.svgDisplayView.hidden = NO; + @weakify(self); + NSString *bgString = [[NSBundle mainBundle] pathForResource:@"anchor_room_speak" ofType:@"svga"]; + NSURL *bgUrl = [NSURL fileURLWithPath:bgString]; + [self.parserManager loadSvgaWithURL:bgUrl completionBlock:^(SVGAVideoEntity * _Nullable videoItem) { + @strongify(self); + self.svgDisplayView.loops = INT_MAX; + self.svgDisplayView.clearsAfterStop = NO; + self.svgDisplayView.videoItem = videoItem; + [self.svgDisplayView startAnimation]; + } failureBlock:^(NSError * _Nullable error) { + }]; + } else { + self.svgDisplayView.hidden = YES; } } +- (void)userSpeaking { + if (self.position != -1) { + [self.animationView startWaveAnimation]; + } +} + +#pragma mark - setter and getter +- (SVGAParserManager *)parserManager { + if (!_parserManager) { + _parserManager = [[SVGAParserManager alloc]init]; + } + return _parserManager; +} + +- (SVGAImageView *)svgDisplayView { + if (_svgDisplayView == nil) { + _svgDisplayView = [[SVGAImageView alloc]init]; + _svgDisplayView.contentMode = UIViewContentModeScaleToFill; + _svgDisplayView.userInteractionEnabled = NO; + _svgDisplayView.frame = CGRectMake(0, 0, 384, 384); + _svgDisplayView.hidden = YES; + _svgDisplayView.backgroundColor = [UIColor clearColor]; + } + return _svgDisplayView; +} + @end diff --git a/xplan-ios/Main/Room/View/StageView/MicroView/MicroView.h b/xplan-ios/Main/Room/View/StageView/MicroView/MicroView.h index dbee0d7b..4ac0a7d5 100644 --- a/xplan-ios/Main/Room/View/StageView/MicroView/MicroView.h +++ b/xplan-ios/Main/Room/View/StageView/MicroView/MicroView.h @@ -11,7 +11,7 @@ #import "NetImageView.h" #import "MicroGiftValueView.h" -@class MicroGiftValueView; +@class MicroGiftValueView, MicroWaveView; NS_ASSUME_NONNULL_BEGIN @interface MicroView : UIView ///头像 @@ -28,6 +28,8 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic,strong) UILabel *leaveLabel; ///坑位是否闭麦的 @property (nonatomic,strong, readonly) UIImageView *micStateImageView; +///声波动画 +@property (nonatomic,strong, readonly) MicroWaveView *animationView; @end diff --git a/xplan-ios/Main/Room/View/XPRoomViewController.m b/xplan-ios/Main/Room/View/XPRoomViewController.m index 6e457945..32f1c9e6 100644 --- a/xplan-ios/Main/Room/View/XPRoomViewController.m +++ b/xplan-ios/Main/Room/View/XPRoomViewController.m @@ -321,6 +321,7 @@ UIKIT_EXTERN NSString * const kRoomMiniNotificationKey; [self.activityContainerView onRoomUpdate]; [self.menuContainerView onRoomUpdate]; [self.functionView onRoomEntered]; + [self.backContainerView onRoomUpdate]; if ([XPRoomMiniManager shareManager].getRoomInfo.uid != self.roomUid.integerValue) {// 最小化进房 还是原来的房间的话 不需要重新进入云信 因为压根没退 [self.presenter enterNIMRoom:[NSString stringWithFormat:@"%ld", self.roomInfo.roomId] user:self.userInfo]; } else { @@ -349,6 +350,7 @@ UIKIT_EXTERN NSString * const kRoomMiniNotificationKey; self.roomInfo = roomInfo; [self.roomHeaderView onRoomUpdate]; [self.activityContainerView onRoomUpdate]; + [self.backContainerView onRoomUpdate]; [self.presenter enterNIMRoom:[NSString stringWithFormat:@"%ld", self.roomInfo.roomId] user:self.userInfo]; } @@ -423,7 +425,6 @@ UIKIT_EXTERN NSString * const kRoomMiniNotificationKey; [self.menuContainerView onRoomUpdate]; [self.functionView onRoomUpdate]; [self.activityContainerView onRoomUpdate]; - [self.backContainerView onRoomUpdate]; } break; } diff --git a/xplan-ios/Sources/anchor_room_speak.svga b/xplan-ios/Sources/anchor_room_speak.svga new file mode 100644 index 00000000..d469fe28 Binary files /dev/null and b/xplan-ios/Sources/anchor_room_speak.svga differ