消息模块-送礼物消息
This commit is contained in:
@@ -59,6 +59,8 @@
|
||||
@property (nonatomic,assign) int normalGiftRetryCount;
|
||||
///背包礼物的重试次数
|
||||
@property (nonatomic,assign) int packGiftRetryCount;
|
||||
///
|
||||
@property (nonatomic,strong) NSArray<XPGiftUserInfoModel *> *userArray;
|
||||
@end
|
||||
|
||||
@implementation XPSendGiftView
|
||||
@@ -71,7 +73,7 @@
|
||||
NSLog(@"六面板销毁了");
|
||||
}
|
||||
|
||||
- (instancetype)initWithType:(SendGiftType)type uid:(NSString *)uid{
|
||||
- (instancetype)initWithType:(SendGiftType)type uid:(NSString * __nullable)uid{
|
||||
if (self = [super init]) {
|
||||
self.modalPresentationStyle = UIModalPresentationOverFullScreen;
|
||||
self.roomUid = uid;
|
||||
@@ -227,7 +229,8 @@
|
||||
}
|
||||
|
||||
- (void)sendCustomMessage:(AttachmentModel *)attachment {
|
||||
NSString *sessionID = [NSString stringWithFormat:@"%ld", [self.delegate getRoomInfo].roomId];
|
||||
|
||||
NSString *sessionID = self.usingplaceType == SendGiftType_User ? [NSString stringWithFormat:@"%ld", self.userArray.firstObject.uid] : [NSString stringWithFormat:@"%ld", [self.delegate getRoomInfo].roomId];
|
||||
NIMMessage *message = [[NIMMessage alloc]init];
|
||||
NIMCustomObject *object = [[NIMCustomObject alloc] init];
|
||||
object.attachment = attachment;
|
||||
@@ -239,9 +242,9 @@
|
||||
extModel.iosBubbleUrl = userInfo.iosBubbleUrl;
|
||||
NSMutableDictionary *remoteExt = [NSMutableDictionary dictionaryWithObject:extModel.model2dictionary forKey:[NSString stringWithFormat:@"%ld", userInfo.uid]];
|
||||
message.remoteExt = remoteExt;
|
||||
|
||||
NIMSessionType sessionType = self.usingplaceType == SendGiftType_Room ? NIMSessionTypeChatroom : NIMSessionTypeP2P;
|
||||
//构造会话
|
||||
NIMSession *session = [NIMSession session:sessionID type:NIMSessionTypeChatroom];
|
||||
NIMSession *session = [NIMSession session:sessionID type:sessionType];
|
||||
[[NIMSDK sharedSDK].chatManager sendMessage:message toSession:session error:nil];
|
||||
}
|
||||
|
||||
@@ -292,6 +295,7 @@
|
||||
|
||||
#pragma mark - Public Method
|
||||
- (void)configGiftUsers:(NSArray<XPGiftUserInfoModel *> *)users {
|
||||
self.userArray = users;
|
||||
[self.userView configGiftUsers:users];
|
||||
}
|
||||
#pragma mark - XPGiftBarViewDelegate
|
||||
@@ -323,6 +327,21 @@
|
||||
[self showErrorToast:@"请选择至少一个人"];
|
||||
return;
|
||||
}
|
||||
} else if(self.usingplaceType == SendGiftType_User) {
|
||||
///送礼物的人
|
||||
NSString * uidString = [self dealSendGiftUids:uids];
|
||||
///送礼物的个数
|
||||
NSString * giftNumber = [self dealSendGiftCount:giftCount gift:giftInfo];
|
||||
///送的什么礼物
|
||||
NSString * giftId = [NSString stringWithFormat:@"%ld", giftInfo.giftId];
|
||||
///给麦上的人送礼物
|
||||
GiftSendType sendType = GiftSendType_Chat;
|
||||
///礼物来源
|
||||
GiftSourceType sourceType = giftInfo.sourceType;
|
||||
///送一个人 还是全麦 还是多人非全麦
|
||||
RoomSendGiftType roomSendType = RoomSendGiftType_ToOne;
|
||||
self.giftBarView.sendButtonIsEnable = NO;
|
||||
[self.presenter sendGift:uidString giftNum:giftNumber sendType:sendType giftId:giftId giftSource:sourceType giftType:giftInfo.giftType roomSendType:roomSendType roomUid:self.roomUid msg:@""];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -452,6 +471,11 @@
|
||||
self.giftInfoView.curUserNobleLevel = self.delegate.getUserInfo.userVipInfoVO.vipLevel;
|
||||
}
|
||||
|
||||
- (void)setUsingplaceType:(SendGiftType)usingplaceType {
|
||||
_usingplaceType = usingplaceType;
|
||||
self.giftInfoView.usingplaceType = _usingplaceType;
|
||||
}
|
||||
|
||||
- (UIView *)topView {
|
||||
if (!_topView) {
|
||||
_topView = [[UIView alloc] init];
|
||||
|
Reference in New Issue
Block a user