公聊大厅

This commit is contained in:
liyuhua
2024-05-07 19:40:21 +08:00
parent 3be0f8bc74
commit ace27b7e91
40 changed files with 1508 additions and 85 deletions

View File

@@ -212,6 +212,11 @@
234489092AC3C5FF0070E5D5 /* SudMGP.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 234489072AC3C5DA0070E5D5 /* SudMGP.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
234D821E2AEC57CF0022EFEB /* YYTextAsyncLayer+PITextAsyncLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 234D821D2AEC57CF0022EFEB /* YYTextAsyncLayer+PITextAsyncLayer.m */; };
234F44E32B3EA4F900E2B532 /* PILineManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 234F44E22B3EA4F900E2B532 /* PILineManager.swift */; };
2357145A2BE8BC6C004C81D6 /* MSSessionPublicChatHallVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 235714592BE8BC6C004C81D6 /* MSSessionPublicChatHallVC.m */; };
235714602BE8BD5C004C81D6 /* MSSessionScrollingModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 2357145F2BE8BD5C004C81D6 /* MSSessionScrollingModel.m */; };
235714642BE8BEA0004C81D6 /* CALayer+Animation.m in Sources */ = {isa = PBXBuildFile; fileRef = 235714632BE8BEA0004C81D6 /* CALayer+Animation.m */; };
235714672BE8C009004C81D6 /* MSSessionScrollingView.m in Sources */ = {isa = PBXBuildFile; fileRef = 235714662BE8C009004C81D6 /* MSSessionScrollingView.m */; };
2357146B2BEA0110004C81D6 /* MSSessionPublicChatHallTopModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 2357146A2BEA0110004C81D6 /* MSSessionPublicChatHallTopModel.m */; };
235A451A2B04A352009753F5 /* PIRoomActivityWebView.m in Sources */ = {isa = PBXBuildFile; fileRef = 235A45192B04A352009753F5 /* PIRoomActivityWebView.m */; };
235A451D2B04A452009753F5 /* PIRoomActivityWebCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 235A451C2B04A452009753F5 /* PIRoomActivityWebCell.m */; };
235A45232B04BEB6009753F5 /* PIBaseModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 235A45222B04BEB6009753F5 /* PIBaseModel.m */; };
@@ -1924,6 +1929,17 @@
234D821C2AEC57CF0022EFEB /* YYTextAsyncLayer+PITextAsyncLayer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "YYTextAsyncLayer+PITextAsyncLayer.h"; path = "YuMi/Appdelegate/YYTextAsyncLayer+PITextAsyncLayer.h"; sourceTree = SOURCE_ROOT; };
234D821D2AEC57CF0022EFEB /* YYTextAsyncLayer+PITextAsyncLayer.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = "YYTextAsyncLayer+PITextAsyncLayer.m"; path = "YuMi/Appdelegate/YYTextAsyncLayer+PITextAsyncLayer.m"; sourceTree = SOURCE_ROOT; };
234F44E22B3EA4F900E2B532 /* PILineManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PILineManager.swift; sourceTree = "<group>"; };
235714582BE8BC6C004C81D6 /* MSSessionPublicChatHallVC.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MSSessionPublicChatHallVC.h; sourceTree = "<group>"; };
235714592BE8BC6C004C81D6 /* MSSessionPublicChatHallVC.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MSSessionPublicChatHallVC.m; sourceTree = "<group>"; };
2357145E2BE8BD5C004C81D6 /* MSSessionScrollingModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MSSessionScrollingModel.h; sourceTree = "<group>"; };
2357145F2BE8BD5C004C81D6 /* MSSessionScrollingModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MSSessionScrollingModel.m; sourceTree = "<group>"; };
235714622BE8BEA0004C81D6 /* CALayer+Animation.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "CALayer+Animation.h"; sourceTree = "<group>"; };
235714632BE8BEA0004C81D6 /* CALayer+Animation.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "CALayer+Animation.m"; sourceTree = "<group>"; };
235714652BE8C009004C81D6 /* MSSessionScrollingView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MSSessionScrollingView.h; sourceTree = "<group>"; };
235714662BE8C009004C81D6 /* MSSessionScrollingView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MSSessionScrollingView.m; sourceTree = "<group>"; };
235714682BE8C055004C81D6 /* MSSessionScrollingProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MSSessionScrollingProtocol.h; sourceTree = "<group>"; };
235714692BEA0110004C81D6 /* MSSessionPublicChatHallTopModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MSSessionPublicChatHallTopModel.h; sourceTree = "<group>"; };
2357146A2BEA0110004C81D6 /* MSSessionPublicChatHallTopModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MSSessionPublicChatHallTopModel.m; sourceTree = "<group>"; };
235A45182B04A352009753F5 /* PIRoomActivityWebView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PIRoomActivityWebView.h; sourceTree = "<group>"; };
235A45192B04A352009753F5 /* PIRoomActivityWebView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PIRoomActivityWebView.m; sourceTree = "<group>"; };
235A451B2B04A452009753F5 /* PIRoomActivityWebCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PIRoomActivityWebCell.h; sourceTree = "<group>"; };
@@ -4922,6 +4938,7 @@
189DD5A726DFA09700AB55B1 /* Tools */ = {
isa = PBXGroup;
children = (
235714612BE8BE88004C81D6 /* CALayer */,
234F44E12B3EA4DC00E2B532 /* YMLine */,
23CEFC082AFB8FC100576D89 /* sdkContent */,
23FF255C2ABA8EEE0064E904 /* PIIAPTool */,
@@ -5113,6 +5130,10 @@
18F404BA2760982000A6C548 /* ChatLimitModel.m */,
E885D5342977CE28004DC088 /* SessionSettingModel.h */,
E885D5352977CE28004DC088 /* SessionSettingModel.m */,
2357145E2BE8BD5C004C81D6 /* MSSessionScrollingModel.h */,
2357145F2BE8BD5C004C81D6 /* MSSessionScrollingModel.m */,
235714692BEA0110004C81D6 /* MSSessionPublicChatHallTopModel.h */,
2357146A2BEA0110004C81D6 /* MSSessionPublicChatHallTopModel.m */,
);
path = Model;
sourceTree = "<group>";
@@ -5160,6 +5181,7 @@
isa = PBXGroup;
children = (
18F404C6276099DF00A6C548 /* MessageProtocol.h */,
235714682BE8C055004C81D6 /* MSSessionScrollingProtocol.h */,
);
path = Protocol;
sourceTree = "<group>";
@@ -5524,6 +5546,15 @@
path = YMLine;
sourceTree = "<group>";
};
235714612BE8BE88004C81D6 /* CALayer */ = {
isa = PBXGroup;
children = (
235714622BE8BEA0004C81D6 /* CALayer+Animation.h */,
235714632BE8BEA0004C81D6 /* CALayer+Animation.m */,
);
path = CALayer;
sourceTree = "<group>";
};
236B2E1B2AA0786E003967A8 /* Library */ = {
isa = PBXGroup;
children = (
@@ -6400,6 +6431,8 @@
23FF256C2ABC48810064E904 /* XPSessionMainViewController.m */,
9B7D80482753783D003DAC0C /* SessionViewController.h */,
9B7D80492753783D003DAC0C /* SessionViewController.m */,
235714582BE8BC6C004C81D6 /* MSSessionPublicChatHallVC.h */,
235714592BE8BC6C004C81D6 /* MSSessionPublicChatHallVC.m */,
E8E20BD9281645300033B688 /* SessionInfoViewController.h */,
E8E20BDA281645300033B688 /* SessionInfoViewController.m */,
E86E79D428A4EA0C006DAF48 /* SessionRiskCache.h */,
@@ -9486,6 +9519,8 @@
E88E4A7F297673DC00019A50 /* SessionNavLiveView.m */,
E885D5372977D10E004DC088 /* SessionSettingUserView.h */,
E885D5382977D10E004DC088 /* SessionSettingUserView.m */,
235714652BE8C009004C81D6 /* MSSessionScrollingView.h */,
235714662BE8C009004C81D6 /* MSSessionScrollingView.m */,
);
path = View;
sourceTree = "<group>";
@@ -11587,6 +11622,7 @@
E85E7B372A4EB0D300B6D00A /* XPMineGuildListCell.m in Sources */,
E85E7B502A4EB0D300B6D00A /* XPMineGuildListVC.m in Sources */,
E824546126F5F4E400BE8163 /* XPMineResetPayPwdViewController.m in Sources */,
2357146B2BEA0110004C81D6 /* MSSessionPublicChatHallTopModel.m in Sources */,
E81D58822720082A003063FE /* MicroWaveView.m in Sources */,
E8A73F8728586A6F00FD9CBC /* XPGiftWeekStarCollectionViewCell.m in Sources */,
E80E09B62A42078F00CD2BE7 /* XPRoomStarKitchenModel.m in Sources */,
@@ -11792,6 +11828,7 @@
23FF256E2ABC48810064E904 /* XPSessionMainViewController.m in Sources */,
E85E7B092A4EB0D200B6D00A /* XPGuildRemoveMemberPresenter.m in Sources */,
E8950186282CAC80007E459A /* XPMonentsTooBarView.m in Sources */,
2357145A2BE8BC6C004C81D6 /* MSSessionPublicChatHallVC.m in Sources */,
E86507E5281A7D4D006951B0 /* MessageContentTweetView.m in Sources */,
E824544B26F5BBB800BE8163 /* XPMineModifPayPwdViewController.m in Sources */,
E81C1B2227705F950020D1E4 /* Api+ArrangeMic.m in Sources */,
@@ -11893,6 +11930,7 @@
23CEFC5F2AFB8FC100576D89 /* BSLogTableViewController.m in Sources */,
236B2E4D2AA07D06003967A8 /* XPRoomLittleGameContainerView.m in Sources */,
E87AE8C1284E184300CAFBB3 /* RoomNewUserGreetModel.m in Sources */,
235714602BE8BD5C004C81D6 /* MSSessionScrollingModel.m in Sources */,
9BC5C91C277C8A7B007C8719 /* XPReleaseRadioViewController.m in Sources */,
23B2AEC42A6516C200543D17 /* LoginForgetPasswordViewController.m in Sources */,
186A534C26FC6ED900D67B2C /* TTAlertView.m in Sources */,
@@ -11971,6 +12009,7 @@
238B37C92AC55A2C00BFC9D5 /* XPTreasureFairyStoreResultSmallView.m in Sources */,
E8C1CD7027D894B800376F83 /* RoomFaceTitleItemModel.m in Sources */,
E85E7B4B2A4EB0D300B6D00A /* XPMineGuildManagerSetViewController.m in Sources */,
235714642BE8BEA0004C81D6 /* CALayer+Animation.m in Sources */,
189DD73D26E21C3F00AB55B1 /* YYUtility+Device.m in Sources */,
187EEEDC26E89B32002833B2 /* BaseModel.m in Sources */,
23CEFC682AFCCE7700576D89 /* PIGiftInfoSegmentedView.m in Sources */,
@@ -12017,6 +12056,7 @@
238B37B02AC55A2C00BFC9D5 /* XPTreasureFairyStoreResultCell.m in Sources */,
E8AEAEED27141AE20017FCE0 /* XPRoomBackContainerView.m in Sources */,
E88B5CC126FB407B00DA9178 /* XPMineUserInfoViewController.m in Sources */,
235714672BE8C009004C81D6 /* MSSessionScrollingView.m in Sources */,
2331C1AC2A60F32D00E1D940 /* CandyTreeRecordModel.m in Sources */,
E81E09CF290F750800A1F410 /* AdvertiseModel.m in Sources */,
2305F3472AD94E9D00AD403C /* XPMaskManagerCell.m in Sources */,

View File

@@ -92,6 +92,7 @@
model.appStoreAuditNoticeVersion = isHigh;
self.configInfo = model;
[[NSNotificationCenter defaultCenter] postNotificationName:@"reloadnewtab" object:nil];
} else {
if (self.retryCount < 10) {
[self clientInit];

View File

@@ -39,6 +39,7 @@ typedef NS_ENUM(NSInteger, FaceLivenessStrategy) {
@property (nonatomic, strong) NSArray<NSString *> *officialMsgUids;
///官方账号 小秘书 红包消息
@property (nonatomic,strong) NSArray<NSString *> *officialAccountUids;
@property(nonatomic,copy) NSDictionary *publicChatRoomIdMap;
///星座礼物顶部是否开启
@property (nonatomic,assign) BOOL twelveStarSwitch;
/// 开房是否需要实名

View File

@@ -16,4 +16,5 @@
}
}
@end

View File

@@ -14,6 +14,12 @@ NS_ASSUME_NONNULL_BEGIN
+ (void)getChatLimit:(HttpRequestHelperCompletion)complection receiverUid:(NSString *)receiverUid ;
///获取私聊限制接口
+(void)getPrivateChatCheck:(HttpRequestHelperCompletion)complection content:(NSString *)content toUid:(NSString *)toUid;
///聊天室发送头条
+(void)sendPublicChatHallTopText:(HttpRequestHelperCompletion)complection content:(NSString *)content;
///获取聊天室头条
+(void)getPublicChatHallTopText:(HttpRequestHelperCompletion)complection;
///获取聊天室数据
+(void)getPublicChatHallList:(HttpRequestHelperCompletion)complection;
@end
NS_ASSUME_NONNULL_END

View File

@@ -17,4 +17,16 @@
+(void)getPrivateChatCheck:(HttpRequestHelperCompletion)complection content:(NSString *)content toUid:(NSString *)toUid{
[self makeRequest:@"privateChat/check" method:HttpRequestHelperMethodGET completion:complection, __FUNCTION__, content,toUid,nil];
}
///
+(void)sendPublicChatHallTopText:(HttpRequestHelperCompletion)complection content:(NSString *)content{
[self makeRequest:@"publicChatTopRecord/send" method:HttpRequestHelperMethodPOST completion:complection, __FUNCTION__, content,nil];
}
///
+(void)getPublicChatHallTopText:(HttpRequestHelperCompletion)complection{
[self makeRequest:@"publicChatTopRecord/send" method:HttpRequestHelperMethodGET completion:complection, __FUNCTION__, nil];
}
///
+(void)getPublicChatHallList:(HttpRequestHelperCompletion)complection{
[self makeRequest:@"publicChatTopRecord/getChatForTop50" method:HttpRequestHelperMethodGET completion:complection, __FUNCTION__, nil];
}
@end

View File

@@ -0,0 +1,20 @@
//
// MSSessionPublicChatHallTopModel.h
// YuMi
//
// Created by duoban on 2024/5/7.
//
#import "PIBaseModel.h"
NS_ASSUME_NONNULL_BEGIN
@interface MSSessionPublicChatHallTopModel : PIBaseModel
@property(nonatomic,copy) NSString *uid;
@property(nonatomic,copy) NSString *content;
@property(nonatomic,assign) BOOL isTop;
@property(nonatomic,copy) NSString *partitionId;
@property(nonatomic,assign) NSString *recordStatus;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,12 @@
//
// MSSessionPublicChatHallTopModel.m
// YuMi
//
// Created by duoban on 2024/5/7.
//
#import "MSSessionPublicChatHallTopModel.h"
@implementation MSSessionPublicChatHallTopModel
@end

View File

@@ -0,0 +1,26 @@
//
// MSSessionScrollingModel.h
// YuMi
//
// Created by duoban on 2024/5/6.
//
#import "PIBaseModel.h"
#import "MSSessionScrollingProtocol.h"
NS_ASSUME_NONNULL_BEGIN
@interface MSSessionScrollingModel : PIBaseModel<MSSessionScrollingProtocol>
@property (nonatomic,assign)NSTimeInterval beginTime;
@property (nonatomic,assign)NSTimeInterval endTime;
@property (nonatomic,copy)NSString *content;
@property (nonatomic,copy)NSString *fromAvatar;
@property(nonatomic,copy) NSString *fromNick;
@property(nonatomic,copy) NSString *fromUid;
@property (nonatomic,copy)NSString *gender;
@property(nonatomic,copy) NSString *partitionId;
@property (nonatomic,copy)NSString *toAvatar;
@property(nonatomic,copy) NSString *toNick;
@property(nonatomic,copy) NSString *toUid;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,12 @@
//
// MSSessionScrollingModel.m
// YuMi
//
// Created by duoban on 2024/5/6.
//
#import "MSSessionScrollingModel.h"
@implementation MSSessionScrollingModel
@end

View File

@@ -6,7 +6,7 @@
//
#import "BaseMvpPresenter.h"
#import "UserInfoModel.h"
NS_ASSUME_NONNULL_BEGIN
@interface MessagePresenter : BaseMvpPresenter
@@ -24,7 +24,16 @@ NS_ASSUME_NONNULL_BEGIN
// 获取用户信息
- (void)getUserInfoWithUid:(NSString *)uid;
///进入聊天室
- (void)enterNIMRoom:(NSString *)roomId user:(UserInfoModel *)userInfo;
///退出聊天室
- (void)exitNIMRoom:(NSString *)roomId;
///聊天室发送头条
-(void)sendPublicChatHallTopTextWithcontent:(NSString *)content;
///获取聊天室发送头条
-(void)getPublicChatHallTopText;
///获取聊天室数据
-(void)getPublicChatHallList;
@end
NS_ASSUME_NONNULL_END

View File

@@ -13,6 +13,7 @@
#import "UserInfoModel.h"
#import "AccountInfoStorage.h"
#import "NIMMessageUtils.h"
#import "XPMessageRemoteExtModel.h"
@implementation MessagePresenter
@@ -61,5 +62,65 @@
[[self getView] attentionUserSuccess:targetUid];
} showLoading:YES] uid:uid likedUid:targetUid ticket:ticket type:type];
}
- (void)enterNIMRoom:(NSString *)roomId user:(UserInfoModel *)userInfo {
NIMChatroomEnterRequest *request = [[NIMChatroomEnterRequest alloc] init];
request.roomId = roomId;
//ext
XPMessageRemoteExtModel * extModel = [[XPMessageRemoteExtModel alloc] init];
extModel.defUser = userInfo.defUser;
extModel.erbanNo = userInfo.erbanNo;
extModel.carName = userInfo.carName;
extModel.inRoomNameplatePic = userInfo.nameplatePic;
extModel.inRoomNameplateWord = userInfo.nameplateWord;
extModel.isCustomWord = userInfo.isCustomWord;
extModel.charmUrl = userInfo.userLevelVo.charmUrl;
extModel.experLevelSeq = userInfo.userLevelVo.experLevelSeq;
extModel.experUrl = userInfo.userLevelVo.experUrl;
extModel.newUser = userInfo.newUser;
extModel.vipIcon = userInfo.userVipInfoVO.vipIcon;
extModel.fromUid = userInfo.fromUid;
extModel.fromType = userInfo.fromType;
extModel.fromNick = userInfo.fromNick;
extModel.iosBubbleUrl = userInfo.iosBubbleUrl;
extModel.androidBubbleUrl = userInfo.androidBubbleUrl;
extModel.enterHide = userInfo.userVipInfoVO.enterHide;
extModel.preventKick = userInfo.userVipInfoVO.preventKick;
extModel.enterRoomEffects = userInfo.userVipInfoVO.enterRoomEffects;
extModel.gender = userInfo.gender;
extModel.fromSayHelloChannel = userInfo.fromSayHelloChannel;
extModel.platformRole = userInfo.platformRole;
NSMutableDictionary *ext = [NSMutableDictionary dictionaryWithObject:extModel.model2dictionary forKey:[NSString stringWithFormat:@"%ld", userInfo.uid]];
request.roomExt = [ext toJSONString];
[[NIMSDK sharedSDK].chatroomManager enterChatroom:request completion:^(NSError * _Nullable error, NIMChatroom * _Nullable chatroom, NIMChatroomMember * _Nullable me) {
if (error) {
[[self getView] enterPublicChatHallFail:error.code];
} else {
[[self getView] enterPublicChatHallSuccess:chatroom];
}
}];
}
- (void)exitNIMRoom:(NSString *)roomId {
[[NIMSDK sharedSDK].chatroomManager exitChatroom:roomId completion:nil];
}
///
-(void)sendPublicChatHallTopTextWithcontent:(NSString *)content{
[Api sendPublicChatHallTopText:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
} showLoading:YES errorToast:YES] content:content];
}
///
-(void)getPublicChatHallTopText{
[Api getPublicChatHallTopText:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
}]];
}
///
-(void)getPublicChatHallList{
[Api getPublicChatHallList:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
}];
}
@end

