修正聊天卡片 UI

修正其他 UI 问题
This commit is contained in:
eggmanQQQ
2024-07-11 13:37:43 +08:00
parent 0d950baaf4
commit 0a973ca4d5
13 changed files with 89 additions and 59 deletions

View File

@@ -683,9 +683,8 @@
}];
}
// section item
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
return self.configModel.typeEnumList.count; //
return self.configModel.typeEnumList.count;
}
- (CGSize)collectionView:(UICollectionView *)collectionView

View File

@@ -247,9 +247,23 @@
NSAssert(classStr != nil, @"message should not be nil");
}
[self.messageBackground addSubview:self.messageContent];
[self.messageContent mas_makeConstraints:^(MASConstraintMaker *make) {
make.leading.top.trailing.bottom.mas_equalTo(self.messageBackground);
}];
//MARK: layout
if ([classStr isEqualToString:@"MessageGameOrderView"]) {
[self.messageBackground mas_remakeConstraints:^(MASConstraintMaker *make) {
self.messageBackgroundLeft = make.leading.mas_equalTo(self.leftAvatar.mas_trailing).offset(15);
self.messageBackgroundRight = make.trailing.mas_equalTo(self.rightAvatar.mas_leading).offset(-15);
make.top.mas_equalTo(self).offset(20);
make.height.mas_equalTo(98 + MESSAGE_PADDING);
}];
[self.messageContent mas_makeConstraints:^(MASConstraintMaker *make) {
make.leading.top.trailing.mas_equalTo(self.messageBackground);
make.height.mas_equalTo(98 + MESSAGE_PADDING);
}];
} else {
[self.messageContent mas_makeConstraints:^(MASConstraintMaker *make) {
make.leading.top.trailing.bottom.mas_equalTo(self.messageBackground);
}];
}
[self.messageContent.superview layoutIfNeeded];
if (model.isHiddenAvatar) {
self.leftAvatar.hidden= YES;

View File

@@ -5,11 +5,12 @@
// Created by P on 2024/7/10.
//
#import "MessageContentCustomView.h"
#import <UIKit/UIKit.h>
#import "MessageContentProtocol.h"
NS_ASSUME_NONNULL_BEGIN
@interface MessageGameOrderView : MessageContentCustomView
@interface MessageGameOrderView : UIView<MessageContentProtocol>
@end

View File

@@ -25,30 +25,50 @@
@implementation MessageGameOrderView
- (void)initSubViews {
[super initSubViews];
[self addSubview:self.bgImageView];
[self addSubview:self.titleLabel];
[self addSubview:self.subTitleLabel];
- (instancetype)init {
self = [super init];
if (self) {
// [self addSubview:self.messageText];
// [self.messageText mas_makeConstraints:^(MASConstraintMaker *make) {
// make.edges.equalTo(self).with.insets(UIEdgeInsetsMake(MESSAGE_TEXT_PADDING, MESSAGE_TEXT_PADDING, MESSAGE_TEXT_PADDING, MESSAGE_TEXT_PADDING));
// }];
_line = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 92, 0.5)];
_line.backgroundColor = UIColorRGBAlpha(0xc1c4db, 0.2);
[self addSubview:_line];
[self addSubview:self.avatarImageView];
[self addSubview:self.gameNameLabel];
[self addSubview:self.roundLabel];
[self addSubview:self.bgImageView];
[self addSubview:self.titleLabel];
[self addSubview:self.subTitleLabel];
_line = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 92, 0.5)];
_line.backgroundColor = UIColorRGBAlpha(0xc1c4db, 0.2);
[self addSubview:_line];
[self addSubview:self.avatarImageView];
[self addSubview:self.gameNameLabel];
[self addSubview:self.roundLabel];
[self initSubViewConstraints];
CAGradientLayer *gradientLayer = [CAGradientLayer layer];
gradientLayer.frame = CGRectMake(0, 0, 300, 98 + MESSAGE_PADDING);
gradientLayer.colors = @[
(id)[UIColorRGBAlpha(0x161616, 0.9) CGColor],
(id)[UIColorRGBAlpha(0x1f1f1f, 0.8) CGColor],
(id)[UIColorRGBAlpha(0x1a1a1a, 0.3) CGColor]
];
gradientLayer.locations = @[@0.0, @0.3, @1.0];
gradientLayer.startPoint = CGPointMake(0.0, 0.5);
gradientLayer.endPoint = CGPointMake(1.0, 0.5);
[self.bgImageView.layer addSublayer:gradientLayer];
}
return self;
}
- (void)initSubViewConstraints {
[super initSubViewConstraints];
[self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
// make.edges.mas_equalTo(self).insets(UIEdgeInsetsMake(MESSAGE_PADDING, MESSAGE_PADDING, MESSAGE_PADDING, MESSAGE_PADDING));
// make.edges.mas_equalTo(self).insets(UIEdgeInsetsMake(MESSAGE_PADDING, MESSAGE_PADDING, MESSAGE_PADDING, MESSAGE_PADDING));
// make.edges.equalTo(self).with.insets(UIEdgeInsetsMake(MESSAGE_PADDING, MESSAGE_PADDING, MESSAGE_PADDING, MESSAGE_PADDING));
make.top.left.right.mas_equalTo(self);
make.height.mas_equalTo(95);
make.height.mas_equalTo(98 + MESSAGE_PADDING);
}];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
@@ -100,7 +120,7 @@
}
}];
[self.roundLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.gameNameLabel.mas_bottom).offset(7);
make.bottom.mas_equalTo(self.avatarImageView.mas_bottom).offset(-7);
if (isMSRTL()) {
make.right.mas_equalTo(self.avatarImageView.mas_left).offset(-5);
make.left.mas_equalTo(9.5);
@@ -126,8 +146,14 @@
NetImageConfig * config = [[NetImageConfig alloc] init];
_bgImageView = [[NetImageView alloc] initWithConfig:config];
_bgImageView.layer.masksToBounds = YES;
_bgImageView.layer.cornerRadius = 8;
// _bgImageView.layer.cornerRadius = 8;
_bgImageView.contentMode = UIViewContentModeScaleAspectFill;
// CAShapeLayer * layer = [CAShapeLayer layer];
// layer.path = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, 300, 98 + MESSAGE_PADDING)
// byRoundingCorners:UIRectCornerTopLeft | UIRectCornerBottomRight | UIRectCornerBottomLeft
// cornerRadii:CGSizeMake(8, 8)].CGPath;
// _bgImageView.layer.mask = layer;
}
return _bgImageView;
}

