小喇叭展示

This commit is contained in:
chenguilong
2022-03-18 18:16:40 +08:00
committed by fengshuo
parent fc4b20a60d
commit ea03132bdb
7 changed files with 234 additions and 1 deletions

View File

@@ -130,6 +130,7 @@
9B33E3CB27D85379003B0E62 /* UploadFile.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B33E3C927D85379003B0E62 /* UploadFile.m */; }; 9B33E3CB27D85379003B0E62 /* UploadFile.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B33E3C927D85379003B0E62 /* UploadFile.m */; };
9B33E3CE27D8540C003B0E62 /* XPVoiceCardViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B33E3CD27D8540C003B0E62 /* XPVoiceCardViewController.m */; }; 9B33E3CE27D8540C003B0E62 /* XPVoiceCardViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B33E3CD27D8540C003B0E62 /* XPVoiceCardViewController.m */; };
9B33E3D427D8A1A4003B0E62 /* XPSkillCardPlayerManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B33E3D327D8A1A4003B0E62 /* XPSkillCardPlayerManager.m */; }; 9B33E3D427D8A1A4003B0E62 /* XPSkillCardPlayerManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B33E3D327D8A1A4003B0E62 /* XPSkillCardPlayerManager.m */; };
9B4D148127E485EB000AA0C1 /* XPRoomTrumpetView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B4D148027E485EB000AA0C1 /* XPRoomTrumpetView.m */; };
9B5BF8A827E1BED1005DD346 /* Api+RoomTrumpet.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B5BF8A727E1BED1005DD346 /* Api+RoomTrumpet.m */; }; 9B5BF8A827E1BED1005DD346 /* Api+RoomTrumpet.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B5BF8A727E1BED1005DD346 /* Api+RoomTrumpet.m */; };
9B6B3AAB278C2EA7005551EC /* XPRoomNobleLevelUpView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B6B3AAA278C2EA7005551EC /* XPRoomNobleLevelUpView.m */; }; 9B6B3AAB278C2EA7005551EC /* XPRoomNobleLevelUpView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B6B3AAA278C2EA7005551EC /* XPRoomNobleLevelUpView.m */; };
9B73CD05279A9A6A006AF255 /* XPSkillCardSaveModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B73CD04279A9A6A006AF255 /* XPSkillCardSaveModel.m */; }; 9B73CD05279A9A6A006AF255 /* XPSkillCardSaveModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B73CD04279A9A6A006AF255 /* XPSkillCardSaveModel.m */; };
@@ -797,6 +798,8 @@
9B33E3CD27D8540C003B0E62 /* XPVoiceCardViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XPVoiceCardViewController.m; sourceTree = "<group>"; }; 9B33E3CD27D8540C003B0E62 /* XPVoiceCardViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XPVoiceCardViewController.m; sourceTree = "<group>"; };
9B33E3D227D8A1A4003B0E62 /* XPSkillCardPlayerManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPSkillCardPlayerManager.h; sourceTree = "<group>"; }; 9B33E3D227D8A1A4003B0E62 /* XPSkillCardPlayerManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPSkillCardPlayerManager.h; sourceTree = "<group>"; };
9B33E3D327D8A1A4003B0E62 /* XPSkillCardPlayerManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPSkillCardPlayerManager.m; sourceTree = "<group>"; }; 9B33E3D327D8A1A4003B0E62 /* XPSkillCardPlayerManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPSkillCardPlayerManager.m; sourceTree = "<group>"; };
9B4D147F27E485EB000AA0C1 /* XPRoomTrumpetView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomTrumpetView.h; sourceTree = "<group>"; };
9B4D148027E485EB000AA0C1 /* XPRoomTrumpetView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPRoomTrumpetView.m; sourceTree = "<group>"; };
9B5BF8A627E1BED1005DD346 /* Api+RoomTrumpet.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Api+RoomTrumpet.h"; sourceTree = "<group>"; }; 9B5BF8A627E1BED1005DD346 /* Api+RoomTrumpet.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Api+RoomTrumpet.h"; sourceTree = "<group>"; };
9B5BF8A727E1BED1005DD346 /* Api+RoomTrumpet.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "Api+RoomTrumpet.m"; sourceTree = "<group>"; }; 9B5BF8A727E1BED1005DD346 /* Api+RoomTrumpet.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "Api+RoomTrumpet.m"; sourceTree = "<group>"; };
9B5BF8A927E1BF45005DD346 /* XPRoomTrumpetProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomTrumpetProtocol.h; sourceTree = "<group>"; }; 9B5BF8A927E1BF45005DD346 /* XPRoomTrumpetProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomTrumpetProtocol.h; sourceTree = "<group>"; };
@@ -2609,6 +2612,8 @@
children = ( children = (
9B16A34627E17D9B00E13A98 /* XPRoomTrumpetViewController.h */, 9B16A34627E17D9B00E13A98 /* XPRoomTrumpetViewController.h */,
9B16A34727E17D9B00E13A98 /* XPRoomTrumpetViewController.m */, 9B16A34727E17D9B00E13A98 /* XPRoomTrumpetViewController.m */,
9B4D147F27E485EB000AA0C1 /* XPRoomTrumpetView.h */,
9B4D148027E485EB000AA0C1 /* XPRoomTrumpetView.m */,
); );
path = View; path = View;
sourceTree = "<group>"; sourceTree = "<group>";
@@ -4792,6 +4797,7 @@
E81366F826F0C12A0076364C /* LoginFullInfoProtocol.h in Sources */, E81366F826F0C12A0076364C /* LoginFullInfoProtocol.h in Sources */,
9BBC028E2786FA060007C24B /* NobleCardModel.m in Sources */, 9BBC028E2786FA060007C24B /* NobleCardModel.m in Sources */,
E8E70D7E26F2F19D00F03460 /* Api+Mine.m in Sources */, E8E70D7E26F2F19D00F03460 /* Api+Mine.m in Sources */,
9B4D148127E485EB000AA0C1 /* XPRoomTrumpetView.m in Sources */,
E8E5E19427C36BA600F457D8 /* XPHomeBannerTableViewCell.m in Sources */, E8E5E19427C36BA600F457D8 /* XPHomeBannerTableViewCell.m in Sources */,
9BD9A18727A120FD004186FE /* XPMineVisitorUnReadModel.m in Sources */, 9BD9A18727A120FD004186FE /* XPMineVisitorUnReadModel.m in Sources */,
E824543D26F58C3A00BE8163 /* XPLoginBindSuccessView.m in Sources */, E824543D26F58C3A00BE8163 /* XPLoginBindSuccessView.m in Sources */,

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