View File

@@ -0,0 +1,18 @@
//
// MSSessionScrollingProtocol.h
// YuMi
//
// Created by duoban on 2024/5/6.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@protocol MSSessionScrollingProtocol <NSObject>
@required
@property (nonatomic,readonly)NSTimeInterval beginTime;
@property (nonatomic,readonly)NSTimeInterval endTime;
@end
NS_ASSUME_NONNULL_END

View File

@@ -7,12 +7,12 @@
#import <Foundation/Foundation.h>
@class ChatLimitModel, UserInfoModel;
@class ChatLimitModel, UserInfoModel,NIMChatroom;
NS_ASSUME_NONNULL_BEGIN
@protocol MessageProtocol <NSObject>
@optional
- (void)onGetLimitChat:(ChatLimitModel *)chatLimit;
///获取用户信息成功
@@ -24,6 +24,10 @@ NS_ASSUME_NONNULL_BEGIN
///获取用户信息
- (void)onGetUserInfoSuccess:(UserInfoModel *)userInfo;
///进入聊天室成功
-(void)enterPublicChatHallSuccess:(NIMChatroom *)chatRoom;
///进入聊天室失败
-(void)enterPublicChatHallFail:(NSInteger)code;
@end
NS_ASSUME_NONNULL_END

View File

