更新 pi_area_info.json,新增突尼斯地区信息;更新 Assets.xcassets 中的 Contents.json,修复幸运数字图像的文件名;移除多个文件中的调试代码以优化勋章展示逻辑,保持代码结构一致性;在 XPRoomFaceTool.m 中改进表情文件加载路径和错误处理,增强代码健壮性;在 XPRoomFaceViewController.m 中添加消息发送错误日志;更新 XPRoomMessageContainerView.m 和 XPRoomMessageParser.m,调整索引类型以提高代码一致性。

This commit is contained in:
edwinQQQ
2025-06-25 14:29:23 +08:00
parent 1190e0f6d9
commit e01148a3a9
11 changed files with 90 additions and 63 deletions

View File

@@ -1,7 +1,6 @@
{
"images" : [
{
"filename" : "幸运数字.png",
"idiom" : "universal",
"scale" : "1x"
},
@@ -10,6 +9,7 @@
"scale" : "2x"
},
{
"filename" : "幸运数字.png",
"idiom" : "universal",
"scale" : "3x"
}

View File

@@ -432,11 +432,6 @@
[self.rankList addObject:user];
}
}
#if DEBUG
[self.rankList addObjectsFromArray:model.rankList];
#endif
[self.rankTableView reloadData];
}
}

View File

@@ -176,9 +176,6 @@ typedef enum : NSInteger {
}
NSTimeInterval time = 5;
#if DEBUG
time = 2; // DEBUG 便
#endif
//
self.autoScrollTimer = [NSTimer scheduledTimerWithTimeInterval:time
@@ -620,14 +617,6 @@ typedef enum : NSInteger {
if (self.displayType == MedalsCenterDisplayType_Mine) {
self.useMedals = self.userMedalsModel.useMedals;
#if DEBUG
NSMutableArray *arr = [self.userMedalsModel.useMedals mutableCopy];
[arr addObjectsFromArray:self.userMedalsModel.useMedals];
[arr addObjectsFromArray:self.userMedalsModel.useMedals];
[arr addObjectsFromArray:self.userMedalsModel.useMedals];
[arr addObjectsFromArray:self.userMedalsModel.useMedals];
self.useMedals = arr.copy;
#endif
} else if (self.displayType == MedalsCenterDisplayType_Square) {
NSArray *arr = [NSArray array];
NSMutableArray *editArr = [NSMutableArray array];
@@ -654,17 +643,7 @@ typedef enum : NSInteger {
}
}
}
self.useMedals = editArr.copy;
#if DEBUG
NSMutableArray *arr_demo = editArr;
[arr_demo addObjectsFromArray:editArr];
[arr_demo addObjectsFromArray:editArr];
[arr_demo addObjectsFromArray:editArr];
[arr_demo addObjectsFromArray:editArr];
self.useMedals = arr_demo.copy;
#endif
}
if (self.displayType != MedalsCenterDisplayType_Other) {

View File

@@ -227,9 +227,6 @@
if (!_selectedImageView) {
_selectedImageView = [[UIImageView alloc] initWithImage:kImage(@"medals_selected")];
_selectedImageView.hidden = YES;
#if DEBUG
_selectedImageView.hidden = NO;
#endif
}
return _selectedImageView;
}

View File

