个播房主位声波动画,请求上麦的弹窗优化

This commit is contained in:
chenguilong
2022-02-17 11:47:09 +08:00
parent 3866a06237
commit 53ee9fbaa1
6 changed files with 100 additions and 13 deletions

View File

@@ -123,6 +123,7 @@
9B7D804D27537950003DAC0C /* MessageCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B7D804C27537950003DAC0C /* MessageCell.m */; }; 9B7D804D27537950003DAC0C /* MessageCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B7D804C27537950003DAC0C /* MessageCell.m */; };
9B7D80502753AA9D003DAC0C /* UITableView+NIMScrollToBottom.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B7D804E2753AA9D003DAC0C /* UITableView+NIMScrollToBottom.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 */; }; 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 */; }; 9BAA5FED277A1BBE007453F3 /* XPPrivacyViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BAA5FEC277A1BBE007453F3 /* XPPrivacyViewController.m */; };
9BAA5FF0277A23F4007453F3 /* XPPermissionsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BAA5FEF277A23F4007453F3 /* XPPermissionsViewController.m */; }; 9BAA5FF0277A23F4007453F3 /* XPPermissionsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BAA5FEF277A23F4007453F3 /* XPPermissionsViewController.m */; };
E80487652717DDD9008595F2 /* XPRoomMenuItem.m in Sources */ = {isa = PBXBuildFile; fileRef = E80487642717DDD9008595F2 /* XPRoomMenuItem.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 = "<group>"; }; 9B7D804F2753AA9D003DAC0C /* UITableView+NIMScrollToBottom.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UITableView+NIMScrollToBottom.h"; sourceTree = "<group>"; };
9B7D80542753C595003DAC0C /* SendMessageView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SendMessageView.h; sourceTree = "<group>"; }; 9B7D80542753C595003DAC0C /* SendMessageView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SendMessageView.h; sourceTree = "<group>"; };
9B7D80552753C595003DAC0C /* SendMessageView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SendMessageView.m; sourceTree = "<group>"; }; 9B7D80552753C595003DAC0C /* SendMessageView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SendMessageView.m; sourceTree = "<group>"; };
9B93598A27BDF2C300852475 /* anchor_room_speak.svga */ = {isa = PBXFileReference; lastKnownFileType = file; path = anchor_room_speak.svga; sourceTree = "<group>"; };
9BAA5FEB277A1BBE007453F3 /* XPPrivacyViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPPrivacyViewController.h; sourceTree = "<group>"; }; 9BAA5FEB277A1BBE007453F3 /* XPPrivacyViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPPrivacyViewController.h; sourceTree = "<group>"; };
9BAA5FEC277A1BBE007453F3 /* XPPrivacyViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPPrivacyViewController.m; sourceTree = "<group>"; }; 9BAA5FEC277A1BBE007453F3 /* XPPrivacyViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPPrivacyViewController.m; sourceTree = "<group>"; };
9BAA5FEE277A23F4007453F3 /* XPPermissionsViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPPermissionsViewController.h; sourceTree = "<group>"; }; 9BAA5FEE277A23F4007453F3 /* XPPermissionsViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPPermissionsViewController.h; sourceTree = "<group>"; };
@@ -3012,6 +3014,7 @@
E8A1E45F276220DA00B294CA /* candyTree_light.svga */, E8A1E45F276220DA00B294CA /* candyTree_light.svga */,
E8A1E45E276220DA00B294CA /* candyTree.svga */, E8A1E45E276220DA00B294CA /* candyTree.svga */,
9B17F71927BD16CD00440843 /* anchor_room_bg.svga */, 9B17F71927BD16CD00440843 /* anchor_room_bg.svga */,
9B93598A27BDF2C300852475 /* anchor_room_speak.svga */,
); );
path = Sources; path = Sources;
sourceTree = "<group>"; sourceTree = "<group>";
@@ -3660,6 +3663,7 @@
E8937AC8276C3EDE00B2C7E1 /* svga_member_in_lv70.svga in Resources */, E8937AC8276C3EDE00B2C7E1 /* svga_member_in_lv70.svga in Resources */,
9B17F71A27BD16CD00440843 /* anchor_room_bg.svga in Resources */, 9B17F71A27BD16CD00440843 /* anchor_room_bg.svga in Resources */,
E8DEC98B27637EA50078CB70 /* candyTree_open.svga in Resources */, E8DEC98B27637EA50078CB70 /* candyTree_open.svga in Resources */,
9B93598B27BDF2C300852475 /* anchor_room_speak.svga in Resources */,
E8A1E460276220DA00B294CA /* candyTree_banner.svga in Resources */, E8A1E460276220DA00B294CA /* candyTree_banner.svga in Resources */,
E8937ACA276C3EDE00B2C7E1 /* svga_member_in_lv50.svga in Resources */, E8937ACA276C3EDE00B2C7E1 /* svga_member_in_lv50.svga in Resources */,
E8937ACD276C3EDE00B2C7E1 /* svga_member_in_lv30.svga in Resources */, E8937ACD276C3EDE00B2C7E1 /* svga_member_in_lv30.svga in Resources */,

View File

