|
|
@@ -46,7 +46,7 @@
|
|
|
#import "OSSManager.h"
|
|
|
|
|
|
static const CGFloat kQuoteViewHeight = 46.0f;
|
|
|
-@interface ChatController()<UITextViewDelegate,ChatsStoreDelegate,UITableViewDelegate,UITableViewDataSource,chatpopViewDelegate,PHPickerViewControllerDelegate,UINavigationControllerDelegate,UIDocumentPickerDelegate,UIScrollViewDelegate>
|
|
|
+@interface ChatController()<UITextViewDelegate,ChatsStoreDelegate,UITableViewDelegate,UITableViewDataSource,chatpopViewDelegate,PHPickerViewControllerDelegate,UINavigationControllerDelegate,UIDocumentPickerDelegate,UIScrollViewDelegate,OSSManagerDelegate>
|
|
|
|
|
|
@property (weak, nonatomic) IBOutlet UILabel *titlelb;
|
|
|
@property (weak, nonatomic) IBOutlet UITableView *_tableView;
|
|
|
@@ -194,6 +194,8 @@ static const CGFloat kQuoteViewHeight = 46.0f;
|
|
|
ChatsStore.shareInstance.userid =self.userId;
|
|
|
ChatListStore.shareInstance.chatId = self.chatId;
|
|
|
[ChatsStore.shareInstance getchatReadTime:self.chatId];
|
|
|
+ [OSSManager sharedManager].delegate = self;
|
|
|
+
|
|
|
_showLoading = YES;
|
|
|
NSString *type=@"";
|
|
|
if(self.type==0){
|
|
|
@@ -228,6 +230,7 @@ static const CGFloat kQuoteViewHeight = 46.0f;
|
|
|
_titlelb.text = self.titlename;
|
|
|
|
|
|
ChatsStore.shareInstance.delegate = self;
|
|
|
+ [OSSManager sharedManager].delegate = self;
|
|
|
ChatsStore.shareInstance.chatId = self.chatId;
|
|
|
ChatsStore.shareInstance.userid =self.userId;
|
|
|
ChatListStore.shareInstance.chatId = self.chatId;
|
|
|
@@ -263,6 +266,7 @@ static const CGFloat kQuoteViewHeight = 46.0f;
|
|
|
[self.preloader stopMonitoring];
|
|
|
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
|
|
ChatsStore.shareInstance.delegate = nil;
|
|
|
+ [OSSManager sharedManager].delegate = nil;
|
|
|
ChatsStore.shareInstance.chatId = nil;
|
|
|
}
|
|
|
-(void)viewDidAppear:(BOOL)animated{
|
|
|
@@ -442,7 +446,7 @@ static const CGFloat kQuoteViewHeight = 46.0f;
|
|
|
}
|
|
|
|
|
|
-(void)ChatsChange:(NSArray *)msgList type:(NSInteger)typpe{
|
|
|
- NSLog(@"msgList:%@",msgList);
|
|
|
+// NSLog(@"msgList:%@",msgList);
|
|
|
if([msgList count]==0){
|
|
|
return;
|
|
|
}
|
|
|
@@ -1338,28 +1342,13 @@ static const CGFloat kQuoteViewHeight = 46.0f;
|
|
|
|
|
|
-(void)TimerAction{
|
|
|
//处理重发事件
|
|
|
- NSDate *now = [NSDate date];
|
|
|
- NSTimeInterval trt = [now timeIntervalSince1970];
|
|
|
// NSLog(@"self.msgList:%@",self.msgList);
|
|
|
for(NSDictionary *dis in self.msgList){
|
|
|
NSString *mine = dis[@"mine"];
|
|
|
if(mine.boolValue){
|
|
|
if([dis[@"id"] isEqualToString:dis[@"localtime"]]){
|
|
|
- NSNumber *tt =dis[@"localtime"];
|
|
|
-// NSLog(@"NSTimeInterval:%f ,%ld",trt,(long)tt.integerValue);
|
|
|
- if((trt-tt.integerValue/1000)>40){
|
|
|
- //发送失败
|
|
|
- NSLog(@"发送失败-------");
|
|
|
- continue;
|
|
|
- }
|
|
|
- if((trt-tt.integerValue/1000)>9){
|
|
|
- NSLog(@"重发-------:%@",dis);
|
|
|
- //重发
|
|
|
- [self resendMsg:dis.copy];
|
|
|
- }
|
|
|
+ [self resendMsg:dis.copy];
|
|
|
}
|
|
|
- [self fileUploadState:dis];
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -1367,20 +1356,57 @@ static const CGFloat kQuoteViewHeight = 46.0f;
|
|
|
-(BOOL)canResend:(NSDictionary *)msg{
|
|
|
NSLog(@"canResend:%@",msg);
|
|
|
NSString *localtime = msg[@"localtime"];
|
|
|
- for (NSDictionary *item in self.msgList) {
|
|
|
- NSString *itlocaltime =item[@"localtime"];
|
|
|
- if([localtime isEqualToString:itlocaltime]){
|
|
|
- NSLog(@"canResend2:%@",item);
|
|
|
- if(![item[@"id"] isEqualToString:item[@"localtime"]]){
|
|
|
- return false;
|
|
|
+ NSString *messageType = msg[@"messageType"];
|
|
|
+ if([messageType isEqualToString:MessageType_text]){
|
|
|
+ for (NSDictionary *item in self.msgList) {
|
|
|
+ NSString *itlocaltime =item[@"localtime"];
|
|
|
+ if([localtime isEqualToString:itlocaltime]){
|
|
|
+ NSLog(@"canResend2:%@",item);
|
|
|
+ if(![item[@"id"] isEqualToString:item[@"localtime"]]){
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ NSDate *now = [NSDate date];
|
|
|
+ NSTimeInterval trt = [now timeIntervalSince1970];
|
|
|
+ NSNumber *tt =msg[@"localtime"];
|
|
|
+ if((trt-tt.integerValue/1000)>40){
|
|
|
+ //发送失败
|
|
|
+ NSLog(@"发送失败-------");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ else{
|
|
|
+ [self fileUploadState:msg];
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
return YES;
|
|
|
}
|
|
|
|
|
|
-(void)fileUploadState:(NSDictionary *)msg{
|
|
|
-
|
|
|
+ NSString *localtime = msg[@"localtime"];
|
|
|
+ NSString *messageType = msg[@"messageType"];
|
|
|
+ if([messageType isEqualToString:MessageType_file]||[messageType isEqualToString:MessageType_image]||[messageType isEqualToString:MessageType_video]) {
|
|
|
+ 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(@"重发文件");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -1468,57 +1494,55 @@ static const CGFloat kQuoteViewHeight = 46.0f;
|
|
|
NSItemProvider *itemProvider = result.itemProvider;
|
|
|
NSString *typeIdentifier = result.itemProvider.registeredTypeIdentifiers.firstObject;
|
|
|
if ([result.itemProvider canLoadObjectOfClass:[UIImage class]]) {
|
|
|
- [itemProvider loadObjectOfClass:[UIImage class] completionHandler:^(__kindof id<NSItemProviderReading> _Nullable object, NSError * _Nullable error) {
|
|
|
- if (!error) {
|
|
|
- UIImage *selectedImage = (UIImage *)object;
|
|
|
-
|
|
|
- // 保存图片到本地
|
|
|
- NSString *savedPath = [self saveImageToSandbox:selectedImage];
|
|
|
- if ([[NSFileManager defaultManager] fileExistsAtPath:savedPath]) {
|
|
|
- NSLog(@"-----找得到文件------");
|
|
|
- }
|
|
|
+
|
|
|
+ [result.itemProvider loadFileRepresentationForTypeIdentifier:typeIdentifier completionHandler:^(NSURL * _Nullable url, NSError * _Nullable error) {
|
|
|
+ if (error) {
|
|
|
+ NSLog(@"Error loading file: %@", error);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ NSLog(@"File URL: %@", url); // 这里就是文件的 URL 路径
|
|
|
+ // 你可以使用这个 URL 进行进一步处理,例如读取文件内容或者将其复制到应用沙盒中的其他位置。
|
|
|
+ NSString *savedPath = [self saveFileToDocumentsDirectory:url];
|
|
|
+ if(savedPath.length>0){
|
|
|
NSURL * fileUrl = [NSURL fileURLWithPath:savedPath];
|
|
|
ChatFileModel * model = [[ChatFileModel alloc] initWithURL:fileUrl];
|
|
|
-
|
|
|
-// ChatFileModel * model = [[ChatFileModel alloc] initWithName:[FileInfoUtils getFileNameWithURL:fileUrl] size:[FileInfoUtils getFileSizeStringWithURL:fileUrl error:nil] isOversize:[FileInfoUtils isFileGreaterThan100MB:fileUrl error:nil]];
|
|
|
model.fileURL = fileUrl;
|
|
|
model.filePath = savedPath;
|
|
|
-
|
|
|
[fileArray addObject:model];
|
|
|
if (fileArray.count==results.count) {
|
|
|
-// [self handleMediaData:fileArray];
|
|
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
[self handleMediaData:fileArray];
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
+ else{
|
|
|
+ NSLog(@"-----找不到文件------");
|
|
|
+ }
|
|
|
}];
|
|
|
+
|
|
|
}else{
|
|
|
-
|
|
|
- [result.itemProvider loadDataRepresentationForTypeIdentifier:typeIdentifier completionHandler:^(NSData * _Nullable data, NSError * _Nullable error) {
|
|
|
- if (data) {
|
|
|
- NSString *savedPath = [self saveVideoDataToDocumentsDirectory:data];
|
|
|
- dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
-
|
|
|
- if ([[NSFileManager defaultManager] fileExistsAtPath:savedPath]) {
|
|
|
- NSLog(@"-----找得到文件------");
|
|
|
- }
|
|
|
- NSURL * fileUrl = [NSURL fileURLWithPath:savedPath];
|
|
|
- ChatFileModel * model = [[ChatFileModel alloc] initWithURL:fileUrl];
|
|
|
-// ChatFileModel * model = [[ChatFileModel alloc] initWithName:[FileInfoUtils getFileNameWithURL:fileUrl] size:[FileInfoUtils getFileSizeStringWithURL:fileUrl error:nil] isOversize:[FileInfoUtils isFileGreaterThan100MB:fileUrl error:nil]];
|
|
|
- model.fileURL = fileUrl;
|
|
|
- model.filePath = savedPath;
|
|
|
- [fileArray addObject:model];
|
|
|
- if (fileArray.count==results.count) {
|
|
|
- dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
- [self handleMediaData:fileArray];
|
|
|
- });
|
|
|
-// [self handleMediaData:fileArray];
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
- }else{
|
|
|
- NSLog(@"%@",error);
|
|
|
+ [result.itemProvider loadFileRepresentationForTypeIdentifier:typeIdentifier completionHandler:^(NSURL * _Nullable url, NSError * _Nullable error) {
|
|
|
+ if (error) {
|
|
|
+ NSLog(@"Error loading file: %@", error);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ NSLog(@"File URL: %@", url); // 这里就是文件的 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];
|
|
|
+ if (fileArray.count==results.count) {
|
|
|
+ dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
+ [self handleMediaData:fileArray];
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ NSLog(@"-----找不到文件------");
|
|
|
}
|
|
|
}];
|
|
|
}
|
|
|
@@ -1570,6 +1594,30 @@ static const CGFloat kQuoteViewHeight = 46.0f;
|
|
|
return filePath;
|
|
|
}
|
|
|
|
|
|
+- (NSString *)saveFileToDocumentsDirectory:(NSURL *)fromePath {
|
|
|
+ NSString *documentsDirectory = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject];
|
|
|
+ NSString *destinationPath = [documentsDirectory stringByAppendingPathComponent:fromePath.lastPathComponent]; // 目标文件路径
|
|
|
+
|
|
|
+ NSFileManager *fileManager = [NSFileManager defaultManager];
|
|
|
+ NSError *error = nil;
|
|
|
+
|
|
|
+ if([[NSFileManager defaultManager] fileExistsAtPath:destinationPath]){
|
|
|
+ return destinationPath;
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ BOOL success = [fileManager copyItemAtPath:fromePath.path toPath:destinationPath error:&error];
|
|
|
+ if (success) {
|
|
|
+ NSLog(@"文件成功复制到本地");
|
|
|
+ return destinationPath;
|
|
|
+ } else {
|
|
|
+ NSLog(@"文件复制失败: %@", error.localizedDescription);
|
|
|
+ return @"";
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
#pragma mark -文件选择和处理
|
|
|
-(void)showfilePicker{
|
|
|
// 创建文档选择器
|
|
|
@@ -1620,28 +1668,6 @@ static const CGFloat kQuoteViewHeight = 46.0f;
|
|
|
NSString *strtime = [self getLocalTime];
|
|
|
[self uploadFile:[NSString stringWithFormat:@"%@",model.fileURL] fpath:model.filePath state:1 act:1 localtime:strtime];
|
|
|
[self OSSuploadFile:model thrid:strtime];
|
|
|
-//// NSLog(@"------fileSize:%@",model.fileSize);
|
|
|
-// [self uploadFile:[NSString stringWithFormat:@"%@",model.fileURL] fpath:model.filePath state:1 act:1 localtime:strtime];
|
|
|
-// //dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
|
|
-//// [FileNetApi uploadWithFilePath:model.fileURL thrid:strtime progress:^(NSString *_Nullable thrid,NSProgress * _Nullable uploadProgress) {
|
|
|
-// [FileNetApi OSSuploadWithFilePath:model.fileURL thrid:strtime progress:^(NSString *_Nullable thrid,NSProgress * _Nullable uploadProgress) {
|
|
|
-// NSLog(@"thrid:%@,%@",thrid,uploadProgress);
|
|
|
-// [self updatajidu:thrid uploadProgress:uploadProgress];
|
|
|
-// } succ:^(int code, NSString *_Nullable thrid,NSDictionary * _Nullable dis) {
|
|
|
-// NSString *reCode =dis[@"code"];
|
|
|
-// if(reCode.intValue==200){
|
|
|
-// NSLog(@"上传成功:%@",dis[@"url"]);
|
|
|
-// [self uploadFile:dis[@"url"] fpath:model.filePath state:1 act:2 localtime:thrid];
|
|
|
-// }
|
|
|
-// else{
|
|
|
-// NSLog(@"上传失败");
|
|
|
-// [self uploadFilefail:thrid];
|
|
|
-// }
|
|
|
-// } fail:^(NSString *_Nullable thrid,NSError * _Nonnull error) {
|
|
|
-// NSLog(@"上传失败");
|
|
|
-// [self uploadFilefail:thrid];
|
|
|
-// }];
|
|
|
-// //});
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -1649,73 +1675,48 @@ static const CGFloat kQuoteViewHeight = 46.0f;
|
|
|
|
|
|
|
|
|
-(void)OSSuploadFile:(ChatFileModel *)model thrid:(NSString *)strtime{
|
|
|
-// 普通上传
|
|
|
-// [OSSManager.sharedManager asyncPutFile:model.fileURL.lastPathComponent localFilePath:model.filePath thrid:strtime progress:^(NSInteger pcent, NSString * loacaltime) {
|
|
|
-// [self Ossupdatajidu:loacaltime uploadProgress:pcent];
|
|
|
-// } success:^(id res, NSString * loacaltime) {
|
|
|
-// [self uploadFile:model.fileURL.lastPathComponent fpath:model.filePath state:1 act:2 localtime:loacaltime];
|
|
|
-// } failure:^(NSError * error, NSString * loacaltime) {
|
|
|
-// [self uploadFilefail:loacaltime];
|
|
|
-// }];
|
|
|
+
|
|
|
|
|
|
+ NSString * tempChatId = self.chatId.mutableCopy;
|
|
|
+ [ChatsStore shareInstance].chatId = tempChatId;
|
|
|
+ [ChatsStore shareInstance].delegate = self;
|
|
|
+
|
|
|
// 断点续传
|
|
|
- [OSSManager.sharedManager asyncResumableUploadFile:model.fileURL.lastPathComponent localFilePath:model.filePath thrid:strtime progress:^(NSInteger pcent, NSString * loacaltime) {
|
|
|
- [self Ossupdatajidu:loacaltime uploadProgress:pcent];
|
|
|
- } success:^(id res, NSString * loacaltime) {
|
|
|
- [self uploadFile:model.fileURL.lastPathComponent fpath:model.filePath state:1 act:2 localtime:loacaltime];
|
|
|
- } failure:^(NSError * error, NSString * loacaltime) {
|
|
|
- [self uploadFilefail:loacaltime];
|
|
|
- }];
|
|
|
+ [OSSManager.sharedManager asyncResumableUploadFile:model.fileURL.lastPathComponent localFilePath:model.filePath thrid:strtime];
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+-(void)stateChange:(NSDictionary *)changeMsg{
|
|
|
+ NSString *loacaltime = changeMsg[@"thrid"];
|
|
|
+ NSString *pcent = changeMsg[@"pcent"];
|
|
|
+ NSString *state = changeMsg[@"state"];
|
|
|
+ if([state isEqualToString:@"1"]){
|
|
|
+ [self Ossupdatajidu:loacaltime uploadProgress:pcent.intValue];
|
|
|
+ }
|
|
|
+// if([state isEqualToString:@"2"]){
|
|
|
+// [self Ossupdatajidu:loacaltime uploadProgress:pcent.intValue];
|
|
|
+// }
|
|
|
|
|
|
}
|
|
|
|
|
|
-(void)resendFile:(ChatMessageModel *)msg{
|
|
|
|
|
|
NSString *strtime = [NSString stringWithFormat:@"%ld",(long)msg.localtime];
|
|
|
- NSString *loaclFile = [NSString stringWithFormat:@"file://%@",msg.localurl];
|
|
|
- NSURL *fileURL = [NSURL URLWithString:loaclFile];
|
|
|
-
|
|
|
- [FileNetApi OSSuploadWithFilePath:fileURL thrid:strtime progress:^(NSString *_Nullable thrid,NSProgress * _Nullable uploadProgress) {
|
|
|
- NSLog(@"thrid:%@,%@",thrid,uploadProgress);
|
|
|
- [self updatajidu:thrid uploadProgress:uploadProgress];
|
|
|
- } succ:^(int code, NSString *_Nullable thrid,NSDictionary * _Nullable dis) {
|
|
|
- NSString *reCode =dis[@"code"];
|
|
|
- if(reCode.intValue==200){
|
|
|
- NSLog(@"上传成功:%@",dis[@"url"]);
|
|
|
- [self uploadFile:dis[@"url"] fpath:msg.localurl state:1 act:2 localtime:thrid];
|
|
|
- }
|
|
|
- else{
|
|
|
- NSLog(@"上传失败");
|
|
|
- [self uploadFilefail:thrid];
|
|
|
- }
|
|
|
- } fail:^(NSString *_Nullable thrid,NSError * _Nonnull error) {
|
|
|
- NSLog(@"上传失败");
|
|
|
- [self uploadFilefail:thrid];
|
|
|
- }];
|
|
|
+ NSString *loaclFile = [NSString stringWithFormat:@"%@",msg.localurl];
|
|
|
+
|
|
|
+ if(![[NSFileManager defaultManager] fileExistsAtPath:loaclFile]){
|
|
|
+ [MBProgressHUD showWithText:@"文件不存在,請重新選擇"];
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ NSURL * fileUrl = [NSURL fileURLWithPath:loaclFile];
|
|
|
+ ChatFileModel * model = [[ChatFileModel alloc] initWithURL:fileUrl];
|
|
|
+ model.fileURL = fileUrl;
|
|
|
+ model.filePath = loaclFile;
|
|
|
+
|
|
|
+ [self OSSuploadFile:model thrid:strtime];
|
|
|
|
|
|
- [GDBManager.shareInstance selectLocalmsgWithLocaltime:strtime 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;
|
|
|
- }
|
|
|
- NSString *strtime = [self getLocalTime];
|
|
|
- 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) {
|
|
|
- ;
|
|
|
- }];
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -1940,9 +1941,7 @@ static const CGFloat kQuoteViewHeight = 46.0f;
|
|
|
NSInteger time = trt*1000;
|
|
|
_AudiofileName = [NSString stringWithFormat:@"%ld.mp4",(long)time];
|
|
|
|
|
|
- if(!_AudiofilePath){
|
|
|
- _AudiofilePath = [NSTemporaryDirectory() stringByAppendingPathComponent:_AudiofileName];
|
|
|
- }
|
|
|
+ _AudiofilePath = [NSTemporaryDirectory() stringByAppendingPathComponent:_AudiofileName];
|
|
|
|
|
|
NSError *error = nil;
|
|
|
AVAudioSession *audioSession = [AVAudioSession sharedInstance];
|
|
|
@@ -1993,6 +1992,7 @@ static const CGFloat kQuoteViewHeight = 46.0f;
|
|
|
return;
|
|
|
}
|
|
|
NSLog(@"_AudiofilePath:%@",_AudiofilePath);
|
|
|
+
|
|
|
NSString *documentsDirectory = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject];
|
|
|
NSString *destinationPath = [documentsDirectory stringByAppendingPathComponent:yuanfileURL.lastPathComponent]; // 目标文件路径
|
|
|
|
|
|
@@ -2000,8 +2000,10 @@ static const CGFloat kQuoteViewHeight = 46.0f;
|
|
|
NSError *error = nil;
|
|
|
BOOL success = [fileManager copyItemAtPath:_AudiofilePath toPath:destinationPath error:&error];
|
|
|
if (success) {
|
|
|
+ [[NSFileManager defaultManager] removeItemAtURL:yuanfileURL error:nil];
|
|
|
NSLog(@"文件成功复制到本地");
|
|
|
} else {
|
|
|
+ [[NSFileManager defaultManager] removeItemAtURL:yuanfileURL error:nil];
|
|
|
NSLog(@"文件复制失败: %@", error.localizedDescription);
|
|
|
}
|
|
|
NSLog(@"destinationPath:%@",destinationPath);
|
|
|
@@ -2013,18 +2015,9 @@ static const CGFloat kQuoteViewHeight = 46.0f;
|
|
|
model.fileURL = fileURL;
|
|
|
model.filePath = destinationPath;
|
|
|
NSString *strtime = [self getLocalTime];
|
|
|
- //普通上传
|
|
|
+
|
|
|
[self sendYuyinMsg:model.fileURL.lastPathComponent filePth:destinationPath localtime:strtime state:0];
|
|
|
- [OSSManager.sharedManager asyncPutFile:model.fileURL.lastPathComponent localFilePath:model.filePath thrid:strtime progress:^(NSInteger pcent, NSString * loacaltime) {
|
|
|
-// [self Ossupdatajidu:loacaltime uploadProgress:pcent];
|
|
|
- } success:^(id res, NSString * loacaltime) {
|
|
|
- [self sendYuyinMsg:model.fileURL.lastPathComponent filePth:destinationPath localtime:loacaltime state:1];
|
|
|
- [[NSFileManager defaultManager] removeItemAtURL:yuanfileURL error:nil];
|
|
|
- } failure:^(NSError * error, NSString * loacaltime) {
|
|
|
-// [self sendYuyinMsg:model.fileURL.lastPathComponent localtime:loacaltime state:2];
|
|
|
- [[NSFileManager defaultManager] removeItemAtURL:yuanfileURL error:nil];
|
|
|
- }];
|
|
|
-
|
|
|
+ [self OSSuploadFile:model thrid:strtime];
|
|
|
|
|
|
[self.heatBeat invalidate];
|
|
|
self.heatBeat = nil;
|
|
|
@@ -2183,7 +2176,7 @@ static const CGFloat kQuoteViewHeight = 46.0f;
|
|
|
}
|
|
|
[favoritesDict setValue:extend forKey:@"extend"];
|
|
|
[UserNetApi addFavorites:favoritesDict succ:^(int code, NSDictionary * _Nullable res) {
|
|
|
- NSLog(@"------result:%@",res);
|
|
|
+// NSLog(@"------result:%@",res);
|
|
|
NSString *ecode = res[@"code"];
|
|
|
if(ecode.intValue==200){
|
|
|
if ([res jk_hasKey:@"msg"] && ![res[@"msg"] isKindOfClass:NSNull.class]) {
|
|
|
@@ -2490,9 +2483,9 @@ static const CGFloat kQuoteViewHeight = 46.0f;
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
-// NSLog(@"othersChatMessageAlert---3:%@",message);
|
|
|
- weakSelf(self);
|
|
|
- [TopPopupView showWithNickname:message.nickName message:message.content chatId:message.type == 0 ? message.avatar : message.chatId type:message.type clickBlock:^{
|
|
|
+ NSLog(@"othersChatMessageAlert---3:%@",message.avatar);
|
|
|
+// weakSelf(self);
|
|
|
+ [TopPopupView showWithNickname:message.nickName avatar:message.avatar message:message.content chatId:message.chatId type:message.type clickBlock:^{
|
|
|
// weakself.chatId = message.chatId;
|
|
|
// weakself.type = message.type;
|
|
|
// weakself.titlename = message.nickName;
|