消息模块-用户升级消息
This commit is contained in:
@@ -386,6 +386,7 @@
|
||||
E83ABEFD280EB5E200322EE4 /* ContentOpenLiveInfoModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E83ABEFC280EB5E200322EE4 /* ContentOpenLiveInfoModel.m */; };
|
||||
E83ABF00280EC45700322EE4 /* MessageContentApplicationShareView.m in Sources */ = {isa = PBXBuildFile; fileRef = E83ABEFF280EC45700322EE4 /* MessageContentApplicationShareView.m */; };
|
||||
E83ABF03280EC90C00322EE4 /* ContentApplicationShareModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E83ABF02280EC90C00322EE4 /* ContentApplicationShareModel.m */; };
|
||||
E83ABF06280EDE2B00322EE4 /* MessageContentLevelUpgradeView.m in Sources */ = {isa = PBXBuildFile; fileRef = E83ABF05280EDE2B00322EE4 /* MessageContentLevelUpgradeView.m */; };
|
||||
E83DB47A27462C4500D8CBD1 /* XPGiftBigPrizeModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E83DB47927462C4500D8CBD1 /* XPGiftBigPrizeModel.m */; };
|
||||
E83DB47D2746372300D8CBD1 /* XPRoomGiftBannerView.m in Sources */ = {isa = PBXBuildFile; fileRef = E83DB47C2746372300D8CBD1 /* XPRoomGiftBannerView.m */; };
|
||||
E83DB481274649FB00D8CBD1 /* XPGiftBannerUserInfoModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E83DB480274649FB00D8CBD1 /* XPGiftBannerUserInfoModel.m */; };
|
||||
@@ -403,6 +404,9 @@
|
||||
E84150BF27747BD300A7F548 /* Api+FirstRecharge.m in Sources */ = {isa = PBXBuildFile; fileRef = E84150BE27747BD300A7F548 /* Api+FirstRecharge.m */; };
|
||||
E84150C227747BF700A7F548 /* FirstRechargeModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E84150C127747BF700A7F548 /* FirstRechargeModel.m */; };
|
||||
E84150C527747E0900A7F548 /* FirstRechargeRewardModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E84150C427747E0900A7F548 /* FirstRechargeRewardModel.m */; };
|
||||
E841ED61280FB0BD00904808 /* ContentLevelUpgradeModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E841ED60280FB0BD00904808 /* ContentLevelUpgradeModel.m */; };
|
||||
E84843AF27F59E7E0050D365 /* XPRoomPKResultView.m in Sources */ = {isa = PBXBuildFile; fileRef = E84843AE27F59E7E0050D365 /* XPRoomPKResultView.m */; };
|
||||
E84843B227F5A0740050D365 /* XPRomPKResultTitleLabel.m in Sources */ = {isa = PBXBuildFile; fileRef = E84843B127F5A0740050D365 /* XPRomPKResultTitleLabel.m */; };
|
||||
E84B0E3F2727EDF6008818C6 /* XPRoomMessageTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E84B0E3E2727EDF6008818C6 /* XPRoomMessageTableViewCell.m */; };
|
||||
E84B0E422727EE0A008818C6 /* XPRoomMessageHeaderView.m in Sources */ = {isa = PBXBuildFile; fileRef = E84B0E412727EE0A008818C6 /* XPRoomMessageHeaderView.m */; };
|
||||
E84B0E462727EF9D008818C6 /* XPRoomMessageParser.m in Sources */ = {isa = PBXBuildFile; fileRef = E84B0E452727EF9D008818C6 /* XPRoomMessageParser.m */; };
|
||||
@@ -1500,6 +1504,8 @@
|
||||
E83ABEFF280EC45700322EE4 /* MessageContentApplicationShareView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MessageContentApplicationShareView.m; sourceTree = "<group>"; };
|
||||
E83ABF01280EC90C00322EE4 /* ContentApplicationShareModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ContentApplicationShareModel.h; sourceTree = "<group>"; };
|
||||
E83ABF02280EC90C00322EE4 /* ContentApplicationShareModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ContentApplicationShareModel.m; sourceTree = "<group>"; };
|
||||
E83ABF04280EDE2B00322EE4 /* MessageContentLevelUpgradeView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MessageContentLevelUpgradeView.h; sourceTree = "<group>"; };
|
||||
E83ABF05280EDE2B00322EE4 /* MessageContentLevelUpgradeView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MessageContentLevelUpgradeView.m; sourceTree = "<group>"; };
|
||||
E83DB47827462C4500D8CBD1 /* XPGiftBigPrizeModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPGiftBigPrizeModel.h; sourceTree = "<group>"; };
|
||||
E83DB47927462C4500D8CBD1 /* XPGiftBigPrizeModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPGiftBigPrizeModel.m; sourceTree = "<group>"; };
|
||||
E83DB47B2746372300D8CBD1 /* XPRoomGiftBannerView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomGiftBannerView.h; sourceTree = "<group>"; };
|
||||
@@ -1536,6 +1542,12 @@
|
||||
E84150C127747BF700A7F548 /* FirstRechargeModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FirstRechargeModel.m; sourceTree = "<group>"; };
|
||||
E84150C327747E0900A7F548 /* FirstRechargeRewardModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FirstRechargeRewardModel.h; sourceTree = "<group>"; };
|
||||
E84150C427747E0900A7F548 /* FirstRechargeRewardModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FirstRechargeRewardModel.m; sourceTree = "<group>"; };
|
||||
E841ED5F280FB0BD00904808 /* ContentLevelUpgradeModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ContentLevelUpgradeModel.h; sourceTree = "<group>"; };
|
||||
E841ED60280FB0BD00904808 /* ContentLevelUpgradeModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ContentLevelUpgradeModel.m; sourceTree = "<group>"; };
|
||||
E84843AD27F59E7E0050D365 /* XPRoomPKResultView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomPKResultView.h; sourceTree = "<group>"; };
|
||||
E84843AE27F59E7E0050D365 /* XPRoomPKResultView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPRoomPKResultView.m; sourceTree = "<group>"; };
|
||||
E84843B027F5A0740050D365 /* XPRomPKResultTitleLabel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRomPKResultTitleLabel.h; sourceTree = "<group>"; };
|
||||
E84843B127F5A0740050D365 /* XPRomPKResultTitleLabel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPRomPKResultTitleLabel.m; sourceTree = "<group>"; };
|
||||
E84B0E3D2727EDF6008818C6 /* XPRoomMessageTableViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomMessageTableViewCell.h; sourceTree = "<group>"; };
|
||||
E84B0E3E2727EDF6008818C6 /* XPRoomMessageTableViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPRoomMessageTableViewCell.m; sourceTree = "<group>"; };
|
||||
E84B0E402727EE0A008818C6 /* XPRoomMessageHeaderView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomMessageHeaderView.h; sourceTree = "<group>"; };
|
||||
@@ -2842,6 +2854,8 @@
|
||||
E83ABEF8280EAF3F00322EE4 /* MessageContentOpenLiveView.m */,
|
||||
E83ABEFE280EC45700322EE4 /* MessageContentApplicationShareView.h */,
|
||||
E83ABEFF280EC45700322EE4 /* MessageContentApplicationShareView.m */,
|
||||
E83ABF04280EDE2B00322EE4 /* MessageContentLevelUpgradeView.h */,
|
||||
E83ABF05280EDE2B00322EE4 /* MessageContentLevelUpgradeView.m */,
|
||||
);
|
||||
path = Content;
|
||||
sourceTree = "<group>";
|
||||
@@ -4243,6 +4257,8 @@
|
||||
E83ABEFC280EB5E200322EE4 /* ContentOpenLiveInfoModel.m */,
|
||||
E83ABF01280EC90C00322EE4 /* ContentApplicationShareModel.h */,
|
||||
E83ABF02280EC90C00322EE4 /* ContentApplicationShareModel.m */,
|
||||
E841ED5F280FB0BD00904808 /* ContentLevelUpgradeModel.h */,
|
||||
E841ED60280FB0BD00904808 /* ContentLevelUpgradeModel.m */,
|
||||
);
|
||||
path = SessionContent;
|
||||
sourceTree = "<group>";
|
||||
@@ -6374,6 +6390,7 @@
|
||||
E800805D27FD34E90055A8AB /* XPMineGuildViewController.m in Sources */,
|
||||
E8834E50280051600029CCC1 /* XPMineGuildManagerPerViewController.m in Sources */,
|
||||
9BC5C8F9277B02EA007C8719 /* Api+NobleCenter.m in Sources */,
|
||||
E83ABF06280EDE2B00322EE4 /* MessageContentLevelUpgradeView.m in Sources */,
|
||||
180806D827293794001FD836 /* NSObject+MJExtension.m in Sources */,
|
||||
E88863D3278ED4C0004BCFAB /* Timestamp.m in Sources */,
|
||||
E88863CF278EC393004BCFAB /* XPAcrossRoomPKPrizeView.m in Sources */,
|
||||
@@ -6732,6 +6749,7 @@
|
||||
E8E5E19A27C36C0B00F457D8 /* XPHomeHotRoomTableViewCell.m in Sources */,
|
||||
E824545926F5E65900BE8163 /* XPMineVerifIdentityView.m in Sources */,
|
||||
9BCE6147277D665600CC0358 /* XPReleaseRadioCellModel.m in Sources */,
|
||||
E841ED61280FB0BD00904808 /* ContentLevelUpgradeModel.m in Sources */,
|
||||
189DD74026E21C3F00AB55B1 /* YYUtility+App.m in Sources */,
|
||||
189DD74526E21CCC00AB55B1 /* YYReachability.m in Sources */,
|
||||
E82109AD26F1C8A000FC3319 /* CountDownHelper.m in Sources */,
|
||||
|
@@ -34,6 +34,8 @@ typedef NS_ENUM(NSUInteger, CustomMessageType) {
|
||||
CustomMessageType_Update_RoomInfo = 20,
|
||||
///应用内分享
|
||||
CustomMessageType_Application_Share = 22,
|
||||
///用户升级
|
||||
CustomMessageType_User_UpGrade = 24,
|
||||
///糖果树
|
||||
CustomMessageType_Candy_Tree = 26,
|
||||
///排麦
|
||||
@@ -167,6 +169,14 @@ typedef NS_ENUM(NSInteger, CustomMessageSubApplicationShare) {
|
||||
Custom_Message_Sub_Application_Share_Room = 221,
|
||||
};
|
||||
|
||||
///first = CustomMessageType_User_UpGrade
|
||||
typedef NS_ENUM(NSInteger, CustomMessageSubUserUpgrade) {
|
||||
///用户等级
|
||||
Custom_Message_Sub_User_UpGrade_Exper = 241,
|
||||
///魅力等级
|
||||
Custom_Message_Sub_User_UpGrade_Charm = 242
|
||||
};
|
||||
|
||||
///first = CustomMessageType_Candy_Tree
|
||||
typedef NS_ENUM(NSUInteger, CustomMessageSubCandyTree) {
|
||||
//.自己可见 一级礼物(最小)
|
||||
|
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// ContentLevelUpgradeModel.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2022/4/20.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface ContentLevelUpgradeModel : NSObject
|
||||
@property (nonatomic, copy) NSString *levelName;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,12 @@
|
||||
//
|
||||
// ContentLevelUpgradeModel.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2022/4/20.
|
||||
//
|
||||
|
||||
#import "ContentLevelUpgradeModel.h"
|
||||
|
||||
@implementation ContentLevelUpgradeModel
|
||||
|
||||
@end
|
@@ -51,6 +51,8 @@
|
||||
return @"您关注的TA上线了,快去围观吧~~~";
|
||||
} else if(attachment.first == CustomMessageType_Application_Share && attachment.second == Custom_Message_Sub_Application_Share_Room) {
|
||||
return @"[分享房间]";
|
||||
}else if(attachment.first == CustomMessageType_User_UpGrade && (attachment.second == Custom_Message_Sub_User_UpGrade_Charm || attachment.second == Custom_Message_Sub_User_UpGrade_Exper)) {
|
||||
return @"[升级消息]";
|
||||
}else{
|
||||
text = @"[消息]";
|
||||
}
|
||||
|
@@ -21,8 +21,6 @@
|
||||
|
||||
#define MESSAGE_PADDING 10
|
||||
@interface MessageContentApplicationShareView ()
|
||||
///背景
|
||||
@property (nonatomic,strong) UIView * backView;
|
||||
///标题
|
||||
@property (nonatomic,strong) UILabel *titleLabel;
|
||||
///头像
|
||||
@@ -67,7 +65,6 @@
|
||||
- (void)initSubViewConstraints {
|
||||
[super initSubViewConstraints];
|
||||
[self.backView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.mas_equalTo(self).insets(UIEdgeInsetsMake(MESSAGE_PADDING, MESSAGE_PADDING, MESSAGE_PADDING, MESSAGE_PADDING));
|
||||
make.size.mas_equalTo(CGSizeMake(KScreenWidth - AVATAR_MARGIN_H * 2 * 2 - AVATAR_SIZE - AVATAR_MARGIN_H, 90));
|
||||
}];
|
||||
|
||||
@@ -112,15 +109,6 @@
|
||||
}
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
- (UIView *)backView {
|
||||
if (!_backView) {
|
||||
_backView = [[UIView alloc] init];
|
||||
_backView.backgroundColor = [UIColor clearColor];
|
||||
}
|
||||
return _backView;
|
||||
}
|
||||
|
||||
|
||||
- (NetImageView *)avatarImageView {
|
||||
if (!_avatarImageView) {
|
||||
NetImageConfig * config = [[NetImageConfig alloc]init];
|
||||
|
@@ -21,6 +21,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
- (void)initSubViews;
|
||||
|
||||
- (void)initSubViewConstraints;
|
||||
@property (nonatomic,strong, readonly) UIView * backView;
|
||||
///代理
|
||||
@property (nonatomic,weak) id<MessageContentCustomViewDelegate> delegate;
|
||||
@end
|
||||
|
@@ -6,6 +6,15 @@
|
||||
//
|
||||
|
||||
#import "MessageContentCustomView.h"
|
||||
///Third
|
||||
#import <Masonry/Masonry.h>
|
||||
|
||||
#define MESSAGE_PADDING 10
|
||||
|
||||
@interface MessageContentCustomView ()
|
||||
///背景
|
||||
@property (nonatomic,strong) UIView * backView;
|
||||
@end
|
||||
|
||||
@implementation MessageContentCustomView
|
||||
|
||||
@@ -18,9 +27,15 @@
|
||||
}
|
||||
|
||||
#pragma mark - Public Method
|
||||
- (void)initSubViews {}
|
||||
- (void)initSubViews {
|
||||
[self addSubview:self.backView];
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {}
|
||||
- (void)initSubViewConstraints {
|
||||
[self.backView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.mas_equalTo(self).insets(UIEdgeInsetsMake(MESSAGE_PADDING, MESSAGE_PADDING, MESSAGE_PADDING, MESSAGE_PADDING));
|
||||
}];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - MessageContentProtocol
|
||||
@@ -32,4 +47,12 @@
|
||||
return 0;
|
||||
}
|
||||
|
||||
- (UIView *)backView {
|
||||
if (!_backView) {
|
||||
_backView = [[UIView alloc] init];
|
||||
_backView.backgroundColor = [UIColor clearColor];
|
||||
}
|
||||
return _backView;
|
||||
}
|
||||
|
||||
@end
|
||||
|
@@ -16,8 +16,6 @@
|
||||
///Model
|
||||
#import "GiftReceiveInfoModel.h"
|
||||
@interface MessageContentGiftView ()
|
||||
///
|
||||
@property (nonatomic,strong) UIView * backView;
|
||||
///礼物的
|
||||
@property (nonatomic,strong) NetImageView *giftImageView;
|
||||
///显示名字
|
||||
@@ -44,13 +42,12 @@
|
||||
- (void)initSubViewConstraints {
|
||||
[super initSubViewConstraints];
|
||||
[self.backView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.equalTo(self).with.insets(UIEdgeInsetsMake(0 , 0, 0, 0));
|
||||
make.size.mas_equalTo(CGSizeMake(185, 80));
|
||||
}];
|
||||
|
||||
[self.giftImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.size.mas_equalTo(CGSizeMake(60, 60));
|
||||
make.left.mas_equalTo(self.backView).offset(12);
|
||||
make.left.mas_equalTo(self.backView);
|
||||
make.centerY.mas_equalTo(self.backView);
|
||||
}];
|
||||
|
||||
@@ -78,14 +75,6 @@
|
||||
self.giftNumLabel.text = [NSString stringWithFormat:@"X%ld", info.giftNum];
|
||||
}
|
||||
|
||||
- (UIView *)backView {
|
||||
if (!_backView) {
|
||||
_backView = [[UIView alloc] init];
|
||||
_backView.backgroundColor = [UIColor clearColor];
|
||||
}
|
||||
return _backView;
|
||||
}
|
||||
|
||||
- (NetImageView *)giftImageView {
|
||||
if (!_giftImageView) {
|
||||
NetImageConfig * config = [[NetImageConfig alloc]init];
|
||||
@@ -107,7 +96,6 @@
|
||||
return _giftNameLabel;
|
||||
}
|
||||
|
||||
|
||||
- (UILabel *)giftNumLabel {
|
||||
if (!_giftNumLabel) {
|
||||
_giftNumLabel = [[UILabel alloc] init];
|
||||
|
@@ -21,8 +21,6 @@
|
||||
#define MESSAGE_MAX_WIDTH 230
|
||||
#define MESSAGE_TEXT_PADDING 10
|
||||
@interface MessageContentGuildView ()
|
||||
///背景
|
||||
@property (nonatomic,strong) UIView * backView;
|
||||
///总的stackView
|
||||
@property (nonatomic,strong) UIStackView *stackView;
|
||||
///内容的view
|
||||
@@ -102,7 +100,6 @@
|
||||
- (void)initSubViewConstraints {
|
||||
[super initSubViewConstraints];
|
||||
[self.backView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.mas_equalTo(self).insets(UIEdgeInsetsMake(0, 0, 0, 0));
|
||||
make.width.mas_equalTo(MESSAGE_MAX_WIDTH);
|
||||
make.bottom.mas_equalTo(self.stackView).offset(MESSAGE_TEXT_PADDING);
|
||||
}];
|
||||
@@ -319,16 +316,6 @@
|
||||
}
|
||||
}
|
||||
#pragma mark - Getters And Setters
|
||||
- (UIView *)backView {
|
||||
if (!_backView) {
|
||||
_backView = [[UIView alloc] init];
|
||||
_backView.backgroundColor = [UIColor whiteColor];
|
||||
_backView.layer.masksToBounds = YES;
|
||||
_backView.layer.cornerRadius = 10;
|
||||
}
|
||||
return _backView;
|
||||
}
|
||||
|
||||
- (UIStackView *)stackView {
|
||||
if (!_stackView) {
|
||||
_stackView = [[UIStackView alloc] init];
|
||||
|
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// MessageContentLevelUpgradeView.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2022/4/19.
|
||||
//
|
||||
|
||||
#import "MessageContentCustomView.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface MessageContentLevelUpgradeView : MessageContentCustomView
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,154 @@
|
||||
//
|
||||
// MessageContentLevelUpgradeView.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2022/4/19.
|
||||
//
|
||||
|
||||
#import "MessageContentLevelUpgradeView.h"
|
||||
///Third
|
||||
#import <Masonry/Masonry.h>
|
||||
///Tool
|
||||
#import "ThemeColor.h"
|
||||
#import "NSObject+MJExtension.h"
|
||||
#import "XPHtmlUrl.h"
|
||||
#import "XCCurrentVCStackManager.h"
|
||||
///Model
|
||||
#import "ContentLevelUpgradeModel.h"
|
||||
///View
|
||||
#import "XPWebViewController.h"
|
||||
|
||||
@interface MessageContentLevelUpgradeView ()
|
||||
|
||||
///logo
|
||||
@property (nonatomic,strong) UIImageView *logoImageView;
|
||||
///等级升级
|
||||
@property (nonatomic,strong) UILabel *levelLabel;
|
||||
///分割线
|
||||
@property (nonatomic,strong) UIView * lineView;
|
||||
///查看
|
||||
@property (nonatomic,strong) UIButton *checkButton;
|
||||
///箭头
|
||||
@property (nonatomic,strong) UIImageView *arrowImageView;
|
||||
|
||||
@end
|
||||
|
||||
@implementation MessageContentLevelUpgradeView
|
||||
+ (CGFloat)measureHeight:(NIMMessage *)message {
|
||||
return (101 + CONTENT_PADDING_V_TOTAL);
|
||||
}
|
||||
|
||||
- (void)render:(NIMMessage *)message {
|
||||
NIMCustomObject *obj = (NIMCustomObject *)message.messageObject;
|
||||
AttachmentModel * attach = obj.attachment;
|
||||
ContentLevelUpgradeModel * model = [ContentLevelUpgradeModel modelWithJSON:attach.data];
|
||||
if (attach.second == Custom_Message_Sub_User_UpGrade_Charm) {
|
||||
self.logoImageView.image = [UIImage imageNamed:@"message_content_upgrade_charm"];
|
||||
self.levelLabel.text = [NSString stringWithFormat:@"恭喜!您的魅力等级已到达Lv%@", model.levelName];
|
||||
} else {
|
||||
self.logoImageView.image = [UIImage imageNamed:@"message_content_upgrade_expre"];
|
||||
self.levelLabel.text = [NSString stringWithFormat:@"恭喜!您的等级已到达Lv%@", model.levelName];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)initSubViews {
|
||||
[super initSubViews];
|
||||
[self.backView addSubview:self.logoImageView];
|
||||
[self.backView addSubview:self.levelLabel];
|
||||
[self.backView addSubview:self.lineView];
|
||||
[self.backView addSubview:self.checkButton];
|
||||
[self.backView addSubview:self.arrowImageView];
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
[super initSubViewConstraints];
|
||||
[self.backView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.size.mas_equalTo(CGSizeMake(220, 101));
|
||||
}];
|
||||
|
||||
|
||||
[self.logoImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.size.mas_equalTo(CGSizeMake(50, 50));
|
||||
make.left.mas_equalTo(self.backView);
|
||||
make.top.mas_equalTo(self.backView);
|
||||
}];
|
||||
|
||||
[self.levelLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.logoImageView.mas_right).offset(10);
|
||||
make.right.mas_equalTo(self.backView);
|
||||
make.top.mas_equalTo(self.logoImageView);
|
||||
}];
|
||||
|
||||
[self.lineView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.mas_equalTo(self.backView);
|
||||
make.height.mas_equalTo(1);
|
||||
make.top.mas_equalTo(self.logoImageView.mas_bottom).offset(10);
|
||||
}];
|
||||
|
||||
[self.checkButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.mas_equalTo(self.backView);
|
||||
make.height.mas_equalTo(40);
|
||||
make.top.mas_equalTo(self.lineView.mas_bottom);
|
||||
}];
|
||||
|
||||
[self.arrowImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.size.mas_equalTo(CGSizeMake(6.5, 11));
|
||||
make.right.mas_equalTo(self.backView);
|
||||
make.centerY.mas_equalTo(self.checkButton);
|
||||
}];
|
||||
}
|
||||
#pragma mark - Event Response
|
||||
- (void)checkButtonAction:(UIButton *)sender {
|
||||
XPWebViewController * webVC = [[XPWebViewController alloc] init];
|
||||
webVC.url = URLWithType(kUserLevelURL);
|
||||
[[XCCurrentVCStackManager shareManager].getCurrentVC.navigationController pushViewController:webVC animated:YES];
|
||||
}
|
||||
#pragma mark - Getters And Setters
|
||||
- (UIImageView *)logoImageView {
|
||||
if (!_logoImageView) {
|
||||
_logoImageView = [[UIImageView alloc] init];
|
||||
_logoImageView.backgroundColor = [UIColor redColor];
|
||||
}
|
||||
return _logoImageView;
|
||||
}
|
||||
|
||||
- (UILabel *)levelLabel {
|
||||
if (!_levelLabel) {
|
||||
_levelLabel = [[UILabel alloc] init];
|
||||
_levelLabel.font = [UIFont systemFontOfSize:14];
|
||||
_levelLabel.textColor = [ThemeColor mainTextColor];
|
||||
_levelLabel.numberOfLines = 2;
|
||||
}
|
||||
return _levelLabel;
|
||||
}
|
||||
|
||||
- (UIButton *)checkButton {
|
||||
if (!_checkButton) {
|
||||
_checkButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_checkButton setTitle:@"立即查看" forState:UIControlStateNormal];
|
||||
[_checkButton setTitleColor:[ThemeColor mainTextColor] forState:UIControlStateNormal];
|
||||
_checkButton.titleLabel.font = [UIFont systemFontOfSize:12];
|
||||
[_checkButton addTarget:self action:@selector(checkButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _checkButton;
|
||||
}
|
||||
|
||||
- (UIView *)lineView {
|
||||
if (!_lineView) {
|
||||
_lineView = [[UIView alloc] init];
|
||||
_lineView.backgroundColor = [ThemeColor dividerColor];
|
||||
}
|
||||
return _lineView;
|
||||
}
|
||||
|
||||
- (UIImageView *)arrowImageView {
|
||||
if (!_arrowImageView) {
|
||||
_arrowImageView = [[UIImageView alloc] init];
|
||||
_arrowImageView.userInteractionEnabled = YES;
|
||||
_arrowImageView.image = [UIImage imageNamed:@"common_right_arrow"];
|
||||
}
|
||||
return _arrowImageView;
|
||||
}
|
||||
|
||||
|
||||
@end
|
@@ -21,8 +21,6 @@
|
||||
#define MESSAGE_PADDING 10
|
||||
|
||||
@interface MessageContentOpenLiveView ()
|
||||
///背景
|
||||
@property (nonatomic,strong) UIView * backView;
|
||||
///头像
|
||||
@property (nonatomic,strong) NetImageView *avatarImageView;
|
||||
///显示标题
|
||||
@@ -47,6 +45,7 @@
|
||||
self.avatarImageView.imageUrl = info.userVo.avatar;
|
||||
self.idLabel.text = [NSString stringWithFormat:@"%@ 上线了", info.userVo.nick];
|
||||
} else {
|
||||
|
||||
NSArray *uids = @[info.uid];
|
||||
[[NIMSDK sharedSDK].userManager fetchUserInfos:uids completion:^(NSArray<NIMUser *> * _Nullable users, NSError * _Nullable error) {
|
||||
if (error == nil) {
|
||||
@@ -65,6 +64,8 @@
|
||||
[self.backView addSubview:self.avatarImageView];
|
||||
[self.backView addSubview:self.titleLabel];
|
||||
[self.backView addSubview:self.idLabel];
|
||||
UITapGestureRecognizer * tap= [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(backViewTapRecognozer)];
|
||||
[self.backView addGestureRecognizer:tap];
|
||||
}
|
||||
|
||||
|
||||
@@ -111,16 +112,6 @@
|
||||
}
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
- (UIView *)backView {
|
||||
if (!_backView) {
|
||||
_backView = [[UIView alloc] init];
|
||||
_backView.backgroundColor = [UIColor clearColor];
|
||||
UITapGestureRecognizer * tap= [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(backViewTapRecognozer)];
|
||||
[_backView addGestureRecognizer:tap];
|
||||
}
|
||||
return _backView;
|
||||
}
|
||||
|
||||
- (NetImageView *)avatarImageView {
|
||||
if (!_avatarImageView) {
|
||||
NetImageConfig * config = [[NetImageConfig alloc]init];
|
||||
|
@@ -67,14 +67,16 @@
|
||||
}
|
||||
|
||||
- (void)initSubViews {
|
||||
[self addSubview:self.messageText];
|
||||
[super initSubViews];
|
||||
[self.backView addSubview:self.messageText];
|
||||
UITapGestureRecognizer * tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(event:)];
|
||||
[self addGestureRecognizer:tapGesture];
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
[super initSubViewConstraints];
|
||||
[self.messageText mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.equalTo(self).with.insets(UIEdgeInsetsMake(MESSAGE_TEXT_PADDING, MESSAGE_TEXT_PADDING, MESSAGE_TEXT_PADDING, MESSAGE_TEXT_PADDING));
|
||||
make.edges.mas_equalTo(self.backView).insets(UIEdgeInsetsMake(0, 0, 0, 0));
|
||||
}];
|
||||
}
|
||||
|
||||
|
@@ -28,7 +28,7 @@
|
||||
}
|
||||
|
||||
- (void)render:(NIMMessage *)message {
|
||||
|
||||
NSLog(@"%@", @"aaaaa");
|
||||
}
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame {
|
||||
|
@@ -16,6 +16,7 @@
|
||||
#import "MessageContentUnSupportView.h"
|
||||
#import "MessageContentOpenLiveView.h"
|
||||
#import "MessageContentApplicationShareView.h"
|
||||
#import "MessageContentLevelUpgradeView.h"
|
||||
|
||||
#import "AttachmentModel.h"
|
||||
#import "NetImageView.h"
|
||||
@@ -55,85 +56,84 @@
|
||||
@implementation MessageCell
|
||||
|
||||
+ (CGFloat)measureHeight:(NIMMessage *)message {
|
||||
CGFloat minHeight = AVATAR_SIZE + AVATAR_MARGIN_H * 2;
|
||||
if (!message) {
|
||||
return minHeight;
|
||||
}
|
||||
|
||||
CGFloat mesuredHeight = 0;
|
||||
switch (message.messageType) {
|
||||
case NIMMessageTypeText:
|
||||
case NIMMessageTypeTip:
|
||||
mesuredHeight = [MessageContentText measureHeight:message];
|
||||
break;
|
||||
case NIMMessageTypeImage:
|
||||
mesuredHeight = [MessageContentImage measureHeight:message];
|
||||
break;
|
||||
case NIMMessageTypeCustom:
|
||||
mesuredHeight = [self customMessageMeasureHeight:message];
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
return MAX(minHeight, mesuredHeight);
|
||||
CGFloat minHeight = AVATAR_SIZE + AVATAR_MARGIN_H * 2;
|
||||
if (!message) {
|
||||
return minHeight;
|
||||
}
|
||||
|
||||
CGFloat mesuredHeight = 0;
|
||||
switch (message.messageType) {
|
||||
case NIMMessageTypeText:
|
||||
case NIMMessageTypeTip:
|
||||
mesuredHeight = [MessageContentText measureHeight:message];
|
||||
break;
|
||||
case NIMMessageTypeImage:
|
||||
mesuredHeight = [MessageContentImage measureHeight:message];
|
||||
break;
|
||||
case NIMMessageTypeCustom:
|
||||
mesuredHeight = [self customMessageMeasureHeight:message];
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
return MAX(minHeight, mesuredHeight);
|
||||
}
|
||||
|
||||
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
|
||||
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
|
||||
if (self) {
|
||||
self.selectionStyle = UITableViewCellSelectionStyleNone;
|
||||
[self initViews];
|
||||
[self initLayout];
|
||||
}
|
||||
return self;
|
||||
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
|
||||
if (self) {
|
||||
self.selectionStyle = UITableViewCellSelectionStyleNone;
|
||||
[self initViews];
|
||||
[self initLayout];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)initViews {
|
||||
self.backgroundColor = UIColor.clearColor;
|
||||
[self.contentView addSubview:self.leftAvatar];
|
||||
[self.contentView addSubview:self.rightAvatar];
|
||||
[self.contentView addSubview:self.messageBackground];
|
||||
self.backgroundColor = UIColor.clearColor;
|
||||
[self.contentView addSubview:self.leftAvatar];
|
||||
[self.contentView addSubview:self.rightAvatar];
|
||||
[self.contentView addSubview:self.messageBackground];
|
||||
}
|
||||
|
||||
- (void)initLayout {
|
||||
[self.leftAvatar mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.top.mas_equalTo(self).offset(15);
|
||||
make.width.height.mas_equalTo(45);
|
||||
}];
|
||||
|
||||
[self.rightAvatar mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(self).offset(15);
|
||||
make.right.mas_equalTo(self).offset(-15);
|
||||
make.width.height.mas_equalTo(45);
|
||||
}];
|
||||
|
||||
[self.messageBackground mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
self.messageBackgroundLeft = make.left.mas_equalTo(self.leftAvatar.mas_right).offset(15);
|
||||
self.messageBackgroundRight = make.right.mas_equalTo(self.rightAvatar.mas_left).offset(-15);
|
||||
make.top.mas_equalTo(self).offset(20);
|
||||
}];
|
||||
[self.leftAvatar mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.top.mas_equalTo(self).offset(15);
|
||||
make.width.height.mas_equalTo(45);
|
||||
}];
|
||||
|
||||
[self.rightAvatar mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(self).offset(15);
|
||||
make.right.mas_equalTo(self).offset(-15);
|
||||
make.width.height.mas_equalTo(45);
|
||||
}];
|
||||
|
||||
[self.messageBackground mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
self.messageBackgroundLeft = make.left.mas_equalTo(self.leftAvatar.mas_right).offset(15);
|
||||
self.messageBackgroundRight = make.right.mas_equalTo(self.rightAvatar.mas_left).offset(-15);
|
||||
make.top.mas_equalTo(self).offset(20);
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)renderWithMessage:(NIMMessage *)message {
|
||||
NSString * avatarUrl = [[NIMSDK sharedSDK].userManager userInfo:message.from].userInfo.avatarUrl;
|
||||
avatarUrl = [avatarUrl stringByReplacingOccurrencesOfString:@"https" withString:@"http"];
|
||||
BOOL isSelf = [[NIMSDK sharedSDK].loginManager.currentAccount isEqualToString:message.from];
|
||||
if (isSelf) {
|
||||
self.leftAvatar.hidden = YES;
|
||||
self.rightAvatar.hidden = NO;
|
||||
[self.messageBackgroundLeft uninstall];
|
||||
[self.messageBackgroundRight install];
|
||||
self.rightAvatar.imageUrl = avatarUrl;
|
||||
} else {
|
||||
self.leftAvatar.hidden = NO;
|
||||
self.rightAvatar.hidden = YES;
|
||||
[self.messageBackgroundLeft install];
|
||||
[self.messageBackgroundRight uninstall];
|
||||
self.leftAvatar.imageUrl = avatarUrl;
|
||||
}
|
||||
|
||||
|
||||
NSString * avatarUrl = [[NIMSDK sharedSDK].userManager userInfo:message.from].userInfo.avatarUrl;
|
||||
avatarUrl = [avatarUrl stringByReplacingOccurrencesOfString:@"https" withString:@"http"];
|
||||
BOOL isSelf = [[NIMSDK sharedSDK].loginManager.currentAccount isEqualToString:message.from];
|
||||
if (isSelf) {
|
||||
self.leftAvatar.hidden = YES;
|
||||
self.rightAvatar.hidden = NO;
|
||||
[self.messageBackgroundLeft uninstall];
|
||||
[self.messageBackgroundRight install];
|
||||
self.rightAvatar.imageUrl = avatarUrl;
|
||||
} else {
|
||||
self.leftAvatar.hidden = NO;
|
||||
self.rightAvatar.hidden = YES;
|
||||
[self.messageBackgroundLeft install];
|
||||
[self.messageBackgroundRight uninstall];
|
||||
self.leftAvatar.imageUrl = avatarUrl;
|
||||
}
|
||||
|
||||
if (self.messageContent) {
|
||||
[self.messageContent removeFromSuperview];
|
||||
}
|
||||
@@ -156,8 +156,7 @@
|
||||
[self.messageContent mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.top.right.bottom.mas_equalTo(self.messageBackground);
|
||||
}];
|
||||
NSLog(@"当前messagecotnet的地址:%p", self.messageContent);
|
||||
[self.messageContent render:message];
|
||||
[self.messageContent render:message];
|
||||
}
|
||||
|
||||
|
||||
@@ -179,6 +178,8 @@
|
||||
return @"MessageContentOpenLiveView";
|
||||
} else if(attachment.first == CustomMessageType_Application_Share && attachment.second == Custom_Message_Sub_Application_Share_Room) {
|
||||
return @"MessageContentOpenLiveView";
|
||||
} else if(attachment.first == CustomMessageType_User_UpGrade && (attachment.second == Custom_Message_Sub_User_UpGrade_Charm || attachment.second == Custom_Message_Sub_User_UpGrade_Exper)) {
|
||||
return @"MessageContentLevelUpgradeView";
|
||||
} else {
|
||||
return @"MessageContentOpenLiveView";
|
||||
}
|
||||
@@ -193,7 +194,7 @@
|
||||
AttachmentModel *attachment = (AttachmentModel *)obj.attachment;
|
||||
if (attachment.first == CustomMessageType_Gift && attachment.second == Custom_Message_Sub_Gift_Send) {
|
||||
return [MessageContentGiftView measureHeight:message];
|
||||
} else if(attachment.first == CustomMessageType_Secretary) {
|
||||
} else if(attachment.first == CustomMessageType_Secretary && attachment.second == Custom_Message_Sub_Secretary_Router) {
|
||||
return [MessageContentTextClickable measureHeight:message];
|
||||
} else if(attachment.first == CustomMessageType_Hall) {
|
||||
return [MessageContentGuildView measureHeight:message];
|
||||
@@ -201,6 +202,8 @@
|
||||
return [MessageContentOpenLiveView measureHeight:message];
|
||||
} else if(attachment.first == CustomMessageType_Application_Share && attachment.second == Custom_Message_Sub_Application_Share_Room) {
|
||||
return [MessageContentApplicationShareView measureHeight:message];
|
||||
} else if(attachment.first == CustomMessageType_User_UpGrade && (attachment.second == Custom_Message_Sub_User_UpGrade_Charm || attachment.second == Custom_Message_Sub_User_UpGrade_Exper)) {
|
||||
return [MessageContentLevelUpgradeView measureHeight:message];
|
||||
} else {
|
||||
return [MessageContentUnSupportView measureHeight:message];
|
||||
}
|
||||
@@ -214,7 +217,7 @@
|
||||
return self.messageContent;
|
||||
}
|
||||
return [[MessageContentGiftView alloc] init];
|
||||
} else if(attachment.first == CustomMessageType_Secretary) {
|
||||
} else if(attachment.first == CustomMessageType_Secretary && attachment.second == Custom_Message_Sub_Secretary_Router) {
|
||||
if ([self.messageContent isKindOfClass:[MessageContentTextClickable class]]) {
|
||||
return self.messageContent;
|
||||
}
|
||||
@@ -236,6 +239,11 @@
|
||||
return self.messageContent;
|
||||
}
|
||||
return [[MessageContentApplicationShareView alloc] init];
|
||||
}else if(attachment.first == CustomMessageType_User_UpGrade && (attachment.second == Custom_Message_Sub_User_UpGrade_Charm || attachment.second == Custom_Message_Sub_User_UpGrade_Exper)) {
|
||||
if ([self.messageContent isKindOfClass:[MessageContentLevelUpgradeView class]]) {
|
||||
return self.messageContent;
|
||||
}
|
||||
return [[MessageContentLevelUpgradeView alloc] init];
|
||||
} else {
|
||||
if ([self.messageContent isKindOfClass:[MessageContentUnSupportView class]]) {
|
||||
return self.messageContent;
|
||||
@@ -253,41 +261,41 @@
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
- (NetImageView *)leftAvatar {
|
||||
if (!_leftAvatar) {
|
||||
NetImageConfig * config = [[NetImageConfig alloc] init];
|
||||
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
|
||||
config.radius = MAXFLOAT;
|
||||
config.imageType = ImageTypeUserIcon;
|
||||
_leftAvatar = [[NetImageView alloc] initWithConfig:config];
|
||||
_leftAvatar.layer.masksToBounds = YES;
|
||||
_leftAvatar.layer.cornerRadius = 45.f / 2;
|
||||
_leftAvatar.hidden = YES;
|
||||
}
|
||||
return _leftAvatar;
|
||||
if (!_leftAvatar) {
|
||||
NetImageConfig * config = [[NetImageConfig alloc] init];
|
||||
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
|
||||
config.radius = MAXFLOAT;
|
||||
config.imageType = ImageTypeUserIcon;
|
||||
_leftAvatar = [[NetImageView alloc] initWithConfig:config];
|
||||
_leftAvatar.layer.masksToBounds = YES;
|
||||
_leftAvatar.layer.cornerRadius = 45.f / 2;
|
||||
_leftAvatar.hidden = YES;
|
||||
}
|
||||
return _leftAvatar;
|
||||
}
|
||||
|
||||
- (NetImageView *)rightAvatar {
|
||||
if (!_rightAvatar) {
|
||||
NetImageConfig * config = [[NetImageConfig alloc] init];
|
||||
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
|
||||
config.radius = MAXFLOAT;
|
||||
config.imageType = ImageTypeUserIcon;
|
||||
_rightAvatar = [[NetImageView alloc] initWithConfig:config];
|
||||
_rightAvatar.layer.masksToBounds = YES;
|
||||
_rightAvatar.layer.cornerRadius = 45.f / 2;
|
||||
_rightAvatar.hidden = YES;
|
||||
}
|
||||
return _rightAvatar;
|
||||
if (!_rightAvatar) {
|
||||
NetImageConfig * config = [[NetImageConfig alloc] init];
|
||||
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
|
||||
config.radius = MAXFLOAT;
|
||||
config.imageType = ImageTypeUserIcon;
|
||||
_rightAvatar = [[NetImageView alloc] initWithConfig:config];
|
||||
_rightAvatar.layer.masksToBounds = YES;
|
||||
_rightAvatar.layer.cornerRadius = 45.f / 2;
|
||||
_rightAvatar.hidden = YES;
|
||||
}
|
||||
return _rightAvatar;
|
||||
}
|
||||
|
||||
- (UIView *)messageBackground {
|
||||
if (!_messageBackground) {
|
||||
_messageBackground = [[UIView alloc]init];
|
||||
_messageBackground.backgroundColor = [ThemeColor appCellBackgroundColor];
|
||||
_messageBackground.layer.masksToBounds = YES;
|
||||
_messageBackground.layer.cornerRadius = 8.f;
|
||||
}
|
||||
return _messageBackground;
|
||||
if (!_messageBackground) {
|
||||
_messageBackground = [[UIView alloc]init];
|
||||
_messageBackground.backgroundColor = [ThemeColor appCellBackgroundColor];
|
||||
_messageBackground.layer.masksToBounds = YES;
|
||||
_messageBackground.layer.cornerRadius = 8.f;
|
||||
}
|
||||
return _messageBackground;
|
||||
}
|
||||
|
||||
@end
|
||||
|
Reference in New Issue
Block a user