@@ -71,9 +71,7 @@
}];
}
}
-(void)aa{
NSLog(@"%f,%f",self.messageText.frame.size.width,(CONTENT_WIDTH_MAX - MESSAGE_TEXT_PADDING * 2));
}
- (YYLabel *)messageText {
if (!_messageText) {
_messageText = [[YYLabel alloc]initWithFrame:CGRectZero];
@@ -81,8 +79,6 @@
_messageText.textColor = DJDKMIMOMColor.mainTextColor;
_messageText.numberOfLines = 0;
_messageText.userInteractionEnabled = YES;
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(aa)];
[_messageText addGestureRecognizer:tap];
}
return _messageText;
}

View File

@@ -0,0 +1,16 @@
//
// MSSessionPublicChatHallVC.h
// YuMi
//
// Created by duoban on 2024/5/6.
//
#import "MvpViewController.h"
#import <NIMSDK/NIMSDK.h>
NS_ASSUME_NONNULL_BEGIN
@interface MSSessionPublicChatHallVC : MvpViewController
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,801 @@
//
// MSSessionPublicChatHallVC.m
// YuMi
//
// Created by duoban on 2024/5/6.
//
#import "MSSessionPublicChatHallVC.h"
#import <IQKeyboardManager/IQKeyboardManager.h>
#import <TZImagePickerController/TZImagePickerController.h>
#import <MJRefresh/MJRefresh.h>
#import <Photos/Photos.h>
///Tool
#import "XCCurrentVCStackManager.h"
#import "NIMMessageMaker.h"
#import "UITableView+NIMScrollToBottom.h"
#import "QEmotionHelper.h"
#import "QKeyboardManager.h"
#import "ClientConfig.h"
///Model
#import "QPhotoImageModel.h"
#import "AttachmentModel.h"
#import "MessageBaseModel.h"
#import "MessageTextModel.h"
#import "MessageAudioModel.h"
#import "MessageTimeModel.h"
#import "MessageImageModel.h"
#import "MessageUnSupportModel.h"
#import "MessageTipsModel.h"
///View
#import "MessageCell.h"
#import "XPMineUserInfoViewController.h"
#import "SessionNavView.h"
#import "QInputBarView.h"
#import "QKeyboardManager.h"
#import "QEmotionBoardView.h"
#import "QinputPhotoView.h"
#import "SessionUserInfoTableViewCell.h"
///P
#import "MessagePresenter.h"
#import "MessageProtocol.h"
#import "Api+Message.h"
#import "XPRoomMessageConstant.h"
@interface MSSessionPublicChatHallVC ()<SessionNavViewDelegate,MessageProtocol, UITableViewDelegate, UITableViewDataSource, NIMChatManagerDelegate, NIMConversationManagerDelegate, NIMMediaManagerDelegate, MessageCellDelegate, TZImagePickerControllerDelegate, SessionNavViewDelegate, QInputBarViewDelegate, QInputBarViewDataSource,InputBoardDataSource ,InputBoardDelegate , QEmotionBoardViewDelegate, QinputPhotoViewDelegate, UIImagePickerControllerDelegate, UINavigationControllerDelegate,NIMChatroomManager>
@property (nonatomic, strong) NIMSession * session;
@property (nonatomic, strong) NSMutableArray<MessageBaseModel *> * messages;
@property (nonatomic,strong) SessionNavView *sessionNavView;
@property (nonatomic, strong) UITableView * sessionTableView;
@property (nonatomic,strong) NIMMessage *lastMessage;
@property(nonatomic,strong)QInputBarView *inputBarView;
@property(nonatomic,strong)QKeyboardManager *keyboardManager;
@property (nonatomic, strong) UserInfoModel *userInfo;
///
@property (nonatomic,strong) QinputPhotoView *photoView;
///
@property (nonatomic,strong) NSArray *phototArray;
@property(nonatomic,assign) BOOL isLoadHistoryMessage;
@property(nonatomic,copy) NSString *publicChatMessageRoomId;
@end
@implementation MSSessionPublicChatHallVC
- (BOOL)isHiddenNavBar {
return YES;
}
- (void)dealloc {
[[NIMSDK sharedSDK].chatManager removeDelegate:self];
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
- (MessagePresenter *)createPresenter {
return [[MessagePresenter alloc] init];
}
- (void)viewDidLoad {
[super viewDidLoad];
self.isLoadHistoryMessage = YES;
[self initViews];
[self initLayout];
[self initHeaderAndFooterRrfresh];
[IQKeyboardManager sharedManager].enable = NO;
[IQKeyboardManager sharedManager].enableAutoToolbar = NO;
[[NIMSDK sharedSDK].chatManager addDelegate:self];
}
- (void)initHeaderAndFooterRrfresh {
[self initData];
}
#pragma mark -
- (void)loadAlbumPhotos {
[YYUtility checkAssetsLibrayAvailable:^{
} denied:^{
} restriction:^{
}];
}
#pragma mark - cell
- (MessageBaseModel *)modeTransformMessage:(NIMMessage *)message {
MessageBaseModel * model;
switch (message.messageType) {
case NIMMessageTypeText:
model = [[MessageTextModel alloc] initWithMessage:message];
break;
case NIMMessageTypeAudio:
model = [[MessageAudioModel alloc] initWithMessage:message];
break;
case NIMMessageTypeImage:
model = [[MessageImageModel alloc] initWithMessage:message];
break;
case NIMMessageTypeTip:
model = [[MessageTipsModel alloc] initWithMessage:message];
break;
default:
model = [[MessageUnSupportModel alloc] initWithMessage:message];
break;
break;
}
return model;
}
- (UINavigationController *)getKeyWindowNav {
if ([XCCurrentVCStackManager shareManager].getCurrentVC) {
return [XCCurrentVCStackManager shareManager].getCurrentVC.navigationController;
}
return self.navigationController;
}
- (MessageBaseModel *)createTimeMessage:(NIMMessage *)message {
MessageTimeModel * timeModel = [[MessageTimeModel alloc] initWithMessage:message];
timeModel.time = [self timestrToTimeSecond:[NSString stringWithFormat:@"%f", message.timestamp]];
return timeModel;
}
- (NSString *)timestrToTimeSecond:(NSString *)timeStr {//timestr
NSTimeInterval interval = [timeStr doubleValue];
NSDate *date = [NSDate dateWithTimeIntervalSince1970:interval];
return [NSDate stringFromDate:date];
}
- (void)addTimeMessage:(NIMMessage *)message {
if (self.messages.count > 0) {
NIMMessage * lastMessage = self.messages.lastObject.message;
CGFloat dur = message.timestamp - lastMessage.timestamp;
if (dur / 60 > 5) {
NIMMessage * newMessage = [[NIMMessage alloc] init];
newMessage.timestamp = message.timestamp;
[newMessage setValue:self.session forKey:@"session"];
MessageBaseModel * timeModel = [self createTimeMessage:newMessage];
[self.messages addObject:timeModel];
}
}
}
- (void)addRevokeMessage:(NIMMessage *)message title:(NSString *)title {
NIMMessage * revokeMessage = [[NIMMessage alloc] init];
[revokeMessage setValue:self.session forKey:@"session"];
[revokeMessage setValue:@(NIMMessageTypeTip) forKey:@"messageType"];
revokeMessage.timestamp = [PLTimeUtil getNowTimeTimestampMillisecond].longLongValue;
revokeMessage.text = title;
[[NIMSDK sharedSDK].conversationManager saveMessage:revokeMessage forSession:self.session completion:nil];
}
#pragma mark - Private Method
- (void)initInputView {
// frameaddBottomInputBarViewframe
// ViewTextFieldViewController
QInputBarViewConfiguration *inputBarViewConfiguration = [QInputBarViewConfiguration defaultInputBarViewConfiguration];
inputBarViewConfiguration.voiceButtonHidden = NO;//
inputBarViewConfiguration.extendButtonHidden = YES;//
inputBarViewConfiguration.toolHidden = NO;
inputBarViewConfiguration.giftButtonHidden = NO;
inputBarViewConfiguration.cameraButtonHidden = NO;
inputBarViewConfiguration.photoButtonHidden = NO;
_inputBarView = [[QInputBarView alloc] initWithFrame:CGRectMake(0,0,self.view.frame.size.width,inputBarViewConfiguration.inputViewHeight)];
[_inputBarView setupWithConfiguration:inputBarViewConfiguration];
_inputBarView.delegate = self;
//keyboard
_keyboardManager = [[QKeyboardManager alloc] initWithViewController:self];
_keyboardManager.dataSource = self;
//addBottomInputBarViewdelegatedelegate
_keyboardManager.delegate = self;
[_keyboardManager addBottomInputBarView:_inputBarView belowViewController:NO];
//
[_keyboardManager bindTextView:_inputBarView.inputTextView];
}
- (void)initViews {
[self.view addSubview:self.sessionNavView];
[self.view addSubview:self.sessionTableView];
[self initInputView];
}
- (void)initLayout {
[self.sessionNavView mas_makeConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(kNavigationHeight);
make.leading.top.trailing.mas_equalTo(self.view);
}];
}
- (void)viewDidLayoutSubviews{
}
- (void)initData {
// NIMUser * user = [[NIMSDK sharedSDK].userManager userInfo:self.session.sessionId];
// if (user) {
// self.sessionNavView.title = user.userInfo.nickName;
// } else {
// self.sessionNavView.title = YMLocalizedString(@"XNDJTDDLoadingTool0");
// }
[self.presenter getUserInfo:self.session.sessionId];
}
- (BOOL)isExistMessages:(NIMMessage *)message{
BOOL isExist = NO;
NIMMessage * model;
for (NIMMessage *item in self.messages.reverseObjectEnumerator.allObjects) {
if ([item isKindOfClass:[NIMMessage class]] && [item.messageId isEqualToString:message.messageId]) {
model = item;
isExist = YES;
break;
}
}
if (model) {
model = message;
}
return isExist;
}
///
- (void)onGetSessionUserInfoSuccess:(UserInfoModel *)userInfo {
_userInfo = userInfo;
self.sessionNavView.userInfo = userInfo;
self.publicChatMessageRoomId = [ClientConfig shareConfig].configInfo.publicChatRoomIdMap[_userInfo.partitionId];
if(self.publicChatMessageRoomId.length > 0){
_session = [NIMSession session:self.publicChatMessageRoomId type:NIMSessionTypeChatroom];
[self.presenter enterNIMRoom:self.publicChatMessageRoomId user:userInfo];
}
}
///
-(void)enterPublicChatHallSuccess:(NIMChatroom *)chatRoom{
[self handleFetchHistoryMessage];
}
///
-(void)enterPublicChatHallFail:(NSInteger)code{
}
- (void)handleFetchHistoryMessage {
NSString *roomId = self.publicChatMessageRoomId;
NIMHistoryMessageSearchOption *option = [[NIMHistoryMessageSearchOption alloc] init];
option.limit = 100;
option.order = NIMMessageSearchOrderAsc;
option.messageTypes = @[@(NIMMessageTypeText),@(NIMMessageTypeImage),@(NIMMessageTypeAudio)];
[[NIMSDK sharedSDK].chatroomManager fetchMessageHistory:roomId option:option result:^(NSError * _Nullable error, NSArray<NIMMessage *> * _Nullable messages) {
if(error != nil){
self.isLoadHistoryMessage = NO;
}
NIMHistoryMessageSearchOption *option = [[NIMHistoryMessageSearchOption alloc] init];
option.limit = [ClientConfig shareConfig].configInfo.roomMessageCount;
option.order = NIMMessageSearchOrderDesc;
option.messageTypes = @[@(NIMMessageTypeText),@(NIMMessageTypeCustom)];
[[NIMSDK sharedSDK].chatroomManager fetchMessageHistory:roomId option:option result:^(NSError * _Nullable error, NSArray<NIMMessage *> * _Nullable messages) {
if(error != nil){
self.isLoadHistoryMessage = NO;
}
dispatch_async(dispatch_get_main_queue(), ^{///线
///
if (self.messages.count > kRoomMessageMaxLength) {
NSIndexSet *set = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, kRoomMessageMaxLength/2)];
NSArray *needRemoveMsgArray = [self.messages objectsAtIndexes:set];
[self.messages removeObjectsInArray:needRemoveMsgArray];
}else{
for (NIMMessage *message in messages) {
[self addTimeMessage:message];
if (message.isDeleted) {
continue;
}
MessageBaseModel * model = [self modeTransformMessage:message];
[self.messages addObject:model];
}
}
//
[self.sessionTableView reloadData];
//
if(self.messages.count > 0){
NSIndexPath *ip = [NSIndexPath indexPathForRow:self.messages.count-1 inSection:0]; //
[self.sessionTableView scrollToRowAtIndexPath:ip atScrollPosition:UITableViewScrollPositionBottom animated:YES]; //
}
});
}];
}];
}
#pragma mark - MessageCellDelegate
- (void)updateMessageSuccess:(NIMMessage *)message {
if ([message.session.sessionId isEqualToString:self.session.sessionId]) {
[self.sessionTableView reloadData];
}
}
- (void)didTapAvatar:(NSString *)uid {
XPMineUserInfoViewController * infoVC = [[XPMineUserInfoViewController alloc] init];
infoVC.uid = uid.integerValue;
[[self getKeyWindowNav] pushViewController:infoVC animated:YES];
}
#pragma mark - SessionNavViewDelegate
- (void)sessionNavView:(SessionNavView *)view didClickBack:(UIButton *)sender {
[self.navigationController popViewControllerAnimated:YES];
}
#pragma mark - UITableViewDataSource
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return self.messages.count;
}
- (nonnull UITableViewCell *)tableView:(nonnull UITableView *)tableView cellForRowAtIndexPath:(nonnull NSIndexPath *)indexPath {
MessageBaseModel * message = [self.messages safeObjectAtIndex1:indexPath.row];
NSString * identifier = [message cellContent:message];
///cell
MessageCell * cell = [tableView dequeueReusableCellWithIdentifier:identifier];
if (!cell) {
/// identifier
[tableView registerClass:[MessageCell class] forCellReuseIdentifier:identifier];
/// cell
cell = [tableView dequeueReusableCellWithIdentifier:identifier];
}
cell.delegate = self;
[cell renderWithMessage:[self.messages safeObjectAtIndex1:indexPath.row]];
return cell;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
MessageBaseModel *msg = [self.messages safeObjectAtIndex1:indexPath.row];
return msg.height;
}
- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView {
[self.keyboardManager hideAllBoardView];
}
#pragma mark - NIMChatManagerDelegate
- (void)onRecvMessages:(NSArray<NIMMessage *> *)messages {
if(!messages.count){
return;
}
NIMMessage *message = messages.firstObject;
NIMSession *session = message.session;
if (self.messages.count > kRoomMessageMaxLength) {
NSIndexSet *set = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, kRoomMessageMaxLength/2)];
NSArray *needRemoveMsgArray = [self.messages objectsAtIndexes:set];
[self.messages removeObjectsInArray:needRemoveMsgArray];
}
for (NIMMessage *message in messages) {
[self addTimeMessage:message];
if (message.isDeleted) {
continue;
}
MessageBaseModel * model = [self modeTransformMessage:message];
[self.messages addObject:model];
}
[self.sessionTableView reloadData];
[self.sessionTableView nim_scrollToBottom:YES];
}
- (void)sendMessage:(NIMMessage *)message didCompleteWithError:(NSError *)error {
if (message.session.sessionType != NIMSessionTypeChatroom) {
return;
}
[self addTimeMessage:message];
if (![self isExistMessages:message]) {
MessageBaseModel * model = [self modeTransformMessage:message];
[self.messages addObject:model];
}
if (message.yidunAntiSpamRes) {
NSDictionary * spamRes = message.yidunAntiSpamRes.toJSONObject;
NSDictionary * spamResExt = ((NSString *)spamRes[@"ext"]).toJSONObject;
if ([spamResExt[@"antispam"][@"suggestion"] intValue] == 2) {
NSDictionary * dic = @{@"suggestion": @"2"};
message.localExt = dic;
[[NIMSDK sharedSDK].conversationManager updateMessage:message forSession:self.session completion:nil];
}
}
[self.sessionTableView reloadData];
[self.sessionTableView nim_scrollToBottom:YES];
}
- (void)sendTextMessage:(NSString *)text {
NIMMessage *message = [NIMMessageMaker msgWithText:text];
[[[NIMSDK sharedSDK] chatManager] sendMessage:message toSession:self.session error:nil];
}
- (void)audioRecordCompletion:(NSString *)recordPath {
NIMMessage *message = [NIMMessageMaker msgWithAudio:recordPath];
[[[NIMSDK sharedSDK] chatManager] sendMessage:message toSession:self.session error:nil];
}
#pragma mark - TZImagePickerControllerDelegate
- (void)imagePickerController:(TZImagePickerController *)picker didFinishPickingPhotos:(NSArray<UIImage *> *)photos sourceAssets:(NSArray *)assets isSelectOriginalPhoto:(BOOL)isSelectOriginalPhoto infos:(NSArray<NSDictionary *> *)infos {
[photos enumerateObjectsUsingBlock:^(UIImage * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
if (obj) {
NIMMessage * message = [NIMMessageMaker msgWithImage:obj];
//
[[NIMSDK sharedSDK].chatManager sendMessage:message toSession:self.session error:nil];
}
}];
}
#pragma mark - SessionUserInfoTableViewCellDelegate
- (void)sessionUserInfoTableViewCell:(SessionUserInfoTableViewCell *)view showUserInfoVC:(UserInfoModel *)userInfo {
[self didTapAvatar:[NSString stringWithFormat:@"%ld", userInfo.uid]];
}
#pragma mark - InputBoardDataSource
//@return Viewframe
- (UIView *)keyboardManagerExtendBoardView:(QKeyboardManager *)keyboardManager {
UIView *boardView = [UIView new];
boardView.backgroundColor = UIColor.clearColor;
return boardView;
}
//@return Viewframe
- (UIView *)keyboardManagerEmotionBoardView:(QKeyboardManager *)keyboardManager {
QEmotionBoardView *emotionView = [[QEmotionBoardView alloc] init];
QEmotionHelper *faceManager = [QEmotionHelper sharedEmotionHelper];
emotionView.emotions = faceManager.emotionArray;
emotionView.delegate = self;
if (@available(iOS 11.0, *)) {
NSBundle *bundle = [NSBundle bundleForClass:[self class]];
emotionView.backgroundColor = [UIColor colorNamed:@"q_input_extend_bg" inBundle:bundle compatibleWithTraitCollection:nil];
} else {
emotionView.backgroundColor = [UIColor colorWithRed:(246)/255.0f green:(246)/255.0f blue:(246)/255.0f alpha:1];
}
return emotionView;
}
//@return Viewframe
- (UIView *)keyboardManagerPhotoBoardView:(QKeyboardManager *)keyboardManager{
QinputPhotoView *emotionView = [[QinputPhotoView alloc] init];
self.photoView = emotionView;
emotionView.photoList = self.phototArray;
emotionView.delegate = self;
emotionView.backgroundColor = [UIColor colorWithRed:(246)/255.0f green:(246)/255.0f blue:(246)/255.0f alpha:1];
return emotionView;
}
//@return View
- (CGFloat)keyboardManagerEmotionBoardHeight:(QKeyboardManager *)keyboardManager {
return 294;
}
//@return View
- (CGFloat)keyboardManagerExtendBoardHeight:(QKeyboardManager *)keyboardManager {
return 174;
}
- (CGFloat)keyboardManagerPhotoBoardHeight:(QKeyboardManager *)keyboardManager {
return 184 + kSafeAreaBottomHeight;
}
//
- (void)inputBarView:(QInputBarView *)inputBarView onEmotionButtonClick:(UIButton *)emotionSwitchButton {
if (emotionSwitchButton.isSelected) {
[_keyboardManager switchToEmotionBoardKeyboard];
} else {
_inputBarView.inputTextView.text = @"";
[_inputBarView textViewBecomeFirstResponder];
}
}
- (void)inputBarView:(QInputBarView *)inputBarView onVoiceSwitchButtonClick:(UIButton *)voiceSwitchButton {
if (!voiceSwitchButton.isSelected) {
_inputBarView.inputTextView.text = @"";
[_inputBarView textViewBecomeFirstResponder];
} else {
[_keyboardManager hideAllBoardView];
}
}
- (void)inputBarView:(QInputBarView *)inputBarView onGiftButtonClick:(UIButton *)emotionSwitchButton {
[_keyboardManager hideAllBoardView];
}
- (void)inputBarView:(QInputBarView *)inputBarView onCameraButtonClick:(UIButton *)emotionSwitchButton {
[_keyboardManager hideAllBoardView];
@kWeakify(self);
[YYUtility checkCameraAvailable:^{
@kStrongify(self);
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
imagePicker.delegate = self;
imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
imagePicker.allowsEditing = YES;
[self presentViewController:imagePicker animated:YES completion:NULL];
} denied:^{
@kStrongify(self);
[self showNotPhoto:YMLocalizedString(@"SessionViewController19") content:YMLocalizedString(@"SessionViewController10")];
} restriction:^{
@kStrongify(self);
[self showNotPhoto:YMLocalizedString(@"SessionViewController19") content:YMLocalizedString(@"SessionViewController12")];
}];
}
- (void)inputBarView:(QInputBarView *)inputBarView onPhototButtonClick:(UIButton *)emotionSwitchButton {
if (emotionSwitchButton.isSelected) {
@kWeakify(self);
[YYUtility checkAssetsLibrayAvailable:^{
@kStrongify(self);
[TZImagePickerConfig sharedInstance].allowPickingImage = YES;
dispatch_async(dispatch_get_global_queue(0, 0), ^{
[[TZImageManager manager] getCameraRollAlbumWithFetchAssets:NO completion:^(TZAlbumModel *model) {
[[TZImageManager manager] getAssetsFromFetchResult:model.result completion:^(NSArray<TZAssetModel *> *models) {
dispatch_async(dispatch_get_main_queue(), ^{
NSMutableArray * array = [NSMutableArray array];
if (models.count > 40) {
for (int i = 0; i < 40; i++) {
TZAssetModel * assets = [models objectAtIndex:i];
QPhotoImageModel * infor = [[QPhotoImageModel alloc] init];
infor.isOrigin = NO;
infor.assetInfo = assets;
[array addObject:infor];
}
} else {
for (int i = 0; i < models.count; i++) {
TZAssetModel * assets = [models objectAtIndex:i];
QPhotoImageModel * infor = [[QPhotoImageModel alloc] init];
infor.isOrigin = NO;
infor.assetInfo = assets;
[array addObject:infor];
}
}
self.phototArray = array;
if (self.phototArray.count > 0) {
self.photoView.photoList = self.phototArray;
[self.keyboardManager switchToPhotoBoardKeyboard];
} else {
TZImagePickerController *imagePickerVc = [[TZImagePickerController alloc] initWithMaxImagesCount:1 delegate:self];
imagePickerVc.modalPresentationStyle = UIModalPresentationOverFullScreen;
imagePickerVc.allowPickingVideo = NO;
imagePickerVc.allowTakeVideo = NO;
imagePickerVc.naviBgColor = [DJDKMIMOMColor appCellBackgroundColor];
imagePickerVc.naviTitleColor = [DJDKMIMOMColor mainTextColor];
imagePickerVc.barItemTextColor = [DJDKMIMOMColor mainTextColor];
[self presentViewController:imagePickerVc animated:YES completion:nil];
}
});
}];
}];
});
} denied:^{
@kStrongify(self);
[self showNotPhoto:YMLocalizedString(@"SessionViewController20") content:YMLocalizedString(@"SessionViewController14")];
} restriction:^{
@kStrongify(self);
[self showNotPhoto:YMLocalizedString(@"SessionViewController20") content:YMLocalizedString(@"SessionViewController16")];
}];
} else {
[_keyboardManager hideAllBoardView];
_inputBarView.inputTextView.text = @"";
[_inputBarView textViewResignFirstResponder];
}
}
- (void)showNotPhoto:(NSString *)title content:(NSString *)content {
TTAlertConfig *config = [[TTAlertConfig alloc] init];
config.title = title;
config.message = content;
[TTPopup alertWithConfig:config confirmHandler:^{
NSURL *url = [NSURL URLWithString:UIApplicationOpenSettingsURLString];
if ([[UIApplication sharedApplication] canOpenURL:url]) {
[[UIApplication sharedApplication] openURL:url options:@{} completionHandler:^(BOOL success) {
}];
}
} cancelHandler:^{
}];
}
#pragma mark - InputBoardDelegate
- (void)keyboardManager:(QKeyboardManager *)keyboardManager onWholeInputViewHeightDidChange:(CGFloat)wholeInputViewHeight reason:(WholeInputViewHeightDidChangeReason)reason {
[UIView animateWithDuration:0.2 animations:^{
[self.sessionTableView nim_scrollToBottom:NO];
[self.sessionTableView mas_remakeConstraints:^(MASConstraintMaker *make) {
make.leading.trailing.mas_equalTo(self.view);
make.top.mas_equalTo(self.sessionNavView.mas_bottom);
make.bottom.mas_equalTo(self.view).offset(-wholeInputViewHeight - kSafeAreaBottomHeight);
}];
}];
}
#pragma mark - QEmotionBoardViewDelegate
/**
*
* @param index `emotions`
* @param emotion `QMUIEmotion`
*/
- (void)emotionView:(QEmotionBoardView *)emotionView didSelectEmotion:(QEmotion *)emotion atIndex:(NSInteger)index {
//😊
[_inputBarView insertEmotion:emotion.displayName];
}
//
- (void)emotionViewDidSelectDeleteButton:(QEmotionBoardView *)emotionView {
if (![_inputBarView deleteEmotion]){
//
[_inputBarView.inputTextView deleteBackward];
}
}
//
- (void)emotionViewDidSelectSendButton:(QEmotionBoardView *)emotionView {
[self sendTextMessage:[_inputBarView textViewInputNormalText]];
_inputBarView.inputTextView.text = @"";
[_keyboardManager hideAllBoardView];
}
/**
*
* @param inputNormalText "害~你好啊[微笑]"
*/
- (void)inputBarView:(QInputBarView *)inputBarView onKeyboardSendClick:(NSString *)inputNormalText {
[self sendTextMessage:inputNormalText];
_inputBarView.inputTextView.text = @"";
[_keyboardManager hideAllBoardView];
}
#pragma mark - QinputPhotoViewDelegate
- (void)qinputPhotoView:(QinputPhotoView *)view didClickSend:(NSArray *)photoList {
for (int i = 0; i < photoList.count; i++) {
QPhotoImageModel * imageInfo = [photoList safeObjectAtIndex1:i];
UIImage * image;
if (view.isOrigin) {
image = imageInfo.originImage;
} else {
image = imageInfo.compressImage;
}
if (image == nil){
continue;
}
//
NIMMessage * message = [NIMMessageMaker msgWithImage:image];
[[NIMSDK sharedSDK].chatManager sendMessage:message toSession:self.session error:nil];
[view resetChoosePhotos];
}
}
- (void)qinputPhotoView:(QinputPhotoView *)view didClickPhoto:(UIButton *)sender {
TZImagePickerController *imagePickerVc = [[TZImagePickerController alloc] initWithMaxImagesCount:1 delegate:self];
imagePickerVc.modalPresentationStyle = UIModalPresentationOverFullScreen;
imagePickerVc.allowPickingVideo = NO;
imagePickerVc.allowTakeVideo = NO;
imagePickerVc.naviBgColor = [DJDKMIMOMColor appCellBackgroundColor];
imagePickerVc.naviTitleColor = [DJDKMIMOMColor mainTextColor];
imagePickerVc.barItemTextColor = [DJDKMIMOMColor mainTextColor];
[self presentViewController:imagePickerVc animated:YES completion:nil];
}
#pragma mark - UIImagePickerControllerDelegate
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
UIImage *selectedPhoto = [info objectForKey:UIImagePickerControllerEditedImage];
if (selectedPhoto) {
if (picker.sourceType == UIImagePickerControllerSourceTypeCamera) {
UIImageWriteToSavedPhotosAlbum(selectedPhoto, nil, nil, nil);
}
NIMMessage * message = [NIMMessageMaker msgWithImage:selectedPhoto];
//
[[NIMSDK sharedSDK].chatManager sendMessage:message toSession:self.session error:nil];
}
[picker dismissViewControllerAnimated:YES completion:^{}];
}
- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker{
[picker dismissViewControllerAnimated:YES completion:^{
}];
}
#pragma mark - Getters And Setters
- (NSArray<MessageBaseModel *> *)messages {
if (!_messages) {
_messages = [[NSMutableArray alloc] init];
}
return _messages;
}
#pragma mark - Event Response
- (void)closeKeyBoard {
[self.view endEditing:YES];
[self.inputBarView textViewResignFirstResponder];
}
- (UITableView *)sessionTableView {
if (!_sessionTableView) {
_sessionTableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
_sessionTableView.delegate = self;
_sessionTableView.dataSource = self;
_sessionTableView.backgroundColor = UIColor.clearColor;
_sessionTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
_sessionTableView.showsVerticalScrollIndicator = NO;
if (@available(iOS 11.0, *)) {
_sessionTableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
}
}
return _sessionTableView;
}
- (SessionNavView *)sessionNavView {
if (!_sessionNavView) {
_sessionNavView = [[SessionNavView alloc] init];
_sessionNavView.delegate = self;
_sessionNavView.isPublicChatHall = YES;
}
return _sessionNavView;
}
@end

