浏览代码

发送文本消息loading

zwp 2 月之前
父节点
当前提交
b9f44411fb

+ 6 - 12
AIIM/Controller/chat/ChatController.m

@@ -420,9 +420,7 @@ static const CGFloat kQuoteViewHeight = 46.0f;
 
 
 - (IBAction)fasongBt:(id)sender {
-    if ([self checkIsNetworkUnavailable]) {
-        return;
-    }
+    
     NSLog(@"fasongBt:1");
     if(_isfriend){
         NSLog(@"fasongBt:2");
@@ -681,9 +679,7 @@ static const CGFloat kQuoteViewHeight = 46.0f;
 #pragma mark  chatpopViewDelegate
 
 -(void)actionNote:(NSString *)note{
-    if ([self checkIsNetworkUnavailable]) {
-        return;
-    }
+    
     [self hidBottonView];
     if([note isEqualToString:@"1"]){//发送图片
         [self showImagePicker:1];
@@ -850,9 +846,6 @@ static const CGFloat kQuoteViewHeight = 46.0f;
     };
     
     [cell setResendMessageBlock:^(ChatMessageModel *message) {
-        if ([weakself checkIsNetworkUnavailable]) {
-            return;
-        }
         if (message.isUploadFile) {
             [weakself resendFile:message];
         } else {
@@ -1913,9 +1906,7 @@ static const CGFloat kQuoteViewHeight = 46.0f;
 }
 
 -(void)UpInside{
-    if ([self checkIsNetworkUnavailable]) {
-        return;
-    }
+    
     _AVRecordBt.layer.backgroundColor = globalColor(GCTypeDark2).CGColor;
     [_AVRecordBt setTitle:@" 按住 说话" forState:UIControlStateNormal];
     NSLog(@"UpInside----------");
@@ -2027,6 +2018,9 @@ static const CGFloat kQuoteViewHeight = 46.0f;
         [MBProgressHUD showWithText:@"群聊暂时不支持该功能"];
         return;
     }
+    if ([self checkIsNetworkUnavailable]) {
+        return;
+    }
     BOOL audioOnly=YES;
     if(state==4){
         audioOnly = YES;

+ 4 - 0
AIIM/Controller/chat/chetCell/ChatMessageModel.m

@@ -481,6 +481,10 @@
 }
 
 - (FileUploadStatus)fileUploadStatus {
+    if (self.messageType == ChatMessageTypeText) {
+        return FileUploading;
+    }
+    
     NSString *key = [self getKey];
     NSInteger value = [[[NSUserDefaults standardUserDefaults] valueForKey:key] integerValue];
     NSLog(@"checkIsNeedResend key: %@  value: %ld", key, value);

+ 22 - 11
AIIM/Controller/chat/chetCell/chatCellView.m

@@ -80,6 +80,8 @@ static const CGFloat kMediaCornerRadius = 4.0f;
 
 @property (nonatomic,strong) NSArray *matchesArray;
 
+@property (nonatomic, strong) UIActivityIndicatorView *indicatorView;
+
 @end
 
 
@@ -179,6 +181,13 @@ static const CGFloat kMediaCornerRadius = 4.0f;
     // 初始化发送失败按钮
     [self setupResendButton];
     
+    self.indicatorView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleMedium];
+    self.indicatorView.color = UIColor.whiteColor;
+    [self.contentView addSubview:self.indicatorView];
+    [self.indicatorView mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.centerY.equalTo(self.bubbleImageView);
+        make.right.equalTo(self.bubbleImageView.mas_left).mas_offset(-8);
+    }];
 }
 
 
@@ -750,32 +759,34 @@ static const CGFloat kMediaCornerRadius = 4.0f;
 // 配置发送进度
 - (void)setupSendingProgress {
     // 只有发送方才显示进度或失败按钮
-    if (!_messageModel.isSender || !_messageModel.isUploadFile) {
-        [self hideProgressView];
-        [self hideResendButton];
-        return;
-    }
-    
-    if (self.messageModel.isSent) {
+    if (!_messageModel.isSender || self.messageModel.isSent) {
         [self hideProgressView];
         [self hideResendButton];
+        [self.indicatorView stopAnimating];
         return;
     }
     
+    self.indicatorView.hidden = self.messageModel.isUploadFile;
     switch (self.messageModel.fileUploadStatus) {
         case FileUploadCompleted:
             [self hideProgressView];
             [self hideResendButton];
+            [self.indicatorView stopAnimating];
             break;
             
-        case FileUploading:
-            [self showProgressView];
+        case FileUploading:{
             [self hideResendButton];
-            break;
-            
+            if (self.messageModel.isUploadFile) {
+                [self showProgressView];
+            } else {
+                [self.indicatorView startAnimating];
+            }
+        }break;
+        
         case FileUploadFail:
             [self showResendButton];
             [self hideProgressView];
+            [self.indicatorView stopAnimating];
             break;
     }