12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- //
- // DiscoverTableViewCell.m
- // WildFireChat
- //
- // Created by Tom Lee on 2020/3/10.
- // Copyright © 2020 WildFireChat. All rights reserved.
- //
- #import "DiscoverMomentsTableViewCell.h"
- #import <SDWebImage/SDWebImage.h>
- @interface DiscoverMomentsTableViewCell ()
- @property(nonatomic, strong)UIImageView *lastFeedPortrait;
- @property (nonatomic, strong)BubbleTipView *bubbleView2;
- @end
- @implementation DiscoverMomentsTableViewCell
- - (void)awakeFromNib {
- [super awakeFromNib];
- // Initialization code
- }
- - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
- [super setSelected:selected animated:animated];
- // Configure the view for the selected state
- }
- - (BubbleTipView *)bubbleView {
- if (!_bubbleView) {
- if(self.textLabel) {
- _bubbleView = [[BubbleTipView alloc] initWithSuperView:self.textLabel];
- _bubbleView.hidden = YES;
- _bubbleView.isShowNotificationNumber = YES;
- }
- }
- return _bubbleView;
- }
- - (BubbleTipView *)bubbleView2 {
- if (!_bubbleView2) {
- if(self.lastFeedPortrait) {
- _bubbleView2 = [[BubbleTipView alloc] initWithSuperView:self.lastFeedPortrait];
- _bubbleView2.hidden = YES;
- _bubbleView2.bubbleTipPositionAdjustment = CGPointMake(-25, -8);
- _bubbleView2.isShowNotificationNumber = NO;
- }
- }
- return _bubbleView2;
- }
- - (UIImageView *)lastFeedPortrait {
- if (!_lastFeedPortrait) {
- _lastFeedPortrait = [[UIImageView alloc] initWithFrame:CGRectMake([UIScreen mainScreen].bounds.size.width - 80, 8, 32, 32)];
- [self.contentView addSubview:_lastFeedPortrait];
- }
- return _lastFeedPortrait;
- }
- #ifdef WFC_MOMENTS
- - (void)setLastFeed:(WFMFeed *)lastFeed {
- _lastFeed = lastFeed;
- WFCCUserInfo *userInfo = [[WFCCIMService sharedWFCIMService] getUserInfo:lastFeed.sender refresh:NO];
-
- [self.lastFeedPortrait sd_setImageWithURL:[NSURL URLWithString:[userInfo.portrait stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]] placeholderImage:[UIImage imageNamed:@"PersonalChat"]];
- if (lastFeed.serverTime > [[WFMomentService sharedService] getLastReadTimestamp]*1000) {
- [self.bubbleView2 setBubbleTipNumber:1];
- self.bubbleView2.hidden = NO;
- } else {
- [self.bubbleView2 setBubbleTipNumber:0];
- self.bubbleView2.hidden = YES;
- }
- }
- #endif
- @end
|