This commit is contained in:
启星
2025-08-08 10:49:36 +08:00
parent 6400cf78bb
commit b5ce3d580a
8780 changed files with 978183 additions and 0 deletions

View File

@@ -0,0 +1,52 @@
//
// TUICustomerServicePluginBranchCellData.m
// TUICustomerServicePlugin
//
// Created by xia on 2023/5/30.
//
#import "TUICustomerServicePluginBranchCellData.h"
#import "TUICustomerServicePluginDataProvider+CalculateSize.h"
@implementation TUICustomerServicePluginBranchCellData
+ (TUIMessageCellData *)getCellData:(V2TIMMessage *)message {
NSDictionary *param = [NSJSONSerialization JSONObjectWithData:message.customElem.data
options:NSJSONReadingAllowFragments error:nil];
if (param == nil) {
return nil;
}
TUICustomerServicePluginBranchCellData *cellData = [[TUICustomerServicePluginBranchCellData alloc] initWithDirection:message.isSelf ? MsgDirectionOutgoing : MsgDirectionIncoming];
cellData.innerMessage = message;
NSDictionary *content = param[@"content"];
cellData.header = content[@"header"];
NSArray *items = content[@"items"];
for (NSDictionary *item in items) {
[cellData.items addObject:item[@"content"]];
}
if ([content.allKeys containsObject:@"selected"]) {
NSDictionary *selected = content[@"selected"];
cellData.selectedContent = selected[@"content"];
cellData.selected = YES;
}
return cellData;
}
+ (NSString *)getDisplayString:(V2TIMMessage *)message {
return TIMCommonLocalizableString(TUICustomerServiceBranchMessage);
}
// Override
- (BOOL)canForward {
return NO;
}
- (NSMutableArray *)items {
if (!_items) {
_items = [[NSMutableArray alloc] init];
}
return _items;
}
@end