提交
This commit is contained in:
96
TUIKit/TIMCommon/UI_Classic/TUIBubbleMessageCell.h
Normal file
96
TUIKit/TIMCommon/UI_Classic/TUIBubbleMessageCell.h
Normal file
@@ -0,0 +1,96 @@
|
||||
|
||||
// Created by Tencent on 2023/06/09.
|
||||
// Copyright © 2023 Tencent. All rights reserved.
|
||||
/**
|
||||
* This document declares the TUIBubbleMessageCell class.
|
||||
* Bubble messages, the most common type of messages that contain strings and emoticons.
|
||||
* Both TUIFileMessageCell and TUIVoiceMessageCell inherit from this class and implement the userinterface of bubble messages.
|
||||
* If developers want to customize the bubble message, they can also refer to the implementation methods of the above two message units to implement their own
|
||||
* bubble message unit.
|
||||
*/
|
||||
#import "TUIBubbleMessageCellData.h"
|
||||
#import "TUIMessageCell.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface TUIBubbleMessageCell : TUIMessageCell
|
||||
|
||||
/**
|
||||
* The bubble image view, the message's bubble icon, wraps the message's content on the UI as a background panel for the bubble.
|
||||
*/
|
||||
@property(nonatomic, strong) UIImageView *bubbleView;
|
||||
|
||||
@property TUIBubbleMessageCellData *bubbleData;
|
||||
|
||||
- (void)fillWithData:(TUIBubbleMessageCellData *)data;
|
||||
|
||||
+ (CGFloat)getBubbleTop:(TUIBubbleMessageCellData *)data;
|
||||
|
||||
- (UIImage *)getBubble;
|
||||
|
||||
- (UIImage *)getErrorBubble;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
#pragma mark - TUILayoutConfiguration
|
||||
|
||||
@interface TUIBubbleMessageCell (TUILayoutConfiguration)
|
||||
|
||||
/**
|
||||
* Send bubble icon (normal state)
|
||||
* - The send icon of the bubble, assigned to the @bubble when the bubble message was sent.
|
||||
*/
|
||||
@property(nonatomic, class) UIImage *outgoingBubble;
|
||||
|
||||
/**
|
||||
* Send bubble icon (highlighted state)
|
||||
* - The send icon (highlighted state) of the bubble, assigned to @highlightedBubble when the bubble message was sent.
|
||||
*/
|
||||
@property(nonatomic, class) UIImage *outgoingHighlightedBubble;
|
||||
|
||||
@property(nonatomic, class) UIImage *outgoingErrorBubble;
|
||||
|
||||
/**
|
||||
*
|
||||
* Send bubble icon (highlighted state)
|
||||
*/
|
||||
@property(nonatomic, class) UIImage *outgoingAnimatedHighlightedAlpha20;
|
||||
@property(nonatomic, class) UIImage *outgoingAnimatedHighlightedAlpha50;
|
||||
|
||||
/**
|
||||
* Receive bubble icon (normal state)
|
||||
* - The receive icon of the bubble, assigned to the @bubble when the bubble message was received.
|
||||
*/
|
||||
@property(nonatomic, class) UIImage *incommingBubble;
|
||||
|
||||
/**
|
||||
* Receive bubble icon (highlighted state)
|
||||
* - The receive icon of the bubble, assigned to @highlightedBubble when the bubble message was received.
|
||||
*/
|
||||
@property(nonatomic, class) UIImage *incommingHighlightedBubble;
|
||||
|
||||
@property(nonatomic, class) UIImage *incommingErrorBubble;
|
||||
|
||||
/**
|
||||
* Receive bubble icon (highlighted state)
|
||||
*/
|
||||
@property(nonatomic, class) UIImage *incommingAnimatedHighlightedAlpha20;
|
||||
@property(nonatomic, class) UIImage *incommingAnimatedHighlightedAlpha50;
|
||||
|
||||
|
||||
/**
|
||||
* Spacing at the top of the send bubble
|
||||
* - It is used to locate the top of the sent bubble, and is assigned to @bubbleTop when the bubble message was sent.
|
||||
*/
|
||||
@property(nonatomic, class) CGFloat outgoingBubbleTop;
|
||||
|
||||
/**
|
||||
* Spacing at the top of the receiving bubble
|
||||
* - It is used to locate the top of the receive bubble, and is assigned to @bubbleTop when the bubble message was
|
||||
* received.
|
||||
*/
|
||||
@property(nonatomic, class) CGFloat incommingBubbleTop;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
354
TUIKit/TIMCommon/UI_Classic/TUIBubbleMessageCell.m
Normal file
354
TUIKit/TIMCommon/UI_Classic/TUIBubbleMessageCell.m
Normal file
@@ -0,0 +1,354 @@
|
||||
//
|
||||
// TBubbleMessageCell.m
|
||||
// TXIMSDK_TUIKit_iOS
|
||||
//
|
||||
// Created by annidyfeng on 2019/5/22.
|
||||
// Copyright © 2023 Tencent. All rights reserved.
|
||||
//
|
||||
|
||||
#import "TUIBubbleMessageCell.h"
|
||||
#import <TIMCommon/TIMCommonModel.h>
|
||||
#import <TIMCommon/TIMDefine.h>
|
||||
#import <TUICore/TUICore.h>
|
||||
|
||||
@implementation TUIBubbleMessageCell
|
||||
|
||||
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
|
||||
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
|
||||
if (self) {
|
||||
_bubbleView = [[UIImageView alloc] initWithFrame:self.container.bounds];
|
||||
_bubbleView.userInteractionEnabled = YES;
|
||||
[self.container addSubview:_bubbleView];
|
||||
_bubbleView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
|
||||
self.securityStrikeView = [[TUISecurityStrikeView alloc] init];
|
||||
[self.bubbleView addSubview:self.securityStrikeView];
|
||||
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)fillWithData:(TUIBubbleMessageCellData *)data {
|
||||
[super fillWithData:data];
|
||||
self.bubbleData = data;
|
||||
self.bubbleView.image = self.getBubble;
|
||||
self.bubbleView.highlightedImage = self.getHighlightBubble;
|
||||
self.securityStrikeView.hidden = YES;
|
||||
BOOL hasRiskContent = self.messageData.innerMessage.hasRiskContent;
|
||||
if (hasRiskContent) {
|
||||
self.bubbleView.image = [self getErrorBubble];
|
||||
self.securityStrikeView.hidden = NO;
|
||||
}
|
||||
|
||||
[self prepareReactTagUI:self.container];
|
||||
// tell constraints they need updating
|
||||
[self setNeedsUpdateConstraints];
|
||||
|
||||
// update constraints now so we can animate the change
|
||||
[self updateConstraintsIfNeeded];
|
||||
|
||||
[self layoutIfNeeded];
|
||||
|
||||
}
|
||||
|
||||
+ (BOOL)requiresConstraintBasedLayout {
|
||||
return YES;
|
||||
}
|
||||
|
||||
// this is Apple's recommended place for adding/updating constraints
|
||||
- (void)updateConstraints {
|
||||
|
||||
[super updateConstraints];
|
||||
[self.bubbleView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
make.leading.mas_equalTo(0);
|
||||
make.size.mas_equalTo(self.container);
|
||||
make.top.mas_equalTo(self.container);
|
||||
}];
|
||||
|
||||
CGPoint center = self.retryView.center;
|
||||
center.y = self.bubbleView.center.y;
|
||||
self.retryView.center = center;
|
||||
|
||||
}
|
||||
|
||||
- (void)layoutSubviews {
|
||||
[super layoutSubviews];
|
||||
}
|
||||
|
||||
- (void)highlightWhenMatchKeyword:(NSString *)keyword {
|
||||
/**
|
||||
* The parent class implements the default highlighting effect - flickering
|
||||
*/
|
||||
if (keyword) {
|
||||
if (self.highlightAnimating) {
|
||||
return;
|
||||
}
|
||||
[self animate:3];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)animate:(int)times {
|
||||
times--;
|
||||
if (times < 0) {
|
||||
self.bubbleView.image = self.getBubble;
|
||||
self.highlightAnimating = NO;
|
||||
return;
|
||||
}
|
||||
self.highlightAnimating = YES;
|
||||
self.bubbleView.image = self.getAnimateHighlightBubble_alpha50;
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.25 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
self.bubbleView.image = self.getAnimateHighlightBubble_alpha20;
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.25 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
if (!self.bubbleData.highlightKeyword) {
|
||||
[self animate:0];
|
||||
return;
|
||||
}
|
||||
[self animate:times];
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
- (CGFloat)getBubbleTop {
|
||||
return [self.class getBubbleTop:self.bubbleData];
|
||||
}
|
||||
|
||||
- (UIImage *)getBubble {
|
||||
if (!TIMConfig.defaultConfig.enableMessageBubble) {
|
||||
return nil;
|
||||
}
|
||||
if (self.bubbleData.direction == MsgDirectionIncoming) {
|
||||
return self.class.incommingBubble;
|
||||
} else {
|
||||
return self.class.outgoingBubble;
|
||||
}
|
||||
}
|
||||
|
||||
- (UIImage *)getHighlightBubble {
|
||||
if (!TIMConfig.defaultConfig.enableMessageBubble) {
|
||||
return nil;
|
||||
}
|
||||
if (self.bubbleData.direction == MsgDirectionIncoming) {
|
||||
return self.class.incommingHighlightedBubble;
|
||||
} else {
|
||||
return self.class.outgoingHighlightedBubble;
|
||||
}
|
||||
}
|
||||
|
||||
- (UIImage *)getErrorBubble {
|
||||
if (self.bubbleData.direction == MsgDirectionIncoming) {
|
||||
return self.class.incommingErrorBubble;
|
||||
} else {
|
||||
return self.class.outgoingErrorBubble;
|
||||
}
|
||||
}
|
||||
|
||||
- (UIImage *)getAnimateHighlightBubble_alpha50 {
|
||||
if (!TIMConfig.defaultConfig.enableMessageBubble) {
|
||||
return nil;
|
||||
}
|
||||
if (self.bubbleData.direction == MsgDirectionIncoming) {
|
||||
return self.class.incommingAnimatedHighlightedAlpha50;
|
||||
} else {
|
||||
return self.class.outgoingAnimatedHighlightedAlpha50;
|
||||
}
|
||||
}
|
||||
|
||||
- (UIImage *)getAnimateHighlightBubble_alpha20 {
|
||||
if (!TIMConfig.defaultConfig.enableMessageBubble) {
|
||||
return nil;
|
||||
}
|
||||
if (self.bubbleData.direction == MsgDirectionIncoming) {
|
||||
return self.class.incommingAnimatedHighlightedAlpha20;
|
||||
} else {
|
||||
return self.class.outgoingAnimatedHighlightedAlpha20;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)prepareReactTagUI:(UIView *)containerView {
|
||||
NSDictionary *param = @{TUICore_TUIChatExtension_ChatMessageReactPreview_Delegate: self};
|
||||
[TUICore raiseExtension:TUICore_TUIChatExtension_ChatMessageReactPreview_ClassicExtensionID parentView:containerView param:param];
|
||||
}
|
||||
|
||||
+ (CGFloat)getBubbleTop:(TUIBubbleMessageCellData *)data {
|
||||
if (data.direction == MsgDirectionIncoming) {
|
||||
return self.class.incommingBubbleTop;
|
||||
} else {
|
||||
return self.class.outgoingBubbleTop;
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@implementation TUIBubbleMessageCell (TUILayoutConfiguration)
|
||||
|
||||
+ (void)initialize {
|
||||
[NSNotificationCenter.defaultCenter addObserver:self selector:@selector(onThemeChanged:) name:TUIDidApplyingThemeChangedNotfication object:nil];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - outgoing Bubble
|
||||
static UIImage *gOutgoingBubble;
|
||||
+ (UIImage *)outgoingBubble {
|
||||
if (!gOutgoingBubble) {
|
||||
UIImage *defaultImage = [[TUIImageCache sharedInstance] getResourceFromCache:TUIChatImagePath(@"SenderTextNodeBkg")];
|
||||
[self setOutgoingBubble:TUIChatDynamicImage(@"chat_bubble_send_img", defaultImage)];
|
||||
}
|
||||
return gOutgoingBubble;
|
||||
}
|
||||
|
||||
+ (void)setOutgoingBubble:(UIImage *)outgoingBubble {
|
||||
gOutgoingBubble = [self stretchImage:outgoingBubble];
|
||||
}
|
||||
|
||||
static UIImage *gOutgoingHighlightedBubble;
|
||||
+ (UIImage *)outgoingHighlightedBubble {
|
||||
if (!gOutgoingHighlightedBubble) {
|
||||
UIImage *defaultImage = [[TUIImageCache sharedInstance] getResourceFromCache:TUIChatImagePath(@"SenderTextNodeBkgHL")];
|
||||
[self setOutgoingHighlightedBubble:TUIChatDynamicImage(@"chat_bubble_send_img", defaultImage)];
|
||||
}
|
||||
return gOutgoingHighlightedBubble;
|
||||
}
|
||||
|
||||
+ (void)setOutgoingHighlightedBubble:(UIImage *)outgoingHighlightedBubble {
|
||||
gOutgoingHighlightedBubble = [self stretchImage:outgoingHighlightedBubble];
|
||||
}
|
||||
|
||||
static UIImage *gOutgoingAnimatedHighlightedAlpha50;
|
||||
+ (UIImage *)outgoingAnimatedHighlightedAlpha50 {
|
||||
if (!gOutgoingAnimatedHighlightedAlpha50) {
|
||||
UIImage *alpha50 = [[TUIImageCache sharedInstance] getResourceFromCache:TUIChatImagePath(@"SenderTextNodeBkg_alpha50")];
|
||||
[self setOutgoingAnimatedHighlightedAlpha50:TUIChatDynamicImage(@"chat_bubble_send_alpha50_img", alpha50)];
|
||||
}
|
||||
return gOutgoingAnimatedHighlightedAlpha50;
|
||||
}
|
||||
|
||||
+ (void)setOutgoingAnimatedHighlightedAlpha50:(UIImage *)outgoingAnimatedHighlightedAlpha50 {
|
||||
gOutgoingAnimatedHighlightedAlpha50 = [self stretchImage:outgoingAnimatedHighlightedAlpha50];
|
||||
}
|
||||
|
||||
static UIImage *gOutgoingAnimatedHighlightedAlpha20;
|
||||
+ (UIImage *)outgoingAnimatedHighlightedAlpha20 {
|
||||
if (!gOutgoingAnimatedHighlightedAlpha20) {
|
||||
UIImage *alpha20 = [[TUIImageCache sharedInstance] getResourceFromCache:TUIChatImagePath(@"SenderTextNodeBkg_alpha20")];
|
||||
[self setOutgoingAnimatedHighlightedAlpha20:TUIChatDynamicImage(@"chat_bubble_send_alpha20_img", alpha20)];
|
||||
}
|
||||
return gOutgoingAnimatedHighlightedAlpha20;
|
||||
}
|
||||
|
||||
+ (void)setOutgoingAnimatedHighlightedAlpha20:(UIImage *)outgoingAnimatedHighlightedAlpha20 {
|
||||
gOutgoingAnimatedHighlightedAlpha20 = [self stretchImage:outgoingAnimatedHighlightedAlpha20];
|
||||
}
|
||||
|
||||
static UIImage *gOutgoingErrorBubble;
|
||||
+ (UIImage *)outgoingErrorBubble {
|
||||
if (!gOutgoingErrorBubble) {
|
||||
UIImage *defaultImage = [[TUIImageCache sharedInstance] getResourceFromCache:TUIChatImagePath(@"SenderTextNodeBkg")];
|
||||
UIImage *formatImage = TUIChatDynamicImage(@"chat_bubble_send_img", defaultImage);
|
||||
formatImage = [TUISecurityStrikeView changeImageColorWith:[UIColor tui_colorWithHex:@"#FA5151" alpha:0.16] image:formatImage alpha:1];
|
||||
gOutgoingErrorBubble = [self stretchImage:formatImage];
|
||||
}
|
||||
return gOutgoingErrorBubble;
|
||||
}
|
||||
|
||||
#pragma mark - incomming Bubble
|
||||
static UIImage *gIncommingBubble;
|
||||
+ (UIImage *)incommingBubble {
|
||||
if (!gIncommingBubble) {
|
||||
UIImage *defaultImage = [[TUIImageCache sharedInstance] getResourceFromCache:TUIChatImagePath(@"ReceiverTextNodeBkg")];
|
||||
[self setIncommingBubble:TUIChatDynamicImage(@"chat_bubble_receive_img", defaultImage)];
|
||||
}
|
||||
return gIncommingBubble;
|
||||
}
|
||||
|
||||
+ (void)setIncommingBubble:(UIImage *)incommingBubble {
|
||||
gIncommingBubble = [self stretchImage:incommingBubble];
|
||||
}
|
||||
|
||||
static UIImage *gIncommingHighlightedBubble;
|
||||
+ (UIImage *)incommingHighlightedBubble {
|
||||
if (!gIncommingHighlightedBubble) {
|
||||
UIImage *defaultImage = [[TUIImageCache sharedInstance] getResourceFromCache:TUIChatImagePath(@"ReceiverTextNodeBkgHL")];
|
||||
[self setIncommingHighlightedBubble:TUIChatDynamicImage(@"chat_bubble_receive_img", defaultImage)];
|
||||
}
|
||||
return gIncommingHighlightedBubble;
|
||||
}
|
||||
|
||||
+ (void)setIncommingHighlightedBubble:(UIImage *)incommingHighlightedBubble {
|
||||
gIncommingHighlightedBubble = [self stretchImage:incommingHighlightedBubble];
|
||||
}
|
||||
|
||||
static UIImage *gIncommingAnimatedHighlightedAlpha50;
|
||||
+ (UIImage *)incommingAnimatedHighlightedAlpha50 {
|
||||
if (!gIncommingAnimatedHighlightedAlpha50) {
|
||||
UIImage *alpha50 = [[TUIImageCache sharedInstance] getResourceFromCache:TUIChatImagePath(@"ReceiverTextNodeBkg_alpha50")];
|
||||
[self setIncommingAnimatedHighlightedAlpha50:TUIChatDynamicImage(@"chat_bubble_receive_alpha50_img", alpha50)];
|
||||
}
|
||||
return gIncommingAnimatedHighlightedAlpha50;
|
||||
}
|
||||
|
||||
+ (void)setIncommingAnimatedHighlightedAlpha50:(UIImage *)incommingAnimatedHighlightedAlpha50 {
|
||||
gIncommingAnimatedHighlightedAlpha50 = [self stretchImage:incommingAnimatedHighlightedAlpha50];
|
||||
}
|
||||
|
||||
static UIImage *gIncommingAnimatedHighlightedAlpha20;
|
||||
+ (UIImage *)incommingAnimatedHighlightedAlpha20 {
|
||||
if (!gIncommingAnimatedHighlightedAlpha20) {
|
||||
UIImage *alpha20 = [[TUIImageCache sharedInstance] getResourceFromCache:TUIChatImagePath(@"ReceiverTextNodeBkg_alpha20")];
|
||||
[self setIncommingAnimatedHighlightedAlpha20:TUIChatDynamicImage(@"chat_bubble_receive_alpha20_img", alpha20)];
|
||||
}
|
||||
return gIncommingAnimatedHighlightedAlpha20;
|
||||
}
|
||||
|
||||
+ (void)setIncommingAnimatedHighlightedAlpha20:(UIImage *)incommingAnimatedHighlightedAlpha20 {
|
||||
gIncommingAnimatedHighlightedAlpha20 = [self stretchImage:incommingAnimatedHighlightedAlpha20];
|
||||
}
|
||||
|
||||
static UIImage *gIncommingErrorBubble;
|
||||
+ (UIImage *)incommingErrorBubble {
|
||||
if (!gIncommingErrorBubble) {
|
||||
UIImage *defaultImage = [[TUIImageCache sharedInstance] getResourceFromCache:TUIChatImagePath(@"ReceiverTextNodeBkg")];
|
||||
UIImage *formatImage = TUIChatDynamicImage(@"chat_bubble_receive_img", defaultImage);
|
||||
formatImage = [TUISecurityStrikeView changeImageColorWith:[UIColor tui_colorWithHex:@"#FA5151" alpha:0.16] image:formatImage alpha:1];
|
||||
gIncommingErrorBubble = [self stretchImage:formatImage];
|
||||
}
|
||||
return gIncommingErrorBubble;
|
||||
}
|
||||
|
||||
+ (UIImage *)stretchImage:(UIImage *)oldImage {
|
||||
UIImage *image = [oldImage rtl_imageFlippedForRightToLeftLayoutDirection];
|
||||
UIEdgeInsets insets = rtlEdgeInsetsWithInsets(UIEdgeInsetsFromString(@"{12,12,12,12}"));
|
||||
return [image resizableImageWithCapInsets:insets resizingMode:UIImageResizingModeStretch];
|
||||
}
|
||||
|
||||
static CGFloat gOutgoingBubbleTop = 0;
|
||||
+ (CGFloat)outgoingBubbleTop {
|
||||
return gOutgoingBubbleTop;
|
||||
}
|
||||
|
||||
+ (void)setOutgoingBubbleTop:(CGFloat)outgoingBubble {
|
||||
gOutgoingBubbleTop = outgoingBubble;
|
||||
}
|
||||
|
||||
static CGFloat gIncommingBubbleTop = 0;
|
||||
+ (CGFloat)incommingBubbleTop {
|
||||
return gIncommingBubbleTop;
|
||||
}
|
||||
|
||||
+ (void)setIncommingBubbleTop:(CGFloat)incommingBubbleTop {
|
||||
gIncommingBubbleTop = incommingBubbleTop;
|
||||
}
|
||||
|
||||
|
||||
+ (void)onThemeChanged:(NSNotification *)notice {
|
||||
gOutgoingBubble = nil;
|
||||
gOutgoingHighlightedBubble = nil;
|
||||
gOutgoingAnimatedHighlightedAlpha50 = nil;
|
||||
gOutgoingAnimatedHighlightedAlpha20 = nil;
|
||||
|
||||
gIncommingBubble = nil;
|
||||
gIncommingHighlightedBubble = nil;
|
||||
gIncommingAnimatedHighlightedAlpha50 = nil;
|
||||
gIncommingAnimatedHighlightedAlpha20 = nil;
|
||||
}
|
||||
|
||||
@end
|
||||
37
TUIKit/TIMCommon/UI_Classic/TUICommonGroupInfoCellData.h
Normal file
37
TUIKit/TIMCommon/UI_Classic/TUICommonGroupInfoCellData.h
Normal file
@@ -0,0 +1,37 @@
|
||||
//
|
||||
// TUICommonGroupInfoCellData.h
|
||||
// TIMCommon
|
||||
//
|
||||
// Created by yiliangwang on 2024/12/26.
|
||||
// Copyright © 2024 Tencent. All rights reserved.
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface TUIGroupMemberCellData : NSObject
|
||||
|
||||
@property(nonatomic, strong) NSString *identifier;
|
||||
|
||||
@property(nonatomic, strong) NSString *name;
|
||||
|
||||
@property(nonatomic, strong) UIImage *avatarImage;
|
||||
|
||||
@property(nonatomic, strong) NSString *avatarUrl;
|
||||
|
||||
@property NSInteger tag;
|
||||
|
||||
@end
|
||||
|
||||
@interface TUIGroupMembersCellData : NSObject
|
||||
|
||||
@property(nonatomic, strong) NSMutableArray *members;
|
||||
- (CGFloat)heightOfWidth:(CGFloat)width;
|
||||
|
||||
@end
|
||||
|
||||
@interface TUICommonGroupInfoCellData : NSObject
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
46
TUIKit/TIMCommon/UI_Classic/TUICommonGroupInfoCellData.m
Normal file
46
TUIKit/TIMCommon/UI_Classic/TUICommonGroupInfoCellData.m
Normal file
@@ -0,0 +1,46 @@
|
||||
//
|
||||
// TUICommonGroupInfoCellData.m
|
||||
// TIMCommon
|
||||
//
|
||||
// Created by yiliangwang on 2024/12/26.
|
||||
// Copyright © 2024 Tencent. All rights reserved.
|
||||
|
||||
#import "TUICommonGroupInfoCellData.h"
|
||||
#import <TIMCommon/TIMDefine.h>
|
||||
#import <TUICore/UIView+TUILayout.h>
|
||||
|
||||
@implementation TUIGroupMemberCellData
|
||||
|
||||
@end
|
||||
|
||||
@implementation TUIGroupMembersCellData
|
||||
|
||||
+ (CGSize)getSize {
|
||||
CGSize headSize = TGroupMemberCell_Head_Size;
|
||||
if (headSize.width * TGroupMembersCell_Column_Count + TGroupMembersCell_Margin * (TGroupMembersCell_Column_Count + 1) > Screen_Width) {
|
||||
CGFloat wd = (Screen_Width - (TGroupMembersCell_Margin * (TGroupMembersCell_Column_Count + 1))) / TGroupMembersCell_Column_Count;
|
||||
headSize = CGSizeMake(wd, wd);
|
||||
}
|
||||
return CGSizeMake(headSize.width, headSize.height + TGroupMemberCell_Name_Height + TGroupMemberCell_Margin);
|
||||
}
|
||||
|
||||
+ (CGFloat)getHeight:(TUIGroupMembersCellData *)data {
|
||||
NSInteger row = ceil(data.members.count * 1.0 / TGroupMembersCell_Column_Count);
|
||||
if (row > TGroupMembersCell_Row_Count) {
|
||||
row = TGroupMembersCell_Row_Count;
|
||||
}
|
||||
CGFloat height = row * [self getSize].height + (row + 1) * TGroupMembersCell_Margin;
|
||||
return height;
|
||||
}
|
||||
|
||||
|
||||
- (CGFloat)heightOfWidth:(CGFloat)width {
|
||||
return [self.class getHeight:self];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@implementation TUICommonGroupInfoCellData
|
||||
|
||||
@end
|
||||
34
TUIKit/TIMCommon/UI_Classic/TUIConfig_Classic.h
Normal file
34
TUIKit/TIMCommon/UI_Classic/TUIConfig_Classic.h
Normal file
@@ -0,0 +1,34 @@
|
||||
//
|
||||
// TUIConfig_Classic.h
|
||||
// TIMCommon
|
||||
//
|
||||
// Created by Tencent on 2024/7/16.
|
||||
// Copyright © 2024 Tencent. All rights reserved.
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface TUIConfig_Classic : NSObject
|
||||
/**
|
||||
* Show the toast prompt built in TUIKit.
|
||||
* The default value is YES.
|
||||
*/
|
||||
+ (void)enableToast:(BOOL)enable;
|
||||
|
||||
/**
|
||||
* Switch the language of TUIKit.
|
||||
* The currently supported languages are "en", "zh-Hans", and "ar".
|
||||
*/
|
||||
+ (void)switchLanguageToTarget:(NSString *)targetLanguage;
|
||||
|
||||
/**
|
||||
* Switch the theme of TUIKit.
|
||||
* The currently supported languages are "system", "serious", "light", "lively", "dark"
|
||||
*/
|
||||
+ (void)switchThemeToTarget:(NSString *)targetTheme;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
27
TUIKit/TIMCommon/UI_Classic/TUIConfig_Classic.m
Normal file
27
TUIKit/TIMCommon/UI_Classic/TUIConfig_Classic.m
Normal file
@@ -0,0 +1,27 @@
|
||||
//
|
||||
// TUIConfig_Classic.m
|
||||
// TIMCommon
|
||||
//
|
||||
// Created by Tencent on 2024/7/16.
|
||||
// Copyright © 2024 Tencent. All rights reserved.
|
||||
|
||||
#import "TUIConfig_Classic.h"
|
||||
#import <TUICore/TUIConfig.h>
|
||||
#import <TUICore/TUIGlobalization.h>
|
||||
#import <TUICore/TUIThemeManager.h>
|
||||
|
||||
@implementation TUIConfig_Classic
|
||||
|
||||
+ (void)enableToast:(BOOL)enable {
|
||||
[TUIConfig defaultConfig].enableToast = enable;
|
||||
}
|
||||
|
||||
+ (void)switchLanguageToTarget:(NSString *)targetLanguage {
|
||||
[TUIGlobalization setPreferredLanguage:targetLanguage];
|
||||
}
|
||||
|
||||
+ (void)switchThemeToTarget:(NSString *)targetTheme {
|
||||
[TUIThemeManager.shareManager applyTheme:targetTheme forModule:TUIThemeModuleAll];
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user