|
@@ -1389,27 +1389,62 @@ static const CGFloat kQuoteViewHeight = 46.0f;
|
|
|
NSString *localtime = msg[@"localtime"];
|
|
NSString *localtime = msg[@"localtime"];
|
|
|
NSString *messageType = msg[@"messageType"];
|
|
NSString *messageType = msg[@"messageType"];
|
|
|
if([messageType isEqualToString:MessageType_file]||[messageType isEqualToString:MessageType_image]||[messageType isEqualToString:MessageType_video]) {
|
|
if([messageType isEqualToString:MessageType_file]||[messageType isEqualToString:MessageType_image]||[messageType isEqualToString:MessageType_video]) {
|
|
|
|
|
+ if([OSSManager.sharedManager isuploadTanck:localtime]){
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
for (NSDictionary *item in self.msgList) {
|
|
for (NSDictionary *item in self.msgList) {
|
|
|
|
|
|
|
|
- if([OSSManager.sharedManager isuploadTanck:localtime]){
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
- NSDictionary *extend =item[@"extend"];
|
|
|
|
|
- NSString *url =extend[@"url"];
|
|
|
|
|
- if([url isEqualToString:@""]){
|
|
|
|
|
- NSString *savedPath =extend[@"localurl"];
|
|
|
|
|
- NSURL * fileUrl = [NSURL fileURLWithPath:savedPath];
|
|
|
|
|
- ChatFileModel * model = [[ChatFileModel alloc] initWithURL:fileUrl];
|
|
|
|
|
- model.fileURL = fileUrl;
|
|
|
|
|
- model.filePath = savedPath;
|
|
|
|
|
- [self OSSuploadFile:model thrid:localtime];
|
|
|
|
|
- NSLog(@"重发文件");
|
|
|
|
|
|
|
+ NSString *itlocaltime =item[@"localtime"];
|
|
|
|
|
+ if([localtime isEqualToString:itlocaltime]){
|
|
|
|
|
+ NSLog(@"canResend2:%@",item);
|
|
|
|
|
+ if(![item[@"id"] isEqualToString:item[@"localtime"]]){
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ NSDictionary *extend =item[@"extend"];
|
|
|
|
|
+ NSString *url =extend[@"url"];
|
|
|
|
|
+ if([url isEqualToString:@""]){
|
|
|
|
|
+ NSString *savedPath =extend[@"localurl"];
|
|
|
|
|
+ NSURL * fileUrl = [NSURL fileURLWithPath:savedPath];
|
|
|
|
|
+ ChatFileModel * model = [[ChatFileModel alloc] initWithURL:fileUrl];
|
|
|
|
|
+ model.fileURL = fileUrl;
|
|
|
|
|
+ model.filePath = savedPath;
|
|
|
|
|
+ [self OSSuploadFile:model thrid:localtime];
|
|
|
|
|
+ NSLog(@"重发文件");
|
|
|
|
|
+ [self FileReUpload:localtime];
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+-(void)FileReUpload:(NSString *)localtime{
|
|
|
|
|
+ [GDBManager.shareInstance selectLocalmsgWithLocaltime:localtime succ:^(NSArray * _Nullable array) {
|
|
|
|
|
+ NSLog(@"selectLocalmsgWithLocaltime:%@",array);
|
|
|
|
|
+
|
|
|
|
|
+ if(array){
|
|
|
|
|
+ if(array.count>0){
|
|
|
|
|
+ NSDictionary *msg =array[0];
|
|
|
|
|
+ NSString *msgtype = msg[@"messageType"];
|
|
|
|
|
+
|
|
|
|
|
+ if (([msgtype isEqualToString:MessageType_Del]||[msgtype isEqualToString:MessageType_CallBack2])) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ NSDictionary *extend=msg[@"extend"];
|
|
|
|
|
+ NSMutableDictionary *mextend = [extend mutableCopy];
|
|
|
|
|
+ [mextend setObject:[NSNumber numberWithInt:0] forKey:@"fileError"];
|
|
|
|
|
+ NSMutableDictionary *mmsg = [msg mutableCopy];
|
|
|
|
|
+ [mmsg setObject:mextend forKey:@"extend"];
|
|
|
|
|
+ [ChatsStore.shareInstance reciveMsg:mmsg];
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ } fail:^(NSString * _Nullable error) {
|
|
|
|
|
+ ;
|
|
|
|
|
+ }];
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
//重发消息
|
|
//重发消息
|
|
|
-(void)resendMsg:(NSDictionary *)msg{
|
|
-(void)resendMsg:(NSDictionary *)msg{
|
|
|
if(![self canResend:msg]){
|
|
if(![self canResend:msg]){
|
|
@@ -1645,11 +1680,16 @@ static const CGFloat kQuoteViewHeight = 46.0f;
|
|
|
if ([urls indexOfObject:url] > 9) {
|
|
if ([urls indexOfObject:url] > 9) {
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
- ChatFileModel * model = [[ChatFileModel alloc] initWithURL:url];
|
|
|
|
|
-// ChatFileModel * model = [[ChatFileModel alloc] initWithName:[FileInfoUtils getFileNameWithURL:url] size:[FileInfoUtils getFileSizeStringWithURL:url error:nil] isOversize:[FileInfoUtils isFileGreaterThan100MB:url error:nil]];
|
|
|
|
|
- model.fileURL = url;
|
|
|
|
|
- model.filePath = [url path];
|
|
|
|
|
- [fileArray addObject:model];
|
|
|
|
|
|
|
+ NSLog(@"url:%@",url);
|
|
|
|
|
+
|
|
|
|
|
+ NSString *savedPath = [self saveFileToDocumentsDirectory:url];
|
|
|
|
|
+ if(savedPath.length>0){
|
|
|
|
|
+ NSURL * fileUrl = [NSURL fileURLWithPath:savedPath];
|
|
|
|
|
+ ChatFileModel * model = [[ChatFileModel alloc] initWithURL:fileUrl];
|
|
|
|
|
+ model.fileURL = fileUrl;
|
|
|
|
|
+ model.filePath = savedPath;
|
|
|
|
|
+ [fileArray addObject:model];
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
[self handleMediaData:fileArray];
|
|
[self handleMediaData:fileArray];
|
|
@@ -1756,7 +1796,8 @@ static const CGFloat kQuoteViewHeight = 46.0f;
|
|
|
extend=@{
|
|
extend=@{
|
|
|
@"url":@"",
|
|
@"url":@"",
|
|
|
@"fileName":filePath.lastPathComponent,
|
|
@"fileName":filePath.lastPathComponent,
|
|
|
- @"localurl":path
|
|
|
|
|
|
|
+ @"localurl":path,
|
|
|
|
|
+ @"fileError":[NSNumber numberWithInt:0]
|
|
|
};
|
|
};
|
|
|
msgt=@{
|
|
msgt=@{
|
|
|
@"messageType":messageType,
|
|
@"messageType":messageType,
|
|
@@ -2005,6 +2046,8 @@ static const CGFloat kQuoteViewHeight = 46.0f;
|
|
|
} else {
|
|
} else {
|
|
|
[[NSFileManager defaultManager] removeItemAtURL:yuanfileURL error:nil];
|
|
[[NSFileManager defaultManager] removeItemAtURL:yuanfileURL error:nil];
|
|
|
NSLog(@"文件复制失败: %@", error.localizedDescription);
|
|
NSLog(@"文件复制失败: %@", error.localizedDescription);
|
|
|
|
|
+ [MBProgressHUD showWithText:@"語音發送異常請重試"];
|
|
|
|
|
+ return;
|
|
|
}
|
|
}
|
|
|
NSLog(@"destinationPath:%@",destinationPath);
|
|
NSLog(@"destinationPath:%@",destinationPath);
|
|
|
|
|
|
|
@@ -2054,7 +2097,7 @@ static const CGFloat kQuoteViewHeight = 46.0f;
|
|
|
@"timestamp":loacaltime,
|
|
@"timestamp":loacaltime,
|
|
|
@"mine":[NSNumber numberWithBool:YES],
|
|
@"mine":[NSNumber numberWithBool:YES],
|
|
|
@"extend":@{
|
|
@"extend":@{
|
|
|
- @"url":filePath,
|
|
|
|
|
|
|
+ @"url":@"",
|
|
|
@"time":[NSString stringWithFormat:@"%ld",self->_rcdL],
|
|
@"time":[NSString stringWithFormat:@"%ld",self->_rcdL],
|
|
|
@"localurl":filePtah
|
|
@"localurl":filePtah
|
|
|
}
|
|
}
|