mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
243ff190bc
The broken code addressed in 8211d4584f
was duplicated a couple of places. This commit ferrets out the rest of
them and centralizes the logic in the ContactsManager.
// FREEBIE
44 lines
1.2 KiB
Objective-C
44 lines
1.2 KiB
Objective-C
#import "ContactTableViewCell.h"
|
|
#import "Environment.h"
|
|
#import "OWSContactAvatarBuilder.h"
|
|
#import "OWSContactsManager.h"
|
|
#import "PhoneManager.h"
|
|
#import "UIUtil.h"
|
|
|
|
NS_ASSUME_NONNULL_BEGIN
|
|
|
|
@interface ContactTableViewCell ()
|
|
|
|
@property (nonatomic) IBOutlet UILabel *nameLabel;
|
|
@property (nonatomic) IBOutlet UIImageView *avatarView;
|
|
|
|
@end
|
|
|
|
@implementation ContactTableViewCell
|
|
|
|
- (nullable NSString *)reuseIdentifier
|
|
{
|
|
return NSStringFromClass(self.class);
|
|
}
|
|
|
|
- (void)configureWithContact:(Contact *)contact contactsManager:(OWSContactsManager *)contactsManager
|
|
{
|
|
self.nameLabel.attributedText = [contactsManager formattedFullNameForContact:contact font:self.nameLabel.font];
|
|
self.avatarView.image =
|
|
[[[OWSContactAvatarBuilder alloc] initWithContactId:contact.textSecureIdentifiers.firstObject
|
|
name:contact.fullName
|
|
contactsManager:contactsManager] build];
|
|
|
|
// Force layout, since imageView isn't being initally rendered on App Store optimized build.
|
|
[self layoutSubviews];
|
|
}
|
|
|
|
- (void)layoutSubviews
|
|
{
|
|
[super layoutSubviews];
|
|
[UIUtil applyRoundedBorderToImageView:self.avatarView];
|
|
}
|
|
|
|
@end
|
|
|
|
NS_ASSUME_NONNULL_END
|