房间内的数据提交
This commit is contained in:
@@ -775,6 +775,7 @@
|
|||||||
8C2C3F742B2B73AC002C3C34 /* DDMessageCustomRemoteExtModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C2C3F732B2B73AC002C3C34 /* DDMessageCustomRemoteExtModel.m */; };
|
8C2C3F742B2B73AC002C3C34 /* DDMessageCustomRemoteExtModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C2C3F732B2B73AC002C3C34 /* DDMessageCustomRemoteExtModel.m */; };
|
||||||
8C2C3F792B2BB4E4002C3C34 /* DDClientConfig.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C2C3F782B2BB4E4002C3C34 /* DDClientConfig.m */; };
|
8C2C3F792B2BB4E4002C3C34 /* DDClientConfig.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C2C3F782B2BB4E4002C3C34 /* DDClientConfig.m */; };
|
||||||
8C2C3F7C2B2BB66F002C3C34 /* DDClientModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C2C3F7B2B2BB66F002C3C34 /* DDClientModel.m */; };
|
8C2C3F7C2B2BB66F002C3C34 /* DDClientModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C2C3F7B2B2BB66F002C3C34 /* DDClientModel.m */; };
|
||||||
|
8CD77F9F2B2BD41A00F4CFF3 /* XPRoomMessageContainerView.m in Sources */ = {isa = PBXBuildFile; fileRef = 8CD77F9E2B2BD41A00F4CFF3 /* XPRoomMessageContainerView.m */; };
|
||||||
8CE493992B23F44800CA14D5 /* NSMutableDictionary+DDSafe.m in Sources */ = {isa = PBXBuildFile; fileRef = 8CE493982B23F44800CA14D5 /* NSMutableDictionary+DDSafe.m */; };
|
8CE493992B23F44800CA14D5 /* NSMutableDictionary+DDSafe.m in Sources */ = {isa = PBXBuildFile; fileRef = 8CE493982B23F44800CA14D5 /* NSMutableDictionary+DDSafe.m */; };
|
||||||
8CE4939C2B23F45C00CA14D5 /* NSArray+DDSafe.m in Sources */ = {isa = PBXBuildFile; fileRef = 8CE4939B2B23F45C00CA14D5 /* NSArray+DDSafe.m */; };
|
8CE4939C2B23F45C00CA14D5 /* NSArray+DDSafe.m in Sources */ = {isa = PBXBuildFile; fileRef = 8CE4939B2B23F45C00CA14D5 /* NSArray+DDSafe.m */; };
|
||||||
8CE493A02B23F5FA00CA14D5 /* DDUploadFile.m in Sources */ = {isa = PBXBuildFile; fileRef = 8CE4939F2B23F5FA00CA14D5 /* DDUploadFile.m */; };
|
8CE493A02B23F5FA00CA14D5 /* DDUploadFile.m in Sources */ = {isa = PBXBuildFile; fileRef = 8CE4939F2B23F5FA00CA14D5 /* DDUploadFile.m */; };
|
||||||
@@ -2222,6 +2223,8 @@
|
|||||||
8C2C3F7A2B2BB66F002C3C34 /* DDClientModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DDClientModel.h; sourceTree = "<group>"; };
|
8C2C3F7A2B2BB66F002C3C34 /* DDClientModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DDClientModel.h; sourceTree = "<group>"; };
|
||||||
8C2C3F7B2B2BB66F002C3C34 /* DDClientModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DDClientModel.m; sourceTree = "<group>"; };
|
8C2C3F7B2B2BB66F002C3C34 /* DDClientModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DDClientModel.m; sourceTree = "<group>"; };
|
||||||
8CAB97312B2259EA00ED8639 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; };
|
8CAB97312B2259EA00ED8639 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; };
|
||||||
|
8CD77F9D2B2BD41A00F4CFF3 /* XPRoomMessageContainerView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomMessageContainerView.h; sourceTree = "<group>"; };
|
||||||
|
8CD77F9E2B2BD41A00F4CFF3 /* XPRoomMessageContainerView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPRoomMessageContainerView.m; sourceTree = "<group>"; };
|
||||||
8CE493972B23F44800CA14D5 /* NSMutableDictionary+DDSafe.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSMutableDictionary+DDSafe.h"; sourceTree = "<group>"; };
|
8CE493972B23F44800CA14D5 /* NSMutableDictionary+DDSafe.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSMutableDictionary+DDSafe.h"; sourceTree = "<group>"; };
|
||||||
8CE493982B23F44800CA14D5 /* NSMutableDictionary+DDSafe.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSMutableDictionary+DDSafe.m"; sourceTree = "<group>"; };
|
8CE493982B23F44800CA14D5 /* NSMutableDictionary+DDSafe.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSMutableDictionary+DDSafe.m"; sourceTree = "<group>"; };
|
||||||
8CE4939A2B23F45C00CA14D5 /* NSArray+DDSafe.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSArray+DDSafe.h"; sourceTree = "<group>"; };
|
8CE4939A2B23F45C00CA14D5 /* NSArray+DDSafe.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSArray+DDSafe.h"; sourceTree = "<group>"; };
|
||||||
@@ -3376,6 +3379,8 @@
|
|||||||
18660DC42A21E54B0032D0C9 /* PublicMessage */,
|
18660DC42A21E54B0032D0C9 /* PublicMessage */,
|
||||||
18660DC72A21E54B0032D0C9 /* ToolView */,
|
18660DC72A21E54B0032D0C9 /* ToolView */,
|
||||||
18660DCA2A21E54B0032D0C9 /* InfoView */,
|
18660DCA2A21E54B0032D0C9 /* InfoView */,
|
||||||
|
8CD77F9D2B2BD41A00F4CFF3 /* XPRoomMessageContainerView.h */,
|
||||||
|
8CD77F9E2B2BD41A00F4CFF3 /* XPRoomMessageContainerView.m */,
|
||||||
);
|
);
|
||||||
path = View;
|
path = View;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@@ -6530,6 +6535,7 @@
|
|||||||
188EC0ED2A47CF3200060F03 /* DDMMoreKeyboard.m in Sources */,
|
188EC0ED2A47CF3200060F03 /* DDMMoreKeyboard.m in Sources */,
|
||||||
18B1EA222A26F28700DDE889 /* DDDynamicModel.m in Sources */,
|
18B1EA222A26F28700DDE889 /* DDDynamicModel.m in Sources */,
|
||||||
186C9D192A2A02F700209BB5 /* DDYoungPwdViewController.m in Sources */,
|
186C9D192A2A02F700209BB5 /* DDYoungPwdViewController.m in Sources */,
|
||||||
|
8CD77F9F2B2BD41A00F4CFF3 /* XPRoomMessageContainerView.m in Sources */,
|
||||||
18660CBD2A21913E0032D0C9 /* WRCustomNavigationBar.m in Sources */,
|
18660CBD2A21913E0032D0C9 /* WRCustomNavigationBar.m in Sources */,
|
||||||
188EC13A2A47CF3300060F03 /* HX_PhotoEditViewController.m in Sources */,
|
188EC13A2A47CF3300060F03 /* HX_PhotoEditViewController.m in Sources */,
|
||||||
1812EC7E2A54FC9300FF2AC0 /* DDRoomSendGiftsView.m in Sources */,
|
1812EC7E2A54FC9300FF2AC0 /* DDRoomSendGiftsView.m in Sources */,
|
||||||
|
@@ -20,6 +20,7 @@
|
|||||||
#import "RoomEditPassWordView.h"
|
#import "RoomEditPassWordView.h"
|
||||||
#import "AccountInfoStorage.h"
|
#import "AccountInfoStorage.h"
|
||||||
#import <NIMSDK/NIMSDK.h>
|
#import <NIMSDK/NIMSDK.h>
|
||||||
|
//#import "XPRoomViewController.h"
|
||||||
static NSString *SAVELOGIN = @"LOGINMODEL";
|
static NSString *SAVELOGIN = @"LOGINMODEL";
|
||||||
static NSString *SAVECITYINFO = @"CITYINFO";
|
static NSString *SAVECITYINFO = @"CITYINFO";
|
||||||
static NSString *SAVELOGINVIDEO = @"LOGINVIDEO";
|
static NSString *SAVELOGINVIDEO = @"LOGINVIDEO";
|
||||||
|
@@ -9,6 +9,7 @@
|
|||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
#import "GCDMulticastDelegate.h"
|
#import "GCDMulticastDelegate.h"
|
||||||
#import "RoomInfoModel.h"
|
#import "RoomInfoModel.h"
|
||||||
|
#import "RoomUserInfoModel.h"
|
||||||
@class VideoModel;
|
@class VideoModel;
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
@protocol AppMessageManagerDelegate <NSObject>
|
@protocol AppMessageManagerDelegate <NSObject>
|
||||||
|
@@ -164,34 +164,34 @@
|
|||||||
///发送公屏文字消息
|
///发送公屏文字消息
|
||||||
- (void)sendPublicTextMessage:(NSString *)roomID text:(NSString *)text userInfo:(RoomUserInfoModel*)userInfo messageType:(NSInteger)messageType{
|
- (void)sendPublicTextMessage:(NSString *)roomID text:(NSString *)text userInfo:(RoomUserInfoModel*)userInfo messageType:(NSInteger)messageType{
|
||||||
[ToolsObject ShowSVProgressHUD:@""];
|
[ToolsObject ShowSVProgressHUD:@""];
|
||||||
if(!userInfo){
|
// if(!userInfo){
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
if([ToolsObject IsNullWithObject:userInfo.nickname] ||[ToolsObject IsNullWithObject:userInfo.room_auth]){
|
// if([ToolsObject IsNullWithObject:userInfo.nickname] ||[ToolsObject IsNullWithObject:userInfo.room_auth]){
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
NSString *meadlBox = @"";
|
// NSString *meadlBox = @"";
|
||||||
if([ToolsObject isBlankString:userInfo.medal_box].length >0){
|
// if([ToolsObject isBlankString:userInfo.medal_box].length >0){
|
||||||
meadlBox = userInfo.medal_box;
|
// meadlBox = userInfo.medal_box;
|
||||||
}
|
// }
|
||||||
NSString *bubbleBox = @"";
|
// NSString *bubbleBox = @"";
|
||||||
if([ToolsObject isBlankString:userInfo.bubble_box].length >0){
|
// if([ToolsObject isBlankString:userInfo.bubble_box].length >0){
|
||||||
bubbleBox = userInfo.bubble_box;
|
// bubbleBox = userInfo.bubble_box;
|
||||||
}
|
// }
|
||||||
NSDictionary *userInfoDic = @{@"nickname":userInfo.nickname,
|
// NSDictionary *userInfoDic = @{@"nickname":userInfo.nickname,
|
||||||
@"room_auth":userInfo.room_auth,
|
// @"room_auth":userInfo.room_auth,
|
||||||
@"user_id":userInfo.user_id,
|
// @"user_id":userInfo.user_id,
|
||||||
@"level_icon":[ToolsObject isBlankString:userInfo.level_icon],
|
// @"level_icon":[ToolsObject isBlankString:userInfo.level_icon],
|
||||||
@"medal_box":meadlBox,
|
// @"medal_box":meadlBox,
|
||||||
@"bubble_box":bubbleBox,
|
// @"bubble_box":bubbleBox,
|
||||||
@"nobility_id":@(userInfo.nobility_id)
|
// @"nobility_id":@(userInfo.nobility_id)
|
||||||
};
|
// };
|
||||||
NSMutableDictionary *dataDic = [[NSMutableDictionary alloc] init];
|
// NSMutableDictionary *dataDic = [[NSMutableDictionary alloc] init];
|
||||||
[dataDic setObject:roomID forKey:@"room_id"];
|
// [dataDic setObject:roomID forKey:@"room_id"];
|
||||||
[dataDic setObject:text forKey:@"content"];
|
// [dataDic setObject:text forKey:@"content"];
|
||||||
[dataDic setObject:userInfoDic forKey:@"user_info"];
|
// [dataDic setObject:userInfoDic forKey:@"user_info"];
|
||||||
[dataDic setObject:@(messageType) forKey:@"message_type"];
|
// [dataDic setObject:@(messageType) forKey:@"message_type"];
|
||||||
[self sendMesageDic:dataDic messageID:1000];
|
// [self sendMesageDic:dataDic messageID:1000];
|
||||||
|
|
||||||
}
|
}
|
||||||
///发送公屏表情消息
|
///发送公屏表情消息
|
||||||
|
@@ -336,7 +336,7 @@ trailingSwipeActionsConfigurationForRowAtIndexPath:(NSIndexPath *)indexPath{
|
|||||||
}
|
}
|
||||||
NSMutableArray *arr = response.data;
|
NSMutableArray *arr = response.data;
|
||||||
RoomInfoModel *model = [RoomInfoModel yy_modelWithJSON:arr.firstObject];
|
RoomInfoModel *model = [RoomInfoModel yy_modelWithJSON:arr.firstObject];
|
||||||
[[ToolsObject shareTools]jumpToRoomVC:model.user_id followUser:[RoomUserInfoModel new]];
|
// [[ToolsObject shareTools]jumpToRoomVC:model.user_id followUser:[RoomUserInfoModel new]];
|
||||||
}
|
}
|
||||||
}];
|
}];
|
||||||
|
|
||||||
|
@@ -146,6 +146,8 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
@property (nonatomic , copy) NSString * roomPwd;
|
@property (nonatomic , copy) NSString * roomPwd;
|
||||||
@property (nonatomic , copy) NSString * roomDesc;
|
@property (nonatomic , copy) NSString * roomDesc;
|
||||||
@property (nonatomic , assign) NSInteger uid;
|
@property (nonatomic , assign) NSInteger uid;
|
||||||
|
///清除公屏的时间(用于拉取此时间后的公屏消息)
|
||||||
|
@property (nonatomic , assign) double clearScreenTime;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
NS_ASSUME_NONNULL_END
|
||||||
|
@@ -51,6 +51,7 @@
|
|||||||
/// Model
|
/// Model
|
||||||
#import "UserInfoModel.h"
|
#import "UserInfoModel.h"
|
||||||
#import "RoomInfoModel.h"
|
#import "RoomInfoModel.h"
|
||||||
|
#import "DDMessageCustomRemoteExtModel.h"
|
||||||
/// Third
|
/// Third
|
||||||
#import <NIMSDK/NIMSDK.h>
|
#import <NIMSDK/NIMSDK.h>
|
||||||
|
|
||||||
@@ -85,6 +86,9 @@ static dispatch_once_t onceToken;
|
|||||||
@property (nonatomic,strong) RoomEventView *roomEventView;
|
@property (nonatomic,strong) RoomEventView *roomEventView;
|
||||||
/**公屏信息*/
|
/**公屏信息*/
|
||||||
@property (nonatomic,strong) RoomPublicMessageView *publicMessageView;
|
@property (nonatomic,strong) RoomPublicMessageView *publicMessageView;
|
||||||
|
///公屏
|
||||||
|
//@property (nonatomic,strong) XPRoomMessageContainerView *messageContainerView;
|
||||||
|
|
||||||
@property (nonatomic, strong) NSMutableArray *timeArray;
|
@property (nonatomic, strong) NSMutableArray *timeArray;
|
||||||
/**房间信息*/
|
/**房间信息*/
|
||||||
@property (nonatomic,strong) RoomInfoModel *roomInfoModel;
|
@property (nonatomic,strong) RoomInfoModel *roomInfoModel;
|
||||||
@@ -256,6 +260,15 @@ static dispatch_once_t onceToken;
|
|||||||
/// 接收消息
|
/// 接收消息
|
||||||
- (void)onRecvMessages:(NSArray<NIMMessage *> *)messages {
|
- (void)onRecvMessages:(NSArray<NIMMessage *> *)messages {
|
||||||
|
|
||||||
|
NSLog(@"message:%@",messages);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
for (NIMMessage *message in messages) {
|
||||||
|
if (message.messageType == NIMMessageTypeNotification) {
|
||||||
|
[self.publicMessageView handleRecvMessages: message];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 发送消息
|
/// 发送消息
|
||||||
@@ -788,6 +801,10 @@ static dispatch_once_t onceToken;
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
#pragma mark --公告/榜单按钮点击
|
#pragma mark --公告/榜单按钮点击
|
||||||
|
- (void)setRoomInfo:(RoomInfoModel *)roomInfo {
|
||||||
|
_roomInfo = roomInfo;
|
||||||
|
[self.publicMessageView roomInfo:roomInfo];
|
||||||
|
}
|
||||||
|
|
||||||
- (void)tipBtnClick{
|
- (void)tipBtnClick{
|
||||||
KRepeatClickTime(1);
|
KRepeatClickTime(1);
|
||||||
@@ -1834,6 +1851,31 @@ static dispatch_once_t onceToken;
|
|||||||
|
|
||||||
@weakify(self);
|
@weakify(self);
|
||||||
/**发送消息*/
|
/**发送消息*/
|
||||||
|
[inputView setSendMsgBlock:^(NSString * _Nonnull message) {
|
||||||
|
DDMessageCustomRemoteExtModel *model = [[DDMessageCustomRemoteExtModel alloc] initMessageRemoteExtModelWithUserModel:self.userInfo];
|
||||||
|
NIMMessage *nimMessage = [[NIMMessage alloc] init];
|
||||||
|
nimMessage.text = message;
|
||||||
|
NSMutableDictionary *remoteExt = [NSMutableDictionary dictionaryWithObject:model.dd_modelDictionary forKey:[AccountInfoStorage instance].getUid];
|
||||||
|
|
||||||
|
// NIMAntiSpamOption *option = [[NIMAntiSpamOption alloc]init];
|
||||||
|
// option.yidunEnabled = YES;
|
||||||
|
// option.businessId = KeyWithType(keyType_YiDunBussinessId);
|
||||||
|
// message.antiSpamOption = option;
|
||||||
|
NSString * sessionId = [NSString stringWithFormat:@"%ld", self.roomInfo.roomId];
|
||||||
|
//构造会话
|
||||||
|
NIMSession *session = [NIMSession session:sessionId type:NIMSessionTypeChatroom];
|
||||||
|
[[NIMSDK sharedSDK].chatManager sendMessage:nimMessage toSession:session completion:^(NSError * _Nullable error) {
|
||||||
|
//
|
||||||
|
NSLog(@"发送消息成功:%@",error);
|
||||||
|
[self.publicMessageView.dataArr addObject:[RoomPublicScreenModel initMessage:message user:self.userInfo other_user:[RoomInfoModel new] giftModel:[DDGiftWallModel new] message_type:3 handle_type:0]];
|
||||||
|
// self.editTextFiled.text = @"";
|
||||||
|
// [self.editTextFiled resignFirstResponder];
|
||||||
|
// [self.atUids removeAllObjects];
|
||||||
|
// [self.atNames removeAllObjects];
|
||||||
|
// self.inputMessage = nil;
|
||||||
|
}];
|
||||||
|
}];
|
||||||
|
|
||||||
[inputView setSendMsgBlock:^(NSString * _Nonnull message) {
|
[inputView setSendMsgBlock:^(NSString * _Nonnull message) {
|
||||||
@strongify(self);
|
@strongify(self);
|
||||||
NSLog(@"[ToolsObject getUserModel].nobility_id -----%lu",[ToolsObject getUserModel].nobility_id);
|
NSLog(@"[ToolsObject getUserModel].nobility_id -----%lu",[ToolsObject getUserModel].nobility_id);
|
||||||
|
@@ -6,6 +6,8 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#import "WLBaseView.h"
|
#import "WLBaseView.h"
|
||||||
|
#import <NIMSDK/NIMSDK.h>
|
||||||
|
#import "RoomInfoModel.h"
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
@@ -14,6 +16,8 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
@property (nonatomic, strong) NSMutableArray *dataArr;
|
@property (nonatomic, strong) NSMutableArray *dataArr;
|
||||||
/**刷新公屏列表**/
|
/**刷新公屏列表**/
|
||||||
- (void)refreshTableView;
|
- (void)refreshTableView;
|
||||||
|
- (void)handleRecvMessages:(NIMMessage *)message;
|
||||||
|
- (void)roomInfo:(RoomInfoModel *)roomInfo;
|
||||||
/**点击**/
|
/**点击**/
|
||||||
@property (nonatomic, copy) void(^cellTapGesActionBlock)(RoomUserInfoModel *userModel);
|
@property (nonatomic, copy) void(^cellTapGesActionBlock)(RoomUserInfoModel *userModel);
|
||||||
@end
|
@end
|
||||||
|
@@ -11,10 +11,19 @@
|
|||||||
#import "RoomPublicScreenEmojiCell.h"
|
#import "RoomPublicScreenEmojiCell.h"
|
||||||
#import "RoomPublicScreenGiftCell.h"
|
#import "RoomPublicScreenGiftCell.h"
|
||||||
#import "RoomPublicScreenModel.h"
|
#import "RoomPublicScreenModel.h"
|
||||||
|
#import "DDClientConfig.h"
|
||||||
|
|
||||||
|
static NSInteger kRoomMessageMaxLength = 1000;
|
||||||
@interface RoomPublicMessageView () <UITableViewDelegate, UITableViewDataSource>
|
@interface RoomPublicMessageView () <UITableViewDelegate, UITableViewDataSource>
|
||||||
/**列表**/
|
/**列表**/
|
||||||
@property (nonatomic, strong) UITableView *tableView;
|
@property (nonatomic, strong) UITableView *tableView;
|
||||||
|
|
||||||
|
@property (nonatomic, strong) RoomInfoModel *roomInfo;
|
||||||
|
///数据源
|
||||||
|
//@property (nonatomic,strong) NSMutableArray<message *> *datasource;
|
||||||
|
|
||||||
|
///数据源
|
||||||
|
//@property (nonatomic,strong) NSMutableArray<XPMessageInfoModel *> *datasource;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation RoomPublicMessageView
|
@implementation RoomPublicMessageView
|
||||||
@@ -23,7 +32,7 @@
|
|||||||
if (self) {
|
if (self) {
|
||||||
|
|
||||||
[self initWithSubView];
|
[self initWithSubView];
|
||||||
|
|
||||||
|
|
||||||
} return self;
|
} return self;
|
||||||
}
|
}
|
||||||
@@ -51,6 +60,110 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)roomInfo:(RoomInfoModel *)roomInfo {
|
||||||
|
self.roomInfo = roomInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)handleRecvMessages:(NIMMessage *)message {
|
||||||
|
NIMNotificationObject *notiMsg = (NIMNotificationObject *)message.messageObject;
|
||||||
|
NIMChatroomNotificationContent *content = (NIMChatroomNotificationContent *)notiMsg.content;
|
||||||
|
if (content.eventType == NIMChatroomEventTypeEnter) {
|
||||||
|
NIMChatroomNotificationMember *member = content.targets[0];
|
||||||
|
if (member.userId.integerValue == [AccountInfoStorage instance].getUid.integerValue) {
|
||||||
|
|
||||||
|
[self handleFetchHistoryMessage:message];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (void)handleFetchHistoryMessage:(NIMMessage *)message {
|
||||||
|
NSString *roomId = [NSString stringWithFormat:@"%ld", self.roomInfo.roomId];
|
||||||
|
NIMHistoryMessageSearchOption *option = [[NIMHistoryMessageSearchOption alloc] init];
|
||||||
|
option.limit = [DDClientConfig shareConfig].configInfo.roomMessageCount;
|
||||||
|
option.startTime = self.roomInfo.clearScreenTime / 1000.0;
|
||||||
|
option.order = NIMMessageSearchOrderAsc;
|
||||||
|
option.messageTypes = @[@(NIMMessageTypeText)];
|
||||||
|
[[NIMSDK sharedSDK].chatroomManager fetchMessageHistory:roomId option:option result:^(NSError * _Nullable error, NSArray<NIMMessage *> * _Nullable messages) {
|
||||||
|
if (messages.count) {
|
||||||
|
//如果拉取的数量等于请求的数量,说明这个时间点以后的消息数量大于等于需要拉取的数量,直接拉取最新的50条
|
||||||
|
if (messages.count == [DDClientConfig shareConfig].configInfo.roomMessageCount) {
|
||||||
|
NIMHistoryMessageSearchOption *option = [[NIMHistoryMessageSearchOption alloc] init];
|
||||||
|
option.limit = [DDClientConfig shareConfig].configInfo.roomMessageCount;
|
||||||
|
option.order = NIMMessageSearchOrderDesc;
|
||||||
|
option.messageTypes = @[@(NIMMessageTypeText)];
|
||||||
|
[[NIMSDK sharedSDK].chatroomManager fetchMessageHistory:roomId option:option result:^(NSError * _Nullable error, NSArray<NIMMessage *> * _Nullable messages) {
|
||||||
|
if (self.dataArr.count > kRoomMessageMaxLength) {
|
||||||
|
NSIndexSet *set = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, kRoomMessageMaxLength/2)];
|
||||||
|
NSArray *needRemoveMsgArray = [self.dataArr objectsAtIndexes:set];
|
||||||
|
[self.dataArr removeObjectsInArray:needRemoveMsgArray];
|
||||||
|
}
|
||||||
|
// 执行插入
|
||||||
|
// for (NIMMessage *item in messages.reverseObjectEnumerator) {
|
||||||
|
// [self.dataArr addObject:[self.messageParser parseMessageAttribute:item]];
|
||||||
|
// if (!self.isMiniEnter) { /// 最小化进房的话 不需要重新保存
|
||||||
|
// if (self.roomInfo.isCloseScreen) {
|
||||||
|
// NIMCustomObject *obj = (NIMCustomObject *)item.messageObject;
|
||||||
|
// if (obj.attachment != nil && [obj.attachment isKindOfClass:[AttachmentModel class]]) {
|
||||||
|
// AttachmentModel *attachment = (AttachmentModel *)obj.attachment;
|
||||||
|
// if (attachment.first == CustomMessageType_Update_RoomInfo && attachment.second == Custom_Message_Sub_Update_RoomInfo_MessageState){
|
||||||
|
// [[XPRoomMiniManager shareManager] saveRoomMessage:item];
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// [[XPRoomMiniManager shareManager] saveRoomMessage:item];
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// [self.messageTableView reloadData];
|
||||||
|
// //执行插入动画并滚动
|
||||||
|
// [self scrollToBottom:YES];
|
||||||
|
// BOOL hideEnter = [self handleHideEnter:message];
|
||||||
|
// if (!hideEnter) {
|
||||||
|
// ///插入进房消息及房间公告提示
|
||||||
|
// [self addRoomMessage:message];
|
||||||
|
// }
|
||||||
|
// if (!roomInfo.hasAnimationEffect) {
|
||||||
|
// [self roomInfoNoGiftAnimationMessage:message];
|
||||||
|
// }
|
||||||
|
// [self createUserEnterRoomAddRoomtopicMessage];
|
||||||
|
}];
|
||||||
|
// return;
|
||||||
|
}
|
||||||
|
if (self.dataArr.count > kRoomMessageMaxLength) {
|
||||||
|
NSIndexSet *set = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, kRoomMessageMaxLength/2)];
|
||||||
|
NSArray *needRemoveMsgArray = [self.dataArr objectsAtIndexes:set];
|
||||||
|
[self.dataArr removeObjectsInArray:needRemoveMsgArray];
|
||||||
|
}
|
||||||
|
// 执行插入
|
||||||
|
for (NIMMessage *item in messages) {
|
||||||
|
// [RoomPublicScreenModel initMessage:<#(nonnull NSString *)#> user:<#(nonnull UserInfoModel *)#> other_user:<#(nonnull UserInfoModel *)#> giftModel:<#(nonnull DDGiftWallModel *)#> message_type:<#(NSInteger)#> handle_type:<#(NSInteger)#>]
|
||||||
|
// self.dataArr addObject:<#(nonnull id)#>
|
||||||
|
// [self.dataArr addObject:[self.messageParser parseMessageAttribute:item]];
|
||||||
|
// if (!self.isMiniEnter) {/// 最小化进房的话 不需要重新保存
|
||||||
|
// if (self.hostDelegate.getRoomInfo.isCloseScreen) {
|
||||||
|
// NIMCustomObject *obj = (NIMCustomObject *)item.messageObject;
|
||||||
|
// if (obj.attachment != nil && [obj.attachment isKindOfClass:[AttachmentModel class]]) {
|
||||||
|
// AttachmentModel *attachment = (AttachmentModel *)obj.attachment;
|
||||||
|
// if (attachment.first == CustomMessageType_Update_RoomInfo && attachment.second == Custom_Message_Sub_Update_RoomInfo_MessageState){
|
||||||
|
// [[XPRoomMiniManager shareManager] saveRoomMessage:item];
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// [[XPRoomMiniManager shareManager] saveRoomMessage:item];
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
// [self.messageTableView reloadData];
|
||||||
|
// //执行插入动画并滚动
|
||||||
|
// [self scrollToBottom:YES];
|
||||||
|
}
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
|
||||||
#pragma mark --- UITableViewDelegate || UITableViewDataSource ---
|
#pragma mark --- UITableViewDelegate || UITableViewDataSource ---
|
||||||
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
||||||
return 10;
|
return 10;
|
||||||
@@ -159,6 +272,36 @@
|
|||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
///追加数据源
|
||||||
|
//- (void)appendAndScrollToBottom {
|
||||||
|
// if (self.incomingMessages.count < 1) {
|
||||||
|
// ///滚动到底部(如果有人at自己后,income消息在点击at按钮处做了拼接处理,因为点击at按钮跳转到的是对应的at人消息,如果后面有其他消息时,点有更多按钮时需要滚动到最底部)
|
||||||
|
// [self scrollToBottom:YES];
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if (self.datasource.count > kRoomMessageMaxLength) {
|
||||||
|
// NSIndexSet *set = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, kRoomMessageMaxLength/2)];
|
||||||
|
// NSArray *needRemoveMsgArray = [self.datasource objectsAtIndexes:set];
|
||||||
|
// [self.datasource removeObjectsInArray:needRemoveMsgArray];
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // 执行插入
|
||||||
|
// NSMutableArray *indexPaths = [NSMutableArray array];
|
||||||
|
// for (NIMMessage *item in self.incomingMessages) {
|
||||||
|
// [self.datasource addObject:[self.messageParser parseMessageAttribute:item]];
|
||||||
|
// [indexPaths addObject:[NSIndexPath indexPathForRow:self.datasource.count - 1 inSection:0]];
|
||||||
|
// }
|
||||||
|
// [self.incomingMessages removeAllObjects];
|
||||||
|
// [self.messageTableView reloadData];
|
||||||
|
//
|
||||||
|
// //执行插入动画并滚动
|
||||||
|
// [self scrollToBottom:YES];
|
||||||
|
//}
|
||||||
|
|
||||||
|
|
||||||
#pragma mark ------ 懒加载 ------
|
#pragma mark ------ 懒加载 ------
|
||||||
- (UITableView *)tableView {
|
- (UITableView *)tableView {
|
||||||
if (!_tableView) {
|
if (!_tableView) {
|
||||||
|
@@ -0,0 +1,16 @@
|
|||||||
|
//
|
||||||
|
// XPRoomMessageContainerView.h
|
||||||
|
// DingDangApp
|
||||||
|
//
|
||||||
|
// Created by 触海 on 2023/12/14.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <UIKit/UIKit.h>
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
|
@interface XPRoomMessageContainerView : UIView
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,13 @@
|
|||||||
|
//
|
||||||
|
// XPRoomMessageContainerView.m
|
||||||
|
// DingDangApp
|
||||||
|
//
|
||||||
|
// Created by 触海 on 2023/12/14.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "XPRoomMessageContainerView.h"
|
||||||
|
|
||||||
|
@implementation XPRoomMessageContainerView
|
||||||
|
|
||||||
|
|
||||||
|
@end
|
@@ -8,6 +8,8 @@
|
|||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
#import "RoomUserInfoModel.h"
|
#import "RoomUserInfoModel.h"
|
||||||
#import "DDGiftWallModel.h"
|
#import "DDGiftWallModel.h"
|
||||||
|
#import "RoomInfoModel.h"
|
||||||
|
#import "UserInfoModel.h"
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
@@ -49,6 +51,39 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
/**背景高度**/
|
/**背景高度**/
|
||||||
@property (nonatomic, assign) CGFloat bgHeight;
|
@property (nonatomic, assign) CGFloat bgHeight;
|
||||||
|
|
||||||
|
|
||||||
|
///显示文本
|
||||||
|
@property (nonatomic,strong) NSAttributedString *content;
|
||||||
|
///cell的高度
|
||||||
|
@property (nonatomic,assign) CGFloat rowHeight;
|
||||||
|
///文本内容的
|
||||||
|
@property (nonatomic,assign) CGFloat contentLeftMargin;
|
||||||
|
///文本右边的间隙
|
||||||
|
@property (nonatomic,assign) CGFloat contentRightMargin;
|
||||||
|
///文本上面的间隙
|
||||||
|
@property (nonatomic,assign) CGFloat contentTopMargin;
|
||||||
|
///文本底部的间隙
|
||||||
|
@property (nonatomic,assign) CGFloat contentBottomMargin;
|
||||||
|
///底部的间隙
|
||||||
|
@property (nonatomic,assign) CGFloat cellBottomMargin;
|
||||||
|
///是否要隐藏背景
|
||||||
|
@property (nonatomic,assign) BOOL isHiddenBubble;
|
||||||
|
///是否改变内容的区域
|
||||||
|
@property (nonatomic,assign) BOOL isUpdateContentFrame;
|
||||||
|
///气泡url
|
||||||
|
@property (nonatomic, copy) NSString *bubbleImageUrl;
|
||||||
|
///是否展示头像
|
||||||
|
@property (nonatomic,assign) BOOL isShowAvatar;
|
||||||
|
///头像地址
|
||||||
|
@property (nonatomic,strong) NSString *avatarUrl;
|
||||||
|
///用户的uid
|
||||||
|
@property (nonatomic,strong) NSString *uid;
|
||||||
|
///是否是特权卡消息
|
||||||
|
@property(nonatomic,assign) BOOL isPrivilegeCard;
|
||||||
|
@property(nonatomic,copy) NSString *cardUrl;
|
||||||
|
///cell的高度
|
||||||
|
@property (nonatomic,assign) CGFloat cardHeight;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
若无对应内容,需初始化改对象
|
若无对应内容,需初始化改对象
|
||||||
msg:公屏富文本内容
|
msg:公屏富文本内容
|
||||||
@@ -58,7 +93,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
message_type:消息类型
|
message_type:消息类型
|
||||||
handle_type:
|
handle_type:
|
||||||
*/
|
*/
|
||||||
+ (RoomPublicScreenModel *)initMessage:(NSString *)msg user:(RoomUserInfoModel *)user other_user:(RoomUserInfoModel *)other_user giftModel:(DDGiftWallModel *)giftModel message_type:(NSInteger)message_type handle_type:(NSInteger)handle_type;
|
+ (RoomPublicScreenModel *)initMessage:(NSString *)msg user:(UserInfoModel *)user other_user:(UserInfoModel *)other_user giftModel:(DDGiftWallModel *)giftModel message_type:(NSInteger)message_type handle_type:(NSInteger)handle_type;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
@@ -7,9 +7,37 @@
|
|||||||
|
|
||||||
#import "RoomPublicScreenModel.h"
|
#import "RoomPublicScreenModel.h"
|
||||||
|
|
||||||
|
#define kRoomMessageMaxWidth (KScreenWidth - 15 - 90)
|
||||||
@implementation RoomPublicScreenModel
|
@implementation RoomPublicScreenModel
|
||||||
|
|
||||||
+ (RoomPublicScreenModel *)initMessage:(NSString *)msg user:(RoomUserInfoModel *)user other_user:(RoomUserInfoModel *)other_user giftModel:(DDGiftWallModel *)giftModel message_type:(NSInteger)message_type handle_type:(NSInteger)handle_type {
|
- (instancetype)init {
|
||||||
|
if ([super init]) {
|
||||||
|
self.contentLeftMargin = 12;
|
||||||
|
self.contentRightMargin = 0;
|
||||||
|
self.contentTopMargin = 10;
|
||||||
|
self.contentBottomMargin = 10;
|
||||||
|
self.cellBottomMargin = 10;
|
||||||
|
self.isUpdateContentFrame = NO;
|
||||||
|
self.isHiddenBubble = NO;
|
||||||
|
}
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)setContent:(NSAttributedString *)content {
|
||||||
|
_content = content;
|
||||||
|
CGSize maxSize = CGSizeMake(kRoomMessageMaxWidth - self.contentLeftMargin - self.contentRightMargin - 12, MAXFLOAT);
|
||||||
|
YYTextContainer *container = [YYTextContainer containerWithSize:maxSize];
|
||||||
|
container.maximumNumberOfRows = 0;
|
||||||
|
YYTextLayout *layout = [YYTextLayout layoutWithContainer:container text:self.content];
|
||||||
|
if (self.isShowAvatar) {
|
||||||
|
self.rowHeight = layout.textBoundingSize.height + self.cellBottomMargin;
|
||||||
|
} else {
|
||||||
|
self.rowHeight = layout.textBoundingSize.height + self.cellBottomMargin + self.contentTopMargin + self.contentBottomMargin;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
+ (RoomPublicScreenModel *)initMessage:(NSString *)msg user:(UserInfoModel *)user other_user:(UserInfoModel *)other_user giftModel:(DDGiftWallModel *)giftModel message_type:(NSInteger)message_type handle_type:(NSInteger)handle_type {
|
||||||
RoomPublicScreenModel *model = [[RoomPublicScreenModel alloc] init];
|
RoomPublicScreenModel *model = [[RoomPublicScreenModel alloc] init];
|
||||||
model.msg = msg;
|
model.msg = msg;
|
||||||
model.user = user;
|
model.user = user;
|
||||||
@@ -18,7 +46,7 @@
|
|||||||
model.msg_type = message_type;
|
model.msg_type = message_type;
|
||||||
model.handle_type = handle_type;
|
model.handle_type = handle_type;
|
||||||
if (model.msg_type == 1) {//欢迎消息
|
if (model.msg_type == 1) {//欢迎消息
|
||||||
NSString *messageStr = [NSString stringWithFormat:@"欢迎%@ 进入本房间",user.nickname];
|
NSString *messageStr = [NSString stringWithFormat:@"欢迎%@ 进入本房间",user.nick];
|
||||||
//文本宽高
|
//文本宽高
|
||||||
CGSize msgSize = [self sizeWithText:messageStr andFont:[UIFont systemFontOfSize:14] maxSize:CGSizeMake(kWidth - KAdaptedWidth(125), CGFLOAT_MAX) andlineSpacing:3];
|
CGSize msgSize = [self sizeWithText:messageStr andFont:[UIFont systemFontOfSize:14] maxSize:CGSizeMake(kWidth - KAdaptedWidth(125), CGFLOAT_MAX) andlineSpacing:3];
|
||||||
//cell高度
|
//cell高度
|
||||||
@@ -40,7 +68,7 @@
|
|||||||
[attributedStr addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, attributedStr.length)];
|
[attributedStr addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, attributedStr.length)];
|
||||||
[attributedStr addAttribute:NSForegroundColorAttributeName value:[UIColor jk_colorWithHexString:@"#FFFFFF"] range:NSMakeRange(0, attributedStr.length)];
|
[attributedStr addAttribute:NSForegroundColorAttributeName value:[UIColor jk_colorWithHexString:@"#FFFFFF"] range:NSMakeRange(0, attributedStr.length)];
|
||||||
|
|
||||||
NSRange range1 = [[attributedStr string] rangeOfString:user.nickname];
|
NSRange range1 = [[attributedStr string] rangeOfString:user.nick];
|
||||||
[attributedStr addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:14] range:range1];
|
[attributedStr addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:14] range:range1];
|
||||||
[attributedStr addAttribute:NSForegroundColorAttributeName value:[UIColor jk_colorWithHexString:@"#80AFF5"] range:range1];
|
[attributedStr addAttribute:NSForegroundColorAttributeName value:[UIColor jk_colorWithHexString:@"#80AFF5"] range:range1];
|
||||||
|
|
||||||
@@ -50,15 +78,15 @@
|
|||||||
if (model.msg_type == 2) {//1踢出房间2禁言3禁麦4跟随5一键送背包
|
if (model.msg_type == 2) {//1踢出房间2禁言3禁麦4跟随5一键送背包
|
||||||
NSString *messageStr = @"";
|
NSString *messageStr = @"";
|
||||||
if (handle_type == 1) {
|
if (handle_type == 1) {
|
||||||
messageStr = [NSString stringWithFormat:@"%@ 已被%@ 踢出房间",other_user.nickname,user.nickname];
|
messageStr = [NSString stringWithFormat:@"%@ 已被%@ 踢出房间",other_user.nick,user.nick];
|
||||||
} else if (handle_type == 2) {
|
} else if (handle_type == 2) {
|
||||||
messageStr = [NSString stringWithFormat:@"您已被%@禁言",user.nickname];
|
messageStr = [NSString stringWithFormat:@"您已被%@禁言",user.nick];
|
||||||
} else if (handle_type == 3) {
|
} else if (handle_type == 3) {
|
||||||
messageStr = [NSString stringWithFormat:@"您已被%@禁麦",user.nickname];
|
messageStr = [NSString stringWithFormat:@"您已被%@禁麦",user.nick];
|
||||||
} else if (handle_type == 4) {
|
} else if (handle_type == 4) {
|
||||||
messageStr = [NSString stringWithFormat:@"%@跟随%@进入本房间",other_user.nickname,user.nickname];
|
messageStr = [NSString stringWithFormat:@"%@跟随%@进入本房间",other_user.nick,user.nick];
|
||||||
} else if (handle_type == 5) {
|
} else if (handle_type == 5) {
|
||||||
messageStr = [NSString stringWithFormat:@"%@一键赠送给 %@%@",user.nickname,other_user.nickname,msg];
|
messageStr = [NSString stringWithFormat:@"%@一键赠送给 %@%@",user.nick,other_user.nick,msg];
|
||||||
}
|
}
|
||||||
|
|
||||||
//文本宽高
|
//文本宽高
|
||||||
@@ -82,11 +110,11 @@
|
|||||||
[attributedStr addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, attributedStr.length)];
|
[attributedStr addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, attributedStr.length)];
|
||||||
[attributedStr addAttribute:NSForegroundColorAttributeName value:[UIColor jk_colorWithHexString:@"#FFFFFF"] range:NSMakeRange(0, attributedStr.length)];
|
[attributedStr addAttribute:NSForegroundColorAttributeName value:[UIColor jk_colorWithHexString:@"#FFFFFF"] range:NSMakeRange(0, attributedStr.length)];
|
||||||
|
|
||||||
NSRange range1 = [[attributedStr string] rangeOfString:user.nickname ?: @""];
|
NSRange range1 = [[attributedStr string] rangeOfString:user.nick ?: @""];
|
||||||
[attributedStr addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:14] range:range1];
|
[attributedStr addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:14] range:range1];
|
||||||
[attributedStr addAttribute:NSForegroundColorAttributeName value:[UIColor jk_colorWithHexString:@"#80AFF5"] range:range1];
|
[attributedStr addAttribute:NSForegroundColorAttributeName value:[UIColor jk_colorWithHexString:@"#80AFF5"] range:range1];
|
||||||
|
|
||||||
NSRange range2 = [[attributedStr string] rangeOfString:other_user.nickname ?: @""];
|
NSRange range2 = [[attributedStr string] rangeOfString:other_user.nick ?: @""];
|
||||||
[attributedStr addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:14] range:range2];
|
[attributedStr addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:14] range:range2];
|
||||||
[attributedStr addAttribute:NSForegroundColorAttributeName value:[UIColor jk_colorWithHexString:@"#80AFF5"] range:range2];
|
[attributedStr addAttribute:NSForegroundColorAttributeName value:[UIColor jk_colorWithHexString:@"#80AFF5"] range:range2];
|
||||||
|
|
||||||
@@ -120,7 +148,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (model.msg_type == 4) {//送礼物消息
|
if (model.msg_type == 4) {//送礼物消息
|
||||||
NSString *messageStr = [NSString stringWithFormat:@"%@赠送给%@",user.nickname ?: @"无名氏",other_user.nickname ?: @"无名氏"];
|
NSString *messageStr = [NSString stringWithFormat:@"%@赠送给%@",user.nick ?: @"无名氏",other_user.nick ?: @"无名氏"];
|
||||||
//消息文本宽高
|
//消息文本宽高
|
||||||
CGSize msgSize = [self sizeWithText:messageStr andFont:[UIFont systemFontOfSize:14] maxSize:CGSizeMake(KAdaptedWidth(182), CGFLOAT_MAX) andlineSpacing:3];
|
CGSize msgSize = [self sizeWithText:messageStr andFont:[UIFont systemFontOfSize:14] maxSize:CGSizeMake(KAdaptedWidth(182), CGFLOAT_MAX) andlineSpacing:3];
|
||||||
//cell高度
|
//cell高度
|
||||||
@@ -149,11 +177,11 @@
|
|||||||
[attributedStr addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, attributedStr.length)];
|
[attributedStr addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, attributedStr.length)];
|
||||||
[attributedStr addAttribute:NSForegroundColorAttributeName value:[UIColor jk_colorWithHexString:@"FFFFFF"] range:NSMakeRange(0, attributedStr.length)];
|
[attributedStr addAttribute:NSForegroundColorAttributeName value:[UIColor jk_colorWithHexString:@"FFFFFF"] range:NSMakeRange(0, attributedStr.length)];
|
||||||
|
|
||||||
NSRange range1 = [[attributedStr string] rangeOfString:other_user.nickname ?: @"无名氏"];
|
NSRange range1 = [[attributedStr string] rangeOfString:other_user.nick ?: @"无名氏"];
|
||||||
[attributedStr addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:14] range:range1];
|
[attributedStr addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:14] range:range1];
|
||||||
[attributedStr addAttribute:NSForegroundColorAttributeName value:[UIColor jk_colorWithHexString:@"#80AFF5"] range:range1];
|
[attributedStr addAttribute:NSForegroundColorAttributeName value:[UIColor jk_colorWithHexString:@"#80AFF5"] range:range1];
|
||||||
|
|
||||||
NSRange range2 = [[attributedStr string] rangeOfString:user.nickname ?: @"无名氏"];
|
NSRange range2 = [[attributedStr string] rangeOfString:user.nick ?: @"无名氏"];
|
||||||
[attributedStr addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:14] range:range2];
|
[attributedStr addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:14] range:range2];
|
||||||
[attributedStr addAttribute:NSForegroundColorAttributeName value:[UIColor jk_colorWithHexString:@"#80AFF5"] range:range2];
|
[attributedStr addAttribute:NSForegroundColorAttributeName value:[UIColor jk_colorWithHexString:@"#80AFF5"] range:range2];
|
||||||
|
|
||||||
@@ -197,7 +225,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (model.msg_type == 7) {//警告
|
if (model.msg_type == 7) {//警告
|
||||||
NSString *messageStr = [NSString stringWithFormat:@"%@已收到您的警告信息",user.nickname ?: @"无名氏"];
|
NSString *messageStr = [NSString stringWithFormat:@"%@已收到您的警告信息",user.nick ?: @"无名氏"];
|
||||||
//文本宽高
|
//文本宽高
|
||||||
CGSize msgSize = [self sizeWithText:messageStr andFont:[UIFont systemFontOfSize:14] maxSize:CGSizeMake(kWidth - KAdaptedWidth(125), CGFLOAT_MAX) andlineSpacing:3];
|
CGSize msgSize = [self sizeWithText:messageStr andFont:[UIFont systemFontOfSize:14] maxSize:CGSizeMake(kWidth - KAdaptedWidth(125), CGFLOAT_MAX) andlineSpacing:3];
|
||||||
//cell高度
|
//cell高度
|
||||||
@@ -219,7 +247,7 @@
|
|||||||
[attributedStr addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, attributedStr.length)];
|
[attributedStr addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, attributedStr.length)];
|
||||||
[attributedStr addAttribute:NSForegroundColorAttributeName value:[UIColor jk_colorWithHexString:@"#FFFFFF"] range:NSMakeRange(0, attributedStr.length)];
|
[attributedStr addAttribute:NSForegroundColorAttributeName value:[UIColor jk_colorWithHexString:@"#FFFFFF"] range:NSMakeRange(0, attributedStr.length)];
|
||||||
|
|
||||||
NSRange range1 = [[attributedStr string] rangeOfString:user.nickname ?: @"无名氏"];
|
NSRange range1 = [[attributedStr string] rangeOfString:user.nick ?: @"无名氏"];
|
||||||
[attributedStr addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:14] range:range1];
|
[attributedStr addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:14] range:range1];
|
||||||
[attributedStr addAttribute:NSForegroundColorAttributeName value:[UIColor jk_colorWithHexString:@"#80AFF5"] range:range1];
|
[attributedStr addAttribute:NSForegroundColorAttributeName value:[UIColor jk_colorWithHexString:@"#80AFF5"] range:range1];
|
||||||
|
|
||||||
@@ -227,7 +255,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (model.msg_type == 8) {//抽奖礼物礼物消息
|
if (model.msg_type == 8) {//抽奖礼物礼物消息
|
||||||
NSString *messageStr = [NSString stringWithFormat:@"%@抽中%@",user.nickname ?: @"无名氏",giftModel.title ?: @""];
|
NSString *messageStr = [NSString stringWithFormat:@"%@抽中%@",user.nick ?: @"无名氏",giftModel.title ?: @""];
|
||||||
//消息文本宽高
|
//消息文本宽高
|
||||||
CGSize msgSize = [self sizeWithText:messageStr andFont:[UIFont systemFontOfSize:14] maxSize:CGSizeMake(KAdaptedWidth(182), CGFLOAT_MAX) andlineSpacing:3];
|
CGSize msgSize = [self sizeWithText:messageStr andFont:[UIFont systemFontOfSize:14] maxSize:CGSizeMake(KAdaptedWidth(182), CGFLOAT_MAX) andlineSpacing:3];
|
||||||
//cell高度
|
//cell高度
|
||||||
@@ -256,11 +284,11 @@
|
|||||||
[attributedStr addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, attributedStr.length)];
|
[attributedStr addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, attributedStr.length)];
|
||||||
[attributedStr addAttribute:NSForegroundColorAttributeName value:[UIColor jk_colorWithHexString:@"#FFFFFF"] range:NSMakeRange(0, attributedStr.length)];
|
[attributedStr addAttribute:NSForegroundColorAttributeName value:[UIColor jk_colorWithHexString:@"#FFFFFF"] range:NSMakeRange(0, attributedStr.length)];
|
||||||
|
|
||||||
NSRange range1 = [[attributedStr string] rangeOfString:other_user.nickname ?: @"无名氏"];
|
NSRange range1 = [[attributedStr string] rangeOfString:other_user.nick ?: @"无名氏"];
|
||||||
[attributedStr addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:14] range:range1];
|
[attributedStr addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:14] range:range1];
|
||||||
[attributedStr addAttribute:NSForegroundColorAttributeName value:[UIColor jk_colorWithHexString:@"#97F0FC"] range:range1];
|
[attributedStr addAttribute:NSForegroundColorAttributeName value:[UIColor jk_colorWithHexString:@"#97F0FC"] range:range1];
|
||||||
|
|
||||||
NSRange range2 = [[attributedStr string] rangeOfString:user.nickname ?: @"无名氏"];
|
NSRange range2 = [[attributedStr string] rangeOfString:user.nick ?: @"无名氏"];
|
||||||
[attributedStr addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:14] range:range2];
|
[attributedStr addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:14] range:range2];
|
||||||
[attributedStr addAttribute:NSForegroundColorAttributeName value:[UIColor jk_colorWithHexString:@"#97F0FC"] range:range2];
|
[attributedStr addAttribute:NSForegroundColorAttributeName value:[UIColor jk_colorWithHexString:@"#97F0FC"] range:range2];
|
||||||
|
|
||||||
|
@@ -0,0 +1,15 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
|
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="19206" systemVersion="20G95" minimumToolsVersion="Automatic" sourceLanguage="Objective-C" userDefinedModelVersionIdentifier="">
|
||||||
|
<entity name="Music" representedClassName="Music" syncable="YES">
|
||||||
|
<attribute name="author" optional="YES" attributeType="String"/>
|
||||||
|
<attribute name="filePath" optional="YES" attributeType="String"/>
|
||||||
|
<attribute name="musicArtists" optional="YES" attributeType="String"/>
|
||||||
|
<attribute name="musicId" optional="YES" attributeType="String"/>
|
||||||
|
<attribute name="musicName" optional="YES" attributeType="String"/>
|
||||||
|
<attribute name="songAlbum" optional="YES" attributeType="Binary"/>
|
||||||
|
<attribute name="songName" optional="YES" attributeType="String"/>
|
||||||
|
</entity>
|
||||||
|
<elements>
|
||||||
|
<element name="Music" positionX="-63" positionY="-18" width="128" height="134"/>
|
||||||
|
</elements>
|
||||||
|
</model>
|
Reference in New Issue
Block a user