View File

@@ -675,9 +675,12 @@
#pragma mark - NIMChatManagerDelegate
- (void)onRecvMessages:(NSArray<NIMMessage *> *)messages {
if(!messages.count){
return;
}
NIMMessage *message = messages.firstObject;
NIMSession *session = message.session;
if (![session isEqual:self.session] || !messages.count) {
if (![session isEqual:self.session] ) {
return;
}
for (NIMMessage *message in messages) {

View File

@@ -0,0 +1,36 @@
//
// MSSessionScrollingView.h
// YuMi
//
// Created by duoban on 2024/5/6.
//
#import <UIKit/UIKit.h>
#import "MSSessionScrollingProtocol.h"
NS_ASSUME_NONNULL_BEGIN
@class MSSessionScrollingView;
@protocol MSSessionScrollingViewDelegate <NSObject>
@property (nonatomic,readonly)NSTimeInterval curTime;
- (UIView *)MSSessionScrollingView:(MSSessionScrollingView *)view scrollingWithModel:(id<MSSessionScrollingProtocol>)model;
- (void)MSSessionScrollingView:(MSSessionScrollingView *)view didClickView:(UIView *)scrollingView atPoint:(CGPoint)point;
@end
@interface MSSessionScrollingView : UIView
@property(nonatomic,weak) id<MSSessionScrollingViewDelegate>delegate;
@property (nonatomic,strong) NSMutableArray <id <MSSessionScrollingProtocol>> *modelList;
@property (nonatomic, assign)BOOL isPause;
@property (nonatomic, assign)BOOL isChange;
/// 暂停
- (void)pauseAnimation;
/// 继续
- (void)resumeAnimation;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,220 @@
//
// MSSessionScrollingView.m
// YuMi
//
// Created by duoban on 2024/5/6.
//
#import "MSSessionScrollingView.h"
#import "CALayer+Animation.h"
static const CGFloat ktimerSec = 0.1;
static const CGFloat kDandaoCount = 5;
@interface MSSessionScrollingView()
@property (nonatomic,weak)NSTimer *timer;
@property (nonatomic,strong)NSMutableArray *waitTimeList;
@property (nonatomic,strong)NSMutableArray *leftTimeList;
@property (nonatomic,strong)NSMutableArray *scrollingList;
@end
@implementation MSSessionScrollingView
- (instancetype)initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame]) {
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(ms_ClickView:)];
[self addGestureRecognizer:tap];
[self installUI];
[self installConstraints];
}
return self;
}
-(void)installUI{
}
-(void)installConstraints{
}
- (void)ms_ClickView:(UITapGestureRecognizer *)tap {
CGPoint point = [tap locationInView:tap.view];
for (UIView *danmuView in self.scrollingList) {
CGRect frame = danmuView.layer.presentationLayer.frame;
BOOL isContain = CGRectContainsPoint(frame, point);
if (isContain) {
if ([self.delegate respondsToSelector:@selector(MSSessionScrollingView:didClickView:atPoint:)]) {
[self.delegate MSSessionScrollingView:self didClickView:danmuView atPoint:point];
}
break;
}
}
}
#pragma mark --
- (void)didMoveToSuperview {
[super didMoveToSuperview];
[self timer];
self.layer.masksToBounds = YES;
}
-(void)dealloc {
[self.timer invalidate];
self.timer = nil;
}
#pragma mark --
///
- (void)pauseAnimation {
_isPause = YES;
[[self.scrollingList valueForKeyPath:@"layer"] makeObjectsPerformSelector:@selector(ms_pauseAnimate)];
[self.timer invalidate];
self.timer = nil;
}
///
- (void)resumeAnimation{
_isPause = NO;
[[self.scrollingList valueForKeyPath:@"layer"] makeObjectsPerformSelector:@selector(ms_resumeAnimate)];
[self timer];
}
#pragma mark --
- (void)checkAndBiu {
if (_isPause) {
return;
}
//
for (int i = 0; i < kDandaoCount; i++) {
double waitValue = [self.waitTimeList[i] doubleValue] - ktimerSec;
if (waitValue <= 0.0) {
waitValue = 0.0;
}
self.waitTimeList[i] = @(waitValue);
double leftValue = [self.leftTimeList[i] doubleValue] - ktimerSec;
if (leftValue <= 0.0) {
leftValue = 0.0;
}
self.leftTimeList[i] = @(leftValue);
}
[self.modelList sortUsingComparator:^NSComparisonResult(id<MSSessionScrollingProtocol> _Nonnull obj1, id<MSSessionScrollingProtocol> _Nonnull obj2) {
if (obj1.beginTime < obj2.beginTime) {
return NSOrderedAscending;
}
return NSOrderedDescending; //
}];
// ,
NSMutableArray *deleteModelArr = [NSMutableArray array];
for (id<MSSessionScrollingProtocol> model in self.modelList) {
//1.
NSTimeInterval beginTime = model.beginTime;
NSTimeInterval curTime = self.delegate.curTime;
if (beginTime > curTime) {
break;
}
//2.
BOOL result = [self checkBoomAndBiuWith:model];
if (result) {
[deleteModelArr addObject:model];
}
}
[self.modelList removeObjectsInArray:deleteModelArr];
}
#pragma mark --
- (BOOL)checkBoomAndBiuWith:(id<MSSessionScrollingProtocol>)model {
CGFloat danmakuH = self.frame.size.height / kDandaoCount + 10;
//
for (int i = 0 ; i < kDandaoCount; i++) {
//1.
NSTimeInterval waitTime = [self.waitTimeList[i] doubleValue];
if (waitTime > 0.0) {
continue;
}
//2.
UIView * danmakuView = [self.delegate MSSessionScrollingView:self scrollingWithModel:model];
NSTimeInterval leftTime = [self.leftTimeList[i] doubleValue];
// = ( + )/endTime
double speed = ( danmakuView.frame.size.width + self.frame.size.width) / model.endTime;
double distance = leftTime * speed;
if (distance > self.frame.size.width) {
continue;
}
if(danmakuH * (i+1) + 5> self.frame.size.height){
continue;
}
[self.scrollingList addObject:danmakuView];
//
// / = v
self.waitTimeList[i] = @(danmakuView.frame.size.width / speed);
self.leftTimeList[i] = @(model.endTime);
//3.
//3.1
CGRect frame = danmakuView.frame;
frame.origin = CGPointMake(self.frame.size.width, danmakuH * i);
danmakuView.frame = frame;
[self addSubview:danmakuView];
[UIView animateWithDuration:model.endTime delay:0 options:UIViewAnimationOptionCurveLinear animations:^{
CGRect frame = danmakuView.frame;
frame.origin.x = - danmakuView.frame.size.width;
danmakuView.frame = frame;
} completion:^(BOOL finished) {
[danmakuView removeFromSuperview];
[self.scrollingList removeObject:danmakuView];
}];
return YES;
}
return NO;
}
#pragma mark --set get
- (NSMutableArray *)modelList {
if (!_modelList) {
_modelList = [NSMutableArray array];
}
return _modelList;
}
-(NSTimer *)timer {
if (!_timer) {
NSTimer *timer = [NSTimer timerWithTimeInterval:ktimerSec repeats:YES block:^(NSTimer * _Nonnull timer) {
[self checkAndBiu];
}];
[[NSRunLoop currentRunLoop]addTimer:timer forMode:NSRunLoopCommonModes];
_timer = timer;
}
return _timer;
}
- (NSMutableArray *)waitTimeList {
if (!_waitTimeList) {
_waitTimeList = [NSMutableArray arrayWithCapacity:kDandaoCount];
for (int i = 0; i < kDandaoCount; i ++) {
_waitTimeList[i] = @0.0;
}
}
return _waitTimeList;
}
- (NSMutableArray *)leftTimeList {
if (!_leftTimeList) {
_leftTimeList = [NSMutableArray arrayWithCapacity:kDandaoCount];
for (int i = 0; i < kDandaoCount; i ++) {
_leftTimeList[i] = @0.0;
}
}
return _leftTimeList;
}
- (NSMutableArray *)scrollingList {
if (!_scrollingList) {
_scrollingList = [NSMutableArray array];
}
return _scrollingList;
}
@end