@@ -1663,16 +1663,6 @@ HWDMP4PlayDelegate>
}
- (void)updateMedalsDisplay:(NSArray<BaseModelVo *> *)medals {
#if DEBUG
NSMutableArray *arr = [NSMutableArray arrayWithArray:medals];
[arr addObjectsFromArray:arr.copy];
[arr addObjectsFromArray:arr.copy];
[arr addObjectsFromArray:arr.copy];
[arr addObjectsFromArray:arr.copy];
[arr addObjectsFromArray:arr.copy];
[arr addObjectsFromArray:arr.copy];
medals = arr.copy;
#endif
//
for (VAPView *mp4View in self.medalMP4Views) {
[mp4View stopHWDMP4];

View File

@@ -275,11 +275,15 @@ done:
- (void)loadFace:(void(^)(NSString *path))fileBlock
withUrl:(NSString *)url {
NSString *cachePath = [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES).firstObject stringByAppendingPathComponent:kNewFacePath];
NSString *cachePath = [self getFaceCachePath];
NSString *fileName = [url lastPathComponent];
NSString *filePath = [cachePath stringByAppendingPathComponent:fileName];
// 使
NSString *resultPath = [[NSFileManager defaultManager] fileExistsAtPath:filePath] ? filePath : nil;
NSLog(@"-------------- 加载表情文件: %@", url);
NSLog(@"-------------- 查找路径: %@", filePath);
NSLog(@"-------------- 文件存在: %@", resultPath ? @"是" : @"否");
dispatch_async(dispatch_get_main_queue(), ^{
if (fileBlock) {
@@ -290,8 +294,9 @@ done:
- (void)cacheChatFaces:(NSArray *)data {
self.chatFaceTabList = [ChatFaceResponse modelsWithArray:data];
NSString *cachePath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES).firstObject
stringByAppendingPathComponent:kNewFacePath];
NSString *cachePath = [self getFaceCachePath];
NSLog(@"-------------- 表情缓存路径: %@", cachePath);
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSMutableDictionary *cachedUrls = [[defaults objectForKey:@"SVGACachedUrls"] mutableCopy] ?: [NSMutableDictionary dictionary];
@@ -339,17 +344,70 @@ done:
}
- (void)downloadFaceFile:(NSString *)urlString savePath:(NSString *)savePath completion:(void(^)(BOOL))completion {
// URL
NSString *cleanedUrlString = [urlString stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
// URL
if (cleanedUrlString.length == 0 ||
(![cleanedUrlString hasPrefix:@"http://"] && ![cleanedUrlString hasPrefix:@"https://"])) {
NSLog(@"-------------- URL格式无效%@", urlString);
if (completion) {
completion(NO);
}
return;
}
// URLASCII
NSString *encodedUrlString = [self encodeURL:cleanedUrlString];
NSLog(@"-------------- URL编码: %@ -> %@", cleanedUrlString, encodedUrlString);
NSURL *url = [NSURL URLWithString:encodedUrlString];
if (!url) {
NSLog(@"-------------- 无法创建URL对象%@", cleanedUrlString);
if (completion) {
completion(NO);
}
return;
}
NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration];
AFURLSessionManager *manager = [[AFURLSessionManager alloc] initWithSessionConfiguration:configuration];
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:urlString]];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
NSLog(@"-------------- 下载表情:%@ : %@", cleanedUrlString, savePath);
[[manager downloadTaskWithRequest:request progress:nil destination:^NSURL *(NSURL *targetPath, NSURLResponse *response) {
[[NSFileManager defaultManager] createDirectoryAtPath:savePath withIntermediateDirectories:YES attributes:nil error:nil];
return [NSURL fileURLWithPath:[savePath stringByAppendingPathComponent:response.suggestedFilename]];
} completionHandler:^(NSURLResponse *response, NSURL *filePath, NSError *error) {
completion(error == nil);
if (error) {
NSLog(@"-------------- 下载失败:%@ : %@\n%@", cleanedUrlString, savePath, error);
} else {
NSLog(@"-------------- 下载成功:%@ -> %@", cleanedUrlString, filePath.path);
}
if (completion) {
completion(error == nil);
}
}] resume];
}
- (NSString *)encodeURL:(NSString *)urlString {
// 使NSURLComponentsURL
NSURLComponents *components = [NSURLComponents componentsWithString:urlString];
if (components) {
// NSURLComponentsURL
return components.URL.absoluteString;
}
// NSURLComponents
NSCharacterSet *allowedCharacters = [NSCharacterSet URLQueryAllowedCharacterSet];
NSString *encodedString = [urlString stringByAddingPercentEncodingWithAllowedCharacters:allowedCharacters];
return encodedString ?: urlString;
}
#pragma mark - Helper Methods
- (NSString *)getFaceCachePath {
return [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES).firstObject
stringByAppendingPathComponent:kNewFacePath];
}
@end

