chore: import upstream snapshot with attribution

This commit is contained in:
wehub-resource-sync
2026-07-13 12:35:01 +08:00
commit a2e318a963
2974 changed files with 158180 additions and 0 deletions
@@ -0,0 +1,13 @@
//
// TLExpressionDetailBannerCell.h
// TLChat
//
// Created by 李伯坤 on 2018/1/4.
// Copyright © 2018年 李伯坤. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface TLExpressionDetailBannerCell : UICollectionViewCell <ZZFlexibleLayoutViewProtocol>
@end
@@ -0,0 +1,49 @@
//
// TLExpressionDetailBannerCell.m
// TLChat
//
// Created by 李伯坤 on 2018/1/4.
// Copyright © 2018年 李伯坤. All rights reserved.
//
#import "TLExpressionDetailBannerCell.h"
@interface TLExpressionDetailBannerCell ()
@property (nonatomic, strong) UIImageView *imageView;
@end
@implementation TLExpressionDetailBannerCell
+ (CGSize)viewSizeByDataModel:(id)dataModel
{
return CGSizeMake(SCREEN_WIDTH, SCREEN_WIDTH * 0.45);
}
- (void)setViewDataModel:(NSString *)dataModel
{
if (dataModel) {
[self.imageView tt_setImageWithURL:TLURL(dataModel)];
}
else {
[self.imageView setImage:nil];
}
}
- (id)initWithFrame:(CGRect)frame
{
if (self = [super initWithFrame:frame]) {
[self setBackgroundColor:[UIColor whiteColor]];
self.imageView = self.addImageView(1)
.clipsToBounds(YES)
.contentMode(UIViewContentModeScaleAspectFill)
.masonry(^(MASConstraintMaker *make){
make.edges.mas_equalTo(0);
})
.view;
}
return self;
}
@end
@@ -0,0 +1,18 @@
//
// TLExpressionDetailInfoCell.h
// TLChat
//
// Created by 李伯坤 on 16/4/11.
// Copyright © 2016年 李伯坤. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "TLExpressionGroupModel.h"
#define HEIGHT_EXP_BANNER (SCREEN_WIDTH * 0.45)
@interface TLExpressionDetailInfoCell : UICollectionViewCell <ZZFlexibleLayoutViewProtocol>
@property (nonatomic, strong) TLExpressionGroupModel *groupModel;
@end
@@ -0,0 +1,137 @@
//
// TLExpressionDetailInfoCell.m
// TLChat
//
// Created by 李伯坤 on 16/4/11.
// Copyright © 2016年 李伯坤. All rights reserved.
//
#import "TLExpressionDetailInfoCell.h"
#import "TLExpressionGroupModel+Download.h"
#import "TLExpressionDownloadButton.h"
@interface TLExpressionDetailInfoCell ()
@property (nonatomic, strong) UILabel *titleLabel;
@property (nonatomic, strong) TLExpressionDownloadButton *downloadButton;
@property (nonatomic, strong) UILabel *detailLabel;
@end
@implementation TLExpressionDetailInfoCell
+ (CGSize)viewSizeByDataModel:(TLExpressionGroupModel *)group
{
CGFloat detailHeight = [group.detail boundingRectWithSize:CGSizeMake(SCREEN_WIDTH - 30, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{ NSFontAttributeName : [UIFont systemFontOfSize:13.0f]} context:nil].size.height;
CGFloat height = 85.0 + detailHeight;
return CGSizeMake(SCREEN_WIDTH, height);
}
- (void)setViewDataModel:(id)dataModel
{
[self setGroupModel:dataModel];
}
- (id)initWithFrame:(CGRect)frame
{
if (self = [super initWithFrame:frame]) {
[self.contentView addSubview:self.titleLabel];
[self.contentView addSubview:self.downloadButton];
[self.contentView addSubview:self.detailLabel];
[self p_addMasonry];
}
return self;
}
- (void)setGroupModel:(TLExpressionGroupModel *)groupModel
{
_groupModel = groupModel;
[self.titleLabel setText:groupModel.name];
[self.detailLabel setText:groupModel.detail];
if (groupModel.status == TLExpressionGroupStatusLocal) {
[self.downloadButton setStatus:TLExpressionDownloadButtonStatusDownloaded];
}
else if (groupModel.status == TLExpressionGroupStatusDownloading) {
[self.downloadButton setStatus:TLExpressionDownloadButtonStatusDownloading];
}
else {
[self.downloadButton setStatus:TLExpressionDownloadButtonStatusNet];
}
@weakify(self);
[self.downloadButton setProgress:groupModel.downloadProgress];
[groupModel setDownloadProgressAction:^(TLExpressionGroupModel *groupModel, CGFloat progress) {
@strongify(self);
[self.downloadButton setProgress:progress];
}];
[groupModel setDownloadCompleteAction:^(TLExpressionGroupModel *groupModel, BOOL success, id data) {
@strongify(self);
[self setGroupModel:groupModel];
}];
}
#pragma mark - # Private Methods
- (void)p_addMasonry
{
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(25.0f);
make.left.mas_equalTo(15.0f);
make.right.mas_lessThanOrEqualTo(self.downloadButton.mas_right).mas_offset(-15);
}];
[self.downloadButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.titleLabel).mas_offset(-3);
make.right.mas_equalTo(self.contentView).mas_offset(-15.0f);
make.size.mas_equalTo(CGSizeMake(83, 30));
}];
[self.detailLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.titleLabel);
make.right.mas_equalTo(self.contentView).mas_offset(-15);
make.top.mas_equalTo(self.titleLabel.mas_bottom).mas_offset(20);
}];
}
#pragma mark - # Getter
- (UILabel *)titleLabel
{
if (_titleLabel == nil) {
_titleLabel = [[UILabel alloc] init];
[_titleLabel setBackgroundColor:[UIColor whiteColor]];
[_titleLabel setClipsToBounds:YES];
}
return _titleLabel;
}
- (TLExpressionDownloadButton *)downloadButton
{
if (_downloadButton == nil) {
_downloadButton = [[TLExpressionDownloadButton alloc] init];
@weakify(self);
[_downloadButton setDownloadButtonClick:^{
@strongify(self);
if (self.groupModel.status == TLExpressionGroupStatusNet) {
[self.groupModel startDownload];
[self setGroupModel:self.groupModel];
}
}];
}
return _downloadButton;
}
- (UILabel *)detailLabel
{
if (_detailLabel == nil) {
_detailLabel = [[UILabel alloc] init];
[_detailLabel setBackgroundColor:[UIColor whiteColor]];
[_detailLabel setClipsToBounds:YES];
[_detailLabel setFont:[UIFont systemFontOfSize:13.0f]];
[_detailLabel setTextColor:[UIColor grayColor]];
[_detailLabel setNumberOfLines:0];
}
return _detailLabel;
}
@end
@@ -0,0 +1,20 @@
//
// TLExpressionDetailItemCell.h
// TLChat
//
// Created by 李伯坤 on 16/4/8.
// Copyright © 2016年 李伯坤. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "TLExpressionModel.h"
#define EXP_DETAIL_EDGE 20.0
#define EXP_DETAIL_SPACE 15.0
#define EXP_DETAIL_CELL_WIDTH MIN(((SCREEN_WIDTH - EXP_DETAIL_EDGE * 2 - EXP_DETAIL_SPACE * 3.0) / 4.0), 84)
@interface TLExpressionDetailItemCell : UICollectionViewCell <ZZFlexibleLayoutViewProtocol>
@property (nonatomic, strong) TLExpressionModel *emoji;
@end
@@ -0,0 +1,57 @@
//
// TLExpressionDetailItemCell.m
// TLChat
//
// Created by 李伯坤 on 16/4/8.
// Copyright © 2016年 李伯坤. All rights reserved.
//
#import "TLExpressionDetailItemCell.h"
#import <SDWebImage/UIImage+GIF.h>
#import "UIImage+Color.h"
@interface TLExpressionDetailItemCell ()
@property (nonatomic, strong) UIImageView *imageView;
@end
@implementation TLExpressionDetailItemCell
+ (CGSize)viewSizeByDataModel:(id)dataModel
{
return CGSizeMake(EXP_DETAIL_CELL_WIDTH, EXP_DETAIL_CELL_WIDTH);
}
- (void)setViewDataModel:(id)dataModel
{
[self setEmoji:dataModel];
}
- (id)initWithFrame:(CGRect)frame
{
if (self = [super initWithFrame:frame]) {
self.imageView = self.contentView.addImageView(1)
.cornerRadius(3.0f)
.masonry(^(MASConstraintMaker *make) {
make.edges.mas_equalTo(self.contentView);
})
.view;
}
return self;
}
- (void)setEmoji:(TLExpressionModel *)emoji
{
_emoji = emoji;
UIImage *image = [UIImage imageNamed:emoji.path];
if (image) {
[self.imageView setImage:image];
}
else {
[self.imageView tt_setImageWithURL:TLURL(emoji.url)];
}
}
@end
@@ -0,0 +1,13 @@
//
// TLExpressionDetailSeperatorCell.h
// TLChat
//
// Created by 李伯坤 on 2018/1/4.
// Copyright © 2018年 李伯坤. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface TLExpressionDetailSeperatorCell : UICollectionViewCell <ZZFlexibleLayoutViewProtocol>
@end
@@ -0,0 +1,52 @@
//
// TLExpressionDetailSeperatorCell.m
// TLChat
//
// Created by 李伯坤 on 2018/1/4.
// Copyright © 2018年 李伯坤. All rights reserved.
//
#import "TLExpressionDetailSeperatorCell.h"
@implementation TLExpressionDetailSeperatorCell
+ (CGSize)viewSizeByDataModel:(id)dataModel
{
return CGSizeMake(SCREEN_WIDTH, 20);
}
- (id)initWithFrame:(CGRect)frame
{
if (self = [super initWithFrame:frame]) {
[self p_initUI];
}
return self;
}
- (void)p_initUI
{
UIView *line1 = self.contentView.addView(1).backgroundColor([UIColor colorGrayLine]).view;
UIView *line2 = self.contentView.addView(2).backgroundColor([UIColor colorGrayLine]).view;
UILabel *label = self.contentView.addLabel(3)
.backgroundColor([UIColor whiteColor]).clipsToBounds(YES)
.textColor([UIColor colorGrayLine]).font([UIFont systemFontOfSize:12.0f])
.text(LOCSTR(@"长按表情可预览")).view;
[label mas_makeConstraints:^(MASConstraintMaker *make) {
make.bottom.mas_equalTo(-5.0f);
make.left.mas_equalTo(line1.mas_right).mas_offset(5.0f);
make.right.mas_equalTo(line2.mas_left).mas_offset(-5.0f);
}];
[line1 mas_makeConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(BORDER_WIDTH_1PX);
make.left.mas_equalTo(15.0f);
make.centerY.mas_equalTo(label);
make.width.mas_equalTo(line2);
}];
[line2 mas_makeConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(BORDER_WIDTH_1PX);
make.right.mas_equalTo(-15.0f);
make.centerY.mas_equalTo(label);
}];
}
@end