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 @@
//
// TLMyExpressionViewController.h
// TLChat
//
// Created by 李伯坤 on 16/3/10.
// Copyright © 2016年 李伯坤. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface TLMyExpressionViewController : ZZFlexibleLayoutViewController
@end
@@ -0,0 +1,95 @@
//
// TLMyExpressionViewController.m
// TLChat
//
// Created by 李伯坤 on 16/3/10.
// Copyright © 2016年 李伯坤. All rights reserved.
//
#import "TLMyExpressionViewController.h"
#import "TLExpressionDetailViewController.h"
#import "TLExpressionHelper.h"
#import "TLMyExpressionCell.h"
typedef NS_ENUM(NSInteger, TLMyExpressionVCSectionType) {
TLMyExpressionVCSectionTypeMine,
TLMyExpressionVCSectionTypeFunction,
};
@interface TLMyExpressionViewController () <TLMyExpressionCellDelegate>
@end
@implementation TLMyExpressionViewController
- (void)loadView
{
[super loadView];
[self setTitle:LOCSTR(@"我的表情")];
[self.view setBackgroundColor:[UIColor colorGrayBG]];
@weakify(self);
[self addRightBarButtonWithTitle:LOCSTR(@"排序") actionBlick:^{
}];
if (self.navigationController.rootViewController == self) {
[self addLeftBarButtonWithTitle:LOCSTR(@"取消") actionBlick:^{
@strongify(self);
[self dismissViewControllerAnimated:YES completion:nil];
}];
}
[self loadMyExpressionVCUI];
}
#pragma mark - # UI
- (void)loadMyExpressionVCUI
{
@weakify(self);
self.clear();
NSArray *expArray = [TLExpressionHelper sharedHelper].userEmojiGroups;
if (expArray.count > 0) {
self.addSection(TLMyExpressionVCSectionTypeMine).sectionInsets(UIEdgeInsetsMake(15, 0, 0, 0));
self.addCells(@"TLMyExpressionCell").toSection(TLMyExpressionVCSectionTypeMine).withDataModelArray(expArray).selectedAction(^ (id data) {
@strongify(self);
TLExpressionDetailViewController *detailVC = [[TLExpressionDetailViewController alloc] initWithGroupModel:data];
PushVC(detailVC);
});
self.addSection(TLMyExpressionVCSectionTypeFunction).sectionInsets(UIEdgeInsetsMake(20, 0, 40, 0));
}
else {
self.addSection(TLMyExpressionVCSectionTypeFunction).sectionInsets(UIEdgeInsetsMake(15, 0, 30, 0));
}
// 添加的表情
self.addCell(CELL_ST_ITEM_NORMAL).toSection(TLMyExpressionVCSectionTypeFunction).withDataModel(TLCreateSettingItem(@"添加的表情")).selectedAction(^ (id data) {
});
// 购买的表情
self.addCell(CELL_ST_ITEM_NORMAL).toSection(TLMyExpressionVCSectionTypeFunction).withDataModel(TLCreateSettingItem(@"购买的表情")).selectedAction(^ (id data) {
});
}
#pragma mark - # Delegate
//MARK: TLMyExpressionCellDelegate
- (void)myExpressionCellDeleteButtonDown:(TLExpressionGroupModel *)group
{
BOOL ok = [[TLExpressionHelper sharedHelper] deleteExpressionGroupByID:group.gId];
if (ok) {
self.deleteCell.byDataModel(group);
if (self.sectionForTag(TLMyExpressionVCSectionTypeMine).dataModelArray.count == 0) {
self.deleteSection(TLMyExpressionVCSectionTypeMine);
self.sectionForTag(TLMyExpressionVCSectionTypeFunction).sectionInsets(UIEdgeInsetsMake(15, 0, 0, 0));
}
[self reloadView];
}
else {
[TLUIUtility showErrorHint:@"表情包删除失败"];
}
}
@end
@@ -0,0 +1,24 @@
//
// TLMyExpressionCell.h
// TLChat
//
// Created by 李伯坤 on 16/3/12.
// Copyright © 2016年 李伯坤. All rights reserved.
//
#import "TLSettingItemBaseCell.h"
#import "TLExpressionGroupModel.h"
@protocol TLMyExpressionCellDelegate <NSObject>
- (void)myExpressionCellDeleteButtonDown:(TLExpressionGroupModel *)group;
@end
@interface TLMyExpressionCell : TLSettingItemBaseCell
@property (nonatomic, assign) id<TLMyExpressionCellDelegate>delegate;
@property (nonatomic, strong) TLExpressionGroupModel *group;
@end
@@ -0,0 +1,96 @@
//
// TLMyExpressionCell.m
// TLChat
//
// Created by 李伯坤 on 16/3/12.
// Copyright © 2016年 李伯坤. All rights reserved.
//
#import "TLMyExpressionCell.h"
#import "UIImage+Color.h"
@interface TLMyExpressionCell()
@property (nonatomic, strong) UIImageView *iconView;
@property (nonatomic, strong) UILabel *titleLabel;
@end
@implementation TLMyExpressionCell
#pragma mark - # Protocol
+ (CGFloat)viewHeightByDataModel:(id)dataModel
{
return 50;
}
- (void)setViewDataModel:(id)dataModel
{
[self setGroup:dataModel];
}
- (void)setViewDelegate:(id)delegate
{
self.delegate = delegate;
}
#pragma mark - # Cell
- (id)initWithFrame:(CGRect)frame
{
if (self = [super initWithFrame:frame]) {
[self.arrowView setHidden:YES];
[self setSelectedBackgrounColor:[UIColor colorGrayLine]];
[self p_initMyExpressionCellSubviews];
}
return self;
}
- (void)setGroup:(TLExpressionGroupModel *)group
{
_group = group;
[self.iconView setImage:[UIImage imageNamed:group.iconPath]];
[self.titleLabel setText:group.name];
}
#pragma mark - # UI
- (void)p_initMyExpressionCellSubviews
{
@weakify(self);
self.iconView = self.contentView.addImageView(1)
.masonry(^ (MASConstraintMaker *make) {
make.left.mas_equalTo(15.0f);
make.centerY.mas_equalTo(0);
make.width.and.height.mas_equalTo(35);
})
.view;
UIButton *deleteButton = self.contentView.addButton(2)
.backgroundColor([UIColor colorGrayBG]).backgroundColorHL([UIColor colorGrayLine])
.title(LOCSTR(@"移除")).titleColor([UIColor grayColor]).titleFont([UIFont systemFontOfSize:13.0f])
.cornerRadius(3.0f).border(BORDER_WIDTH_1PX, [UIColor colorGrayLine])
.eventBlock(UIControlEventTouchUpInside, ^(UIButton *sender) {
@strongify(self);
if (self.delegate && [self.delegate respondsToSelector:@selector(myExpressionCellDeleteButtonDown:)]) {
[self.delegate myExpressionCellDeleteButtonDown:self.group];
}
})
.masonry(^ (MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(50, 30));
make.right.mas_equalTo(-15);
make.centerY.mas_equalTo(0);
})
.view;
self.titleLabel = self.addLabel(3)
.masonry(^(MASConstraintMaker *make) {
make.centerY.mas_equalTo(0);
make.left.mas_equalTo(self.iconView.mas_right).mas_offset(10.0f);
make.right.mas_lessThanOrEqualTo(deleteButton.mas_left).mas_offset(-15.0f);
})
.view;
}
@end