diff --git a/ChatSecure/Classes/Model/Yap Storage/OTRXMPPBuddy.m b/ChatSecure/Classes/Model/Yap Storage/OTRXMPPBuddy.m index 0b7719354..2def4a87b 100644 --- a/ChatSecure/Classes/Model/Yap Storage/OTRXMPPBuddy.m +++ b/ChatSecure/Classes/Model/Yap Storage/OTRXMPPBuddy.m @@ -9,6 +9,7 @@ #import "OTRXMPPBuddy.h" #import "OTRBuddyCache.h" @import XMPPFramework; +@import OTRAssets; @implementation OTRXMPPBuddy @synthesize vCardTemp = _vCardTemp; @@ -59,6 +60,15 @@ - (BOOL) waitingForvCardTempFetch { return [[OTRBuddyCache sharedInstance] waitingForvCardTempFetchForBuddy:self]; } +- (NSString *)threadName +{ + NSString *threadName = [super threadName]; + if (self.pendingApproval) { + threadName = [NSString stringWithFormat:@"%@ - %@", threadName, PENDING_APPROVAL_STRING()]; + } + return threadName; +} + #pragma - mark Class Methods + (NSString *)collection diff --git a/ChatSecure/Classes/View Controllers/OTRConversationViewController.m b/ChatSecure/Classes/View Controllers/OTRConversationViewController.m index 5e2bc67f8..0ac4f071b 100644 --- a/ChatSecure/Classes/View Controllers/OTRConversationViewController.m +++ b/ChatSecure/Classes/View Controllers/OTRConversationViewController.m @@ -343,11 +343,6 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N }]; cell = approvalCell; cell.selectionStyle = UITableViewCellSelectionStyleNone; - - } else if ([thread isKindOfClass:[OTRXMPPBuddy class]] && - ((OTRXMPPBuddy*)thread).pendingApproval) { - cell = [tableView dequeueReusableCellWithIdentifier:[OTRBuddyInfoCell reuseIdentifier] forIndexPath:indexPath]; - cell.selectionStyle = UITableViewCellSelectionStyleNone; } else { cell = [tableView dequeueReusableCellWithIdentifier:[OTRConversationCell reuseIdentifier] forIndexPath:indexPath]; cell.selectionStyle = UITableViewCellSelectionStyleDefault; @@ -380,10 +375,9 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath { id thread = [self threadForIndexPath:indexPath]; - // Bail out if it's a subscription request or pending approval + // Bail out if it's a subscription request if ([thread isKindOfClass:[OTRXMPPBuddy class]] && - (((OTRXMPPBuddy*)thread).hasIncomingSubscriptionRequest || - ((OTRXMPPBuddy*)thread).pendingApproval)) { + ((OTRXMPPBuddy*)thread).hasIncomingSubscriptionRequest) { return; } diff --git a/ChatSecure/Classes/Views/Cells/OTRBuddyInfoCell.m b/ChatSecure/Classes/Views/Cells/OTRBuddyInfoCell.m index 01f4a22fb..cc7227d17 100644 --- a/ChatSecure/Classes/Views/Cells/OTRBuddyInfoCell.m +++ b/ChatSecure/Classes/Views/Cells/OTRBuddyInfoCell.m @@ -73,13 +73,6 @@ - (void)setThread:(id)thread self.nameLabel.text = name; self.identifierLabel.text = nil; - - if ([thread isKindOfClass:[OTRXMPPBuddy class]]) { - if(((OTRXMPPBuddy *)thread).pendingApproval) { - NSString *pendingString = [NSString stringWithFormat:@" - %@",PENDING_APPROVAL_STRING()]; - self.nameLabel.text = [self.nameLabel.text stringByAppendingString:pendingString]; - } - } } - (void)updateConstraints diff --git a/ChatSecure/Classes/Views/Cells/UserInfoProfileCell.swift b/ChatSecure/Classes/Views/Cells/UserInfoProfileCell.swift index 11b476aa7..878f32267 100644 --- a/ChatSecure/Classes/Views/Cells/UserInfoProfileCell.swift +++ b/ChatSecure/Classes/Views/Cells/UserInfoProfileCell.swift @@ -16,20 +16,17 @@ public class UserInfoProfileCell: XLFormBaseCell { @IBOutlet weak var displayNameLabel: UILabel! @IBOutlet weak var avatarImageView: UIImageView! - public override func awakeFromNib() { - super.awakeFromNib() - - - - } - public override func update() { super.update() guard let userInfo = rowDescriptor.value as? OTRUserInfoProfile else { return } + var displayName = userInfo.displayName + if let userInfo = userInfo as? OTRThreadOwner { + displayName = userInfo.threadName() + } usernameLabel.text = userInfo.username - displayNameLabel.text = userInfo.displayName + displayNameLabel.text = displayName avatarImageView.image = userInfo.avatarImage avatarImageView.layer.cornerRadius = CGRectGetHeight(self.avatarImageView.frame)/2 avatarImageView.layer.masksToBounds = true