View File

@@ -196,8 +196,12 @@
object.attachment = attachment;
message.messageObject = object;
//
NSError *error;
NIMSession *session = [NIMSession session:sessionID type:NIMSessionTypeChatroom];
[[NIMSDK sharedSDK].chatManager sendMessage:message toSession:session error:nil];
[[NIMSDK sharedSDK].chatManager sendMessage:message toSession:session error:&error];
if (error) {
NSLog(@" !!!!!!!!!! 发送消息失败: %@", error);
}
[self dismissViewControllerAnimated:YES completion:nil];
}

View File

@@ -1042,6 +1042,14 @@
NSArray * array = [RoomFaceSendInfoModel modelsWithArray:attachment.data[@"data"]];
for (int i = 0; i< array.count; i++) {
RoomFaceSendInfoModel * sendFaceInfo = [array xpSafeObjectAtIndex:i];
#if DEBUG
sendFaceInfo.faceId = 1;
#endif
if (sendFaceInfo.faceId == 1) {
UIImage *image = kImage(@"幸运数字");
[attribute appendAttributedString:[self createImageAttribute:[image cutImage:CGSizeMake(30, 30)]]];
}
[attribute appendAttributedString:[self createTextAttribute:sendFaceInfo.nick color:[DJDKMIMOMColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
[attribute appendAttributedString:[self createTextAttribute:@":" color:[DJDKMIMOMColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
[attribute appendAttributedString:[self createTextAttribute:@"\n" color:[DJDKMIMOMColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];

View File

@@ -187,7 +187,7 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
}
// 3. @
int index = [self safeGetIndexFromLocationArrayAt:0];
NSInteger index = [self safeGetIndexFromLocationArrayAt:0];
if (index == NSNotFound) {
[self scrollToBottomWithTipsHidden:YES];
return;
@@ -271,7 +271,7 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
}
}
- (int)safeGetIndexFromLocationArrayAt:(NSUInteger)index {
- (NSInteger)safeGetIndexFromLocationArrayAt:(NSUInteger)index {
if (index < self.locationArray.count) {
NSNumber *number = self.locationArray[index];
return [number intValue];
@@ -335,7 +335,7 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
return;
}
int index = [self safeGetIndexFromLocationArrayAt:0];
NSInteger index = [self safeGetIndexFromLocationArrayAt:0];
if (index == NSNotFound || index >= rows) {
[self scrollToBottomWithTipsHidden:YES];
} else {
@@ -918,7 +918,7 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
if ([message.messageObject isKindOfClass:[NIMCustomObject class]]) {
NIMCustomObject *obj = (NIMCustomObject *)message.messageObject;
AttachmentModel *attachment =(AttachmentModel *)obj.attachment;
if (attachment.first == 9 && attachment.second == 91) {
if (attachment.second == Custom_Message_Sub_Face_Send) {
NSArray *datas = [attachment.data objectForKey:@"data"];
NSDictionary *obj = [datas xpSafeObjectAtIndex:0];
if (obj) {

View File

@@ -505,17 +505,7 @@
if (medals.count == 0) {
self.medalsScrollView.hidden = YES;
return;
} else {
#if DEBUG
NSMutableArray *arr = [NSMutableArray arrayWithArray:medals];
[arr addObjectsFromArray:arr.copy];
[arr addObjectsFromArray:arr.copy];
[arr addObjectsFromArray:arr.copy];
[arr addObjectsFromArray:arr.copy];
[arr addObjectsFromArray:arr.copy];
medals = arr.copy;
#endif
}
}
self.medalsScrollView.hidden = NO;

View File

@@ -965,6 +965,12 @@
"abbr": "YE",
"mcc": "607",
"code": "967"
}
},
{
"name": "Tunisia",
"abbr": "TN",
"mcc": "605",
"code": "216"
},
]
}