View File

@@ -25,7 +25,8 @@
self.bgURLPath = [gameInfos objectForKey:@"gamePic"];
self.logoURLPath = [gameInfos objectForKey:@"gameLogo"];
self.height = 98;
self.contentSize = CGSizeMake(234 + MESSAGE_PADDING* 2, 98 + MESSAGE_PADDING * 2);
self.height = 98 + MESSAGE_PADDING * 2 + CONTENT_PADDING_V_TOTAL;
}
return self;
}

View File

@@ -69,19 +69,17 @@
make.edges.mas_equalTo(self.contentView).insets(UIEdgeInsetsMake(0, 0, 10, 0));
}];
UIImage *image = [UIImage gradientColorImageFromColors:@[UIColorRGBAlpha(0x161616, 0.9), UIColorRGBAlpha(0x1f1f1f, 0.8), UIColorRGBAlpha(0x1a1a1a, 0.3)]
gradientType:isMSRTL() ? GradientTypeLeftToRight : GradientTypeLeftToRight
imgSize:CGSizeMake(370, 68)];
UIImageView *mask = [[UIImageView alloc] initWithImage:image];
mask.alpha = 0.4;
mask.backgroundColor = [UIColor clearColor];
mask.opaque = YES;
mask.layer.cornerRadius = 8;
mask.layer.masksToBounds = YES;
[self.contentView addSubview:mask];
[mask mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(self.bgImageView);
}];
CAGradientLayer *gradientLayer = [CAGradientLayer layer];
gradientLayer.frame = CGRectMake(0, 0, KScreenWidth - 28, 68);
gradientLayer.colors = @[
(id)[UIColorRGBAlpha(0x161616, 0.9) CGColor],
(id)[UIColorRGBAlpha(0x1f1f1f, 0.8) CGColor],
(id)[UIColorRGBAlpha(0x1a1a1a, 0.3) CGColor]
];
gradientLayer.locations = @[@0.0, @0.3, @1.0];
gradientLayer.startPoint = CGPointMake(0.0, 0.5);
gradientLayer.endPoint = CGPointMake(1.0, 0.5);
[self.bgImageView.layer addSublayer:gradientLayer];
[self.contentView addSubview:self.logoImageView];
[self.logoImageView mas_makeConstraints:^(MASConstraintMaker *make) {

View File

@@ -74,7 +74,7 @@
- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
XPMIneGameCollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPMIneGameCollectionViewCell class]) forIndexPath:indexPath];
LittleGameInfoModel * item = [self.datasource xpSafeObjectAtIndex:indexPath.row];
cell.gameModel = item;
cell.gameModel = item;
return cell;
}

