提交
This commit is contained in:
91
TUIKit/TUIConversation/CommonModel/TUIConversationConfig.h
Normal file
91
TUIKit/TUIConversation/CommonModel/TUIConversationConfig.h
Normal file
@@ -0,0 +1,91 @@
|
||||
//
|
||||
// TUIConversationConfig.h
|
||||
// TUIConversation
|
||||
//
|
||||
// Created by Tencent on 2024/9/6.
|
||||
// Copyright © 2024 Tencent. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@class TUIConversationCellData;
|
||||
|
||||
typedef NS_OPTIONS(NSInteger, TUIConversationItemInMoreMenu) {
|
||||
TUIConversationItemInMoreMenu_None = 0,
|
||||
TUIConversationItemInMoreMenu_Delete = 1 << 0,
|
||||
TUIConversationItemInMoreMenu_MarkRead = 1 << 1,
|
||||
TUIConversationItemInMoreMenu_Hide = 1 << 2,
|
||||
TUIConversationItemInMoreMenu_Pin = 1 << 1,
|
||||
TUIConversationItemInMoreMenu_Clear = 1 << 2,
|
||||
};
|
||||
@protocol TUIConversationConfigDataSource <NSObject>
|
||||
@optional
|
||||
/**
|
||||
* Implement this method to hide items in more menu.
|
||||
*/
|
||||
- (TUIConversationItemInMoreMenu)conversationShouldHideItemsInMoreMenu:(TUIConversationCellData *)data;
|
||||
/**
|
||||
* Implement this method to add new items.
|
||||
*/
|
||||
- (NSArray *)conversationShouldAddNewItemsToMoreMenu:(TUIConversationCellData *)data;
|
||||
@end
|
||||
|
||||
|
||||
@interface TUIConversationConfig : NSObject
|
||||
|
||||
+ (TUIConversationConfig *)sharedConfig;
|
||||
|
||||
/**
|
||||
* DataSource of more menu.
|
||||
*/
|
||||
@property (nonatomic, weak) id<TUIConversationConfigDataSource> moreMenuDataSource;
|
||||
/**
|
||||
* Background color of conversation list.
|
||||
*/
|
||||
@property (nonatomic, strong) UIColor *listBackgroundColor;
|
||||
/**
|
||||
* Background color of cell in conversation list.
|
||||
* This configuration takes effect in all cells.
|
||||
*/
|
||||
@property (nonatomic, strong) UIColor *cellBackgroundColor;
|
||||
/**
|
||||
* Background color of pinned cell in conversation list.
|
||||
* This configuration takes effect in all pinned cells.
|
||||
*/
|
||||
@property (nonatomic, strong) UIColor *pinnedCellBackgroundColor;
|
||||
/**
|
||||
* Font of title label of cell in conversation list.
|
||||
* This configuration takes effect in all cells.
|
||||
*/
|
||||
@property (nonatomic, strong) UIFont *cellTitleLabelFont;
|
||||
/**
|
||||
* Font of subtitle label of cell in conversation list.
|
||||
* This configuration takes effect in all cells.
|
||||
*/
|
||||
@property (nonatomic, strong) UIFont *cellSubtitleLabelFont;
|
||||
/**
|
||||
* Font of time label of cell in conversation list.
|
||||
* This configuration takes effect in all cells.
|
||||
*/
|
||||
@property (nonatomic, strong) UIFont *cellTimeLabelFont;
|
||||
/**
|
||||
* Corner radius of the avatar.
|
||||
* This configuration takes effect in all avatars.
|
||||
*/
|
||||
@property(nonatomic, assign) CGFloat avatarCornerRadius;
|
||||
/**
|
||||
* Display user's online status icon in conversation and contact list.
|
||||
* The default value is NO.
|
||||
*/
|
||||
@property(nonatomic, assign) BOOL showUserOnlineStatusIcon;
|
||||
/**
|
||||
* Display unread count icon in each conversation cell.
|
||||
* The default value is YES.
|
||||
*/
|
||||
@property(nonatomic, assign) BOOL showCellUnreadCount;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
48
TUIKit/TUIConversation/CommonModel/TUIConversationConfig.m
Normal file
48
TUIKit/TUIConversation/CommonModel/TUIConversationConfig.m
Normal file
@@ -0,0 +1,48 @@
|
||||
//
|
||||
// TUIConversationConfig.m
|
||||
// TUIConversation
|
||||
//
|
||||
// Created by Tencent on 2024/9/6.
|
||||
// Copyright © 2024 Tencent. All rights reserved.
|
||||
//
|
||||
|
||||
#import "TUIConversationConfig.h"
|
||||
#import <TUICore/TUIConfig.h>
|
||||
|
||||
@implementation TUIConversationConfig
|
||||
|
||||
+ (TUIConversationConfig *)sharedConfig {
|
||||
static dispatch_once_t onceToken;
|
||||
static TUIConversationConfig *config;
|
||||
dispatch_once(&onceToken, ^{
|
||||
config = [[TUIConversationConfig alloc] init];
|
||||
});
|
||||
return config;
|
||||
}
|
||||
|
||||
- (instancetype)init {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
self.showCellUnreadCount = YES;
|
||||
_cellBackgroundColor = [UIColor clearColor];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)setAvatarCornerRadius:(CGFloat)avatarCornerRadius {
|
||||
[TUIConfig defaultConfig].avatarCornerRadius = avatarCornerRadius;
|
||||
}
|
||||
|
||||
- (CGFloat)avatarCornerRadius {
|
||||
return [TUIConfig defaultConfig].avatarCornerRadius;
|
||||
}
|
||||
|
||||
- (void)setShowUserOnlineStatusIcon:(BOOL)showUserOnlineStatusIcon {
|
||||
[TUIConfig defaultConfig].displayOnlineStatusIcon = showUserOnlineStatusIcon;
|
||||
}
|
||||
|
||||
- (BOOL)showUserOnlineStatusIcon {
|
||||
return [TUIConfig defaultConfig].displayOnlineStatusIcon;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,39 @@
|
||||
//
|
||||
// TUIConversationListControllerListener.h
|
||||
// Masonry
|
||||
//
|
||||
// Created by wyl on 2022/10/13.
|
||||
// Copyright © 2023 Tencent. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
typedef NS_ENUM(NSInteger, TUISearchType) { TUISearchTypeContact = 0, TUISearchTypeGroup = 1, TUISearchTypeChatHistory = 2 };
|
||||
|
||||
@protocol TUIConversationListControllerListener <NSObject>
|
||||
@optional
|
||||
|
||||
/**
|
||||
* In the conversation list, the callback to get the session display information.
|
||||
*/
|
||||
- (NSString *)getConversationDisplayString:(V2TIMConversation *)conversation;
|
||||
|
||||
/**
|
||||
* The callback for clicking the conversation in the conversation list
|
||||
* You can use this callback to respond to the user's click operation and jump to the chat interface corresponding to the session.
|
||||
*/
|
||||
- (void)conversationListController:(UIViewController *)conversationController didSelectConversation:(TUIConversationCellData *)conversation;
|
||||
|
||||
/**
|
||||
* The callback to clear all conversation unread count.
|
||||
*/
|
||||
- (void)onClearAllConversationUnreadCount;
|
||||
|
||||
/**
|
||||
* The callback to close conversation multiple choose board.
|
||||
*/
|
||||
- (void)onCloseConversationMultiChooseBoard;
|
||||
@end
|
||||
NS_ASSUME_NONNULL_END
|
||||
Reference in New Issue
Block a user