View File

@@ -27,6 +27,7 @@
#import "XPRoomMessageTableViewCell.h" #import "XPRoomMessageTableViewCell.h"
#import "XPRoomMessageHeaderView.h" #import "XPRoomMessageHeaderView.h"
#import "View/XPRoomMessageHeaderView.h" #import "View/XPRoomMessageHeaderView.h"
#import "XPRoomTrumpetView.h"
NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey"; NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
@@ -50,6 +51,10 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
@property (nonatomic,strong) NSMutableArray<NIMMessage *> *incomingMessages; @property (nonatomic,strong) NSMutableArray<NIMMessage *> *incomingMessages;
///messageView TODO: ///messageView TODO:
@property (nonatomic,strong) XPRoomMessageParser *messageParser; @property (nonatomic,strong) XPRoomMessageParser *messageParser;
///
@property (nonatomic, strong) XPRoomTrumpetView *trumpetView;
///
@property (nonatomic, strong) NSMutableArray *trumpetQueue;
@end @end
@@ -82,6 +87,7 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
[self addSubview:self.messageTableView]; [self addSubview:self.messageTableView];
[self addSubview:self.messageTipsBtn]; [self addSubview:self.messageTipsBtn];
self.messageTableView.tableHeaderView = self.headerView; self.messageTableView.tableHeaderView = self.headerView;
[self addSubview:self.trumpetView];
} }
- (void)initSubViewConstraints { - (void)initSubViewConstraints {
@@ -96,6 +102,12 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
make.bottom.mas_equalTo(self.mas_bottom).offset(-5); make.bottom.mas_equalTo(self.mas_bottom).offset(-5);
make.left.mas_equalTo(self); make.left.mas_equalTo(self);
}]; }];
[self.trumpetView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self);
make.left.mas_equalTo(15);
make.right.mas_equalTo(0);
make.height.mas_equalTo(32);
}];
} }
/// ///
@@ -323,7 +335,14 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
[[XPRoomMiniManager shareManager] resetLocalMessage]; [[XPRoomMiniManager shareManager] resetLocalMessage];
[self addRoomMessage:message]; [self addRoomMessage:message];
return; return;
} } else if (attachment.first == CustomMessageType_Noble_VIP && attachment.second == Custom_Message_Sub_Room_Trumpet) {
if (self.trumpetView.isHidden) {
self.trumpetView.hidden = NO;
}
[self.trumpetQueue addObject:attachment.data];
self.trumpetView.data = attachment.data;
return;
}
} }
if (self.hostDelegate.getRoomInfo.isCloseScreen) { if (self.hostDelegate.getRoomInfo.isCloseScreen) {
return; return;
@@ -522,4 +541,19 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
return _messageParser; return _messageParser;
} }
- (XPRoomTrumpetView *)trumpetView {
if (!_trumpetView) {
_trumpetView = [[XPRoomTrumpetView alloc] init];
_trumpetView.hidden = YES;
}
return _trumpetView;
}
- (NSMutableArray *)trumpetQueue {
if (!_trumpetQueue) {
_trumpetQueue = [NSMutableArray array];
}
return _trumpetQueue;
}
@end @end