@@ -147,16 +147,8 @@
NIMCustomObject *obj = (NIMCustomObject *)message.messageObject; NIMCustomObject *obj = (NIMCustomObject *)message.messageObject;
if (obj.attachment != nil && [obj.attachment isKindOfClass:[AttachmentModel class]]) { if (obj.attachment != nil && [obj.attachment isKindOfClass:[AttachmentModel class]]) {
AttachmentModel *attachment = (AttachmentModel *)obj.attachment; AttachmentModel *attachment = (AttachmentModel *)obj.attachment;
if (attachment.first == CustomMessageType_AnchorRoom_AudienceUpMic) { if (attachment.first == CustomMessageType_AnchorRoom_AudienceUpMic) {
UserInfoModel *model = [UserInfoModel modelWithJSON:attachment.data]; [self showAskForUpMic: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];
} else if(attachment.first == CustomMessageType_Room_GiftValue && attachment.second == Custom_Message_Sub_Room_GiftValue_Sync) { } else if(attachment.first == CustomMessageType_Room_GiftValue && attachment.second == Custom_Message_Sub_Room_GiftValue_Sync) {
[self handleAnchorGiftValue:attachment.data]; [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)) { } 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]; } 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 { - (void)handleAnchorGiftValue:(NSDictionary *)dict {
if (self.delegate.getRoomInfo.type != RoomType_Anchor) {// if (self.delegate.getRoomInfo.type != RoomType_Anchor) {//
return; return;

View File

@@ -8,9 +8,38 @@
#import "AnchorMicroView.h" #import "AnchorMicroView.h"
///Third ///Third
#import <Masonry/Masonry.h> #import <Masonry/Masonry.h>
#import <ReactiveObjC/ReactiveObjC.h>
//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 @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 #pragma mark - MicroViewProtocol
- (void)showGiftValueMode:(BOOL)isGiftValue { - (void)showGiftValueMode:(BOOL)isGiftValue {
self.giftValueView.hidden = YES; self.giftValueView.hidden = YES;
@@ -24,6 +53,7 @@
[super configMicroView:model]; [super configMicroView:model];
UserInfoModel * userInfo = model.userInfo; UserInfoModel * userInfo = model.userInfo;
int position = model.microState.position; int position = model.microState.position;
self.position = position;
if (position != -1 && userInfo == nil) { if (position != -1 && userInfo == nil) {
self.nickLabel.text = @"号嘉宾"; self.nickLabel.text = @"号嘉宾";
} }
@@ -49,7 +79,7 @@
[self.leaveLabel mas_makeConstraints:^(MASConstraintMaker *make) { [self.leaveLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(self.avatarImageView); 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; self.leaveLabel.layer.masksToBounds = YES;
} }
} }
@@ -59,7 +89,48 @@
make.right.mas_equalTo(self.avatarImageView).mas_offset(-(150 / 4) +11); make.right.mas_equalTo(self.avatarImageView).mas_offset(-(150 / 4) +11);
make.width.height.mas_equalTo(22); 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 @end

View File

@@ -11,7 +11,7 @@
#import "NetImageView.h" #import "NetImageView.h"
#import "MicroGiftValueView.h" #import "MicroGiftValueView.h"
@class MicroGiftValueView; @class MicroGiftValueView, MicroWaveView;
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@interface MicroView : UIView<MicroViewProtocol> @interface MicroView : UIView<MicroViewProtocol>
///头像 ///头像
@@ -28,6 +28,8 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic,strong) UILabel *leaveLabel; @property (nonatomic,strong) UILabel *leaveLabel;
///坑位是否闭麦的 ///坑位是否闭麦的
@property (nonatomic,strong, readonly) UIImageView *micStateImageView; @property (nonatomic,strong, readonly) UIImageView *micStateImageView;
///声波动画
@property (nonatomic,strong, readonly) MicroWaveView *animationView;
@end @end

View File

@@ -321,6 +321,7 @@ UIKIT_EXTERN NSString * const kRoomMiniNotificationKey;
[self.activityContainerView onRoomUpdate]; [self.activityContainerView onRoomUpdate];
[self.menuContainerView onRoomUpdate]; [self.menuContainerView onRoomUpdate];
[self.functionView onRoomEntered]; [self.functionView onRoomEntered];
[self.backContainerView onRoomUpdate];
if ([XPRoomMiniManager shareManager].getRoomInfo.uid != self.roomUid.integerValue) {// 退 if ([XPRoomMiniManager shareManager].getRoomInfo.uid != self.roomUid.integerValue) {// 退
[self.presenter enterNIMRoom:[NSString stringWithFormat:@"%ld", self.roomInfo.roomId] user:self.userInfo]; [self.presenter enterNIMRoom:[NSString stringWithFormat:@"%ld", self.roomInfo.roomId] user:self.userInfo];
} else { } else {
@@ -349,6 +350,7 @@ UIKIT_EXTERN NSString * const kRoomMiniNotificationKey;
self.roomInfo = roomInfo; self.roomInfo = roomInfo;
[self.roomHeaderView onRoomUpdate]; [self.roomHeaderView onRoomUpdate];
[self.activityContainerView onRoomUpdate]; [self.activityContainerView onRoomUpdate];
[self.backContainerView onRoomUpdate];
[self.presenter enterNIMRoom:[NSString stringWithFormat:@"%ld", self.roomInfo.roomId] user:self.userInfo]; [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.menuContainerView onRoomUpdate];
[self.functionView onRoomUpdate]; [self.functionView onRoomUpdate];
[self.activityContainerView onRoomUpdate]; [self.activityContainerView onRoomUpdate];
[self.backContainerView onRoomUpdate];
} }
break; break;
} }

Binary file not shown.