View File

@@ -10,6 +10,8 @@
NS_ASSUME_NONNULL_BEGIN
@class SessionNavView, UserInfoModel;
@protocol SessionNavViewDelegate <NSObject>
@optional
///点击了举报
- (void)sessionNavView:(SessionNavView *)view didClickReport:(UIButton *)sender;
///点击了关注
@@ -28,6 +30,8 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic,strong) UserInfoModel *userInfo;
///是否已经喜欢了
@property (nonatomic,assign) BOOL isLike;
@property(nonatomic,assign) BOOL isPublicChatHall;
///代理
@property (nonatomic,weak) id<SessionNavViewDelegate> delegate;
///是否在房间中

View File

@@ -51,7 +51,12 @@
}
return self;
}
- (void)setIsPublicChatHall:(BOOL)isPublicChatHall{
_isPublicChatHall = isPublicChatHall;
self.liveView.hidden = _isPublicChatHall;
self.reportButton.hidden = _isPublicChatHall;
self.likeButton.hidden = _isPublicChatHall;
}
#pragma mark - Private Method
- (void)initSubViews {
self.backgroundColor = [DJDKMIMOMColor appCellBackgroundColor];

View File

@@ -441,7 +441,7 @@
CGFloat width = image.size.width <= 0 ? kGetScaleWidth(60) : image.size.width;
CGFloat height = image.size.height ;
CGFloat getHeigth = KScreenWidth * height / width;
bannerView = [[PIUniversalBannerView alloc]initWithFrame:CGRectMake(0, top, KScreenWidth, getHeigth) ];
bannerView = [[PIUniversalBannerView alloc]initWithFrame:CGRectMake(KScreenWidth, top, KScreenWidth, getHeigth) ];
[self showGeneralFloatingScreenView:bannerView model:model];
}fail:^(NSError * _Nonnull error) {

View File

@@ -273,33 +273,31 @@
}];
}
- (void)showLittleGameMiniView:(RoomType)type micCount:(NSInteger)micCount {
// if([ClientConfig shareConfig].canOpen){
// if (type == RoomType_MiniGame) {
// if (!self.littleGameMiniView.superview) {
// [self addSubview:self.littleGameMiniView];
// [self.littleGameMiniView mas_makeConstraints:^(MASConstraintMaker *make) {
// make.trailing.mas_equalTo(0);
// make.top.mas_equalTo(kNavigationHeight);
// make.height.mas_equalTo(23);
// }];
// }
// self.littleGameMiniView.micCount = micCount;
// if (micCount > 6) {
// [self.littleGameMiniView removeFromSuperview];
// }
// } else {
// if (self.littleGameMiniView.superview) {
// [self.littleGameMiniView removeFromSuperview];
// }
// }
// }else{
// if (self.littleGameMiniView.superview) {
// [self.littleGameMiniView removeFromSuperview];
// }
// }
if (self.littleGameMiniView.superview) {
[self.littleGameMiniView removeFromSuperview];
if([ClientConfig shareConfig].canOpen){
if (type == RoomType_MiniGame) {
if (!self.littleGameMiniView.superview) {
[self addSubview:self.littleGameMiniView];
[self.littleGameMiniView mas_makeConstraints:^(MASConstraintMaker *make) {
make.trailing.mas_equalTo(0);
make.top.mas_equalTo(kNavigationHeight);
make.height.mas_equalTo(23);
}];
}
self.littleGameMiniView.micCount = micCount;
if (micCount > 6) {
[self.littleGameMiniView removeFromSuperview];
}
} else {
if (self.littleGameMiniView.superview) {
[self.littleGameMiniView removeFromSuperview];
}
}
}else{
if (self.littleGameMiniView.superview) {
[self.littleGameMiniView removeFromSuperview];
}
}
}
- (void)configLittleGameState {

View File

@@ -14,6 +14,7 @@
#import "XPSailingViewController.h"
#import "XPRoomViewController.h"
#import "MSRoomGameWebVC.h"
#import "XPRoomAnimationView.h"
@interface MSRoomMenuGameVC ()<MSRoomMenuGameViewDelegate>
@property(nonatomic,strong) MSRoomMenuGameView *gameView;
///host
@@ -117,7 +118,15 @@
vc.view.frame = CGRectMake(0, 0, KScreenWidth, KScreenHeight);
XPRoomViewController *roomVC = (XPRoomViewController *)self.hostDelegate;
[roomVC addChildViewController:vc];
XPRoomAnimationView *animationView;
for (id obj in self.hostDelegate.getSuperView.subviews) {
if ([obj isKindOfClass:[XPRoomAnimationView class]]){
animationView = obj;
break;
}
}
[self.hostDelegate.getSuperView addSubview:vc.view];
[self.hostDelegate.getSuperView bringSubviewToFront:animationView];
}
}

