mirror of https://github.com/oxen-io/session-ios
				
				
				
			
			You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
	
	
		
			117 lines
		
	
	
		
			2.5 KiB
		
	
	
	
		
			Matlab
		
	
		
		
			
		
	
	
			117 lines
		
	
	
		
			2.5 KiB
		
	
	
	
		
			Matlab
		
	
| 
											9 years ago
										 | // | ||
| 
											8 years ago
										 | //  Copyright (c) 2018 Open Whisper Systems. All rights reserved. | ||
| 
											9 years ago
										 | // | ||
|  | 
 | ||
| 
											12 years ago
										 | #import "ContactTableViewCell.h" | ||
| 
											7 years ago
										 | #import "ContactCellView.h" | ||
| 
											7 years ago
										 | #import "OWSTableViewController.h" | ||
|  | #import "UIColor+OWS.h" | ||
| 
											9 years ago
										 | #import "UIFont+OWS.h" | ||
|  | #import "UIView+OWS.h" | ||
| 
											5 years ago
										 | #import <SignalUtilitiesKit/SignalAccount.h> | ||
| 
											11 years ago
										 | 
 | ||
| 
											9 years ago
										 | NS_ASSUME_NONNULL_BEGIN | ||
|  | 
 | ||
| 
											9 years ago
										 | @interface ContactTableViewCell () | ||
| 
											12 years ago
										 | 
 | ||
| 
											7 years ago
										 | @property (nonatomic) ContactCellView *cellView; | ||
| 
											8 years ago
										 | 
 | ||
| 
											11 years ago
										 | @end | ||
|  | 
 | ||
| 
											7 years ago
										 | #pragma mark - | ||
|  | 
 | ||
| 
											12 years ago
										 | @implementation ContactTableViewCell | ||
|  | 
 | ||
| 
											7 years ago
										 | - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(nullable NSString *)reuseIdentifier | ||
| 
											9 years ago
										 | { | ||
| 
											7 years ago
										 |     if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { | ||
| 
											7 years ago
										 |         [self configure]; | ||
| 
											9 years ago
										 |     } | ||
|  |     return self; | ||
|  | } | ||
|  | 
 | ||
| 
											7 years ago
										 | + (NSString *)reuseIdentifier | ||
| 
											9 years ago
										 | { | ||
| 
											11 years ago
										 |     return NSStringFromClass(self.class); | ||
| 
											12 years ago
										 | } | ||
|  | 
 | ||
| 
											7 years ago
										 | - (void)setAccessoryView:(nullable UIView *)accessoryView | ||
| 
											9 years ago
										 | { | ||
| 
											7 years ago
										 |     OWSFailDebug(@"use ows_setAccessoryView instead."); | ||
| 
											7 years ago
										 | } | ||
| 
											8 years ago
										 | 
 | ||
| 
											7 years ago
										 | - (void)configure | ||
| 
											7 years ago
										 | { | ||
| 
											7 years ago
										 |     OWSAssertDebug(!self.cellView); | ||
| 
											7 years ago
										 | 
 | ||
| 
											7 years ago
										 |     self.preservesSuperviewLayoutMargins = YES; | ||
|  |     self.contentView.preservesSuperviewLayoutMargins = YES; | ||
| 
											6 years ago
										 |      | ||
| 
											7 years ago
										 |     self.cellView = [ContactCellView new]; | ||
|  |     [self.contentView addSubview:self.cellView]; | ||
|  |     [self.cellView autoPinEdgesToSuperviewMargins]; | ||
| 
											7 years ago
										 |     self.cellView.userInteractionEnabled = NO; | ||
| 
											8 years ago
										 | } | ||
|  | 
 | ||
| 
											7 years ago
										 | - (void)configureWithRecipientId:(NSString *)recipientId | ||
| 
											9 years ago
										 | { | ||
| 
											7 years ago
										 |     [OWSTableItem configureCell:self]; | ||
|  | 
 | ||
| 
											7 years ago
										 |     [self.cellView configureWithRecipientId:recipientId]; | ||
| 
											8 years ago
										 | 
 | ||
| 
											9 years ago
										 |     // Force layout, since imageView isn't being initally rendered on App Store optimized build. | ||
|  |     [self layoutSubviews]; | ||
| 
											9 years ago
										 | } | ||
|  | 
 | ||
| 
											7 years ago
										 | - (void)configureWithThread:(TSThread *)thread | ||
| 
											9 years ago
										 | { | ||
| 
											7 years ago
										 |     OWSAssertDebug(thread); | ||
| 
											8 years ago
										 | 
 | ||
| 
											7 years ago
										 |     [OWSTableItem configureCell:self]; | ||
|  | 
 | ||
| 
											7 years ago
										 |     [self.cellView configureWithThread:thread]; | ||
| 
											9 years ago
										 | 
 | ||
|  |     // Force layout, since imageView isn't being initally rendered on App Store optimized build. | ||
|  |     [self layoutSubviews]; | ||
|  | } | ||
|  | 
 | ||
| 
											7 years ago
										 | - (void)setAccessoryMessage:(nullable NSString *)accessoryMessage | ||
| 
											9 years ago
										 | { | ||
| 
											7 years ago
										 |     OWSAssertDebug(self.cellView); | ||
| 
											7 years ago
										 | 
 | ||
|  |     self.cellView.accessoryMessage = accessoryMessage; | ||
| 
											9 years ago
										 | } | ||
|  | 
 | ||
| 
											7 years ago
										 | - (NSAttributedString *)verifiedSubtitle | ||
| 
											8 years ago
										 | { | ||
| 
											7 years ago
										 |     return self.cellView.verifiedSubtitle; | ||
| 
											8 years ago
										 | } | ||
| 
											8 years ago
										 | 
 | ||
| 
											7 years ago
										 | - (void)setAttributedSubtitle:(nullable NSAttributedString *)attributedSubtitle | ||
| 
											8 years ago
										 | { | ||
| 
											7 years ago
										 |     [self.cellView setAttributedSubtitle:attributedSubtitle]; | ||
| 
											8 years ago
										 | } | ||
|  | 
 | ||
| 
											9 years ago
										 | - (void)prepareForReuse | ||
|  | { | ||
| 
											8 years ago
										 |     [super prepareForReuse]; | ||
|  | 
 | ||
| 
											7 years ago
										 |     [self.cellView prepareForReuse]; | ||
| 
											8 years ago
										 | 
 | ||
| 
											9 years ago
										 |     self.accessoryType = UITableViewCellAccessoryNone; | ||
| 
											8 years ago
										 | } | ||
|  | 
 | ||
| 
											7 years ago
										 | - (BOOL)hasAccessoryText | ||
|  | { | ||
|  |     return [self.cellView hasAccessoryText]; | ||
|  | } | ||
|  | 
 | ||
|  | - (void)ows_setAccessoryView:(UIView *)accessoryView | ||
|  | { | ||
| 
											7 years ago
										 |     return [self.cellView setAccessoryView:accessoryView]; | ||
| 
											7 years ago
										 | } | ||
|  | 
 | ||
| 
											12 years ago
										 | @end | ||
| 
											9 years ago
										 | 
 | ||
|  | NS_ASSUME_NONNULL_END |