View File

@@ -0,0 +1,18 @@
//
// XPRoomTrumpetView.h
// xplan-ios
//
// Created by GreenLand on 2022/3/18.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface XPRoomTrumpetView : UIView
@property (nonatomic, strong) NSDictionary *data;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,153 @@
//
// XPRoomTrumpetView.m
// xplan-ios
//
// Created by GreenLand on 2022/3/18.
//
#import "XPRoomTrumpetView.h"
#import "NetImageView.h"
///tool
#import "ThemeColor.h"
#import "ThemeColor+NobleCenter.h"
#import "XPMacro.h"
#import "XCHUDTool.h"
///Third
#import <Masonry/Masonry.h>
@interface XPRoomTrumpetView()
///
@property (nonatomic, strong) UIImageView *backView;
///
@property (nonatomic,strong) NetImageView *avatarImageView;
///
@property (nonatomic,strong) NetImageView *nobleImageView;
///
@property (nonatomic, strong) UILabel *nickLabel;
///
@property (nonatomic, strong) UILabel *contentLabel;
@end
@implementation XPRoomTrumpetView
- (instancetype)initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame]) {
[self initSubViews];
[self initContraints];
}
return self;
}
- (void)initSubViews {
[self addSubview:self.backView];
[self addSubview:self.avatarImageView];
[self addSubview:self.nobleImageView];
[self addSubview:self.nickLabel];
[self addSubview:self.contentLabel];
}
- (void)initContraints {
[self.backView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(0);
}];
[self.avatarImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(8);
make.width.height.mas_equalTo(24);
make.centerY.mas_equalTo(self);
}];
[self.nobleImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.avatarImageView.mas_right).mas_offset(4);
make.width.height.mas_equalTo(20);
make.centerY.mas_equalTo(self);
}];
[self.nickLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.nobleImageView.mas_right).mas_offset(2);
make.centerY.mas_equalTo(self);
make.width.mas_greaterThanOrEqualTo(40).priority(500);
}];
//
[self.nickLabel setContentHuggingPriority:UILayoutPriorityDefaultHigh forAxis:UILayoutConstraintAxisHorizontal];
[self.contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.nickLabel.mas_right).mas_offset(2);
make.right.mas_equalTo(0);
make.centerY.mas_equalTo(self);
}];
[self.contentLabel setContentCompressionResistancePriority:UILayoutPriorityDefaultLow forAxis:UILayoutConstraintAxisHorizontal];
}
- (void)setData:(NSDictionary *)data {
_data = data;
self.avatarImageView.imageUrl = data[@"avatar"];
self.nobleImageView.imageUrl = data[@"vipIcon"];
NSString *nickStr = data[@"nick"];
if (nickStr.length > 10) {
nickStr = [NSString stringWithFormat:@"%@…", [nickStr substringToIndex:5]];
} else {
nickStr = [NSString stringWithFormat:@"%@:", nickStr];
}
self.nickLabel.text = nickStr;
self.contentLabel.text = data[@"content"];
[self layoutIfNeeded];
}
#pragma mark - getter
- (UIImageView *)backView {
if (!_backView) {
_backView = [[UIImageView alloc] init];
_backView.userInteractionEnabled = YES;
_backView.image = [UIImage imageNamed:@"rooom_trumpet_bgImage"];
_backView.contentMode = UIViewContentModeTopLeft;
}
return _backView;
}
- (NetImageView *)avatarImageView {
if (!_avatarImageView) {
NetImageConfig *config = [[NetImageConfig alloc] init];
config.imageType = ImageTypeUserIcon;
_avatarImageView = [[NetImageView alloc] initWithConfig:config];
_avatarImageView.contentMode = UIViewContentModeScaleAspectFit;
_avatarImageView.layer.cornerRadius = 12;
_avatarImageView.layer.masksToBounds = YES;
}
return _avatarImageView;
}
- (NetImageView *)nobleImageView {
if (!_nobleImageView) {
NetImageConfig *config = [[NetImageConfig alloc] init];
config.imageType = ImageTypeUserIcon;
_nobleImageView = [[NetImageView alloc] initWithConfig:config];
_nobleImageView.contentMode = UIViewContentModeScaleAspectFit;
}
return _nobleImageView;
}
- (UILabel *)nickLabel {
if (!_nickLabel) {
UILabel *label = [[UILabel alloc] init];
label.font = [UIFont systemFontOfSize:12];
label.textColor = [ThemeColor hightNobleLightTextColor];
[label sizeToFit];
_nickLabel = label;
}
return _nickLabel;
}
- (UILabel *)contentLabel {
if (!_contentLabel) {
UILabel *label = [[UILabel alloc] init];
label.font = [UIFont systemFontOfSize:12];
label.textColor = [ThemeColor appCellBackgroundColor];
label.textAlignment = NSTextAlignmentLeft;
_contentLabel = label;
}
return _contentLabel;
}
@end