提交
This commit is contained in:
17
TUIKit/TUIChat/UI_Classic/Service/TUIChatExtensionObserver.h
Normal file
17
TUIKit/TUIChat/UI_Classic/Service/TUIChatExtensionObserver.h
Normal file
@@ -0,0 +1,17 @@
|
||||
//
|
||||
// TUIChatExtensionObserver.h
|
||||
// TUIChat
|
||||
//
|
||||
// Created by cologne on 2023/3/30.
|
||||
// Copyright © 2023 Tencent. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface TUIChatExtensionObserver : NSObject
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
105
TUIKit/TUIChat/UI_Classic/Service/TUIChatExtensionObserver.m
Normal file
105
TUIKit/TUIChat/UI_Classic/Service/TUIChatExtensionObserver.m
Normal file
@@ -0,0 +1,105 @@
|
||||
//
|
||||
// TUIChatExtensionObserver.m
|
||||
// TUIChat
|
||||
//
|
||||
// Created by cologne on 2023/3/30.
|
||||
// Copyright © 2023 Tencent. All rights reserved.
|
||||
//
|
||||
|
||||
#import "TUIChatExtensionObserver.h"
|
||||
#import <TIMCommon/TIMCommonModel.h>
|
||||
#import <TUICore/TUICore.h>
|
||||
#import "TUIC2CChatViewController.h"
|
||||
#import "TUIGroupInfoController.h"
|
||||
|
||||
@interface TUIChatExtensionObserver () <TUIExtensionProtocol>
|
||||
|
||||
@end
|
||||
|
||||
@implementation TUIChatExtensionObserver
|
||||
|
||||
+ (void)load {
|
||||
[self registerFriendProfileActionMenuExtension];
|
||||
}
|
||||
|
||||
+ (instancetype)shareInstance {
|
||||
static dispatch_once_t onceToken;
|
||||
static id instance = nil;
|
||||
dispatch_once(&onceToken, ^{
|
||||
instance = [[self alloc] init];
|
||||
});
|
||||
return instance;
|
||||
}
|
||||
|
||||
+ (void)registerFriendProfileActionMenuExtension {
|
||||
[TUICore registerExtension:TUICore_TUIContactExtension_FriendProfileActionMenu_ClassicExtensionID object:TUIChatExtensionObserver.shareInstance];
|
||||
|
||||
[TUICore registerExtension:TUICore_TUIChatExtension_NavigationMoreItem_ClassicExtensionID object:TUIChatExtensionObserver.shareInstance];
|
||||
}
|
||||
|
||||
#pragma mark - TUIExtensionProtocol
|
||||
- (NSArray<TUIExtensionInfo *> *)onGetExtension:(NSString *)extensionID param:(NSDictionary *)param {
|
||||
if (![extensionID isKindOfClass:NSString.class]) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
if ([extensionID isEqualToString:TUICore_TUIContactExtension_FriendProfileActionMenu_ClassicExtensionID]) {
|
||||
return [self getFriendProfileActionMenuExtensionForClassicContact:param];
|
||||
}
|
||||
else if ([extensionID isEqualToString:TUICore_TUIChatExtension_NavigationMoreItem_ClassicExtensionID]) {
|
||||
return [self getNavigationMoreItemExtensionForClassicChat:param];
|
||||
}
|
||||
else {
|
||||
return nil;
|
||||
}
|
||||
}
|
||||
|
||||
- (NSArray<TUIExtensionInfo *> *)getFriendProfileActionMenuExtensionForClassicContact:(NSDictionary *)param {
|
||||
TUIExtensionInfo *info = [[TUIExtensionInfo alloc] init];
|
||||
info.weight = 300;
|
||||
info.text = TIMCommonLocalizableString(ProfileSendMessages);
|
||||
info.onClicked = ^(NSDictionary *_Nonnull actionParam) {
|
||||
NSString *userID = [actionParam tui_objectForKey:TUICore_TUIContactExtension_FriendProfileActionMenu_UserID asClass:NSString.class];
|
||||
UINavigationController *pushVC = [actionParam tui_objectForKey:TUICore_TUIContactExtension_FriendProfileActionMenu_PushVC
|
||||
asClass:UINavigationController.class];
|
||||
if (userID.length > 0 && pushVC) {
|
||||
TUIChatConversationModel *conversationModel = [[TUIChatConversationModel alloc] init];
|
||||
conversationModel.userID = userID;
|
||||
conversationModel.conversationID = [NSString stringWithFormat:@"c2c_%@", userID];
|
||||
TUIBaseChatViewController *chatVC = [[TUIC2CChatViewController alloc] init];
|
||||
chatVC.conversationData = conversationModel;
|
||||
chatVC.title = conversationModel.title;
|
||||
for (UIViewController *vc in pushVC.childViewControllers) {
|
||||
if ([vc isKindOfClass:chatVC.class]) {
|
||||
[pushVC popToViewController:vc animated:YES];
|
||||
return;
|
||||
}
|
||||
}
|
||||
[pushVC pushViewController:chatVC animated:YES];
|
||||
}
|
||||
};
|
||||
return @[ info ];
|
||||
}
|
||||
|
||||
- (NSArray<TUIExtensionInfo *> *)getNavigationMoreItemExtensionForClassicChat:(NSDictionary *)param {
|
||||
if (![param isKindOfClass:NSDictionary.class]) {
|
||||
return nil;
|
||||
}
|
||||
NSString *groupID = [param tui_objectForKey:TUICore_TUIChatExtension_NavigationMoreItem_GroupID asClass:NSString.class];
|
||||
if (groupID.length > 0) {
|
||||
TUIExtensionInfo *info = [[TUIExtensionInfo alloc] init];
|
||||
info.icon = TIMCommonBundleThemeImage(@"chat_nav_more_menu_img", @"chat_nav_more_menu");
|
||||
info.onClicked = ^(NSDictionary *_Nonnull param) {
|
||||
UINavigationController *pushVC = [param tui_objectForKey:TUICore_TUIChatExtension_NavigationMoreItem_PushVC asClass:UINavigationController.class];
|
||||
if (pushVC) {
|
||||
TUIGroupInfoController *vc = [[TUIGroupInfoController alloc] init];
|
||||
vc.groupId = groupID;
|
||||
[pushVC pushViewController:vc animated:YES];
|
||||
}
|
||||
};
|
||||
return @[ info ];
|
||||
} else {
|
||||
return nil;
|
||||
}
|
||||
}
|
||||
@end
|
||||
19
TUIKit/TUIChat/UI_Classic/Service/TUIChatObjectFactory.h
Normal file
19
TUIKit/TUIChat/UI_Classic/Service/TUIChatObjectFactory.h
Normal file
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// TUIChatObjectFactory.h
|
||||
// TUIChat
|
||||
//
|
||||
// Created by wyl on 2023/3/20.
|
||||
// Copyright © 2023 Tencent. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <TIMCommon/TIMDefine.h>
|
||||
#import <TUICore/TUICore.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface TUIChatObjectFactory : NSObject
|
||||
+ (TUIChatObjectFactory *)shareInstance;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
157
TUIKit/TUIChat/UI_Classic/Service/TUIChatObjectFactory.m
Normal file
157
TUIKit/TUIChat/UI_Classic/Service/TUIChatObjectFactory.m
Normal file
@@ -0,0 +1,157 @@
|
||||
//
|
||||
// TUIChatObjectFactory.m
|
||||
// TUIChat
|
||||
//
|
||||
// Created by wyl on 2023/3/20.
|
||||
// Copyright © 2023 Tencent. All rights reserved.
|
||||
//
|
||||
|
||||
#import "TUIChatObjectFactory.h"
|
||||
#import <TUICore/NSDictionary+TUISafe.h>
|
||||
#import "TUIC2CChatViewController.h"
|
||||
#import "TUIChatConfig.h"
|
||||
#import "TUIChatDefine.h"
|
||||
#import "TUIGroupChatViewController.h"
|
||||
#import "TUIChatShortcutMenuView.h"
|
||||
#import "TUIGroupInfoController.h"
|
||||
|
||||
@interface TUIChatObjectFactory () <TUIObjectProtocol>
|
||||
|
||||
@end
|
||||
|
||||
@implementation TUIChatObjectFactory
|
||||
+ (void)load {
|
||||
[TUICore registerObjectFactory:TUICore_TUIChatObjectFactory objectFactory:[TUIChatObjectFactory shareInstance]];
|
||||
}
|
||||
+ (TUIChatObjectFactory *)shareInstance {
|
||||
static dispatch_once_t onceToken;
|
||||
static TUIChatObjectFactory *g_sharedInstance = nil;
|
||||
dispatch_once(&onceToken, ^{
|
||||
g_sharedInstance = [[TUIChatObjectFactory alloc] init];
|
||||
});
|
||||
return g_sharedInstance;
|
||||
}
|
||||
|
||||
#pragma mark - TUIObjectProtocol
|
||||
- (id)onCreateObject:(NSString *)method param:(nullable NSDictionary *)param {
|
||||
if ([method isEqualToString:TUICore_TUIChatObjectFactory_ChatViewController_Classic]) {
|
||||
return [self createChatViewControllerParam:param];
|
||||
}
|
||||
else if ([method isEqualToString:TUICore_TUIContactObjectFactory_GetGroupInfoVC_Classic]) {
|
||||
return [self createGroupInfoController:[param tui_objectForKey:TUICore_TUIContactObjectFactory_GetGroupInfoVC_GroupID asClass:NSString.class]];
|
||||
}
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
#pragma mark - Private
|
||||
|
||||
- (UIViewController *)createChatViewControllerParam:(nullable NSDictionary *)param {
|
||||
|
||||
NSString *title = [param tui_objectForKey:TUICore_TUIChatObjectFactory_ChatViewController_Title asClass:NSString.class];
|
||||
NSString *userID = [param tui_objectForKey:TUICore_TUIChatObjectFactory_ChatViewController_UserID asClass:NSString.class];
|
||||
NSString *groupID = [param tui_objectForKey:TUICore_TUIChatObjectFactory_ChatViewController_GroupID asClass:NSString.class];
|
||||
NSString *conversationID = [param tui_objectForKey:TUICore_TUIChatObjectFactory_ChatViewController_ConversationID asClass:NSString.class];
|
||||
UIImage *avatarImage = [param tui_objectForKey:TUICore_TUIChatObjectFactory_ChatViewController_AvatarImage asClass:UIImage.class];
|
||||
NSString *avatarUrl = [param tui_objectForKey:TUICore_TUIChatObjectFactory_ChatViewController_AvatarUrl asClass:NSString.class];
|
||||
NSString *highlightKeyword = [param tui_objectForKey:TUICore_TUIChatObjectFactory_ChatViewController_HighlightKeyword asClass:NSString.class];
|
||||
V2TIMMessage *locateMessage = [param tui_objectForKey:TUICore_TUIChatObjectFactory_ChatViewController_LocateMessage asClass:V2TIMMessage.class];
|
||||
NSString * atTipsStr = [param tui_objectForKey:TUICore_TUIChatObjectFactory_ChatViewController_AtTipsStr asClass:NSString.class];
|
||||
NSArray * atMsgSeqs = [param tui_objectForKey:TUICore_TUIChatObjectFactory_ChatViewController_AtMsgSeqs asClass:NSArray.class];
|
||||
NSString *draft = [param tui_objectForKey:TUICore_TUIChatObjectFactory_ChatViewController_Draft asClass:NSString.class];
|
||||
NSString *isEnableVideoInfoStr = [param tui_objectForKey:TUICore_TUIChatObjectFactory_ChatViewController_Enable_Video_Call asClass:NSString.class];
|
||||
NSString *isEnableAudioInfoStr = [param tui_objectForKey:TUICore_TUIChatObjectFactory_ChatViewController_Enable_Audio_Call asClass:NSString.class];
|
||||
NSString *isEnableRoomInfoStr = [param tui_objectForKey:TUICore_TUIChatObjectFactory_ChatViewController_Enable_Room asClass:NSString.class];
|
||||
NSString *isLimitedPortraitOrientationStr = [param tui_objectForKey:TUICore_TUIChatObjectFactory_ChatViewController_Limit_Portrait_Orientation
|
||||
asClass: NSString.class];
|
||||
NSString *isEnablePollInfoStr = [param tui_objectForKey:TUICore_TUIChatObjectFactory_ChatViewController_Enable_Poll
|
||||
asClass:NSString.class];
|
||||
NSString *isEnableGroupNoteInfoStr = [param tui_objectForKey:TUICore_TUIChatObjectFactory_ChatViewController_Enable_GroupNote asClass:NSString.class];
|
||||
NSString *isEnableWelcomeCustomMessage = [param tui_objectForKey:
|
||||
TUICore_TUIChatObjectFactory_ChatViewController_Enable_WelcomeCustomMessage
|
||||
asClass:NSString.class];
|
||||
|
||||
NSString *isEnableTakePhotoStr = [param tui_objectForKey:TUICore_TUIChatObjectFactory_ChatViewController_Enable_TakePhoto asClass:NSString.class];
|
||||
|
||||
NSString *isEnableRecordVideoStr = [param tui_objectForKey:TUICore_TUIChatObjectFactory_ChatViewController_Enable_RecordVideo asClass:NSString.class];
|
||||
|
||||
NSString *isEnableFileStr = [param tui_objectForKey:TUICore_TUIChatObjectFactory_ChatViewController_Enable_File
|
||||
asClass:NSString.class];
|
||||
NSString *isEnableAlbumStr = [param tui_objectForKey:TUICore_TUIChatObjectFactory_ChatViewController_Enable_Album
|
||||
asClass:NSString.class];
|
||||
|
||||
|
||||
TUIChatConversationModel *conversationModel = [[TUIChatConversationModel alloc] init];
|
||||
conversationModel.title = title;
|
||||
conversationModel.userID = userID;
|
||||
conversationModel.groupID = groupID;
|
||||
conversationModel.conversationID = conversationID;
|
||||
conversationModel.avatarImage = avatarImage;
|
||||
conversationModel.faceUrl = avatarUrl;
|
||||
conversationModel.atTipsStr = atTipsStr;
|
||||
conversationModel.atMsgSeqs = [NSMutableArray arrayWithArray:atMsgSeqs];
|
||||
conversationModel.draftText = draft;
|
||||
|
||||
if ([isEnableVideoInfoStr isEqualToString:@"0"]) {
|
||||
conversationModel.enableVideoCall = NO;
|
||||
}
|
||||
|
||||
if ([isEnableAudioInfoStr isEqualToString:@"0"]) {
|
||||
conversationModel.enableAudioCall = NO;
|
||||
}
|
||||
|
||||
if ([isEnableRoomInfoStr isEqualToString:@"0"]) {
|
||||
conversationModel.enableRoom = NO;
|
||||
}
|
||||
if ([isLimitedPortraitOrientationStr isEqualToString:@"1"]) {
|
||||
conversationModel.isLimitedPortraitOrientation = YES;
|
||||
}
|
||||
|
||||
if ([isEnableWelcomeCustomMessage isEqualToString:@"0"]) {
|
||||
conversationModel.enableWelcomeCustomMessage = NO;
|
||||
}
|
||||
|
||||
if ([isEnablePollInfoStr isEqualToString:@"0"]) {
|
||||
conversationModel.enablePoll = NO;
|
||||
}
|
||||
|
||||
if ([isEnableGroupNoteInfoStr isEqualToString:@"0"]) {
|
||||
conversationModel.enableGroupNote = NO;
|
||||
}
|
||||
|
||||
if ([isEnableTakePhotoStr isEqualToString:@"0"]) {
|
||||
conversationModel.enableTakePhoto = NO;
|
||||
}
|
||||
|
||||
if ([isEnableRecordVideoStr isEqualToString:@"0"]) {
|
||||
conversationModel.enableRecordVideo = NO;
|
||||
}
|
||||
|
||||
if ([isEnableFileStr isEqualToString:@"0"]) {
|
||||
conversationModel.enableFile = NO;
|
||||
}
|
||||
|
||||
if ([isEnableAlbumStr isEqualToString:@"0"]) {
|
||||
conversationModel.enableAlbum = NO;
|
||||
}
|
||||
|
||||
TUIBaseChatViewController *chatVC = nil;
|
||||
if (conversationModel.groupID.length > 0) {
|
||||
chatVC = [[TUIGroupChatViewController alloc] init];
|
||||
} else if (conversationModel.userID.length > 0) {
|
||||
chatVC = [[TUIC2CChatViewController alloc] init];
|
||||
}
|
||||
chatVC.conversationData = conversationModel;
|
||||
chatVC.title = conversationModel.title;
|
||||
chatVC.highlightKeyword = highlightKeyword;
|
||||
chatVC.locateMessage = locateMessage;
|
||||
return chatVC;
|
||||
}
|
||||
|
||||
|
||||
- (UIViewController *)createGroupInfoController:(NSString *)groupID {
|
||||
TUIGroupInfoController *vc = [[TUIGroupInfoController alloc] init];
|
||||
vc.groupId = groupID;
|
||||
return vc;
|
||||
}
|
||||
@end
|
||||
39
TUIKit/TUIChat/UI_Classic/Service/TUIChatService.h
Normal file
39
TUIKit/TUIChat/UI_Classic/Service/TUIChatService.h
Normal file
@@ -0,0 +1,39 @@
|
||||
//
|
||||
// TUIChatManager.h
|
||||
// TXIMSDK_TUIKit_iOS
|
||||
//
|
||||
// Created by kayev on 2021/8/12.
|
||||
// Copyright © 2023 Tencent. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <TIMCommon/TIMDefine.h>
|
||||
#import <TUICore/TUICore.h>
|
||||
|
||||
@import ImSDK_Plus;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
/**
|
||||
* TUIChatService currently provides two services:
|
||||
* 1. Creating chat class
|
||||
* 2. Getting display text information through V2TIMMessage object
|
||||
*
|
||||
* You can call the service through the [TUICore callService:..] method. The different service parameters are as follows:
|
||||
*
|
||||
* > Getting display text information through V2TIMMessage object
|
||||
* serviceName: TUICore_TUIChatService
|
||||
* method :TUICore_TUIChatService_GetDisplayStringMethod
|
||||
* param: @{TUICore_TUIChatService_GetDisplayStringMethod_MsgKey:V2TIMMessage};
|
||||
*
|
||||
* > Send Message
|
||||
* serviceName: TUICore_TUIChatService
|
||||
* method: TUICore_TUIChatService_SendMessageMethod
|
||||
* param: @{TUICore_TUIChatService_SendMessageMethod_MsgKey:V2TIMMessage};
|
||||
*/
|
||||
|
||||
@interface TUIChatService : NSObject <TUIServiceProtocol>
|
||||
|
||||
+ (TUIChatService *)shareInstance;
|
||||
|
||||
@end
|
||||
NS_ASSUME_NONNULL_END
|
||||
138
TUIKit/TUIChat/UI_Classic/Service/TUIChatService.m
Normal file
138
TUIKit/TUIChat/UI_Classic/Service/TUIChatService.m
Normal file
@@ -0,0 +1,138 @@
|
||||
|
||||
// Created by Tencent on 2023/06/09.
|
||||
// Copyright © 2023 Tencent. All rights reserved.
|
||||
|
||||
#import "TUIChatService.h"
|
||||
#import <TUICore/NSDictionary+TUISafe.h>
|
||||
#import <TUICore/TUILogin.h>
|
||||
#import <TUICore/TUIThemeManager.h>
|
||||
#import "TUIChatConfig.h"
|
||||
#import "TUIChatDefine.h"
|
||||
#import "TUIMessageCellConfig.h"
|
||||
#import "TUIBaseMessageController.h"
|
||||
|
||||
@interface TUIChatService () <TUINotificationProtocol, TUIExtensionProtocol>
|
||||
|
||||
@end
|
||||
|
||||
@implementation TUIChatService
|
||||
|
||||
+ (void)load {
|
||||
[TUICore registerService:TUICore_TUIChatService object:[TUIChatService shareInstance]];
|
||||
TUIRegisterThemeResourcePath(TUIChatThemePath, TUIThemeModuleChat);
|
||||
}
|
||||
|
||||
+ (TUIChatService *)shareInstance {
|
||||
static dispatch_once_t onceToken;
|
||||
static TUIChatService *g_sharedInstance = nil;
|
||||
dispatch_once(&onceToken, ^{
|
||||
g_sharedInstance = [[TUIChatService alloc] init];
|
||||
});
|
||||
return g_sharedInstance;
|
||||
}
|
||||
|
||||
- (instancetype)init {
|
||||
if (self = [super init]) {
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(loginSuccessNotification) name:TUILoginSuccessNotification object:nil];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)loginSuccessNotification {
|
||||
[TUICore callService:TUICore_TUICallingService
|
||||
method:TUICore_TUICallingService_EnableFloatWindowMethod
|
||||
param:@{TUICore_TUICallingService_EnableFloatWindowMethod_EnableFloatWindow : @(TUIChatConfig.defaultConfig.enableFloatWindowForCall)}];
|
||||
[TUICore
|
||||
callService:TUICore_TUICallingService
|
||||
method:TUICore_TUICallingService_EnableMultiDeviceAbilityMethod
|
||||
param:@{
|
||||
TUICore_TUICallingService_EnableMultiDeviceAbilityMethod_EnableMultiDeviceAbility : @(TUIChatConfig.defaultConfig.enableMultiDeviceForCall)
|
||||
}];
|
||||
[TUICore
|
||||
callService:TUICore_TUICallingService
|
||||
method:TUICore_TUICallingService_EnableIncomingBannerMethod
|
||||
param:@{
|
||||
TUICore_TUICallingService_EnableIncomingBannerMethod_EnableIncomingBanner : @(TUIChatConfig.defaultConfig.enableIncomingBanner)
|
||||
}];
|
||||
[TUICore
|
||||
callService:TUICore_TUICallingService
|
||||
method:TUICore_TUICallingService_EnableVirtualBackgroundForCallMethod
|
||||
param:@{
|
||||
TUICore_TUICallingService_EnableVirtualBackgroundForCallMethod_EnableVirtualBackgroundForCall
|
||||
: @(TUIChatConfig.defaultConfig.enableVirtualBackgroundForCall)
|
||||
}];
|
||||
}
|
||||
|
||||
- (NSString *)getDisplayString:(V2TIMMessage *)message {
|
||||
return [TUIBaseMessageController getDisplayString:message];
|
||||
}
|
||||
|
||||
- (void)asyncGetDisplayString:(NSArray<V2TIMMessage *> *)messageList callback:(TUICallServiceResultCallback)resultCallback {
|
||||
if (resultCallback == nil) {
|
||||
return;
|
||||
}
|
||||
|
||||
[TUIBaseMessageController asyncGetDisplayString:messageList callback:^(NSDictionary<NSString *,NSString *> * result) {
|
||||
resultCallback(0, @"", result);
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - TUIServiceProtocol
|
||||
- (id)onCall:(NSString *)method param:(nullable NSDictionary *)param {
|
||||
if ([method isEqualToString:TUICore_TUIChatService_GetDisplayStringMethod]) {
|
||||
return [self getDisplayString:param[TUICore_TUIChatService_GetDisplayStringMethod_MsgKey]];
|
||||
} else if ([method isEqualToString:TUICore_TUIChatService_SendMessageMethod]) {
|
||||
V2TIMMessage *message = [param tui_objectForKey:TUICore_TUIChatService_SendMessageMethod_MsgKey asClass:V2TIMMessage.class];
|
||||
TUIMessageCellData *cellData = [param tui_objectForKey:TUICore_TUIChatService_SendMessageMethod_PlaceHolderUIMsgKey asClass:TUIMessageCellData.class];
|
||||
if (!message && !cellData) {
|
||||
return nil;
|
||||
}
|
||||
NSMutableDictionary *userInfo = [NSMutableDictionary dictionary];
|
||||
if (message) {
|
||||
[userInfo setObject:message forKey:TUICore_TUIChatService_SendMessageMethod_MsgKey];
|
||||
}
|
||||
if (cellData) {
|
||||
[userInfo setObject:cellData forKey:TUICore_TUIChatService_SendMessageMethod_PlaceHolderUIMsgKey];
|
||||
}
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:TUIChatSendMessageNotification object:nil userInfo:userInfo];
|
||||
} else if ([method isEqualToString:TUICore_TUIChatService_SendMessageMethodWithoutUpdateUI]) {
|
||||
V2TIMMessage *message = [param tui_objectForKey:TUICore_TUIChatService_SendMessageMethodWithoutUpdateUI_MsgKey asClass:V2TIMMessage.class];
|
||||
if (message == nil) {
|
||||
return nil;
|
||||
}
|
||||
NSDictionary *userInfo = @{TUICore_TUIChatService_SendMessageMethodWithoutUpdateUI_MsgKey : message};
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:TUIChatSendMessageWithoutUpdateUINotification object:nil userInfo:userInfo];
|
||||
} else if ([method isEqualToString:TUICore_TUIChatService_SetChatExtensionMethod]) {
|
||||
[param enumerateKeysAndObjectsUsingBlock:^(NSString *key, NSNumber *obj, BOOL *_Nonnull stop) {
|
||||
if (![key isKindOfClass:NSString.class] || ![obj isKindOfClass:NSNumber.class]) {
|
||||
return;
|
||||
}
|
||||
}];
|
||||
} else if ([method isEqualToString:TUICore_TUIChatService_AppendCustomMessageMethod]) {
|
||||
if ([param isKindOfClass:NSDictionary.class]) {
|
||||
NSString *businessID = param[BussinessID];
|
||||
NSString *cellName = param[TMessageCell_Name];
|
||||
NSString *cellDataName = param[TMessageCell_Data_Name];
|
||||
[TUIMessageCellConfig registerCustomMessageCell:cellName messageCellData:cellDataName forBusinessID:businessID isPlugin:YES];
|
||||
}
|
||||
}
|
||||
else if ([method isEqualToString:TUICore_TUIChatService_SetMaxTextSize]) {
|
||||
if ([param isKindOfClass:NSDictionary.class]) {
|
||||
CGSize sizeVa = [param[@"maxsize"] CGSizeValue];
|
||||
[TUIMessageCellConfig setMaxTextSize:sizeVa];
|
||||
}
|
||||
}
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (id)onCall:(NSString *)method param:(NSDictionary *)param resultCallback:(TUICallServiceResultCallback)resultCallback {
|
||||
if ([method isEqualToString:TUICore_TUIChatService_AsyncGetDisplayStringMethod]) {
|
||||
NSArray *messageList = param[TUICore_TUIChatService_AsyncGetDisplayStringMethod_MsgListKey];
|
||||
[self asyncGetDisplayString:messageList callback:resultCallback];
|
||||
return nil;
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user