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,16 @@
//
// TLChatFileCell.h
// TLChat
//
// Created by 李伯坤 on 16/3/18.
// Copyright © 2016年 李伯坤. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "TLImageMessage.h"
@interface TLChatFileCell : UICollectionViewCell
@property (nonatomic, strong) TLMessage * message;
@end
@@ -0,0 +1,64 @@
//
// TLChatFileCell.m
// TLChat
//
// Created by 李伯坤 on 16/3/18.
// Copyright © 2016年 李伯坤. All rights reserved.
//
#import "TLChatFileCell.h"
#import "NSFileManager+TLChat.h"
#import "TLMacros.h"
@interface TLChatFileCell ()
@property (nonatomic, strong) UIImageView *imageView;
@end
@implementation TLChatFileCell
- (id)initWithFrame:(CGRect)frame
{
if (self = [super initWithFrame:frame]) {
[self.contentView addSubview:self.imageView];
[self p_addMasonry];
}
return self;
}
- (void)setMessage:(TLMessage *)message
{
_message = message;
if (message.messageType == TLMessageTypeImage) {
if ([(TLImageMessage *)message imagePath].length > 0) {
NSString *imagePath = [NSFileManager pathUserChatImage:[(TLImageMessage *)message imagePath]];
[self.imageView setImage:[UIImage imageNamed:imagePath]];
}
else if ([(TLImageMessage *)message imageURL].length > 0) {
[self.imageView tt_setImageWithURL:TLURL([(TLImageMessage *)message imageURL]) placeholderImage:[UIImage imageNamed:DEFAULT_AVATAR_PATH]];
}
else {
[self.imageView setImage:nil];
}
}
}
#pragma mark - Private Methods -
- (void)p_addMasonry
{
[self.imageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(self.contentView);
}];
}
#pragma mark - Getter -
- (UIImageView *)imageView
{
if (_imageView == nil) {
_imageView = [[UIImageView alloc] init];
}
return _imageView;
}
@end
@@ -0,0 +1,15 @@
//
// TLChatFileHeaderView.h
// TLChat
//
// Created by 李伯坤 on 16/3/18.
// Copyright © 2016年 李伯坤. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface TLChatFileHeaderView : UICollectionReusableView
@property (nonatomic, strong) NSString *title;
@end
@@ -0,0 +1,70 @@
//
// TLChatFileHeaderView.m
// TLChat
//
// Created by 李伯坤 on 16/3/18.
// Copyright © 2016年 李伯坤. All rights reserved.
//
#import "TLChatFileHeaderView.h"
@interface TLChatFileHeaderView ()
@property (nonatomic, strong) UIView *bgView;
@property (nonatomic, strong) UILabel *titleLabel;
@end
@implementation TLChatFileHeaderView
- (id)initWithFrame:(CGRect)frame
{
if (self = [super initWithFrame:frame]) {
[self setBackgroundColor:[UIColor clearColor]];
[self addSubview:self.bgView];
[self addSubview:self.titleLabel];
[self p_addMasonry];
}
return self;
}
- (void)setTitle:(NSString *)title
{
_title = title;
[self.titleLabel setText:title];
}
#pragma mark - Private Methods -
- (void)p_addMasonry
{
[self.bgView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(self);
}];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(self).mas_offset(UIEdgeInsetsMake(0, 10, 0, 10));
}];
}
#pragma mark - Getter -
- (UIView *)bgView
{
if (_bgView == nil) {
_bgView = [[UIView alloc] init];
[_bgView setBackgroundColor:[UIColor colorBlackBG]];
[_bgView setAlpha:0.8f];
}
return _bgView;
}
- (UILabel *)titleLabel
{
if (_titleLabel == nil) {
_titleLabel = [[UILabel alloc] init];
[_titleLabel setTextColor:[UIColor whiteColor]];
[_titleLabel setFont:[UIFont systemFontOfSize:14.0f]];
}
return _titleLabel;
}
@end