View File

@@ -382,8 +382,10 @@ typedef enum : NSUInteger {
XPMineDataGameMateTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMineDataGameMateTableViewCell class])
forIndexPath:indexPath];
cell.cellModel = [self.gameInfos xpSafeObjectAtIndex:indexPath.row];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
@kWeakify(self);
[cell setDidTapOrder:^(XPMineGamePartnerInfoModel *model) {
@kStrongify(self);
if (self.delegate) {
[self.delegate showGameOrderView:model];
}

View File

@@ -65,10 +65,12 @@
make.leading.trailing.bottom.equalTo(self.bgView);
}];
}
-(void)setRoomId:(NSString *)roomId{
_roomId = roomId;
[self getGiftListData];
}
-(void)getGiftListData{
[Api requestNormalGiftList:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
if(code == 200){
@@ -84,11 +86,10 @@
}
}
[self.collectionView reloadData];
}
} roomUid:self.roomId];
}
#pragma mark -UICollectionViewDelegate,UICollectionViewDataSource
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath{
if(self.giftList.count == 0)return self.collectionView.frame.size;

View File

@@ -123,6 +123,9 @@ typedef NS_ENUM(NSUInteger, RoomSendGiftType) {
//超级幸运礼物新增字段
@property(nonatomic,copy) NSString *bannerUrl;
@property(nonatomic,copy) NSString *skipUrl;
@property (nonatomic, copy) NSDictionary *i18nGiftNameMap;
@end
NS_ASSUME_NONNULL_END

View File

@@ -1470,7 +1470,7 @@
_headWearSVGAImageView = [[SVGAImageView alloc]init];
_headWearSVGAImageView.backgroundColor = [UIColor clearColor];
_headWearSVGAImageView.frame = CGRectZero;
_headWearSVGAImageView.userInteractionEnabled = YES;
_headWearSVGAImageView.userInteractionEnabled = NO;
_headWearSVGAImageView.autoPlay = YES;
}
return _headWearSVGAImageView;

View File

@@ -1915,20 +1915,6 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
}
//
- (void)sendMessage:(NIMMessage *)message didCompleteWithError:(NSError *)error {
if (![message.session.sessionId isEqualToString:[NSString stringWithFormat:@"%ld", self.roomInfo.roomId]]) {
return;
}
NSString *publicChatRoomId = [NSString stringWithFormat:@"%@",[ClientConfig shareConfig].configInfo.publicChatRoomIdMap[self.userInfo.partitionId]];
if([message.session.sessionId isEqualToString:publicChatRoomId]){
//
if(message.messageType == NIMMessageTypeText) {
[self.messageContainerView handleNIMTextMessage:message];
}else if(message.messageType == NIMMessageTypeImage){
[self.messageContainerView handleNIMImageMessage:message];
}
return;
}
NSString *publicChatRoomId = [NSString stringWithFormat:@"%@",[ClientConfig shareConfig].configInfo.publicChatRoomIdMap[self.userInfo.partitionId]];
if([message.session.sessionId isEqualToString:publicChatRoomId]){

View File

@@ -535,7 +535,6 @@ NSString * const kJSOpenPaymentCallback = @"openPaymentCallback";
@kWeakify(self);
[Api requestIAPRecharge:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
@kStrongify(self);
[self showErrorToast:@"苹果下单 成功"];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
switch (code) {