View File

@@ -1010,19 +1010,20 @@
#pragma mark - //
- (XPMessageInfoModel *)createKickUserAttribute:(AttachmentModel *)attachment info:(XPKickUserModel *)info messageInfo:(XPMessageInfoModel *)messageInfo{
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
[attribute appendAttributedString:[self createNickAtrribute:info.targetNick uid:info.targetUid]];
[attribute appendAttributedString:[self createTextAttribute:YMLocalizedString(@"XPRoomMessageParser92") color:[DJDKMIMOMColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
[attribute appendAttributedString:[self createNickAtrribute:info.handleNick uid:info.handleUid]];
NSString * content= @"";
if (attachment.second == Custom_Message_Sub_Kick_BeKicked || attachment.second == Custom_Message_Sub_Hall_Super_Admin_Kick_Manager_Out_Room) {
content = YMLocalizedString(@"XPRoomMessageParser93");
} else if(attachment.second == Custom_Message_Sub_Kick_BlackList) {
content = YMLocalizedString(@"XPRoomMessageParser94");
} else if(attachment.second == Custom_Message_Sub_Queue_Kick) {
content = YMLocalizedString(@"XPRoomMessageParser95");
}
[attribute appendAttributedString:[self createTextAttribute:content color:[DJDKMIMOMColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
NSString * content= @"";
if (attachment.second == Custom_Message_Sub_Kick_BeKicked || attachment.second == Custom_Message_Sub_Hall_Super_Admin_Kick_Manager_Out_Room) {
content = [NSString stringWithFormat:YMLocalizedString(@"XPRoomMessageParser93"),info.targetNick,info.handleNick];
} else if(attachment.second == Custom_Message_Sub_Kick_BlackList) {
content = [NSString stringWithFormat:YMLocalizedString(@"XPRoomMessageParser94"),info.targetNick,info.handleNick];
} else if(attachment.second == Custom_Message_Sub_Queue_Kick) {
content = [NSString stringWithFormat:YMLocalizedString(@"XPRoomMessageParser95"),info.targetNick,info.handleNick];
}
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] initWithString:content attributes:@{NSForegroundColorAttributeName:[DJDKMIMOMColor messageDefaultTextColor],NSFontAttributeName:[UIFont systemFontOfSize:kRoomMessageDefalutFont]}];
[attribute addAttributes:@{NSForegroundColorAttributeName:[DJDKMIMOMColor messageNickColor],NSFontAttributeName:[UIFont systemFontOfSize:kRoomMessageDefalutFont]} range:[content rangeOfString:info.targetNick]];
[attribute addAttributes:@{NSForegroundColorAttributeName:[DJDKMIMOMColor messageNickColor],NSFontAttributeName:[UIFont systemFontOfSize:kRoomMessageDefalutFont]} range:[content rangeOfString:info.handleNick]];
[self attributeAddHihtLight:attribute range:[content rangeOfString:info.targetNick] uid:info.targetUid];
[self attributeAddHihtLight:attribute range:[content rangeOfString:info.handleNick] uid:info.handleUid];
messageInfo.content = attribute;
return messageInfo;
}
@@ -1239,7 +1240,14 @@
[self attributeAddHihtLight:attribute uid:uid];
return attribute;
}
- (void)attributeAddHihtLight:(NSMutableAttributedString *)attribute range:(NSRange)range uid:(NSInteger)uid {
@kWeakify(self);
[attribute yy_setTextHighlightRange:range color:nil backgroundColor:nil tapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) {
@kStrongify(self);
if (uid <= 0) {return;}
[self showUserCard:uid];
}];
}
- (void)attributeAddHihtLight:(NSMutableAttributedString *)attribute uid:(NSInteger)uid {
@kWeakify(self);
[attribute yy_setTextHighlightRange:NSMakeRange(0, attribute.length) color:nil backgroundColor:nil tapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) {

View File

@@ -513,6 +513,7 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
@(CustomMessageType_LuckyBag):
[NSSet setWithObjects:
@(Custom_Message_Sub_Room_Gift_LuckBag_Server),
@(Custom_Message_Sub_Room_Gift_LuckBag_FullScree),
nil],
@(CustomMessageType_Gift_Compound):
[NSSet setWithObjects:@(Custom_Message_Sub_Gift_Compound),

View File

@@ -418,7 +418,7 @@
if (self.roomInfo.type == RoomType_Anchor || (self.roomInfo.roomModeType == RoomModeType_Open_AcrossRoomPK_mode && self.roomInfo.roomId > 0) || (self.roomInfo.roomModeType == RoomModeType_Open_Blind && micState.position == 999)) {
self.positionCharmImgView.hidden = YES;
}
self.nickLabel.text = [NSString stringWithFormat:YMLocalizedString(@"MicroView0"), micState.position + 1];
self.nickLabel.text = YMLocalizedString(@"MicroView0");
}
-(UserInfoModel *)getUser{
return self.userInfo;

View File

@@ -63,7 +63,7 @@
[Api attentionStatusCompletion:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
BOOL isLike = ((NSNumber *)data.data).boolValue;
self.attentionItem.isSelect = isLike;
[[self getView] onGetFunctionArraySccess:self.functionArray];
[[self getView] onGetFollowDataSccess];
}errorToast:NO] uid:uid isLikeUid:targetUid];
}

View File

@@ -16,6 +16,7 @@ NS_ASSUME_NONNULL_BEGIN
///获取用户卡片中 functioin的数据源
- (void)onGetFunctionArraySccess:(NSArray<XPUserCardItemModel *> *)array;
- (void)onGetFollowDataSccess;
///获取用户卡片中 操作麦的 functioin的数据源
- (void)onGetMicroFunctionArraySuccess:(NSArray<XPUserCardMicroItemModel *> *)array;
///关注成功

View File

@@ -599,7 +599,9 @@
[self.presenter getMicroFunctionItemsByUserInfo:self.cardInfo];
}
-(void)onGetFollowDataSccess{
[self.collectionView reloadData];
}
- (void)onGetMicroFunctionArraySuccess:(NSArray<XPUserCardMicroItemModel *> *)array {
if (array.count <= 0) {
if (self.datasource.count > 0){

View File

@@ -1692,7 +1692,10 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
isHave = YES;
}else if (attachment.first == CustomMessageType_Tarot && (attachment.second == Custom_Message_Sub_Tarot_Advanced || attachment.second == Custom_Message_Sub_Tarot_Intermediate)){
isHave = YES;
}if (attachment.first == CustomMessageType_RedPacket && attachment.second == Custom_Message_Sub_AllDiamandRedPacket) {
}else if(attachment.first == CustomMessageType_LuckyBag && attachment.second == Custom_Message_Sub_Room_Gift_LuckBag_FullScree){
isHave = YES;
}
if (attachment.first == CustomMessageType_RedPacket && attachment.second == Custom_Message_Sub_AllDiamandRedPacket) {
if(self.isShowRedPacket == YES)return;
XPRedPacketModel *data = [XPRedPacketModel modelWithDictionary:attachment.data];
data.validityType = 0;

View File

@@ -52,6 +52,7 @@ NSString * const kMSGameLoaded = @"gameLoaded";
@property (nonatomic, strong) WKUserContentController *ms_userContentController;
@property (nonatomic,weak) id<RoomHostDelegate> hostDelegate;
@property(nonatomic,strong) ActivityInfoModel *gameModel;
@property(nonatomic,strong) UIButton *backBtn;
@end
@implementation MSRoomGameWebVC
@@ -71,9 +72,16 @@ NSString * const kMSGameLoaded = @"gameLoaded";
- (void)viewDidLoad {
[super viewDidLoad];
[self installUI];
self.backBtn = [UIButton new];
[self.view addSubview:self.backBtn];
[self.backBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self.view);
}];
[self.backBtn addTarget:self action:@selector(backBtnAction) forControlEvents:UIControlEventTouchUpInside];
}
-(void)installUI{
self.view.backgroundColor = [UIColor colorWithWhite:0 alpha:0.4];
MSWeakWebViewScriptMessageDelegate *weakScriptMessageDelegate = [[MSWeakWebViewScriptMessageDelegate alloc] initWithDelegate:self];
_ms_userContentController = [[WKUserContentController alloc] init];
[_ms_userContentController addScriptMessageHandler:weakScriptMessageDelegate name:kMSGetConfig];
@@ -103,6 +111,7 @@ NSString * const kMSGameLoaded = @"gameLoaded";
[self.webview.scrollView setBackgroundColor:[UIColor clearColor]];
[self.webview setBackgroundColor:[UIColor clearColor]];
[self.webview setUIDelegate:self];
self.webview.navigationDelegate = self;
//
[self.webview setOpaque:NO];
//
@@ -199,7 +208,6 @@ NSString * const kMSGameLoaded = @"gameLoaded";
NSString *code = gameModel.code ?: @"";
NSString *roomId = [NSString stringWithFormat:@"%ld",roomInfo.uid];
NSString *gameMode = gameModel.gameMode ?: @"";
NSString *language = gameModel.language ?: @"";
NSDictionary *gameConfig = gameModel.gameConfig ?: @{};
int gsp = gameModel.gsp;
// APP
@@ -240,7 +248,19 @@ NSString * const kMSGameLoaded = @"gameLoaded";
[self.view removeFromSuperview]; //2
[self removeFromParentViewController]; //3
}
-(void)backBtnAction{
TTAlertConfig *config = [[TTAlertConfig alloc]init];
config.message = YMLocalizedString(@"MSRoomGameWebVC0");
config.actionStyle = TTAlertActionBothStyle;
[TTPopup alertWithConfig:config showBorder:NO confirmHandler:^{
[self willMoveToParentViewController:nil]; //1
[self.view removeFromSuperview]; //2
[self removeFromParentViewController]; //3
} cancelHandler:^{
}];
}
//
- (void) gameRecharge:(NSDictionary*)args
{
@@ -257,14 +277,22 @@ NSString * const kMSGameLoaded = @"gameLoaded";
}];
}
//
- (void) gameLoaded:(NSDictionary*)args
{
NSLog(@"BSGAME %s","游戏调⽤gameLoaded");
// TODO
[self.backBtn removeFromSuperview];
}
//
- (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation {
//progressView
}
//
- (void)webView:(WKWebView *)webView didFailProvisionalNavigation:(WKNavigation *)navigation withError:(NSError *)error {
//progressView
}
@end

View File

@@ -8,13 +8,29 @@
#import "PIBaseModel.h"
@implementation PIBaseModel
- (NSString *)description{
return [self toJSONString];
- (NSString *)debugDescription {
//NSArray NSDictionary NSNumber debugDescription
if ([self isKindOfClass:[NSArray class]] || [self isKindOfClass:[NSDictionary class]] || [self isKindOfClass:[NSString class]] || [self isKindOfClass:[NSNumber class]]) {
return [self debugDescription];
}
//
NSMutableDictionary *dictionary = [NSMutableDictionary dictionary];
//class
uint count;
objc_property_t *properties = class_copyPropertyList([self class], &count);
}
- (NSString *)debugDescription{
//KVC
for (int i = 0; i<count; i++) {
objc_property_t property = properties[i];
NSString *name = @(property_getName(property));
id value = [self valueForKey:name]?:@"nil";//nil
[dictionary setObject:value forKey:name];//
}
return [self toJSONString];
//
free(properties);
//return
return [NSString stringWithFormat:@"<%@: %p> -- %@",[self class],self,dictionary];
}
@end

View File

@@ -0,0 +1,20 @@
//
// CALayer+Animation.h
// YuMi
//
// Created by duoban on 2024/5/6.
//
#import <QuartzCore/QuartzCore.h>
NS_ASSUME_NONNULL_BEGIN
@interface CALayer (Animation)
// 暂停动画
- (void)ms_pauseAnimate;
// 恢复动画
- (void)ms_resumeAnimate;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,29 @@
//
// CALayer+Animation.m
// YuMi
//
// Created by duoban on 2024/5/6.
//
#import "CALayer+Animation.h"
@implementation CALayer (Animation)
//
- (void)ms_pauseAnimate {
CFTimeInterval pausedTime = [self convertTime:CACurrentMediaTime() fromLayer:nil];
self.speed = 0.0;
self.timeOffset = pausedTime;
}
//
- (void)ms_resumeAnimate {
CFTimeInterval pausedTime = [self timeOffset];
self.speed = 1.0;
self.timeOffset = 0.0;
self.beginTime = 0.0;
CFTimeInterval timeSincePause = [self convertTime:CACurrentMediaTime() fromLayer:nil] - pausedTime;
self.beginTime = timeSincePause;
}
@end

View File

@@ -1856,7 +1856,7 @@ ineHeadView12" = "الحمل";
"MicroGiftValueView0" = "9999 مليون+";
"MicroGiftValueView1" = "%lld مليون";
"MicroView0" = "مكان %d";
"MicroView0" = "مكان";
"MicroView1" = "موقع";
"MicroView2" = "الفريق الأحمر";
"MicroView3" = "الفريق الأزرق";
@@ -2063,10 +2063,9 @@ ineHeadView12" = "الحمل";
"XPRoomMessageParser89" = "تهانينا";
"XPRoomMessageParser90" = "الانضمام إلى نادي المعجبين";
"XPRoomMessageParser91" = "غادر نادي المعجبين";
"XPRoomMessageParser92" = "تم";
"XPRoomMessageParser93" = "طرد من الغرفة";
"XPRoomMessageParser94" = "تم وضعه في الزنزانة";
"XPRoomMessageParser95" = "الرجاء النزول من الميكروفون";
"XPRoomMessageParser93" = "تم إزالة %@ من الغرفة بواسطة %@";
"XPRoomMessageParser94" = "تم وضع %@ في الغرفة السوداء بواسطة %@";
"XPRoomMessageParser95" = "تم طلب %@ للتنحي عن الميكروفون بواسطة %@";
"XPRoomMessageParser96" = "قام بمشاركة الغرفة";
"XPRoomMessageParser97" = "بدأ متابعة مالك الغرفة";
"XPRoomMessageParser98" = "تبرع";
@@ -2076,7 +2075,7 @@ ineHeadView12" = "الحمل";
"XPRoomMessageParser102" = "ل";
"XPRoomMessageParser103" = "تمنح";
"XPRoomMessageParser104" = "قيمة ";
"XPRoomMessageParser105" = "هدايا العملات الذهبية";
"XPRoomMessageParser105" = "هدايا العملات الذهبية";
"XPRoomMessageParser106" = "أرسل هدية ل";
"XPRoomMessageParser107" = "قدم هدية ل";
"XPRoomMessageParser108" = "تم منح";
@@ -3798,5 +3797,7 @@ ineHeadView12" = "الحمل";
"MJRefreshHeaderNoneLastDateText" = "لا سجلات";
//MSRoomGameWebVC
"MSRoomGameWebVC0"="هل أنت متأكد أنك تريد الخروج من اللعبة؟";

View File

@@ -1596,7 +1596,7 @@
"MicroGiftValueView0" = "99.99M+";
"MicroGiftValueView1" = "%lldM";
"MicroView0" = "Mic %d Position";
"MicroView0" = "Mic";
"MicroView1" = "Slot";
"MicroView2" = "Red Team";
"MicroView3" = "Blue Team";
@@ -1801,10 +1801,9 @@
"XPRoomMessageParser89" = "Congratulations";
"XPRoomMessageParser90" = "Joined fan club";
"XPRoomMessageParser91" = "Left fan club";
"XPRoomMessageParser92" = "was";
"XPRoomMessageParser93" = "Kicked out of the room";
"XPRoomMessageParser94" = "Jailed";
"XPRoomMessageParser95" = "Please leave the mic";
"XPRoomMessageParser93" = "%@ was removed from the room by %@";
"XPRoomMessageParser94" = "%@ was put into the black room by %@";
"XPRoomMessageParser95" = "%@ was asked to step down from the mic by %@";
"XPRoomMessageParser96" = "Shared the room";
"XPRoomMessageParser97" = "Followed the room owner";
"XPRoomMessageParser98" = "  Reward  ";
@@ -3599,3 +3598,5 @@
"MJRefreshHeaderLastTimeText" = "Latest update:";
"MJRefreshHeaderDateTodayText" = "Today";
"MJRefreshHeaderNoneLastDateText" = "No record";
//MSRoomGameWebVC
"MSRoomGameWebVC0"="Are you sure you want to exit the game?";

View File

@@ -1415,10 +1415,9 @@
"XPRoomMessageParser89" = "恭喜";
"XPRoomMessageParser90" = "加入粉丝团";
"XPRoomMessageParser91" = "已退出粉丝团";
"XPRoomMessageParser92" = "";
"XPRoomMessageParser93" = "请出房间";
"XPRoomMessageParser94" = "关进小黑屋";
"XPRoomMessageParser95" = "请下麦";
"XPRoomMessageParser93" = "%@被%@请出房间";
"XPRoomMessageParser94" = "%@被%@关进小黑屋";
"XPRoomMessageParser95" = "%@被%@请下麦";
"XPRoomMessageParser96" = "分享了房间";
"XPRoomMessageParser97" = "关注了房主";
"XPRoomMessageParser98" = " 打赏 ";
@@ -3255,3 +3254,5 @@
"MJRefreshHeaderLastTimeText" = "最后更新:";
"MJRefreshHeaderDateTodayText" = "今天";
"MJRefreshHeaderNoneLastDateText" = "无记录";
//MSRoomGameWebVC
"MSRoomGameWebVC0"="确定退出游戏吗?";

View File

@@ -1418,10 +1418,9 @@
"XPRoomMessageParser89" = "恭喜";
"XPRoomMessageParser90" = "加入粉絲團";
"XPRoomMessageParser91" = "已退出粉絲團";
"XPRoomMessageParser92" = "";
"XPRoomMessageParser93" = "請出房間";
"XPRoomMessageParser94" = "關進小黑屋";
"XPRoomMessageParser95" = "請下麥";
"XPRoomMessageParser93" = "%@被%@請出房間";
"XPRoomMessageParser94" = "%@被%@關進小黑屋";
"XPRoomMessageParser95" = "%@被%@請下麥";
"XPRoomMessageParser96" = "分享了房間";
"XPRoomMessageParser97" = "關註了房主";
"XPRoomMessageParser98" = " 打賞 ";
@@ -3249,3 +3248,5 @@
"MJRefreshHeaderLastTimeText" = "最後更新:";
"MJRefreshHeaderDateTodayText" = "今天";
"MJRefreshHeaderNoneLastDateText" = "無記錄";
//MSRoomGameWebVC
"MSRoomGameWebVC0"="確定退出遊戲嗎?";