全服红包接收、进房,红包小秘书消息跳转
@@ -203,6 +203,7 @@
|
|||||||
9B86D8802817F4A300494FCD /* XPNobleSettingNavView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B86D87F2817F4A300494FCD /* XPNobleSettingNavView.m */; };
|
9B86D8802817F4A300494FCD /* XPNobleSettingNavView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B86D87F2817F4A300494FCD /* XPNobleSettingNavView.m */; };
|
||||||
9B86D88328192DC000494FCD /* XPRoomRankEntranceView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B86D88228192DC000494FCD /* XPRoomRankEntranceView.m */; };
|
9B86D88328192DC000494FCD /* XPRoomRankEntranceView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B86D88228192DC000494FCD /* XPRoomRankEntranceView.m */; };
|
||||||
9B86D886281942D200494FCD /* SocialMicroView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B86D885281942D200494FCD /* SocialMicroView.m */; };
|
9B86D886281942D200494FCD /* SocialMicroView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B86D885281942D200494FCD /* SocialMicroView.m */; };
|
||||||
|
9B88E20C28C5EB8300D26FBA /* MessageContentRedPacketView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B88E20B28C5EB8300D26FBA /* MessageContentRedPacketView.m */; };
|
||||||
9B8DE0E1289CF02900FB6EC2 /* XPGiftCompoundModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B8DE0E0289CF02900FB6EC2 /* XPGiftCompoundModel.m */; };
|
9B8DE0E1289CF02900FB6EC2 /* XPGiftCompoundModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B8DE0E0289CF02900FB6EC2 /* XPGiftCompoundModel.m */; };
|
||||||
9B8DE0E4289CF7AA00FB6EC2 /* XPRoomGiftCompoundView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B8DE0E3289CF7AA00FB6EC2 /* XPRoomGiftCompoundView.m */; };
|
9B8DE0E4289CF7AA00FB6EC2 /* XPRoomGiftCompoundView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B8DE0E3289CF7AA00FB6EC2 /* XPRoomGiftCompoundView.m */; };
|
||||||
9B8DE0E8289CFE8100FB6EC2 /* compound_gift_banner.svga in Resources */ = {isa = PBXBuildFile; fileRef = 9B8DE0E7289CFE8100FB6EC2 /* compound_gift_banner.svga */; };
|
9B8DE0E8289CFE8100FB6EC2 /* compound_gift_banner.svga in Resources */ = {isa = PBXBuildFile; fileRef = 9B8DE0E7289CFE8100FB6EC2 /* compound_gift_banner.svga */; };
|
||||||
@@ -1562,6 +1563,8 @@
|
|||||||
9B86D88228192DC000494FCD /* XPRoomRankEntranceView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPRoomRankEntranceView.m; sourceTree = "<group>"; };
|
9B86D88228192DC000494FCD /* XPRoomRankEntranceView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPRoomRankEntranceView.m; sourceTree = "<group>"; };
|
||||||
9B86D884281942D200494FCD /* SocialMicroView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SocialMicroView.h; sourceTree = "<group>"; };
|
9B86D884281942D200494FCD /* SocialMicroView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SocialMicroView.h; sourceTree = "<group>"; };
|
||||||
9B86D885281942D200494FCD /* SocialMicroView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SocialMicroView.m; sourceTree = "<group>"; };
|
9B86D885281942D200494FCD /* SocialMicroView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SocialMicroView.m; sourceTree = "<group>"; };
|
||||||
|
9B88E20A28C5EB8300D26FBA /* MessageContentRedPacketView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MessageContentRedPacketView.h; sourceTree = "<group>"; };
|
||||||
|
9B88E20B28C5EB8300D26FBA /* MessageContentRedPacketView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MessageContentRedPacketView.m; sourceTree = "<group>"; };
|
||||||
9B8DE0DF289CF02900FB6EC2 /* XPGiftCompoundModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPGiftCompoundModel.h; sourceTree = "<group>"; };
|
9B8DE0DF289CF02900FB6EC2 /* XPGiftCompoundModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPGiftCompoundModel.h; sourceTree = "<group>"; };
|
||||||
9B8DE0E0289CF02900FB6EC2 /* XPGiftCompoundModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPGiftCompoundModel.m; sourceTree = "<group>"; };
|
9B8DE0E0289CF02900FB6EC2 /* XPGiftCompoundModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPGiftCompoundModel.m; sourceTree = "<group>"; };
|
||||||
9B8DE0E2289CF7AA00FB6EC2 /* XPRoomGiftCompoundView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomGiftCompoundView.h; sourceTree = "<group>"; };
|
9B8DE0E2289CF7AA00FB6EC2 /* XPRoomGiftCompoundView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomGiftCompoundView.h; sourceTree = "<group>"; };
|
||||||
@@ -4013,6 +4016,8 @@
|
|||||||
E85E3FA628B7A6F000268DC8 /* MessageContentMonentsView.m */,
|
E85E3FA628B7A6F000268DC8 /* MessageContentMonentsView.m */,
|
||||||
E80A63DA28B86B9700690914 /* MessageContentMonentsAutoView.h */,
|
E80A63DA28B86B9700690914 /* MessageContentMonentsAutoView.h */,
|
||||||
E80A63DB28B86B9700690914 /* MessageContentMonentsAutoView.m */,
|
E80A63DB28B86B9700690914 /* MessageContentMonentsAutoView.m */,
|
||||||
|
9B88E20A28C5EB8300D26FBA /* MessageContentRedPacketView.h */,
|
||||||
|
9B88E20B28C5EB8300D26FBA /* MessageContentRedPacketView.m */,
|
||||||
);
|
);
|
||||||
path = Content;
|
path = Content;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@@ -9490,6 +9495,7 @@
|
|||||||
9B8DE0E4289CF7AA00FB6EC2 /* XPRoomGiftCompoundView.m in Sources */,
|
9B8DE0E4289CF7AA00FB6EC2 /* XPRoomGiftCompoundView.m in Sources */,
|
||||||
1808072D2731598F001FD836 /* XPNetImageYYLabel.m in Sources */,
|
1808072D2731598F001FD836 /* XPNetImageYYLabel.m in Sources */,
|
||||||
E818E348286ECA4B005EDF68 /* XPMonentsPublishViewController.m in Sources */,
|
E818E348286ECA4B005EDF68 /* XPMonentsPublishViewController.m in Sources */,
|
||||||
|
9B88E20C28C5EB8300D26FBA /* MessageContentRedPacketView.m in Sources */,
|
||||||
E800806827FD3B520055A8AB /* XPClanMenuView.m in Sources */,
|
E800806827FD3B520055A8AB /* XPClanMenuView.m in Sources */,
|
||||||
E896EFAF2771AF0F00AD2CC1 /* XPMineFriendEmptyTableViewCell.m in Sources */,
|
E896EFAF2771AF0F00AD2CC1 /* XPMineFriendEmptyTableViewCell.m in Sources */,
|
||||||
E8E859E928264F4500EE4857 /* XPRoomTransferMusicViewController.m in Sources */,
|
E8E859E928264F4500EE4857 /* XPRoomTransferMusicViewController.m in Sources */,
|
||||||
|
21
xplan-ios/Assets.xcassets/Room/RedPacket/redPacket_entrance.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
{
|
||||||
|
"images" : [
|
||||||
|
{
|
||||||
|
"filename" : "redPacket_entrance.png",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "1x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "2x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "3x"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
BIN
xplan-ios/Assets.xcassets/Room/RedPacket/redPacket_entrance.imageset/redPacket_entrance.png
vendored
Normal file
After Width: | Height: | Size: 7.3 KiB |
22
xplan-ios/Assets.xcassets/Room/RedPacket/redPacket_msg_icon.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"images" : [
|
||||||
|
{
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "1x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename" : "redPacket_msg_icon@2x.png",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "2x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename" : "redPacket_msg_icon@3x.png",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "3x"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
BIN
xplan-ios/Assets.xcassets/Room/RedPacket/redPacket_msg_icon.imageset/redPacket_msg_icon@2x.png
vendored
Normal file
After Width: | Height: | Size: 5.3 KiB |
BIN
xplan-ios/Assets.xcassets/Room/RedPacket/redPacket_msg_icon.imageset/redPacket_msg_icon@3x.png
vendored
Normal file
After Width: | Height: | Size: 9.9 KiB |
22
xplan-ios/Assets.xcassets/Room/RedPacket/redPacket_msg_inValid_bg.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"images" : [
|
||||||
|
{
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "1x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename" : "redPacket_msg_inValid_bg@2x.png",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "2x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename" : "redPacket_msg_inValid_bg@3x.png",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "3x"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
After Width: | Height: | Size: 916 B |
After Width: | Height: | Size: 1.9 KiB |
22
xplan-ios/Assets.xcassets/Room/RedPacket/redPacket_msg_valid_bg.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"images" : [
|
||||||
|
{
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "1x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename" : "redPacket_msg_valid_bg@2x.png",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "2x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename" : "redPacket_msg_valid_bg@3x.png",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "3x"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
After Width: | Height: | Size: 916 B |
After Width: | Height: | Size: 1.9 KiB |
@@ -16,6 +16,7 @@ UIKIT_EXTERN NSString * const kTeenagerAlertDatekey;
|
|||||||
UIKIT_EXTERN NSString * const kRoomMiniNotificationKey;
|
UIKIT_EXTERN NSString * const kRoomMiniNotificationKey;
|
||||||
UIKIT_EXTERN NSString * const kVisitorUnReadCountNotificationKey;
|
UIKIT_EXTERN NSString * const kVisitorUnReadCountNotificationKey;
|
||||||
UIKIT_EXTERN NSString * const kHadShowNewUserGiftKey;
|
UIKIT_EXTERN NSString * const kHadShowNewUserGiftKey;
|
||||||
|
UIKIT_EXTERN NSString * const kRedPacketHistory;
|
||||||
|
|
||||||
typedef NS_ENUM(NSUInteger, KeyType) {
|
typedef NS_ENUM(NSUInteger, KeyType) {
|
||||||
KeyType_PasswordEncode,///密码 des 加密的
|
KeyType_PasswordEncode,///密码 des 加密的
|
||||||
|
@@ -25,6 +25,7 @@ NSString * const kHadShowNewUserGiftKey = @"kHadShowNewUserGiftKey";//新用户
|
|||||||
NSString * const kNewUserRechargeKey = @"kNewUserRechargeKey";//新用户充值优惠 不同于房间内首充
|
NSString * const kNewUserRechargeKey = @"kNewUserRechargeKey";//新用户充值优惠 不同于房间内首充
|
||||||
NSString * const kFromSearchToHomeViewKey = @"kFromSearchToHomeViewKey";//用户第一次从搜索页返回首页
|
NSString * const kFromSearchToHomeViewKey = @"kFromSearchToHomeViewKey";//用户第一次从搜索页返回首页
|
||||||
NSString * const kTabShowAnchorCardKey = @"kTabShowAnchorCardKey"; //tab展示主播卡片
|
NSString * const kTabShowAnchorCardKey = @"kTabShowAnchorCardKey"; //tab展示主播卡片
|
||||||
|
NSString * const kRedPacketHistory = @"kRedPacketHistory";
|
||||||
|
|
||||||
///在里面进行判断当前环境是什么
|
///在里面进行判断当前环境是什么
|
||||||
NSString * const KeyWithType(KeyType type) {
|
NSString * const KeyWithType(KeyType type) {
|
||||||
|
@@ -321,8 +321,8 @@ typedef NS_ENUM(NSUInteger, Custom_Noti_Sub_Dynamic) {
|
|||||||
typedef NS_ENUM(NSUInteger, CustomMessageSubRedPacket) {
|
typedef NS_ENUM(NSUInteger, CustomMessageSubRedPacket) {
|
||||||
Custom_Message_Sub_RoomGiftRedPacket = 601, //房间礼物红包
|
Custom_Message_Sub_RoomGiftRedPacket = 601, //房间礼物红包
|
||||||
Custom_Message_Sub_RoomDiamandRedPacket = 602, //房间钻石红包
|
Custom_Message_Sub_RoomDiamandRedPacket = 602, //房间钻石红包
|
||||||
Custom_Message_Sub_AllDiamandRedPacket = 603, //全服礼物红包
|
Custom_Message_Sub_AllGiftRedPacket = 603, //全服礼物红包
|
||||||
Custom_Message_Sub_AllGiftRedPacket = 604, //全服钻石红包
|
Custom_Message_Sub_AllDiamandRedPacket = 604, //全服钻石红包
|
||||||
Custom_Message_Sub_OpenRedPacketSuccess = 605,//抢红包成功
|
Custom_Message_Sub_OpenRedPacketSuccess = 605,//抢红包成功
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -60,6 +60,8 @@
|
|||||||
return text.length > 0 ? text : @"[消息]";
|
return text.length > 0 ? text : @"[消息]";
|
||||||
} else if(attachment.first == CustomMessageType_Monents && attachment.second == Custom_Message_Sub_Monents_Share) {
|
} else if(attachment.first == CustomMessageType_Monents && attachment.second == Custom_Message_Sub_Monents_Share) {
|
||||||
return @"[分享了一条动态]";
|
return @"[分享了一条动态]";
|
||||||
|
} else if(attachment.first == CustomMessageType_RedPacket && attachment.second == Custom_Message_Sub_AllDiamandRedPacket) {
|
||||||
|
return @"[你收到一个全服红包]";
|
||||||
} else {
|
} else {
|
||||||
text = @"[消息]";
|
text = @"[消息]";
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,16 @@
|
|||||||
|
//
|
||||||
|
// MessageContentRedPacketView.h
|
||||||
|
// xplan-ios
|
||||||
|
//
|
||||||
|
// Created by GreenLand on 2022/9/5.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "MessageContentCustomView.h"
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
|
@interface MessageContentRedPacketView : MessageContentCustomView
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,214 @@
|
|||||||
|
//
|
||||||
|
// MessageContentRedPacketView.m
|
||||||
|
// xplan-ios
|
||||||
|
//
|
||||||
|
// Created by GreenLand on 2022/9/5.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "MessageContentRedPacketView.h"
|
||||||
|
///Third
|
||||||
|
#import <Masonry/Masonry.h>
|
||||||
|
#import "ThemeColor.h"
|
||||||
|
#import "XPReceiveRedPacketModel.h"
|
||||||
|
#import "NSObject+MJExtension.h"
|
||||||
|
#import "XPConstant.h"
|
||||||
|
#import "XCCurrentVCStackManager.h"
|
||||||
|
#import "XPRoomViewController.h"
|
||||||
|
#import "RoomHostDelegate.h"
|
||||||
|
|
||||||
|
#define MESSAGE_MAX_WIDTH 260
|
||||||
|
|
||||||
|
@interface MessageContentRedPacketView ()
|
||||||
|
|
||||||
|
@property (nonatomic, strong) UIImageView *bgImageView;
|
||||||
|
///红包icon
|
||||||
|
@property (nonatomic, strong) UIImageView *redPacketImageView;
|
||||||
|
///显示标题
|
||||||
|
@property (nonatomic,strong) UILabel *titleLabel;
|
||||||
|
///发出一个全服红包
|
||||||
|
@property (nonatomic,strong) UILabel *subLabel;
|
||||||
|
///分割线
|
||||||
|
@property (nonatomic, strong) UIView *devideView;
|
||||||
|
///领取说明
|
||||||
|
@property (nonatomic, strong) UILabel *descLabel;
|
||||||
|
///消息的信息
|
||||||
|
@property (nonatomic,strong) XPReceiveRedPacketModel *messageInfo;
|
||||||
|
@property (nonatomic,strong) AttachmentModel *attachment;
|
||||||
|
@property (nonatomic,strong) NIMMessage *message;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation MessageContentRedPacketView
|
||||||
|
|
||||||
|
+ (CGFloat)measureHeight:(NIMMessage *)message {
|
||||||
|
return 95 + CONTENT_PADDING_V_TOTAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)initSubViews {
|
||||||
|
[super initSubViews];
|
||||||
|
[self.backView addSubview:self.bgImageView];
|
||||||
|
[self.backView addSubview:self.redPacketImageView];
|
||||||
|
[self.backView addSubview:self.titleLabel];
|
||||||
|
[self.backView addSubview:self.subLabel];
|
||||||
|
[self.backView addSubview:self.devideView];
|
||||||
|
[self.backView addSubview:self.descLabel];
|
||||||
|
|
||||||
|
UITapGestureRecognizer * tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(event:)];
|
||||||
|
[self.bgImageView addGestureRecognizer:tapGesture];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)initSubViewConstraints {
|
||||||
|
[super initSubViewConstraints];
|
||||||
|
[self.backView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
|
make.width.mas_equalTo(MESSAGE_MAX_WIDTH);
|
||||||
|
make.height.mas_equalTo(95);
|
||||||
|
make.edges.mas_equalTo(self).insets(UIEdgeInsetsMake(0, 0, 0, 0));
|
||||||
|
}];
|
||||||
|
[self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
|
make.width.mas_equalTo(MESSAGE_MAX_WIDTH);
|
||||||
|
make.top.mas_equalTo(self.backView);
|
||||||
|
make.height.mas_equalTo(95);
|
||||||
|
make.left.mas_equalTo(self.backView);
|
||||||
|
}];
|
||||||
|
[self.redPacketImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
|
make.left.mas_equalTo(self.backView).mas_offset(16);
|
||||||
|
make.width.mas_equalTo(31);
|
||||||
|
make.height.mas_equalTo(40);
|
||||||
|
make.top.mas_equalTo(self.backView).mas_offset(13);
|
||||||
|
}];
|
||||||
|
|
||||||
|
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
|
make.left.mas_equalTo(self.redPacketImageView.mas_right).mas_offset(6);
|
||||||
|
make.height.mas_equalTo(16);
|
||||||
|
make.top.mas_equalTo(self.redPacketImageView).mas_offset(12);
|
||||||
|
}];
|
||||||
|
|
||||||
|
[self.subLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
|
make.left.mas_equalTo(self.titleLabel);
|
||||||
|
make.top.mas_equalTo(self.titleLabel.mas_bottom).mas_offset(8);
|
||||||
|
make.height.mas_equalTo(13);
|
||||||
|
}];
|
||||||
|
[self.devideView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
|
make.left.mas_equalTo(16);
|
||||||
|
make.right.mas_equalTo(-8);
|
||||||
|
make.top.mas_equalTo(self.redPacketImageView.mas_bottom).offset(11);
|
||||||
|
make.height.mas_equalTo(0.5);
|
||||||
|
}];
|
||||||
|
[self.descLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
|
make.left.mas_equalTo(16);
|
||||||
|
make.top.mas_equalTo(self.devideView.mas_bottom).offset(9);
|
||||||
|
make.height.mas_equalTo(13);
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)render:(NIMMessage *)message {
|
||||||
|
self.message = message;
|
||||||
|
NIMCustomObject *obj = (NIMCustomObject *)message.messageObject;
|
||||||
|
AttachmentModel * attach = obj.attachment;
|
||||||
|
self.attachment = attach;
|
||||||
|
XPReceiveRedPacketModel * info = [XPReceiveRedPacketModel modelWithJSON:attach.data];
|
||||||
|
self.messageInfo = info;
|
||||||
|
//超过半小时就是失效
|
||||||
|
NSTimeInterval now = [[NSDate date] timeIntervalSince1970];
|
||||||
|
if (now - message.timestamp > 60*30) {
|
||||||
|
self.titleLabel.text = @"红包已失效";
|
||||||
|
self.descLabel.text = @"下次要快点来哦~";
|
||||||
|
self.subLabel.hidden = YES;
|
||||||
|
self.bgImageView.image = [UIImage imageNamed:@"redPacket_msg_inValid_bg"];
|
||||||
|
self.bgImageView.userInteractionEnabled = NO;
|
||||||
|
} else {
|
||||||
|
NSArray *redPacketHistory = [[NSUserDefaults standardUserDefaults] objectForKey:kRedPacketHistory];
|
||||||
|
if (info) {
|
||||||
|
if ([redPacketHistory containsObject:info.redEnvelopeId]) {
|
||||||
|
self.subLabel.hidden = YES;
|
||||||
|
self.titleLabel.text = @"红包已领取";
|
||||||
|
self.bgImageView.image = [UIImage imageNamed:@"redPacket_msg_inValid_bg"];
|
||||||
|
self.descLabel.text = @"可前往账单查看详情";
|
||||||
|
self.bgImageView.userInteractionEnabled = NO;
|
||||||
|
} else {
|
||||||
|
self.titleLabel.text = info.sendUserNick;
|
||||||
|
self.descLabel.text = @"点击进房领取>";
|
||||||
|
self.subLabel.hidden = NO;
|
||||||
|
self.bgImageView.image = [UIImage imageNamed:@"redPacket_msg_valid_bg"];
|
||||||
|
self.bgImageView.userInteractionEnabled = YES;
|
||||||
|
[self.titleLabel mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||||
|
make.top.mas_equalTo(self.redPacketImageView).mas_offset(5);
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)event:(UITapGestureRecognizer *)gesture {
|
||||||
|
UIViewController * controllerView = [XCCurrentVCStackManager shareManager].getCurrentVC;
|
||||||
|
//退出原来的房间 如果有的话 TODO 总感觉这种处理不太优雅 进房入口多了 怎么办 进房需要整合
|
||||||
|
[controllerView.navigationController.viewControllers enumerateObjectsUsingBlock:^(__kindof UIViewController * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||||
|
if ([obj isKindOfClass:[XPRoomViewController class]]) {
|
||||||
|
[controllerView.navigationController popToRootViewControllerAnimated:NO];
|
||||||
|
XPRoomViewController<RoomHostDelegate> * rooomVC = obj;
|
||||||
|
[rooomVC exitRoom];
|
||||||
|
*stop = YES;
|
||||||
|
}
|
||||||
|
}];
|
||||||
|
dispatch_after(1.0, dispatch_get_main_queue(), ^{
|
||||||
|
[XPRoomViewController openRoom:self.messageInfo.roomUid viewController:[XCCurrentVCStackManager shareManager].getCurrentVC];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma mark - Getters And Setters
|
||||||
|
- (UIImageView *)bgImageView {
|
||||||
|
if (!_bgImageView) {
|
||||||
|
_bgImageView = [[UIImageView alloc] init];
|
||||||
|
_bgImageView.image = [UIImage imageNamed:@"redPacket_msg_valid_bg"];
|
||||||
|
self.bgImageView.userInteractionEnabled = YES;
|
||||||
|
}
|
||||||
|
return _bgImageView;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (UIImageView *)redPacketImageView {
|
||||||
|
if (!_redPacketImageView) {
|
||||||
|
_redPacketImageView = [[UIImageView alloc] init];
|
||||||
|
_redPacketImageView.contentMode = UIViewContentModeScaleAspectFit;
|
||||||
|
_redPacketImageView.image = [UIImage imageNamed:@"redPacket_msg_icon"];
|
||||||
|
}
|
||||||
|
return _redPacketImageView;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (UILabel *)titleLabel {
|
||||||
|
if (!_titleLabel) {
|
||||||
|
_titleLabel = [[UILabel alloc] init];
|
||||||
|
_titleLabel.textAlignment= NSTextAlignmentCenter;
|
||||||
|
_titleLabel.font = [UIFont systemFontOfSize:16];
|
||||||
|
_titleLabel.textColor = [UIColor whiteColor];
|
||||||
|
}
|
||||||
|
return _titleLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (UILabel *)subLabel {
|
||||||
|
if (!_subLabel) {
|
||||||
|
_subLabel = [[UILabel alloc] init];
|
||||||
|
_subLabel.text = @"发出了一个全服红包";
|
||||||
|
_subLabel.font = [UIFont systemFontOfSize:13];
|
||||||
|
_subLabel.textColor = [UIColor whiteColor];
|
||||||
|
}
|
||||||
|
return _subLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (UILabel *)descLabel {
|
||||||
|
if (!_descLabel) {
|
||||||
|
_descLabel = [[UILabel alloc] init];
|
||||||
|
_descLabel.font = [UIFont systemFontOfSize:13];
|
||||||
|
_descLabel.textColor = [UIColor whiteColor];
|
||||||
|
}
|
||||||
|
return _descLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (UIView *)devideView {
|
||||||
|
if (!_devideView) {
|
||||||
|
_devideView = [[UIView alloc] init];
|
||||||
|
_devideView.backgroundColor = [UIColor whiteColor];
|
||||||
|
}
|
||||||
|
return _devideView;
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
@@ -24,6 +24,7 @@
|
|||||||
#import "MessageContentRiskAlertView.h"
|
#import "MessageContentRiskAlertView.h"
|
||||||
#import "MessageContentMonentsView.h"
|
#import "MessageContentMonentsView.h"
|
||||||
#import "MessageContentMonentsAutoView.h"
|
#import "MessageContentMonentsAutoView.h"
|
||||||
|
#import "MessageContentRedPacketView.h"
|
||||||
|
|
||||||
#import "AttachmentModel.h"
|
#import "AttachmentModel.h"
|
||||||
#import "NetImageView.h"
|
#import "NetImageView.h"
|
||||||
@@ -264,6 +265,8 @@
|
|||||||
return @"MessageContentMonentsAutoView";
|
return @"MessageContentMonentsAutoView";
|
||||||
} else if(attachment.first == CustomMessageType_Message_Handle && attachment.second == Custom_Message_Sub_Message_Handle_Content) {
|
} else if(attachment.first == CustomMessageType_Message_Handle && attachment.second == Custom_Message_Sub_Message_Handle_Content) {
|
||||||
return @"MessageContentMonentsAutoView";
|
return @"MessageContentMonentsAutoView";
|
||||||
|
} else if (attachment.first == CustomMessageType_RedPacket && attachment.second == Custom_Message_Sub_AllDiamandRedPacket) {
|
||||||
|
return @"MessageContentRedPacketView";
|
||||||
} else {
|
} else {
|
||||||
return @"MessageContentUnSupportView";
|
return @"MessageContentUnSupportView";
|
||||||
}
|
}
|
||||||
@@ -313,6 +316,8 @@
|
|||||||
return [MessageContentMonentsAutoView measureHeight:message];
|
return [MessageContentMonentsAutoView measureHeight:message];
|
||||||
}else if(attachment.first == CustomMessageType_Message_Handle && attachment.second == Custom_Message_Sub_Message_Handle_Content) {
|
}else if(attachment.first == CustomMessageType_Message_Handle && attachment.second == Custom_Message_Sub_Message_Handle_Content) {
|
||||||
return [MessageContentMonentsAutoView measureHeight:message];
|
return [MessageContentMonentsAutoView measureHeight:message];
|
||||||
|
} else if (attachment.first == CustomMessageType_RedPacket && attachment.second == Custom_Message_Sub_AllDiamandRedPacket){
|
||||||
|
return [MessageContentRedPacketView measureHeight:message];
|
||||||
} else {
|
} else {
|
||||||
return [MessageContentUnSupportView measureHeight:message];
|
return [MessageContentUnSupportView measureHeight:message];
|
||||||
}
|
}
|
||||||
@@ -388,6 +393,12 @@
|
|||||||
return self.messageContent;
|
return self.messageContent;
|
||||||
}
|
}
|
||||||
return [[MessageContentMonentsAutoView alloc] init];
|
return [[MessageContentMonentsAutoView alloc] init];
|
||||||
|
} else if(attachment.first == CustomMessageType_RedPacket && attachment.second == Custom_Message_Sub_AllDiamandRedPacket) {
|
||||||
|
self.messageBackground.backgroundColor = [UIColor clearColor];
|
||||||
|
if ([self.messageContent isKindOfClass:[MessageContentRedPacketView class]]) {
|
||||||
|
return self.messageContent;
|
||||||
|
}
|
||||||
|
return [[MessageContentRedPacketView alloc] init];
|
||||||
} else {
|
} else {
|
||||||
if ([self.messageContent isKindOfClass:[MessageContentUnSupportView class]]) {
|
if ([self.messageContent isKindOfClass:[MessageContentUnSupportView class]]) {
|
||||||
return self.messageContent;
|
return self.messageContent;
|
||||||
|
@@ -194,6 +194,11 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
/// @param roomUid 房间uid
|
/// @param roomUid 房间uid
|
||||||
+ (void)requestNewUserInRoomGift:(HttpRequestHelperCompletion)completion roomUid:(NSString *)roomUid;
|
+ (void)requestNewUserInRoomGift:(HttpRequestHelperCompletion)completion roomUid:(NSString *)roomUid;
|
||||||
|
|
||||||
|
/// 获取红包信息
|
||||||
|
/// @param completion 完成
|
||||||
|
/// @param roomUid 房间Uid
|
||||||
|
+ (void)requestRedPacket:(HttpRequestHelperCompletion)completion uid:(NSString *)roomUid;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
NS_ASSUME_NONNULL_END
|
||||||
|
@@ -233,5 +233,11 @@
|
|||||||
[self makeRequest:@"gift/newUser/inRoom" method:HttpRequestHelperMethodGET completion:completion, __FUNCTION__, roomUid, nil];
|
[self makeRequest:@"gift/newUser/inRoom" method:HttpRequestHelperMethodGET completion:completion, __FUNCTION__, roomUid, nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// 获取红包信息
|
||||||
|
/// @param completion 完成
|
||||||
|
/// @param roomUid 房间Uid
|
||||||
|
+ (void)requestRedPacket:(HttpRequestHelperCompletion)completion uid:(NSString *)roomUid {
|
||||||
|
[self makeRequest:@"room/red-envelop" method:HttpRequestHelperMethodGET completion:completion, __FUNCTION__, roomUid, nil];
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@@ -57,6 +57,9 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
///获取当前房间是否有效
|
///获取当前房间是否有效
|
||||||
- (void)getCurrentRoomInfo:(NSString *)roomUid;
|
- (void)getCurrentRoomInfo:(NSString *)roomUid;
|
||||||
|
|
||||||
|
///获取红包信息
|
||||||
|
- (void)getRedPacket:(NSString *)roomUid;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
NS_ASSUME_NONNULL_END
|
||||||
|
@@ -20,6 +20,7 @@
|
|||||||
#import "XPMessageRemoteExtModel.h"
|
#import "XPMessageRemoteExtModel.h"
|
||||||
#import "RoomNewUserGreetModel.h"
|
#import "RoomNewUserGreetModel.h"
|
||||||
#import "XPRoomRecommendModel.h"
|
#import "XPRoomRecommendModel.h"
|
||||||
|
#import "XPRedPacketModel.h"
|
||||||
///P
|
///P
|
||||||
#import "XPRoomProtocol.h"
|
#import "XPRoomProtocol.h"
|
||||||
|
|
||||||
@@ -228,4 +229,12 @@
|
|||||||
}] uid:roomUid intoUid:uid];
|
}] uid:roomUid intoUid:uid];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///获取房间红包
|
||||||
|
- (void)getRedPacket:(NSString *)roomUid {
|
||||||
|
[Api requestRedPacket:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||||
|
NSArray *array = [XPRedPacketModel modelsWithArray:data.data];
|
||||||
|
[[self getView] getRedPacketSuccess:array];
|
||||||
|
}] uid:roomUid];
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@@ -27,6 +27,9 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
- (void)getNextAnchorRoomSuccess:(RoomInfoModel *)roomInfo;
|
- (void)getNextAnchorRoomSuccess:(RoomInfoModel *)roomInfo;
|
||||||
///获取当前房间的信息
|
///获取当前房间的信息
|
||||||
- (void)getCurrentRoomInfoSuccess:(RoomInfoModel *_Nullable)roomInfo;
|
- (void)getCurrentRoomInfoSuccess:(RoomInfoModel *_Nullable)roomInfo;
|
||||||
|
///获取红包成功
|
||||||
|
- (void)getRedPacketSuccess:(NSArray *)list;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
NS_ASSUME_NONNULL_END
|
||||||
|
@@ -109,7 +109,7 @@
|
|||||||
|
|
||||||
XPRoomMoreItemModel * redPacket = [[XPRoomMoreItemModel alloc] init];
|
XPRoomMoreItemModel * redPacket = [[XPRoomMoreItemModel alloc] init];
|
||||||
redPacket.title = @"红包";
|
redPacket.title = @"红包";
|
||||||
redPacket.imageName = @"room_more_menu_trumpet";
|
redPacket.imageName = @"redPacket_entrance";
|
||||||
redPacket.type = RoomMoreMenuType_Room_redPacket;
|
redPacket.type = RoomMoreMenuType_Room_redPacket;
|
||||||
redPacket.titleColor = [ThemeColor roomMoreMenuTextColor];
|
redPacket.titleColor = [ThemeColor roomMoreMenuTextColor];
|
||||||
|
|
||||||
|
@@ -29,7 +29,7 @@ typedef enum : NSUInteger {
|
|||||||
@property (nonatomic, copy) NSString *roomUId;
|
@property (nonatomic, copy) NSString *roomUId;
|
||||||
///发红包用户id
|
///发红包用户id
|
||||||
@property (nonatomic, copy) NSString *userId;
|
@property (nonatomic, copy) NSString *userId;
|
||||||
|
///发送者信息
|
||||||
@property (nonatomic, strong) UserInfoModel *userVO;
|
@property (nonatomic, strong) UserInfoModel *userVO;
|
||||||
/// 红包总数
|
/// 红包总数
|
||||||
@property (nonatomic, copy) NSString *totalNum;
|
@property (nonatomic, copy) NSString *totalNum;
|
||||||
|
@@ -9,9 +9,17 @@
|
|||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
|
@class XPReceiveRedPacketModel, XPRedPacketModel;
|
||||||
@interface XPReceiveRedPacketView : UIView
|
@interface XPReceiveRedPacketView : UIView
|
||||||
|
|
||||||
@property (nonatomic, strong) NSDictionary *dict;
|
///是否在全服红包的房间内
|
||||||
|
@property (nonatomic, assign) BOOL inAllPacketRoom;
|
||||||
|
///红包信息
|
||||||
|
@property (nonatomic, strong) XPReceiveRedPacketModel *redPacketModel;
|
||||||
|
|
||||||
|
@property (nonatomic, strong) XPRedPacketModel *receiveModel;
|
||||||
|
|
||||||
|
//@property (nonatomic, strong) NSDictionary *dict;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
@@ -16,11 +16,16 @@
|
|||||||
#import "XCHUDTool.h"
|
#import "XCHUDTool.h"
|
||||||
#import "XPRedPacketResultModel.h"
|
#import "XPRedPacketResultModel.h"
|
||||||
#import "XPOpenRedPacketCell.h"
|
#import "XPOpenRedPacketCell.h"
|
||||||
|
#import "XCCurrentVCStackManager.h"
|
||||||
|
#import "XPRoomViewController.h"
|
||||||
|
#import "RoomHostDelegate.h"
|
||||||
|
#import "XPRoomMiniManager.h"
|
||||||
|
#import "RoomInfoModel.h"
|
||||||
|
#import "XPRedPacketModel.h"
|
||||||
|
#import "XPConstant.h"
|
||||||
|
|
||||||
@interface XPReceiveRedPacketView()<UITableViewDelegate, UITableViewDataSource>
|
@interface XPReceiveRedPacketView()<UITableViewDelegate, UITableViewDataSource>
|
||||||
|
|
||||||
@property (nonatomic, strong) XPReceiveRedPacketModel *redPacketModel;
|
|
||||||
|
|
||||||
@property (nonatomic, strong) XPRedPacketResultModel *resultData;
|
@property (nonatomic, strong) XPRedPacketResultModel *resultData;
|
||||||
|
|
||||||
@property (nonatomic, strong) UIView *alphaView;
|
@property (nonatomic, strong) UIView *alphaView;
|
||||||
@@ -94,7 +99,7 @@
|
|||||||
make.centerX.mas_equalTo(self.bgImageView);
|
make.centerX.mas_equalTo(self.bgImageView);
|
||||||
make.top.mas_equalTo(self.sendAvatar.mas_bottom).mas_offset(9);
|
make.top.mas_equalTo(self.sendAvatar.mas_bottom).mas_offset(9);
|
||||||
make.height.mas_equalTo(18);
|
make.height.mas_equalTo(18);
|
||||||
make.left.mas_equalTo(30);
|
make.left.mas_equalTo(self.bgImageView).mas_offset(16);
|
||||||
}];
|
}];
|
||||||
[self.sendWishLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
[self.sendWishLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
make.centerX.mas_equalTo(self.bgImageView);
|
make.centerX.mas_equalTo(self.bgImageView);
|
||||||
@@ -108,28 +113,97 @@
|
|||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setDict:(NSDictionary *)dict {
|
- (void)setInAllPacketRoom:(BOOL)inAllPacketRoom {
|
||||||
XPReceiveRedPacketModel *data = [XPReceiveRedPacketModel modelWithDictionary:dict];
|
_inAllPacketRoom = inAllPacketRoom;
|
||||||
self.redPacketModel = data;
|
|
||||||
self.sendAvatar.imageUrl = data.sendUserAvatar;
|
|
||||||
self.sendWishLabel.text = data.redEnvelopeMessage;
|
|
||||||
if (data.redEnvelopeType == 1) {
|
|
||||||
self.sendNickLabel.text = data.sendUserNick;
|
|
||||||
} else {
|
|
||||||
NSString *nick = data.sendUserNick;
|
|
||||||
if (data.sendUserNick.length > 6) {
|
|
||||||
nick = [NSString stringWithFormat:@"%@...", [data.sendUserNick substringToIndex:6]];
|
|
||||||
}
|
}
|
||||||
self.sendNickLabel.text = [NSString stringWithFormat:@"%@厅内的%@", data.roomTitle, nick];
|
|
||||||
|
- (void)setRedPacketModel:(XPReceiveRedPacketModel *)redPacketModel {
|
||||||
|
_redPacketModel = redPacketModel;
|
||||||
|
self.sendAvatar.imageUrl = redPacketModel.sendUserAvatar;
|
||||||
|
self.sendWishLabel.text = redPacketModel.redEnvelopeMessage;
|
||||||
|
if (redPacketModel.redEnvelopeType == 1) {
|
||||||
|
self.sendNickLabel.text = redPacketModel.sendUserNick;
|
||||||
|
} else {
|
||||||
|
if (self.inAllPacketRoom) {
|
||||||
|
self.sendNickLabel.text = redPacketModel.sendUserNick;
|
||||||
|
} else {
|
||||||
|
NSString *nick = redPacketModel.sendUserNick;
|
||||||
|
if (redPacketModel.sendUserNick.length > 6) {
|
||||||
|
nick = [NSString stringWithFormat:@"%@...", [redPacketModel.sendUserNick substringToIndex:6]];
|
||||||
|
}
|
||||||
|
NSString *roomTitle = redPacketModel.roomTitle;
|
||||||
|
if (redPacketModel.roomTitle.length > 6) {
|
||||||
|
roomTitle = [NSString stringWithFormat:@"%@...", [redPacketModel.roomTitle substringToIndex:6]];
|
||||||
|
}
|
||||||
|
|
||||||
|
NSMutableAttributedString *attribute = [[NSMutableAttributedString alloc] init];
|
||||||
|
NSMutableAttributedString *roomAttr = [[NSMutableAttributedString alloc] initWithString:roomTitle attributes:@{NSForegroundColorAttributeName : UIColorFromRGB(0xFDCD00)}];
|
||||||
|
NSMutableAttributedString *redPacketStr = [[NSMutableAttributedString alloc] initWithString:@"厅内的" attributes:@{NSForegroundColorAttributeName : [UIColor whiteColor]}];
|
||||||
|
NSMutableAttributedString *nickAttr = [[NSMutableAttributedString alloc] initWithString:nick attributes:@{NSForegroundColorAttributeName : UIColorFromRGB(0xFDCD00)}];
|
||||||
|
[attribute appendAttributedString:roomAttr];
|
||||||
|
[attribute appendAttributedString:redPacketStr];
|
||||||
|
[attribute appendAttributedString:nickAttr];
|
||||||
|
self.sendNickLabel.attributedText = attribute;
|
||||||
|
|
||||||
[self.openButton setImage:[UIImage imageNamed:@"redPacket_openRoom"] forState:UIControlStateNormal];
|
[self.openButton setImage:[UIImage imageNamed:@"redPacket_openRoom"] forState:UIControlStateNormal];
|
||||||
|
[self.openButton mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||||
|
make.centerX.mas_equalTo(self.bgImageView);
|
||||||
|
make.width.mas_equalTo(147);
|
||||||
|
make.height.mas_equalTo(67);
|
||||||
|
make.bottom.mas_equalTo(self.bgImageView).mas_offset(-97);
|
||||||
|
}];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)setReceiveModel:(XPRedPacketModel *)receiveModel {
|
||||||
|
_receiveModel = receiveModel;
|
||||||
|
self.sendAvatar.imageUrl = receiveModel.userVO.avatar;
|
||||||
|
self.sendWishLabel.text = receiveModel.message;
|
||||||
|
self.sendNickLabel.text = receiveModel.userVO.nick;
|
||||||
|
}
|
||||||
|
|
||||||
#pragma mark - action
|
#pragma mark - action
|
||||||
- (void)onOpenButtonClick:(UIButton *)sender {
|
- (void)onOpenButtonClick:(UIButton *)sender {
|
||||||
|
if (!self.redPacketModel) {
|
||||||
|
[self openRoomRedPacket:sender redEnvelopeId:self.receiveModel.redEnvelopeId];
|
||||||
|
} else {
|
||||||
//判断是否为房内红包
|
//判断是否为房内红包
|
||||||
|
if (self.redPacketModel.redEnvelopeType == 1) {
|
||||||
//1、房内红包
|
//1、房内红包
|
||||||
|
[self openRoomRedPacket:sender redEnvelopeId:self.redPacketModel.redEnvelopeId];
|
||||||
|
} else {
|
||||||
|
//2、全服红包
|
||||||
|
if (self.inAllPacketRoom) {//在全服红包的房间内,直接打开
|
||||||
|
[self openRoomRedPacket:sender redEnvelopeId:self.redPacketModel.redEnvelopeId];
|
||||||
|
} else {//不在房内,进入发红包的房间
|
||||||
|
if ([XPRoomMiniManager shareManager].getRoomInfo) {
|
||||||
|
RoomInfoModel *roomInfo = [XPRoomMiniManager shareManager].getRoomInfo;
|
||||||
|
if (roomInfo.uid == self.redPacketModel.roomUid.integerValue) {
|
||||||
|
[XPRoomViewController openMiniRoom:[NSString stringWithFormat:@"%ld", roomInfo.uid] viewController:[[XCCurrentVCStackManager shareManager] getCurrentVC]];
|
||||||
|
} else {
|
||||||
|
[XPRoomViewController openRoom:self.redPacketModel.roomUid viewController:[[XCCurrentVCStackManager shareManager] getCurrentVC]];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
[[XCCurrentVCStackManager shareManager].getCurrentVC.navigationController.viewControllers enumerateObjectsUsingBlock:^(__kindof UIViewController * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||||
|
if ([obj isKindOfClass:[XPRoomViewController class]]) {
|
||||||
|
[[XCCurrentVCStackManager shareManager].getCurrentVC.navigationController popToRootViewControllerAnimated:NO];
|
||||||
|
XPRoomViewController<RoomHostDelegate> * rooomVC = obj;
|
||||||
|
[rooomVC exitRoom];
|
||||||
|
*stop = YES;
|
||||||
|
}
|
||||||
|
}];
|
||||||
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||||
|
[XPRoomViewController openRoom:self.redPacketModel.roomUid viewController:[XCCurrentVCStackManager shareManager].getCurrentVC];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
[self removeFromSuperview];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)openRoomRedPacket:(UIButton *)sender redEnvelopeId:(NSString *)redEnvelopeId {
|
||||||
//1.1 开红包动画
|
//1.1 开红包动画
|
||||||
CABasicAnimation *transformAnima = [CABasicAnimation animationWithKeyPath:@"transform.rotation.y"];
|
CABasicAnimation *transformAnima = [CABasicAnimation animationWithKeyPath:@"transform.rotation.y"];
|
||||||
transformAnima.toValue = [NSNumber numberWithFloat:M_PI];
|
transformAnima.toValue = [NSNumber numberWithFloat:M_PI];
|
||||||
@@ -150,7 +224,16 @@
|
|||||||
XPRedPacketResultModel *model = [XPRedPacketResultModel modelWithJSON:data.data];
|
XPRedPacketResultModel *model = [XPRedPacketResultModel modelWithJSON:data.data];
|
||||||
self.resultData = model;
|
self.resultData = model;
|
||||||
[self showRedPacketResultViewWithResultData:model];
|
[self showRedPacketResultViewWithResultData:model];
|
||||||
} redEnvelopeId:self.redPacketModel.redEnvelopeId];
|
// 如果打开红包成功 则记录当前红包状态
|
||||||
|
NSArray *history = [[NSUserDefaults standardUserDefaults] objectForKey:kRedPacketHistory];
|
||||||
|
NSMutableArray *tempArray = [NSMutableArray arrayWithArray:history];
|
||||||
|
if (![tempArray containsObject:self.resultData.redEnvelopeVO.redEnvelopeId]) {
|
||||||
|
[tempArray addObject:self.resultData.redEnvelopeVO.redEnvelopeId];
|
||||||
|
[[NSUserDefaults standardUserDefaults] setObject:tempArray forKey:kRedPacketHistory];
|
||||||
|
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||||
|
}
|
||||||
|
|
||||||
|
} redEnvelopeId:redEnvelopeId];
|
||||||
}
|
}
|
||||||
|
|
||||||
///显示红包结果
|
///显示红包结果
|
||||||
|
@@ -29,6 +29,8 @@
|
|||||||
#import "GuildSuperAdminInfoModel.h"
|
#import "GuildSuperAdminInfoModel.h"
|
||||||
#import "XPKickUserModel.h"
|
#import "XPKickUserModel.h"
|
||||||
#import "ContentLevelUpgradeModel.h"
|
#import "ContentLevelUpgradeModel.h"
|
||||||
|
#import "XPReceiveRedPacketModel.h"
|
||||||
|
#import "XPRedPacketModel.h"
|
||||||
///View
|
///View
|
||||||
#import "BaseNavigationController.h"
|
#import "BaseNavigationController.h"
|
||||||
#import "XPRoomActivityContainerView.h"
|
#import "XPRoomActivityContainerView.h"
|
||||||
@@ -769,6 +771,8 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
|
|||||||
if (self.giftId.length) {
|
if (self.giftId.length) {
|
||||||
[[NSNotificationCenter defaultCenter] postNotificationName:@"kShowGiftView" object:@{@"giftId": self.giftId}];
|
[[NSNotificationCenter defaultCenter] postNotificationName:@"kShowGiftView" object:@{@"giftId": self.giftId}];
|
||||||
}
|
}
|
||||||
|
//获取一下红包信息
|
||||||
|
[self.presenter getRedPacket:[NSString stringWithFormat:@"%ld", self.roomInfo.uid]];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)enterRoomFail:(NSInteger)code {
|
- (void)enterRoomFail:(NSInteger)code {
|
||||||
@@ -949,6 +953,18 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)getRedPacketSuccess:(NSArray *)list {
|
||||||
|
if (list.count == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (XPRedPacketModel *data in list) {
|
||||||
|
XPReceiveRedPacketView *view = [[XPReceiveRedPacketView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)];
|
||||||
|
view.receiveModel = data;
|
||||||
|
[self.view addSubview:view];
|
||||||
|
[self.view bringSubviewToFront:view];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#pragma mark - NIMChatroomManagerDelegate
|
#pragma mark - NIMChatroomManagerDelegate
|
||||||
- (void)chatroomBeKicked:(NIMChatroomBeKickedResult *)result {
|
- (void)chatroomBeKicked:(NIMChatroomBeKickedResult *)result {
|
||||||
if (result.reason == 2) {
|
if (result.reason == 2) {
|
||||||
@@ -1159,7 +1175,8 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
|
|||||||
} else if (attachment.first == CustomMessageType_RedPacket) {
|
} else if (attachment.first == CustomMessageType_RedPacket) {
|
||||||
if (attachment.second == Custom_Message_Sub_RoomDiamandRedPacket) {
|
if (attachment.second == Custom_Message_Sub_RoomDiamandRedPacket) {
|
||||||
XPReceiveRedPacketView *view = [[XPReceiveRedPacketView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)];
|
XPReceiveRedPacketView *view = [[XPReceiveRedPacketView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)];
|
||||||
view.dict = attachment.data;
|
XPReceiveRedPacketModel *data = [XPReceiveRedPacketModel modelWithJSON:attachment.data];
|
||||||
|
view.redPacketModel = data;
|
||||||
[self.view addSubview:view];
|
[self.view addSubview:view];
|
||||||
[self.view bringSubviewToFront:view];
|
[self.view bringSubviewToFront:view];
|
||||||
}
|
}
|
||||||
|
@@ -40,6 +40,7 @@
|
|||||||
#import "XPTabAnchorCardModel.h"
|
#import "XPTabAnchorCardModel.h"
|
||||||
#import "FirstRechargeModel.h"
|
#import "FirstRechargeModel.h"
|
||||||
#import "MonentsUnReadModel.h"
|
#import "MonentsUnReadModel.h"
|
||||||
|
#import "XPReceiveRedPacketModel.h"
|
||||||
///VC
|
///VC
|
||||||
#import "TabbarViewController.h"
|
#import "TabbarViewController.h"
|
||||||
#import "BaseViewController.h"
|
#import "BaseViewController.h"
|
||||||
@@ -96,6 +97,8 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
|
|||||||
@property (nonatomic, strong) XPAnchorCardView *anchorCardView;
|
@property (nonatomic, strong) XPAnchorCardView *anchorCardView;
|
||||||
///任务完成提示
|
///任务完成提示
|
||||||
@property (nonatomic, strong) XPTaskCompleteTipView *taskTipView;
|
@property (nonatomic, strong) XPTaskCompleteTipView *taskTipView;
|
||||||
|
///代理
|
||||||
|
@property (nonatomic,weak) id<RoomHostDelegate>delegate;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@@ -361,49 +364,37 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
|
|||||||
service.style = TTPopupStyleAlert;
|
service.style = TTPopupStyleAlert;
|
||||||
[TTPopup popupWithConfig:service];
|
[TTPopup popupWithConfig:service];
|
||||||
}
|
}
|
||||||
} else if (attachment.first == CustomMessageType_RedPacket && attachment.second == Custom_Message_Sub_AllGiftRedPacket) {
|
} else if (attachment.first == CustomMessageType_RedPacket && attachment.second == Custom_Message_Sub_AllDiamandRedPacket) {
|
||||||
|
XPReceiveRedPacketModel *data = [XPReceiveRedPacketModel modelWithDictionary:attachment.data];
|
||||||
//判断是否在房间
|
//判断是否在房间
|
||||||
if ([XPRoomMiniManager shareManager].getRoomInfo) {
|
__block BOOL isInRoom;
|
||||||
|
[[XCCurrentVCStackManager shareManager].getCurrentVC.navigationController.viewControllers enumerateObjectsUsingBlock:^(__kindof UIViewController * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||||
} else {
|
if ([obj isKindOfClass:[XPRoomViewController class]]) {
|
||||||
// if ([rootViewController presentedViewController]) { //有一个被present出来的控制器 要先dismiss
|
XPRoomViewController<RoomHostDelegate> * roomVC = obj;
|
||||||
// [[rootViewController presentedViewController] dismissViewControllerAnimated:YES completion:^{
|
RoomInfoModel *roomInfo = [roomVC getRoomInfo];
|
||||||
// if ([[XCCurrentVCStackManager shareManager] getCurrentVC].navigationController.viewControllers.count > 1) {
|
|
||||||
// [[[XCCurrentVCStackManager shareManager] getCurrentVC].navigationController popToRootViewControllerAnimated:YES];
|
|
||||||
// }
|
|
||||||
// if ([[UIApplication sharedApplication].delegate.window.rootViewController isKindOfClass:[UITabBarController class]]) {
|
|
||||||
// UITabBarController *tabVC = (UITabBarController *)[UIApplication sharedApplication].delegate.window.rootViewController;
|
|
||||||
// if (tabVC.selectedViewController.navigationController) {
|
|
||||||
// [tabVC.selectedViewController.navigationController popToRootViewControllerAnimated:YES];
|
|
||||||
// }
|
|
||||||
// dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|
||||||
// [tabVC setSelectedIndex:0];
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
// }];
|
|
||||||
// }else { //不是被present出来的 就有可能是rootvc或者是被push出来的 所以要判断nav是不是只有一个vc 如果有多个就pop
|
|
||||||
// if ([[XCCurrentVCStackManager shareManager] getCurrentVC].navigationController.viewControllers.count > 1) {
|
|
||||||
// [[[XCCurrentVCStackManager shareManager] getCurrentVC].navigationController popToRootViewControllerAnimated:YES];
|
|
||||||
// }
|
|
||||||
// if ([[UIApplication sharedApplication].delegate.window.rootViewController isKindOfClass:[UITabBarController class]]) {
|
|
||||||
// UITabBarController *tabVC = (UITabBarController *)[UIApplication sharedApplication].delegate.window.rootViewController;
|
|
||||||
// if (tabVC.selectedViewController) {
|
|
||||||
// if ([tabVC.selectedViewController isKindOfClass:[UINavigationController class]]) {
|
|
||||||
// [tabVC.selectedViewController popToRootViewControllerAnimated:YES];
|
|
||||||
// } else {
|
|
||||||
// [tabVC.selectedViewController.navigationController popToRootViewControllerAnimated:YES];
|
|
||||||
// }
|
|
||||||
// dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|
||||||
// [tabVC setSelectedIndex:0];
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
XPReceiveRedPacketView *view = [[XPReceiveRedPacketView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)];
|
XPReceiveRedPacketView *view = [[XPReceiveRedPacketView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)];
|
||||||
view.dict = attachment.data;
|
if (roomInfo.uid == data.roomUid.integerValue) {
|
||||||
[self.view addSubview:view];
|
view.inAllPacketRoom = YES;
|
||||||
[self.view bringSubviewToFront:view];
|
} else {
|
||||||
|
view.inAllPacketRoom = NO;
|
||||||
|
}
|
||||||
|
XPReceiveRedPacketModel *data = [XPReceiveRedPacketModel modelWithJSON:attachment.data];
|
||||||
|
view.redPacketModel = data;
|
||||||
|
[roomVC.view addSubview:view];
|
||||||
|
[roomVC.view bringSubviewToFront:view];
|
||||||
|
*stop = YES;
|
||||||
|
isInRoom = YES;
|
||||||
|
}
|
||||||
|
}];
|
||||||
|
if (!isInRoom) {
|
||||||
|
UIViewController *currentVc = [[XCCurrentVCStackManager shareManager] getCurrentVC];
|
||||||
|
XPReceiveRedPacketView *view = [[XPReceiveRedPacketView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)];
|
||||||
|
view.inAllPacketRoom = NO;
|
||||||
|
XPReceiveRedPacketModel *data = [XPReceiveRedPacketModel modelWithJSON:attachment.data];
|
||||||
|
view.redPacketModel = data;
|
||||||
|
[currentVc.view addSubview:view];
|
||||||
|
[currentVc.view bringSubviewToFront:view];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|