修复bug
This commit is contained in:
@@ -20,64 +20,12 @@ isPhoneXSeries = [[UIApplication sharedApplication] delegate].window.safeAreaIns
|
|||||||
|
|
||||||
#define KScreenWidth [[UIScreen mainScreen] bounds].size.width
|
#define KScreenWidth [[UIScreen mainScreen] bounds].size.width
|
||||||
#define KScreenHeight [[UIScreen mainScreen] bounds].size.height
|
#define KScreenHeight [[UIScreen mainScreen] bounds].size.height
|
||||||
// 状态栏高度
|
#define statusbarHeight [[UIApplication sharedApplication] statusBarFrame].size.height
|
||||||
#define statusbarHeight \
|
|
||||||
({\
|
|
||||||
CGFloat height = 0.0;\
|
|
||||||
if (@available(iOS 11.0, *)) {\
|
|
||||||
UIEdgeInsets insets = [UIApplication sharedApplication].delegate.window.safeAreaInsets;\
|
|
||||||
height = insets.top;\
|
|
||||||
} else {\
|
|
||||||
height = 20.0;\
|
|
||||||
}\
|
|
||||||
height;\
|
|
||||||
})
|
|
||||||
#define kStatusBarHeight statusbarHeight
|
#define kStatusBarHeight statusbarHeight
|
||||||
// 安全区域底部高度
|
#define kSafeAreaBottomHeight (iPhoneXSeries ? 34 : 0)
|
||||||
#define kSafeAreaBottomHeight \
|
#define kSafeAreaTopHeight (iPhoneXSeries ? 24 : 0)
|
||||||
({\
|
#define kNavigationHeight (kStatusBarHeight + 44)
|
||||||
CGFloat height = 0.0;\
|
#define kTabBarHeight (iPhoneXSeries ? 49.0+34.0 : 49.0)
|
||||||
if (@available(iOS 11.0, *)) {\
|
|
||||||
UIEdgeInsets insets = [UIApplication sharedApplication].delegate.window.safeAreaInsets;\
|
|
||||||
height = insets.bottom;\
|
|
||||||
}\
|
|
||||||
height;\
|
|
||||||
})
|
|
||||||
// 安全区域顶部高度
|
|
||||||
#define kSafeAreaTopHeight \
|
|
||||||
({\
|
|
||||||
CGFloat height = 0.0;\
|
|
||||||
if (@available(iOS 11.0, *)) {\
|
|
||||||
UIEdgeInsets insets = [UIApplication sharedApplication].delegate.window.safeAreaInsets;\
|
|
||||||
height = insets.top;\
|
|
||||||
}\
|
|
||||||
height;\
|
|
||||||
})
|
|
||||||
|
|
||||||
// 导航栏高度
|
|
||||||
#define kNavigationHeight \
|
|
||||||
({\
|
|
||||||
CGFloat height = 0.0;\
|
|
||||||
if (@available(iOS 11.0, *)) {\
|
|
||||||
UIEdgeInsets insets = [UIApplication sharedApplication].delegate.window.safeAreaInsets;\
|
|
||||||
height = insets.top > 0 ? 44.0 + insets.top : 44.0;\
|
|
||||||
} else {\
|
|
||||||
height = 64.0;\
|
|
||||||
}\
|
|
||||||
height;\
|
|
||||||
})
|
|
||||||
// 标签栏高度
|
|
||||||
#define kTabBarHeight \
|
|
||||||
({\
|
|
||||||
CGFloat height = 0.0;\
|
|
||||||
if (@available(iOS 11.0, *)) {\
|
|
||||||
UIEdgeInsets insets = [UIApplication sharedApplication].delegate.window.safeAreaInsets;\
|
|
||||||
height = insets.bottom > 0 ? 49.0 + insets.bottom : 49.0;\
|
|
||||||
} else {\
|
|
||||||
height = 49.0;\
|
|
||||||
}\
|
|
||||||
height;\
|
|
||||||
})
|
|
||||||
#define kScreenScale ((CGFloat)KScreenWidth / (CGFloat)375)
|
#define kScreenScale ((CGFloat)KScreenWidth / (CGFloat)375)
|
||||||
#define kScreenHeightScale ((CGFloat)KScreenHeight / (CGFloat)812)
|
#define kScreenHeightScale ((CGFloat)KScreenHeight / (CGFloat)812)
|
||||||
#define kHalfScreenHeight KScreenHeight * 0.65
|
#define kHalfScreenHeight KScreenHeight * 0.65
|
||||||
|
@@ -147,7 +147,7 @@
|
|||||||
}
|
}
|
||||||
}];
|
}];
|
||||||
dispatch_after(1.0, dispatch_get_main_queue(), ^{
|
dispatch_after(1.0, dispatch_get_main_queue(), ^{
|
||||||
[XPRoomViewController openRoom:self.messageInfo.roomUid viewController:[XCCurrentVCStackManager shareManager].getCurrentVC redEnvelopeId:self.messageInfo.redEnvelopeId];
|
[XPRoomViewController openRoom:self.messageInfo.roomUid viewController:kWindow.rootViewController redEnvelopeId:self.messageInfo.redEnvelopeId];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -45,106 +45,117 @@
|
|||||||
@implementation MessageContentTweetView
|
@implementation MessageContentTweetView
|
||||||
|
|
||||||
- (void)render:(MessageBaseModel *)model1 {
|
- (void)render:(MessageBaseModel *)model1 {
|
||||||
MessageTweetModel *obj = (MessageTweetModel *)model1;
|
MessageTweetModel *obj = (MessageTweetModel *)model1;
|
||||||
ContentTweetModel * model = obj.tweetInfo;
|
ContentTweetModel * model = obj.tweetInfo;
|
||||||
self.tweetModel = model;
|
self.tweetModel = model;
|
||||||
self.messageId = model1.message.messageId;
|
self.messageId = model1.message.messageId;
|
||||||
self.logoImageView.imageUrl = model.picUrl;
|
self.logoImageView.imageUrl = model.picUrl;
|
||||||
self.titleLabel.attributedText = [[NSMutableAttributedString alloc] initWithString:model.title attributes:[self messageTextAttibutes:[UIFont systemFontOfSize:16] color:[DJDKMIMOMColor mainTextColor]]];
|
self.titleLabel.attributedText = [[NSMutableAttributedString alloc] initWithString:model.title attributes:[self messageTextAttibutes:[UIFont systemFontOfSize:16] color:[DJDKMIMOMColor mainTextColor]]];
|
||||||
self.subTitleLabel.attributedText = [[NSMutableAttributedString alloc] initWithString:model.desc attributes:[self messageTextAttibutes:[UIFont systemFontOfSize:13] color:[DJDKMIMOMColor secondTextColor]]];
|
self.subTitleLabel.attributedText = [[NSMutableAttributedString alloc] initWithString:model.desc attributes:[self messageTextAttibutes:[UIFont systemFontOfSize:13] color:[DJDKMIMOMColor secondTextColor]]];
|
||||||
|
|
||||||
CGFloat oneHeight = [YMLocalizedString(@"MessageContentTweetView0") boundingRectWithSize:CGSizeMake(240, CGFLOAT_MAX) options:NSStringDrawingUsesFontLeading | NSStringDrawingUsesLineFragmentOrigin
|
CGFloat oneHeight = [YMLocalizedString(@"MessageContentTweetView0") boundingRectWithSize:CGSizeMake(240, CGFLOAT_MAX) options:NSStringDrawingUsesFontLeading | NSStringDrawingUsesLineFragmentOrigin
|
||||||
attributes:[self messageTextAttibutes:[UIFont systemFontOfSize:16] color:[DJDKMIMOMColor mainTextColor]] context:nil].size.height + 2.5;
|
attributes:[self messageTextAttibutes:[UIFont systemFontOfSize:16] color:[DJDKMIMOMColor mainTextColor]] context:nil].size.height + 2.5;
|
||||||
|
|
||||||
CGFloat titleHeight = [model.title boundingRectWithSize:CGSizeMake(240, CGFLOAT_MAX) options:NSStringDrawingUsesFontLeading | NSStringDrawingUsesLineFragmentOrigin
|
CGFloat titleHeight = [model.title boundingRectWithSize:CGSizeMake(240, CGFLOAT_MAX) options:NSStringDrawingUsesFontLeading | NSStringDrawingUsesLineFragmentOrigin
|
||||||
attributes:[self messageTextAttibutes:[UIFont systemFontOfSize:16] color:[DJDKMIMOMColor mainTextColor]] context:nil].size.height;
|
attributes:[self messageTextAttibutes:[UIFont systemFontOfSize:16] color:[DJDKMIMOMColor mainTextColor]] context:nil].size.height;
|
||||||
if (titleHeight <= oneHeight * 2) {
|
if (titleHeight <= oneHeight * 2) {
|
||||||
[self.titleLabel mas_updateConstraints:^(MASConstraintMaker *make) {
|
[self.titleLabel mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||||
make.height.mas_equalTo(titleHeight + 5);
|
make.height.mas_equalTo(titleHeight + 5);
|
||||||
}];
|
}];
|
||||||
} else{
|
} else{
|
||||||
[self.titleLabel mas_updateConstraints:^(MASConstraintMaker *make) {
|
[self.titleLabel mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||||
make.height.mas_equalTo(oneHeight * 2);
|
make.height.mas_equalTo(oneHeight * 2);
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CGFloat desHeight = [model.desc boundingRectWithSize:CGSizeMake(240, CGFLOAT_MAX) options:NSStringDrawingUsesFontLeading | NSStringDrawingUsesLineFragmentOrigin
|
CGFloat desHeight = [model.desc boundingRectWithSize:CGSizeMake(240, CGFLOAT_MAX) options:NSStringDrawingUsesFontLeading | NSStringDrawingUsesLineFragmentOrigin
|
||||||
attributes:[self messageTextAttibutes:[UIFont systemFontOfSize:13] color:[DJDKMIMOMColor mainTextColor]] context:nil].size.height;
|
attributes:[self messageTextAttibutes:[UIFont systemFontOfSize:13] color:[DJDKMIMOMColor mainTextColor]] context:nil].size.height;
|
||||||
[self.subTitleLabel mas_updateConstraints:^(MASConstraintMaker *make) {
|
[self.subTitleLabel mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||||
make.height.mas_equalTo(desHeight);
|
make.height.mas_equalTo(desHeight);
|
||||||
}];
|
}];
|
||||||
|
|
||||||
NSArray *redPacketHistory = [[NSUserDefaults standardUserDefaults] objectForKey:kTuWenMessageHistory];
|
NSArray *redPacketHistory = [[NSUserDefaults standardUserDefaults] objectForKey:kTuWenMessageHistory];
|
||||||
if ([redPacketHistory containsObject: model1.message.messageId]) {
|
if ( [redPacketHistory containsObject: model1.message.messageId]) {
|
||||||
self.isNewImageView.hidden = YES;
|
self.isNewImageView.hidden = YES;
|
||||||
|
[self.isNewImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||||
|
make.right.mas_equalTo(self.backView);
|
||||||
|
make.centerY.equalTo(self.titleLabel);
|
||||||
|
make.size.mas_equalTo(CGSizeMake(0, 10));
|
||||||
|
}];
|
||||||
} else {
|
} else {
|
||||||
self.isNewImageView.hidden = NO;
|
self.isNewImageView.hidden = NO;
|
||||||
|
[self.isNewImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||||
|
make.right.mas_equalTo(self.backView);
|
||||||
|
make.centerY.equalTo(self.titleLabel);
|
||||||
|
make.size.mas_equalTo(CGSizeMake(24, 10));
|
||||||
|
}];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSDictionary<NSAttributedStringKey, id> *)messageTextAttibutes:(UIFont *)font color:(UIColor *)color {
|
- (NSDictionary<NSAttributedStringKey, id> *)messageTextAttibutes:(UIFont *)font color:(UIColor *)color {
|
||||||
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
|
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
|
||||||
[paragraphStyle setLineSpacing:2.5];
|
[paragraphStyle setLineSpacing:2.5];
|
||||||
return @{
|
return @{
|
||||||
NSFontAttributeName:font,
|
NSFontAttributeName:font,
|
||||||
NSParagraphStyleAttributeName: paragraphStyle,
|
NSParagraphStyleAttributeName: paragraphStyle,
|
||||||
NSForegroundColorAttributeName:color
|
NSForegroundColorAttributeName:color
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)initSubViews {
|
- (void)initSubViews {
|
||||||
[super initSubViews];
|
[super initSubViews];
|
||||||
[self.backView addSubview:self.titleLabel];
|
[self.backView addSubview:self.titleLabel];
|
||||||
[self.backView addSubview:self.logoImageView];
|
[self.backView addSubview:self.logoImageView];
|
||||||
[self.backView addSubview:self.lineView];
|
[self.backView addSubview:self.lineView];
|
||||||
[self.backView addSubview:self.subTitleLabel];
|
[self.backView addSubview:self.subTitleLabel];
|
||||||
[self.backView addSubview:self.checkButton];
|
[self.backView addSubview:self.checkButton];
|
||||||
[self.backView addSubview:self.isNewImageView];
|
[self.backView addSubview:self.isNewImageView];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)initSubViewConstraints {
|
- (void)initSubViewConstraints {
|
||||||
[super initSubViewConstraints];
|
[super initSubViewConstraints];
|
||||||
[self.backView mas_makeConstraints:^(MASConstraintMaker *make) {
|
[self.backView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
make.width.mas_equalTo(280);
|
make.width.mas_equalTo(280);
|
||||||
make.bottom.mas_equalTo(self.checkButton);
|
make.bottom.mas_equalTo(self.checkButton);
|
||||||
}];
|
}];
|
||||||
|
|
||||||
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
||||||
make.left.right.mas_equalTo(self.backView);
|
|
||||||
make.top.mas_equalTo(self.backView);
|
|
||||||
make.height.mas_equalTo(18);
|
|
||||||
}];
|
|
||||||
|
|
||||||
[self.logoImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
||||||
make.left.right.mas_equalTo(self.backView);
|
|
||||||
make.top.mas_equalTo(self.titleLabel.mas_bottom).offset(10);
|
|
||||||
make.height.mas_equalTo(87);
|
|
||||||
}];
|
|
||||||
|
|
||||||
[self.subTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
||||||
make.left.right.mas_equalTo(self.backView);
|
|
||||||
make.top.mas_equalTo(self.logoImageView.mas_bottom).offset(10);
|
|
||||||
make.height.mas_equalTo(18);
|
|
||||||
}];
|
|
||||||
|
|
||||||
[self.lineView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
||||||
make.left.right.mas_equalTo(self.backView);
|
|
||||||
make.height.mas_equalTo(0.5);
|
|
||||||
make.top.mas_equalTo(self.subTitleLabel.mas_bottom).offset(5);
|
|
||||||
}];
|
|
||||||
|
|
||||||
[self.checkButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
||||||
make.left.right.mas_equalTo(self.backView);
|
|
||||||
make.top.mas_equalTo(self.lineView.mas_bottom).offset(10);
|
|
||||||
make.height.mas_equalTo(20);
|
|
||||||
}];
|
|
||||||
[self.isNewImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
[self.isNewImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
make.right.mas_equalTo(self.backView);
|
make.right.mas_equalTo(self.backView);
|
||||||
make.top.mas_equalTo(self.backView).mas_offset(3);
|
make.centerY.equalTo(self.titleLabel);
|
||||||
make.size.mas_equalTo(CGSizeMake(24, 10));
|
make.size.mas_equalTo(CGSizeMake(24, 10));
|
||||||
}];
|
}];
|
||||||
|
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
|
make.left.mas_equalTo(self.backView);
|
||||||
|
make.right.equalTo(self.isNewImageView.mas_left);
|
||||||
|
make.top.mas_equalTo(self.backView);
|
||||||
|
make.height.mas_equalTo(18);
|
||||||
|
}];
|
||||||
|
|
||||||
|
[self.logoImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
|
make.left.right.mas_equalTo(self.backView);
|
||||||
|
make.top.mas_equalTo(self.titleLabel.mas_bottom).offset(10);
|
||||||
|
make.height.mas_equalTo(87);
|
||||||
|
}];
|
||||||
|
|
||||||
|
[self.subTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
|
make.left.right.mas_equalTo(self.backView);
|
||||||
|
make.top.mas_equalTo(self.logoImageView.mas_bottom).offset(10);
|
||||||
|
make.height.mas_equalTo(18);
|
||||||
|
}];
|
||||||
|
|
||||||
|
[self.lineView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
|
make.left.right.mas_equalTo(self.backView);
|
||||||
|
make.height.mas_equalTo(0.5);
|
||||||
|
make.top.mas_equalTo(self.subTitleLabel.mas_bottom).offset(5);
|
||||||
|
}];
|
||||||
|
|
||||||
|
[self.checkButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
|
make.left.right.mas_equalTo(self.backView);
|
||||||
|
make.top.mas_equalTo(self.lineView.mas_bottom).offset(10);
|
||||||
|
make.height.mas_equalTo(20);
|
||||||
|
}];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - Event Response
|
#pragma mark - Event Response
|
||||||
@@ -174,53 +185,53 @@
|
|||||||
|
|
||||||
#pragma mark - Getters And Setters
|
#pragma mark - Getters And Setters
|
||||||
- (NetImageView *)logoImageView {
|
- (NetImageView *)logoImageView {
|
||||||
if (!_logoImageView) {
|
if (!_logoImageView) {
|
||||||
NetImageConfig * config = [[NetImageConfig alloc]init];
|
NetImageConfig * config = [[NetImageConfig alloc]init];
|
||||||
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
|
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
|
||||||
_logoImageView = [[NetImageView alloc] initWithConfig:config];
|
_logoImageView = [[NetImageView alloc] initWithConfig:config];
|
||||||
_logoImageView.layer.masksToBounds = YES;
|
_logoImageView.layer.masksToBounds = YES;
|
||||||
_logoImageView.layer.cornerRadius = 10;
|
_logoImageView.layer.cornerRadius = 10;
|
||||||
_logoImageView.contentMode = UIViewContentModeScaleAspectFill;
|
_logoImageView.contentMode = UIViewContentModeScaleAspectFill;
|
||||||
_logoImageView.layer.masksToBounds = YES;
|
_logoImageView.layer.masksToBounds = YES;
|
||||||
}
|
}
|
||||||
return _logoImageView;
|
return _logoImageView;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (UILabel *)titleLabel {
|
- (UILabel *)titleLabel {
|
||||||
if (!_titleLabel) {
|
if (!_titleLabel) {
|
||||||
_titleLabel = [[UILabel alloc] init];
|
_titleLabel = [[UILabel alloc] init];
|
||||||
_titleLabel.numberOfLines = 2;
|
_titleLabel.numberOfLines = 2;
|
||||||
_titleLabel.preferredMaxLayoutWidth = 240;
|
_titleLabel.preferredMaxLayoutWidth = 240;
|
||||||
}
|
}
|
||||||
return _titleLabel;
|
return _titleLabel;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (UIView *)lineView {
|
- (UIView *)lineView {
|
||||||
if (!_lineView) {
|
if (!_lineView) {
|
||||||
_lineView = [[UIView alloc] init];
|
_lineView = [[UIView alloc] init];
|
||||||
_lineView.backgroundColor = [DJDKMIMOMColor dividerColor];
|
_lineView.backgroundColor = [DJDKMIMOMColor dividerColor];
|
||||||
}
|
}
|
||||||
return _lineView;
|
return _lineView;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (UILabel *)subTitleLabel {
|
- (UILabel *)subTitleLabel {
|
||||||
if (!_subTitleLabel) {
|
if (!_subTitleLabel) {
|
||||||
_subTitleLabel = [[UILabel alloc] init];
|
_subTitleLabel = [[UILabel alloc] init];
|
||||||
_subTitleLabel.numberOfLines = 0;
|
_subTitleLabel.numberOfLines = 0;
|
||||||
_subTitleLabel.preferredMaxLayoutWidth = 240;
|
_subTitleLabel.preferredMaxLayoutWidth = 240;
|
||||||
}
|
}
|
||||||
return _subTitleLabel;
|
return _subTitleLabel;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (UIButton *)checkButton {
|
- (UIButton *)checkButton {
|
||||||
if (!_checkButton) {
|
if (!_checkButton) {
|
||||||
_checkButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
_checkButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||||
[_checkButton setTitle:YMLocalizedString(@"MessageContentTweetView1") forState:UIControlStateNormal];
|
[_checkButton setTitle:YMLocalizedString(@"MessageContentTweetView1") forState:UIControlStateNormal];
|
||||||
[_checkButton setTitleColor:UIColorFromRGB(0x4C5AF1) forState:UIControlStateNormal];
|
[_checkButton setTitleColor:UIColorFromRGB(0x4C5AF1) forState:UIControlStateNormal];
|
||||||
_checkButton.titleLabel.font = [UIFont systemFontOfSize:14];
|
_checkButton.titleLabel.font = [UIFont systemFontOfSize:14];
|
||||||
[_checkButton addTarget:self action:@selector(checkButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
[_checkButton addTarget:self action:@selector(checkButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||||
}
|
}
|
||||||
return _checkButton;
|
return _checkButton;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (UIImageView *)isNewImageView {
|
- (UIImageView *)isNewImageView {
|
||||||
|
@@ -15,9 +15,10 @@
|
|||||||
if (self = [super initWithMessage:message]) {
|
if (self = [super initWithMessage:message]) {
|
||||||
self.messageType = SessionMessageType_Custom;
|
self.messageType = SessionMessageType_Custom;
|
||||||
NIMCustomObject *obj = (NIMCustomObject *)message.messageObject;
|
NIMCustomObject *obj = (NIMCustomObject *)message.messageObject;
|
||||||
AttachmentModel * attach = obj.attachment;
|
AttachmentModel * attach = (AttachmentModel *)obj.attachment;
|
||||||
ContentTweetModel * model = [ContentTweetModel modelWithJSON:attach.data];
|
ContentTweetModel * model = [ContentTweetModel modelWithJSON:attach.data];
|
||||||
self.tweetInfo = model;
|
self.tweetInfo = model;
|
||||||
|
|
||||||
CGFloat oneHeight = [YMLocalizedString(@"MessageTweetModel0") boundingRectWithSize:CGSizeMake(240, CGFLOAT_MAX) options:NSStringDrawingUsesFontLeading | NSStringDrawingUsesLineFragmentOrigin
|
CGFloat oneHeight = [YMLocalizedString(@"MessageTweetModel0") boundingRectWithSize:CGSizeMake(240, CGFLOAT_MAX) options:NSStringDrawingUsesFontLeading | NSStringDrawingUsesLineFragmentOrigin
|
||||||
attributes:[self messageTextAttibutes:[UIFont systemFontOfSize:16]] context:nil].size.height + 2.5;
|
attributes:[self messageTextAttibutes:[UIFont systemFontOfSize:16]] context:nil].size.height + 2.5;
|
||||||
|
|
||||||
|
@@ -209,6 +209,17 @@
|
|||||||
- (void)setBroadcastModel:(GiftReceiveInfoModel *)broadcastModel {
|
- (void)setBroadcastModel:(GiftReceiveInfoModel *)broadcastModel {
|
||||||
_broadcastModel = broadcastModel;
|
_broadcastModel = broadcastModel;
|
||||||
if (_broadcastModel) {
|
if (_broadcastModel) {
|
||||||
|
_roomNameLabel.hidden = _broadcastModel.roomTitle.length == 0;
|
||||||
|
_pi_roomIconView.hidden = _broadcastModel.roomTitle.length == 0;
|
||||||
|
_circuseeBtn.hidden = _broadcastModel.roomTitle.length == 0;
|
||||||
|
if(_broadcastModel.roomTitle.length == 0){
|
||||||
|
[self.pi_contentView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||||
|
make.leading.equalTo(self.senderAvatarView.mas_trailing).mas_offset(kGetScaleWidth(13));
|
||||||
|
make.centerY.equalTo(self.backImageView);
|
||||||
|
make.trailing.mas_equalTo(-kGetScaleWidth(133));
|
||||||
|
make.height.mas_equalTo(kGetScaleWidth(14));
|
||||||
|
}];
|
||||||
|
}
|
||||||
NSString *sendUserNick = _broadcastModel.sendUserNick ?: @"";
|
NSString *sendUserNick = _broadcastModel.sendUserNick ?: @"";
|
||||||
NSString *recvUserNick = _broadcastModel.recvUserNick ?: @"";
|
NSString *recvUserNick = _broadcastModel.recvUserNick ?: @"";
|
||||||
self.senderAvatarView.imageUrl = _broadcastModel.sendUserAvatar;
|
self.senderAvatarView.imageUrl = _broadcastModel.sendUserAvatar;
|
||||||
|
@@ -106,7 +106,11 @@
|
|||||||
if(_albumModel.status == 0){
|
if(_albumModel.status == 0){
|
||||||
[self.unlockPhotoView loadImageWithUrl:_albumModel.photoUrl completion:^(UIImage * _Nonnull image, NSURL * _Nonnull url) {
|
[self.unlockPhotoView loadImageWithUrl:_albumModel.photoUrl completion:^(UIImage * _Nonnull image, NSURL * _Nonnull url) {
|
||||||
@kStrongify(self);
|
@kStrongify(self);
|
||||||
self.unlockPhotoView.image = [self setBlurImage:image];
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
|
// UI更新代码
|
||||||
|
self.unlockPhotoView.image = [self setBlurImage:image];
|
||||||
|
});
|
||||||
|
|
||||||
}];
|
}];
|
||||||
}else{
|
}else{
|
||||||
self.unlockPhotoView.image = nil;
|
self.unlockPhotoView.image = nil;
|
||||||
|
@@ -91,7 +91,10 @@
|
|||||||
|
|
||||||
[self.bgImageView loadImageWithUrl:_albumModel.photoUrl completion:^(UIImage * _Nonnull image, NSURL * _Nonnull url) {
|
[self.bgImageView loadImageWithUrl:_albumModel.photoUrl completion:^(UIImage * _Nonnull image, NSURL * _Nonnull url) {
|
||||||
@kStrongify(self);
|
@kStrongify(self);
|
||||||
self.bgImageView.image = [self setBlurImage:image];
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
|
// UI更新代码
|
||||||
|
self.bgImageView.image = [self setBlurImage:image];
|
||||||
|
});
|
||||||
}];
|
}];
|
||||||
}else{
|
}else{
|
||||||
self.bgImageView.image = nil;
|
self.bgImageView.image = nil;
|
||||||
|
@@ -217,8 +217,9 @@
|
|||||||
self.redPacketModel = self.redPacketList.firstObject;
|
self.redPacketModel = self.redPacketList.firstObject;
|
||||||
self.hidden = NO;
|
self.hidden = NO;
|
||||||
self.pi_redNum = @(self.redPacketList.count).stringValue;
|
self.pi_redNum = @(self.redPacketList.count).stringValue;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
[self.redPacketList replaceObjectAtIndex:[self.redPacketList indexOfObject:self.redPacketModel] withObject:redModel];
|
[self.redPacketList replaceObjectAtIndex:[self.redPacketList indexOfObject:self.redPacketModel] withObject:redModel];
|
||||||
self.redPacketModel = redModel;
|
self.redPacketModel = redModel;
|
||||||
|
@@ -8,6 +8,11 @@
|
|||||||
#import <UIKit/UIKit.h>
|
#import <UIKit/UIKit.h>
|
||||||
#import "XPRedPacketModel.h"
|
#import "XPRedPacketModel.h"
|
||||||
|
|
||||||
|
@protocol XPReceiveRedPacketViewDelegate <NSObject>
|
||||||
|
|
||||||
|
-(void)closeViewAction;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
@@ -16,7 +21,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
|
|
||||||
///是否在全服红包的房间内
|
///是否在全服红包的房间内
|
||||||
@property (nonatomic, assign) BOOL inAllPacketRoom;
|
@property (nonatomic, assign) BOOL inAllPacketRoom;
|
||||||
|
@property(nonatomic,weak) id<XPReceiveRedPacketViewDelegate>delegate;
|
||||||
|
|
||||||
@property (nonatomic, strong) XPRedPacketModel *receiveModel;
|
@property (nonatomic, strong) XPRedPacketModel *receiveModel;
|
||||||
|
|
||||||
|
@@ -317,12 +317,12 @@
|
|||||||
}
|
}
|
||||||
}else if(self.receiveModel.kind == RedPacketConditionsType_Followd){
|
}else if(self.receiveModel.kind == RedPacketConditionsType_Followd){
|
||||||
if(self.isCountDownEnd == NO && self.receiveModel.finish == 0){
|
if(self.isCountDownEnd == NO && self.receiveModel.finish == 0){
|
||||||
[self removeFromSuperview];
|
[self onCloseButtonClick];
|
||||||
[[NSNotificationCenter defaultCenter]postNotificationName:@"kOpenRedPacketNotification" object:nil userInfo:@{@"type":@(RedPacketConditionsType_Followd),@"uid":self.receiveModel.userId ?: @"",@"roomUid":self.receiveModel.roomUId ?: @""}];
|
[[NSNotificationCenter defaultCenter]postNotificationName:@"kOpenRedPacketNotification" object:nil userInfo:@{@"type":@(RedPacketConditionsType_Followd),@"uid":self.receiveModel.userId ?: @"",@"roomUid":self.receiveModel.roomUId ?: @""}];
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}else if(self.isCountDownEnd == YES && self.receiveModel.finish == 0){
|
}else if(self.isCountDownEnd == YES && self.receiveModel.finish == 0){
|
||||||
[self removeFromSuperview];
|
[self onCloseButtonClick];
|
||||||
[XNDJTDDLoadingTool showErrorWithMessage:YMLocalizedString(@"XPReceiveRedPacketView18")];
|
[XNDJTDDLoadingTool showErrorWithMessage:YMLocalizedString(@"XPReceiveRedPacketView18")];
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@@ -332,12 +332,12 @@
|
|||||||
|
|
||||||
}else if(self.receiveModel.kind == RedPacketConditionsType_Share){
|
}else if(self.receiveModel.kind == RedPacketConditionsType_Share){
|
||||||
if(self.isCountDownEnd == NO && self.receiveModel.finish == 0){
|
if(self.isCountDownEnd == NO && self.receiveModel.finish == 0){
|
||||||
[self removeFromSuperview];
|
[self onCloseButtonClick];
|
||||||
|
|
||||||
[[NSNotificationCenter defaultCenter]postNotificationName:@"kOpenRedPacketNotification" object:nil userInfo:@{@"type":@(RedPacketConditionsType_Share),@"uid":self.receiveModel.userId ?: @"",@"roomUid":self.receiveModel.roomUId ?: @""}];
|
[[NSNotificationCenter defaultCenter]postNotificationName:@"kOpenRedPacketNotification" object:nil userInfo:@{@"type":@(RedPacketConditionsType_Share),@"uid":self.receiveModel.userId ?: @"",@"roomUid":self.receiveModel.roomUId ?: @""}];
|
||||||
return;
|
return;
|
||||||
}else if(self.isCountDownEnd == YES && self.receiveModel.finish == 0){
|
}else if(self.isCountDownEnd == YES && self.receiveModel.finish == 0){
|
||||||
[self removeFromSuperview];
|
[self onCloseButtonClick];
|
||||||
[XNDJTDDLoadingTool showErrorWithMessage:YMLocalizedString(@"XPReceiveRedPacketView18")];
|
[XNDJTDDLoadingTool showErrorWithMessage:YMLocalizedString(@"XPReceiveRedPacketView18")];
|
||||||
|
|
||||||
|
|
||||||
@@ -347,12 +347,12 @@
|
|||||||
}
|
}
|
||||||
}else if(self.receiveModel.kind == RedPacketConditionsType_Scrolling){
|
}else if(self.receiveModel.kind == RedPacketConditionsType_Scrolling){
|
||||||
if(self.isCountDownEnd == NO && self.receiveModel.finish == 0){
|
if(self.isCountDownEnd == NO && self.receiveModel.finish == 0){
|
||||||
[self removeFromSuperview];
|
[self onCloseButtonClick];
|
||||||
[[NSNotificationCenter defaultCenter]postNotificationName:@"kOpenRedPacketNotification" object:nil userInfo:@{@"type":@(RedPacketConditionsType_Scrolling),@"uid":self.receiveModel.userId ?: @"",@"roomUid":self.receiveModel.roomUId ?: @"",@"scrolling":self.receiveModel.message ?: @""}];
|
[[NSNotificationCenter defaultCenter]postNotificationName:@"kOpenRedPacketNotification" object:nil userInfo:@{@"type":@(RedPacketConditionsType_Scrolling),@"uid":self.receiveModel.userId ?: @"",@"roomUid":self.receiveModel.roomUId ?: @"",@"scrolling":self.receiveModel.message ?: @""}];
|
||||||
return;
|
return;
|
||||||
}else if(self.isCountDownEnd == YES && self.receiveModel.finish == 0){
|
}else if(self.isCountDownEnd == YES && self.receiveModel.finish == 0){
|
||||||
|
|
||||||
[self removeFromSuperview];
|
[self onCloseButtonClick];
|
||||||
[XNDJTDDLoadingTool showErrorWithMessage:YMLocalizedString(@"XPReceiveRedPacketView18")];
|
[XNDJTDDLoadingTool showErrorWithMessage:YMLocalizedString(@"XPReceiveRedPacketView18")];
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@@ -394,7 +394,7 @@
|
|||||||
[XPRoomViewController openRoom:self.receiveModel.roomUid viewController:[XCCurrentVCStackManager shareManager].getCurrentVC redEnvelopeId:self.receiveModel.redEnvelopeId];
|
[XPRoomViewController openRoom:self.receiveModel.roomUid viewController:[XCCurrentVCStackManager shareManager].getCurrentVC redEnvelopeId:self.receiveModel.redEnvelopeId];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
[self removeFromSuperview];
|
[self onCloseButtonClick];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -471,9 +471,11 @@
|
|||||||
self.countDownView.text = [NSString stringWithFormat:@"%02d:%02d",minutes,second];
|
self.countDownView.text = [NSString stringWithFormat:@"%02d:%02d",minutes,second];
|
||||||
}
|
}
|
||||||
#pragma mark - action
|
#pragma mark - action
|
||||||
- (void)onCloseButtonClick:(UIButton *)sender {
|
- (void)onCloseButtonClick{
|
||||||
[self removeFromSuperview];
|
[self removeFromSuperview];
|
||||||
|
if(self.delegate && [self.delegate respondsToSelector:@selector(closeViewAction)]){
|
||||||
|
[self.delegate closeViewAction];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - getter
|
#pragma mark - getter
|
||||||
@@ -550,7 +552,7 @@
|
|||||||
if (!_closeBtn) {
|
if (!_closeBtn) {
|
||||||
_closeBtn = [[UIButton alloc] init];
|
_closeBtn = [[UIButton alloc] init];
|
||||||
[_closeBtn setImage:[UIImage imageNamed:@"pi_red_packet_receive_colse"] forState:UIControlStateNormal];
|
[_closeBtn setImage:[UIImage imageNamed:@"pi_red_packet_receive_colse"] forState:UIControlStateNormal];
|
||||||
[_closeBtn addTarget:self action:@selector(onCloseButtonClick:) forControlEvents:UIControlEventTouchUpInside];
|
[_closeBtn addTarget:self action:@selector(onCloseButtonClick) forControlEvents:UIControlEventTouchUpInside];
|
||||||
}
|
}
|
||||||
return _closeBtn;
|
return _closeBtn;
|
||||||
}
|
}
|
||||||
|
@@ -451,10 +451,14 @@
|
|||||||
NIMCustomObject *object = [[NIMCustomObject alloc] init];
|
NIMCustomObject *object = [[NIMCustomObject alloc] init];
|
||||||
object.attachment = attachMent;
|
object.attachment = attachMent;
|
||||||
message.messageObject = object;
|
message.messageObject = object;
|
||||||
|
|
||||||
//构造会话
|
//构造会话
|
||||||
NSString * sessionId = [NSString stringWithFormat:@"%ld", roomInfo.roomId];
|
NSString * sessionId = [NSString stringWithFormat:@"%ld", roomInfo.roomId];
|
||||||
NIMSession *session = [NIMSession session:sessionId type:NIMSessionTypeChatroom];
|
NIMSession *session = [NIMSession session:sessionId type:NIMSessionTypeChatroom];
|
||||||
[[NIMSDK sharedSDK].chatManager sendMessage:message toSession:session error:nil];
|
[[NIMSDK sharedSDK].chatManager sendMessage:message toSession:session completion:^(NSError * _Nullable error) {
|
||||||
|
|
||||||
|
}];
|
||||||
|
|
||||||
}
|
}
|
||||||
} roomUid:roomUid micUid:uid position:position uid:uid];
|
} roomUid:roomUid micUid:uid position:position uid:uid];
|
||||||
}
|
}
|
||||||
|
@@ -87,7 +87,7 @@ UIKIT_EXTERN NSString * const kFreeGiftCountdownNotification;
|
|||||||
NSString * const kHadShowAnchorRoomTipKey = @"kHadShowAnchorRoomTipKey";//是否展示过个播房上划用户引导
|
NSString * const kHadShowAnchorRoomTipKey = @"kHadShowAnchorRoomTipKey";//是否展示过个播房上划用户引导
|
||||||
NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出过非自己房间
|
NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出过非自己房间
|
||||||
|
|
||||||
@interface XPRoomViewController ()<XPRoomProtocol, RoomHostDelegate, NIMChatroomManagerDelegate, NIMChatManagerDelegate, NIMConversationManagerDelegate, NIMLoginManagerDelegate, XPRoomSettingInputViewDelegate, AnchorRoomScrollViewDelegate, XPFirstRechargeViewDelegate,NIMBroadcastManagerDelegate,XPRoomLittleGameContainerViewDelegate,CountDownHelperDelegate,PIRoomEnterRedPacketViewDelegate>
|
@interface XPRoomViewController ()<XPRoomProtocol, RoomHostDelegate, NIMChatroomManagerDelegate, NIMChatManagerDelegate, NIMConversationManagerDelegate, NIMLoginManagerDelegate, XPRoomSettingInputViewDelegate, AnchorRoomScrollViewDelegate, XPFirstRechargeViewDelegate,NIMBroadcastManagerDelegate,XPRoomLittleGameContainerViewDelegate,CountDownHelperDelegate,PIRoomEnterRedPacketViewDelegate,XPReceiveRedPacketViewDelegate>
|
||||||
///背景
|
///背景
|
||||||
@property (nonatomic,strong) XPRoomBackContainerView *backContainerView;
|
@property (nonatomic,strong) XPRoomBackContainerView *backContainerView;
|
||||||
|
|
||||||
@@ -153,6 +153,8 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
|
|||||||
@property(nonatomic,copy) NSString *redEnvelopeId;
|
@property(nonatomic,copy) NSString *redEnvelopeId;
|
||||||
///红包
|
///红包
|
||||||
@property(nonatomic,strong) PIRoomEnterRedPacketView *redPacketView;
|
@property(nonatomic,strong) PIRoomEnterRedPacketView *redPacketView;
|
||||||
|
///是否正在显示红包弹窗,防止显示多个弹窗
|
||||||
|
@property(nonatomic,assign) BOOL isShowRedPacket;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation XPRoomViewController
|
@implementation XPRoomViewController
|
||||||
@@ -387,6 +389,8 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
|
|||||||
}
|
}
|
||||||
|
|
||||||
XPReceiveRedPacketView *view = [[XPReceiveRedPacketView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)];
|
XPReceiveRedPacketView *view = [[XPReceiveRedPacketView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)];
|
||||||
|
view.delegate = self;
|
||||||
|
self.isShowRedPacket = YES;
|
||||||
view.receiveModel = redModel;
|
view.receiveModel = redModel;
|
||||||
for (UIView *subView in self.view.subviews) {
|
for (UIView *subView in self.view.subviews) {
|
||||||
if([subView isKindOfClass:[XPReceiveRedPacketView class]]) {
|
if([subView isKindOfClass:[XPReceiveRedPacketView class]]) {
|
||||||
@@ -699,11 +703,17 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
|
|||||||
}];
|
}];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
#pragma mark- XPReceiveRedPacketViewDelegate
|
||||||
|
- (void)closeViewAction{
|
||||||
|
self.isShowRedPacket = NO;
|
||||||
|
|
||||||
|
}
|
||||||
#pragma mark- PIRoomEnterRedPacketViewDelegate
|
#pragma mark- PIRoomEnterRedPacketViewDelegate
|
||||||
- (void)openRedPacketWtihModel:(XPRedPacketModel *)redModel{
|
- (void)openRedPacketWtihModel:(XPRedPacketModel *)redModel{
|
||||||
XPReceiveRedPacketView *view = [[XPReceiveRedPacketView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)];
|
XPReceiveRedPacketView *view = [[XPReceiveRedPacketView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)];
|
||||||
view.receiveModel = redModel;
|
view.receiveModel = redModel;
|
||||||
|
view.delegate = self;
|
||||||
|
self.isShowRedPacket = YES;
|
||||||
for (UIView *subView in self.view.subviews) {
|
for (UIView *subView in self.view.subviews) {
|
||||||
if([subView isKindOfClass:[XPReceiveRedPacketView class]]) {
|
if([subView isKindOfClass:[XPReceiveRedPacketView class]]) {
|
||||||
view.alphaView.backgroundColor = [UIColor clearColor];
|
view.alphaView.backgroundColor = [UIColor clearColor];
|
||||||
@@ -1297,6 +1307,8 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
|
|||||||
}
|
}
|
||||||
- (void)getRedPacketInftSuccess:(XPRedPacketModel *)redInfo{
|
- (void)getRedPacketInftSuccess:(XPRedPacketModel *)redInfo{
|
||||||
XPReceiveRedPacketView *view = [[XPReceiveRedPacketView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)];
|
XPReceiveRedPacketView *view = [[XPReceiveRedPacketView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)];
|
||||||
|
view.delegate = self;
|
||||||
|
self.isShowRedPacket = YES;
|
||||||
redInfo.validityType = 0;
|
redInfo.validityType = 0;
|
||||||
redInfo.kind = 1;
|
redInfo.kind = 1;
|
||||||
view.receiveModel = redInfo;
|
view.receiveModel = redInfo;
|
||||||
@@ -1315,9 +1327,14 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (XPRedPacketModel *data in list) {
|
for (XPRedPacketModel *data in list) {
|
||||||
|
if(data.kind == 0){
|
||||||
|
data.kind = 1;
|
||||||
|
}
|
||||||
if((data.validityType == 0 && data.type == RedPacketType_RoomDiamond)|| data.type == RedPacketType_AllDiamond){
|
if((data.validityType == 0 && data.type == RedPacketType_RoomDiamond)|| data.type == RedPacketType_AllDiamond){
|
||||||
XPReceiveRedPacketView *view = [[XPReceiveRedPacketView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)];
|
XPReceiveRedPacketView *view = [[XPReceiveRedPacketView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)];
|
||||||
view.receiveModel = data;
|
view.receiveModel = data;
|
||||||
|
view.delegate = self;
|
||||||
|
self.isShowRedPacket = YES;
|
||||||
for (UIView *subView in self.view.subviews) {
|
for (UIView *subView in self.view.subviews) {
|
||||||
if([subView isKindOfClass:[XPReceiveRedPacketView class]]) {
|
if([subView isKindOfClass:[XPReceiveRedPacketView class]]) {
|
||||||
view.alphaView.backgroundColor = [UIColor clearColor];
|
view.alphaView.backgroundColor = [UIColor clearColor];
|
||||||
@@ -1593,6 +1610,8 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
|
|||||||
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)];
|
||||||
XPRedPacketModel *data = [XPRedPacketModel modelWithJSON:attachment.data];
|
XPRedPacketModel *data = [XPRedPacketModel modelWithJSON:attachment.data];
|
||||||
|
view.delegate = self;
|
||||||
|
self.isShowRedPacket = YES;
|
||||||
data.validityType = 0;
|
data.validityType = 0;
|
||||||
data.kind = 1;
|
data.kind = 1;
|
||||||
data.redEnvelopeId = attachment.data[@"redEnvelopeId"];
|
data.redEnvelopeId = attachment.data[@"redEnvelopeId"];
|
||||||
@@ -1605,11 +1624,19 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
|
|||||||
}
|
}
|
||||||
[self.view addSubview:view];
|
[self.view addSubview:view];
|
||||||
[self.view bringSubviewToFront:view];
|
[self.view bringSubviewToFront:view];
|
||||||
|
if(self.activityContainerView.redPacketList == nil){
|
||||||
|
self.activityContainerView.redPacketList = [NSMutableArray array];
|
||||||
|
}
|
||||||
|
NSMutableArray *redPacketList = [NSMutableArray arrayWithArray:self.activityContainerView.redPacketList];
|
||||||
|
[redPacketList insertObject:data atIndex:0];
|
||||||
|
self.activityContainerView.redPacketList = redPacketList;
|
||||||
}else if(attachment.second == Custom_Message_Sub_NewRoomDiamandRedPacket){
|
}else if(attachment.second == Custom_Message_Sub_NewRoomDiamandRedPacket){
|
||||||
XPRedPacketModel *curData = [XPRedPacketModel modelWithJSON:attachment.data];
|
XPRedPacketModel *curData = [XPRedPacketModel modelWithJSON:attachment.data];
|
||||||
curData.redEnvelopeId = attachment.data[@"redEnvelopeId"];
|
curData.redEnvelopeId = attachment.data[@"redEnvelopeId"];
|
||||||
if(curData.validityType == 0){
|
if(curData.validityType == 0){
|
||||||
XPReceiveRedPacketView *view = [[XPReceiveRedPacketView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)];
|
XPReceiveRedPacketView *view = [[XPReceiveRedPacketView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)];
|
||||||
|
view.delegate = self;
|
||||||
|
self.isShowRedPacket = YES;
|
||||||
view.receiveModel = curData;
|
view.receiveModel = curData;
|
||||||
for (UIView *subView in self.view.subviews) {
|
for (UIView *subView in self.view.subviews) {
|
||||||
if([subView isKindOfClass:[XPReceiveRedPacketView class]]) {
|
if([subView isKindOfClass:[XPReceiveRedPacketView class]]) {
|
||||||
@@ -1668,12 +1695,15 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
|
|||||||
}else if (attachment.first == CustomMessageType_Tarot && (attachment.second == Custom_Message_Sub_Tarot_Advanced || attachment.second == Custom_Message_Sub_Tarot_Intermediate)){
|
}else if (attachment.first == CustomMessageType_Tarot && (attachment.second == Custom_Message_Sub_Tarot_Advanced || attachment.second == Custom_Message_Sub_Tarot_Intermediate)){
|
||||||
isHave = YES;
|
isHave = YES;
|
||||||
}if (attachment.first == CustomMessageType_RedPacket && attachment.second == Custom_Message_Sub_AllDiamandRedPacket) {
|
}if (attachment.first == CustomMessageType_RedPacket && attachment.second == Custom_Message_Sub_AllDiamandRedPacket) {
|
||||||
|
if(self.isShowRedPacket == YES)return;
|
||||||
XPRedPacketModel *data = [XPRedPacketModel modelWithDictionary:attachment.data];
|
XPRedPacketModel *data = [XPRedPacketModel modelWithDictionary:attachment.data];
|
||||||
data.validityType = 0;
|
data.validityType = 0;
|
||||||
data.kind = 1;
|
data.kind = 1;
|
||||||
data.redEnvelopeId = attachment.data[@"redEnvelopeId"];
|
data.redEnvelopeId = attachment.data[@"redEnvelopeId"];
|
||||||
RoomInfoModel *roomInfo = self.roomInfo;
|
RoomInfoModel *roomInfo = self.roomInfo;
|
||||||
XPReceiveRedPacketView *view = [[XPReceiveRedPacketView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)];
|
XPReceiveRedPacketView *view = [[XPReceiveRedPacketView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)];
|
||||||
|
view.delegate = self;
|
||||||
|
self.isShowRedPacket = YES;
|
||||||
if (roomInfo.uid == data.roomUid.integerValue) {
|
if (roomInfo.uid == data.roomUid.integerValue) {
|
||||||
view.inAllPacketRoom = YES;
|
view.inAllPacketRoom = YES;
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user