Files
peko-ios/YuMi/Modules/YMMessage/View/Session/Content/MessageContentMonentsView.m
QQQ 9cb71643f1 移除 A/B 相关代码。
通过 [ClientConfig shareConfig].canOpen 控制页面,现在已没有相关配置,删除/调整相关内容,[ClientConfig shareConfig].canOpen == YES 的部分将保留等价逻辑/代码
2024-05-22 18:58:09 +08:00

119 lines
3.6 KiB
Objective-C

//
// MessageContentMonentsView.m
// YUMI
//
// Created by YUMI on 2022/8/25.
//
#import "MessageContentMonentsView.h"
///Third
#import <Masonry/Masonry.h>
///Tool
#import "NetImageView.h"
#import "DJDKMIMOMColor.h"
#import "XPGiftStorage.h"
#import "NSObject+MJExtension.h"
#import "XCCurrentVCStackManager.h"
#import "ClientConfig.h"
///Model
#import "GiftReceiveInfoModel.h"
#import "MessageMonentsModel.h"
///View
#import "XPMonentsDetailViewController.h"
#import "XPMomentsSimpleDetailViewController.h"
#import "MonentsInfoModel.h"
@interface MessageContentMonentsView ()
///礼物的
@property (nonatomic,strong) NetImageView *monentsView;
///显示名字
@property (nonatomic,strong) UILabel *titleLabel;
///描述
@property (nonatomic,strong) UILabel *contentLabel;
///动态
@property (nonatomic,strong) MonentsInfoModel *monents;
@end
@implementation MessageContentMonentsView
- (void)initSubViews {
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapBackView)];
[self.backView addGestureRecognizer:tap];
[super initSubViews];
[self addSubview:self.backView];
[self.backView addSubview:self.monentsView];
[self.backView addSubview:self.titleLabel];
[self.backView addSubview:self.contentLabel];
}
- (void)initSubViewConstraints {
[super initSubViewConstraints];
[self.backView mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(250, 60));
}];
[self.monentsView mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(50, 50));
make.leading.mas_equalTo(self.backView);
make.centerY.mas_equalTo(self.backView);
}];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.leading.mas_equalTo(self.monentsView.mas_trailing).offset(10);
make.bottom.mas_equalTo(self.monentsView.mas_centerY).offset(-3);
make.trailing.mas_lessThanOrEqualTo(self.backView).offset(-10);
}];
[self.contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.leading.mas_equalTo(self.titleLabel);
make.top.mas_equalTo(self.monentsView.mas_centerY).offset(3);
make.trailing.mas_lessThanOrEqualTo(self.backView).offset(-10);
}];
}
- (void)tapBackView {
XPMonentsDetailViewController * detailView = [[XPMonentsDetailViewController alloc] init];
detailView.monentsInfo = self.monents;
[[XCCurrentVCStackManager shareManager].getCurrentVC.navigationController pushViewController:detailView animated:YES];
}
- (void)render:(MessageBaseModel *)message {
MessageMonentsModel *obj = (MessageMonentsModel *)message;
self.monents = obj.monentsInfo;
self.monentsView.imageUrl = obj.imageUrl;
self.titleLabel.text = obj.title;
self.contentLabel.text = self.monents.content;
}
- (NetImageView *)monentsView {
if (!_monentsView) {
NetImageConfig * config = [[NetImageConfig alloc]init];
config.imageType = ImageTypeUserIcon;
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
_monentsView = [[NetImageView alloc] initWithConfig:config];
_monentsView.contentMode = UIViewContentModeScaleAspectFill;
_monentsView.layer.masksToBounds = YES;
_monentsView.layer.cornerRadius = 10;
}
return _monentsView;
}
- (UILabel *)titleLabel {
if (!_titleLabel) {
_titleLabel = [[UILabel alloc] init];
_titleLabel.font = [UIFont systemFontOfSize:15];
_titleLabel.textColor = [DJDKMIMOMColor mainTextColor];
}
return _titleLabel;
}
- (UILabel *)contentLabel {
if (!_contentLabel) {
_contentLabel = [[UILabel alloc] init];
_contentLabel.font = [UIFont systemFontOfSize:12];
_contentLabel.textColor = [DJDKMIMOMColor secondTextColor];
}
return _contentLabel;
}@end