Browse Source

已读回执

heavyrain2012 5 years ago
parent
commit
81ff03cbd4

+ 20 - 1
wfuikit/WFChatUIKit/MessageList/Cell/WFCUMessageCell.m

@@ -31,6 +31,8 @@
 @property (nonatomic, strong)UIActivityIndicatorView *activityIndicatorView;
 @property (nonatomic, strong)UIImageView *failureView;
 @property (nonatomic, strong)UIImageView *maskView;
+
+@property (nonatomic, strong)UIImageView *tickView;
 @end
 
 @implementation WFCUMessageCell
@@ -173,6 +175,13 @@
       UIImage *image = self.bubbleView.image;
       self.bubbleView.image = [self.bubbleView.image
                                          resizableImageWithCapInsets:UIEdgeInsetsMake(image.size.height * 0.8, image.size.width * 0.2,image.size.height * 0.2, image.size.width * 0.8)];
+      
+      if (model.message.status == Message_Status_Readed) {
+          self.tickView.hidden = NO;
+          self.tickView.frame = CGRectMake(self.bubbleView.frame.origin.x - 16, self.frame.size.height - 18 , 14, 14);
+      } else {
+          self.tickView.hidden = YES;
+      }
   } else {
     CGFloat top = [WFCUMessageCellBase hightForTimeLabel:model];
     self.portraitView.frame = CGRectMake(Portrait_Padding_Left, top, Portrait_Size, Portrait_Size);
@@ -204,6 +213,8 @@
                                          resizableImageWithCapInsets:UIEdgeInsetsMake(image.size.height * 0.8, image.size.width * 0.8,
                                                                                       image.size.height * 0.2, image.size.width * 0.2)];
       
+      self.tickView.hidden = YES;
+      
   }
     
     NSString *groupId = nil;
@@ -250,7 +261,15 @@
         _maskView.frame = self.bubbleView.bounds;
     }
 }
-
+- (UIImageView *)tickView {
+    if (!_tickView) {
+        _tickView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 20, 20)];
+        _tickView.image = [UIImage imageNamed:@"tick"];
+        _tickView.hidden = YES;
+        [self.contentView addSubview:_tickView];
+    }
+    return _tickView;
+}
 - (UIImageView *)portraitView {
   if (!_portraitView) {
     _portraitView = [[UIImageView alloc] init];

+ 6 - 0
wfuikit/WFChatUIKit/MessageList/ViewController/WFCUMessageListViewController.m

@@ -121,6 +121,8 @@
     
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onCallStateChanged:) name:kCallStateUpdated object:nil];
     
+    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onSettingUpdated:) name:kSettingUpdated object:nil];
+    
     __weak typeof(self) ws = self;
     
   if(self.conversation.type == Single_Type) {
@@ -701,6 +703,10 @@
     [self reloadMessageList];
 }
 
+- (void)onSettingUpdated:(NSNotification *)notification {
+    [self reloadMessageList];
+}
+
 - (void)reloadMessageList {
     NSArray *messageList;
     if (self.highlightMessageId > 0) {

+ 21 - 0
wfuikit/WFChatUIKit/Resources/WFChatUIKit.xcassets/tick.imageset/Contents.json

@@ -0,0 +1,21 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "icons8-double-tick-50.png",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "universal",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  }
+}

BIN
wfuikit/WFChatUIKit/Resources/WFChatUIKit.xcassets/tick.imageset/icons8-double-tick-50.png