diff --git a/YuMi/Assets.xcassets/20.20.61/幸运数字.imageset/Contents.json b/YuMi/Assets.xcassets/20.20.61/幸运数字.imageset/Contents.json index 8c8be53e..ec7f1919 100644 --- a/YuMi/Assets.xcassets/20.20.61/幸运数字.imageset/Contents.json +++ b/YuMi/Assets.xcassets/20.20.61/幸运数字.imageset/Contents.json @@ -1,7 +1,6 @@ { "images" : [ { - "filename" : "幸运数字.png", "idiom" : "universal", "scale" : "1x" }, @@ -10,6 +9,7 @@ "scale" : "2x" }, { + "filename" : "幸运数字.png", "idiom" : "universal", "scale" : "3x" } diff --git a/YuMi/Modules/YMMine/View/Medals/MedalsRankViewController.m b/YuMi/Modules/YMMine/View/Medals/MedalsRankViewController.m index 3b69237b..3340c23d 100644 --- a/YuMi/Modules/YMMine/View/Medals/MedalsRankViewController.m +++ b/YuMi/Modules/YMMine/View/Medals/MedalsRankViewController.m @@ -432,11 +432,6 @@ [self.rankList addObject:user]; } } - -#if DEBUG - [self.rankList addObjectsFromArray:model.rankList]; -#endif - [self.rankTableView reloadData]; } } diff --git a/YuMi/Modules/YMMine/View/Medals/MedalsViewController.m b/YuMi/Modules/YMMine/View/Medals/MedalsViewController.m index b102b00d..08fbf756 100644 --- a/YuMi/Modules/YMMine/View/Medals/MedalsViewController.m +++ b/YuMi/Modules/YMMine/View/Medals/MedalsViewController.m @@ -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) { diff --git a/YuMi/Modules/YMMine/View/Medals/MedalsWearingListCollectionViewCell.m b/YuMi/Modules/YMMine/View/Medals/MedalsWearingListCollectionViewCell.m index 592420d6..7e6eb32a 100644 --- a/YuMi/Modules/YMMine/View/Medals/MedalsWearingListCollectionViewCell.m +++ b/YuMi/Modules/YMMine/View/Medals/MedalsWearingListCollectionViewCell.m @@ -227,9 +227,6 @@ if (!_selectedImageView) { _selectedImageView = [[UIImageView alloc] initWithImage:kImage(@"medals_selected")]; _selectedImageView.hidden = YES; -#if DEBUG - _selectedImageView.hidden = NO; -#endif } return _selectedImageView; } diff --git a/YuMi/Modules/YMMine/View/SubViews/MineInfo/XPMineUserInfoHeaderView.m b/YuMi/Modules/YMMine/View/SubViews/MineInfo/XPMineUserInfoHeaderView.m index ce259f3e..32d66ec7 100644 --- a/YuMi/Modules/YMMine/View/SubViews/MineInfo/XPMineUserInfoHeaderView.m +++ b/YuMi/Modules/YMMine/View/SubViews/MineInfo/XPMineUserInfoHeaderView.m @@ -1663,16 +1663,6 @@ HWDMP4PlayDelegate> } - (void)updateMedalsDisplay:(NSArray *)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]; diff --git a/YuMi/Modules/YMRoom/View/FaceView/Presenter/XPRoomFaceTool.m b/YuMi/Modules/YMRoom/View/FaceView/Presenter/XPRoomFaceTool.m index 4b7ad022..b95efcb6 100644 --- a/YuMi/Modules/YMRoom/View/FaceView/Presenter/XPRoomFaceTool.m +++ b/YuMi/Modules/YMRoom/View/FaceView/Presenter/XPRoomFaceTool.m @@ -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; + } + + // URL编码处理,支持中文等非ASCII字符 + 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 { + // 使用NSURLComponents来正确处理URL编码 + NSURLComponents *components = [NSURLComponents componentsWithString:urlString]; + if (components) { + // NSURLComponents会自动处理URL编码 + 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 diff --git a/YuMi/Modules/YMRoom/View/FaceView/View/XPRoomFaceViewController.m b/YuMi/Modules/YMRoom/View/FaceView/View/XPRoomFaceViewController.m index 9d30249e..fb11f9c8 100644 --- a/YuMi/Modules/YMRoom/View/FaceView/View/XPRoomFaceViewController.m +++ b/YuMi/Modules/YMRoom/View/FaceView/View/XPRoomFaceViewController.m @@ -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]; } diff --git a/YuMi/Modules/YMRoom/View/MessageContainerView/Tool/XPRoomMessageParser.m b/YuMi/Modules/YMRoom/View/MessageContainerView/Tool/XPRoomMessageParser.m index 266c6a54..e447ad26 100644 --- a/YuMi/Modules/YMRoom/View/MessageContainerView/Tool/XPRoomMessageParser.m +++ b/YuMi/Modules/YMRoom/View/MessageContainerView/Tool/XPRoomMessageParser.m @@ -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]]; diff --git a/YuMi/Modules/YMRoom/View/MessageContainerView/XPRoomMessageContainerView.m b/YuMi/Modules/YMRoom/View/MessageContainerView/XPRoomMessageContainerView.m index 3f5d9efd..e5566466 100644 --- a/YuMi/Modules/YMRoom/View/MessageContainerView/XPRoomMessageContainerView.m +++ b/YuMi/Modules/YMRoom/View/MessageContainerView/XPRoomMessageContainerView.m @@ -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) { diff --git a/YuMi/Modules/YMRoom/View/UserCard/View/UserRoomCardViewController.m b/YuMi/Modules/YMRoom/View/UserCard/View/UserRoomCardViewController.m index 9fa0c226..7b95d747 100644 --- a/YuMi/Modules/YMRoom/View/UserCard/View/UserRoomCardViewController.m +++ b/YuMi/Modules/YMRoom/View/UserCard/View/UserRoomCardViewController.m @@ -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; diff --git a/YuMi/pi_area_info.json b/YuMi/pi_area_info.json index eb978ac3..dba20050 100644 --- a/YuMi/pi_area_info.json +++ b/YuMi/pi_area_info.json @@ -965,6 +965,12 @@ "abbr": "YE", "mcc": "607", "code": "967" - } + }, + { + "name": "Tunisia", + "abbr": "TN", + "mcc": "605", + "code": "216" + }, ] }