Respond to CR.

pull/1/head
Matthew Chen 7 years ago
parent 581347a7fb
commit fa8a07abf1

@ -236,7 +236,6 @@ public class ContactsPicker: OWSViewController, UITableViewDelegate, UITableView
owsFail("\(logTag) in \(#function) cell had unexpected type") owsFail("\(logTag) in \(#function) cell had unexpected type")
return UITableViewCell() return UITableViewCell()
} }
OWSTableItem.configureCell(cell)
let dataSource = filteredSections let dataSource = filteredSections
let cnContact = dataSource[indexPath.section][indexPath.row] let cnContact = dataSource[indexPath.section][indexPath.row]

@ -115,7 +115,6 @@ NS_ASSUME_NONNULL_BEGIN
OWSAssert(self.viewItem); OWSAssert(self.viewItem);
OWSAssert([self.viewItem.interaction isKindOfClass:[OWSContactOffersInteraction class]]); OWSAssert([self.viewItem.interaction isKindOfClass:[OWSContactOffersInteraction class]]);
// [OWSTableItem configureCell:self];
self.backgroundColor = [Theme backgroundColor]; self.backgroundColor = [Theme backgroundColor];
[self configureFonts]; [self configureFonts];

@ -49,6 +49,7 @@ typedef void (^SystemMessageActionBlock)(void);
@property (nonatomic) UILabel *titleLabel; @property (nonatomic) UILabel *titleLabel;
@property (nonatomic) UIButton *button; @property (nonatomic) UIButton *button;
@property (nonatomic) UIStackView *vStackView; @property (nonatomic) UIStackView *vStackView;
@property (nonatomic) UIView *cellBackgroundView;
@property (nonatomic) OWSMessageHeaderView *headerView; @property (nonatomic) OWSMessageHeaderView *headerView;
@property (nonatomic) NSLayoutConstraint *headerViewHeightConstraint; @property (nonatomic) NSLayoutConstraint *headerViewHeightConstraint;
@property (nonatomic) NSArray<NSLayoutConstraint *> *layoutConstraints; @property (nonatomic) NSArray<NSLayoutConstraint *> *layoutConstraints;
@ -114,6 +115,7 @@ typedef void (^SystemMessageActionBlock)(void);
self.vStackView.spacing = self.buttonVSpacing; self.vStackView.spacing = self.buttonVSpacing;
self.vStackView.alignment = UIStackViewAlignmentCenter; self.vStackView.alignment = UIStackViewAlignmentCenter;
self.vStackView.layoutMarginsRelativeArrangement = YES; self.vStackView.layoutMarginsRelativeArrangement = YES;
self.cellBackgroundView = [self.vStackView addBackgroundViewWithBackgroundColor:Theme.backgroundColor];
UIStackView *cellStackView = [[UIStackView alloc] initWithArrangedSubviews:@[ self.headerView, self.vStackView ]]; UIStackView *cellStackView = [[UIStackView alloc] initWithArrangedSubviews:@[ self.headerView, self.vStackView ]];
cellStackView.axis = UILayoutConstraintAxisVertical; cellStackView.axis = UILayoutConstraintAxisVertical;
@ -162,6 +164,8 @@ typedef void (^SystemMessageActionBlock)(void);
OWSAssert(self.viewItem); OWSAssert(self.viewItem);
OWSAssert(transaction); OWSAssert(transaction);
self.cellBackgroundView.backgroundColor = [Theme backgroundColor];
[self.button setBackgroundColor:Theme.conversationButtonBackgroundColor]; [self.button setBackgroundColor:Theme.conversationButtonBackgroundColor];
TSInteraction *interaction = self.viewItem.interaction; TSInteraction *interaction = self.viewItem.interaction;

@ -234,7 +234,6 @@ typedef enum : NSUInteger {
@property (nonatomic) ContactShareViewHelper *contactShareViewHelper; @property (nonatomic) ContactShareViewHelper *contactShareViewHelper;
@property (nonatomic) NSTimer *reloadTimer; @property (nonatomic) NSTimer *reloadTimer;
@property (nonatomic, nullable) NSDate *lastReloadDate; @property (nonatomic, nullable) NSDate *lastReloadDate;
@property (nonatomic) BOOL didChangeTheme;
@end @end
@ -353,10 +352,6 @@ typedef enum : NSUInteger {
selector:@selector(keyboardWillChangeFrame:) selector:@selector(keyboardWillChangeFrame:)
name:UIKeyboardWillChangeFrameNotification name:UIKeyboardWillChangeFrameNotification
object:nil]; object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(themeDidChange:)
name:ThemeDidChangeNotification
object:nil];
} }
- (BOOL)isGroupConversation - (BOOL)isGroupConversation
@ -1185,13 +1180,6 @@ typedef enum : NSUInteger {
[self becomeFirstResponder]; [self becomeFirstResponder];
} }
} }
if (self.didChangeTheme) {
self.didChangeTheme = NO;
[self applyTheme];
[self.collectionView reloadData];
}
} }
// `viewWillDisappear` is called whenever the view *starts* to disappear, // `viewWillDisappear` is called whenever the view *starts* to disappear,
@ -4247,15 +4235,6 @@ typedef enum : NSUInteger {
} }
} }
- (void)themeDidChange:(NSNotification *)notification
{
OWSAssertIsOnMainThread();
[self applyTheme];
[self.collectionView reloadData];
self.didChangeTheme = YES;
}
- (void)applyTheme - (void)applyTheme
{ {
OWSAssertIsOnMainThread(); OWSAssertIsOnMainThread();

@ -214,7 +214,6 @@ class ConversationSearchViewController: UITableViewController {
owsFail("searchResult was unexpectedly nil") owsFail("searchResult was unexpectedly nil")
return UITableViewCell() return UITableViewCell()
} }
OWSTableItem.configureCell(cell)
cell.configure(withThread: searchResult.thread, contactsManager: contactsManager, blockedPhoneNumber: self.blockedPhoneNumberSet) cell.configure(withThread: searchResult.thread, contactsManager: contactsManager, blockedPhoneNumber: self.blockedPhoneNumberSet)
return cell return cell
case .contacts: case .contacts:
@ -227,7 +226,6 @@ class ConversationSearchViewController: UITableViewController {
owsFail("searchResult was unexpectedly nil") owsFail("searchResult was unexpectedly nil")
return UITableViewCell() return UITableViewCell()
} }
OWSTableItem.configureCell(cell)
cell.configure(with: searchResult.signalAccount, contactsManager: contactsManager) cell.configure(with: searchResult.signalAccount, contactsManager: contactsManager)
return cell return cell
case .messages: case .messages:
@ -241,8 +239,6 @@ class ConversationSearchViewController: UITableViewController {
return UITableViewCell() return UITableViewCell()
} }
OWSTableItem.configureCell(cell)
var overrideSnippet = NSAttributedString() var overrideSnippet = NSAttributedString()
var overrideDate: Date? var overrideDate: Date?
if searchResult.messageId != nil { if searchResult.messageId != nil {

@ -194,6 +194,8 @@ NS_ASSUME_NONNULL_BEGIN
OWSAssert(contactsManager); OWSAssert(contactsManager);
OWSAssert(blockedPhoneNumberSet); OWSAssert(blockedPhoneNumberSet);
[OWSTableItem configureCell:self];
self.thread = thread; self.thread = thread;
self.contactsManager = contactsManager; self.contactsManager = contactsManager;

@ -806,7 +806,6 @@ NSString *const kArchivedConversationsReuseIdentifier = @"kArchivedConversations
{ {
HomeViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:HomeViewCell.cellReuseIdentifier]; HomeViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:HomeViewCell.cellReuseIdentifier];
OWSAssert(cell); OWSAssert(cell);
[OWSTableItem configureCell:cell];
ThreadViewModel *thread = [self threadViewModelForIndexPath:indexPath]; ThreadViewModel *thread = [self threadViewModelForIndexPath:indexPath];
[cell configureWithThread:thread [cell configureWithThread:thread

@ -71,6 +71,9 @@ class ContactCell: UITableViewCell {
} }
func configure(contact: Contact, subtitleType: SubtitleCellValue, showsWhenSelected: Bool, contactsManager: OWSContactsManager) { func configure(contact: Contact, subtitleType: SubtitleCellValue, showsWhenSelected: Bool, contactsManager: OWSContactsManager) {
OWSTableItem.configureCell(self)
self.contact = contact self.contact = contact
self.showsWhenSelected = showsWhenSelected self.showsWhenSelected = showsWhenSelected

@ -108,6 +108,7 @@ const CGFloat kOWSTable_DefaultCellHeight = 45.f;
+ (void)configureCell:(UITableViewCell *)cell + (void)configureCell:(UITableViewCell *)cell
{ {
cell.backgroundColor = [Theme backgroundColor]; cell.backgroundColor = [Theme backgroundColor];
cell.contentView.backgroundColor = [Theme backgroundColor];
cell.textLabel.font = [UIFont ows_regularFontWithSize:18.f]; cell.textLabel.font = [UIFont ows_regularFontWithSize:18.f];
cell.textLabel.textColor = [Theme primaryColor]; cell.textLabel.textColor = [Theme primaryColor];

@ -46,7 +46,6 @@ NS_ASSUME_NONNULL_BEGIN
self.preservesSuperviewLayoutMargins = YES; self.preservesSuperviewLayoutMargins = YES;
self.contentView.preservesSuperviewLayoutMargins = YES; self.contentView.preservesSuperviewLayoutMargins = YES;
[OWSTableItem configureCell:self];
self.cellView = [ContactCellView new]; self.cellView = [ContactCellView new];
[self.contentView addSubview:self.cellView]; [self.contentView addSubview:self.cellView];
@ -56,11 +55,13 @@ NS_ASSUME_NONNULL_BEGIN
- (void)configureWithSignalAccount:(SignalAccount *)signalAccount contactsManager:(OWSContactsManager *)contactsManager - (void)configureWithSignalAccount:(SignalAccount *)signalAccount contactsManager:(OWSContactsManager *)contactsManager
{ {
[self.cellView configureWithRecipientId:signalAccount.recipientId contactsManager:contactsManager]; [self configureWithRecipientId:signalAccount.recipientId contactsManager:contactsManager];
} }
- (void)configureWithRecipientId:(NSString *)recipientId contactsManager:(OWSContactsManager *)contactsManager - (void)configureWithRecipientId:(NSString *)recipientId contactsManager:(OWSContactsManager *)contactsManager
{ {
[OWSTableItem configureCell:self];
[self.cellView configureWithRecipientId:recipientId contactsManager:contactsManager]; [self.cellView configureWithRecipientId:recipientId contactsManager:contactsManager];
// Force layout, since imageView isn't being initally rendered on App Store optimized build. // Force layout, since imageView isn't being initally rendered on App Store optimized build.
@ -71,6 +72,8 @@ NS_ASSUME_NONNULL_BEGIN
{ {
OWSAssert(thread); OWSAssert(thread);
[OWSTableItem configureCell:self];
[self.cellView configureWithThread:thread contactsManager:contactsManager]; [self.cellView configureWithThread:thread contactsManager:contactsManager];
// Force layout, since imageView isn't being initally rendered on App Store optimized build. // Force layout, since imageView isn't being initally rendered on App Store optimized build.

@ -143,7 +143,7 @@ CGFloat ScaleFromIPhone5(CGFloat iPhone5Value);
@interface UIStackView (OWS) @interface UIStackView (OWS)
- (void)addBackgroundViewWithBackgroundColor:(UIColor *)backgroundColor; - (UIView *)addBackgroundViewWithBackgroundColor:(UIColor *)backgroundColor;
@end @end

@ -538,12 +538,14 @@ CGFloat ScaleFromIPhone5(CGFloat iPhone5Value)
@implementation UIStackView (OWS) @implementation UIStackView (OWS)
- (void)addBackgroundViewWithBackgroundColor:(UIColor *)backgroundColor - (UIView *)addBackgroundViewWithBackgroundColor:(UIColor *)backgroundColor
{ {
UIView *subview = [UIView new]; UIView *subview = [UIView new];
subview.backgroundColor = backgroundColor; subview.backgroundColor = backgroundColor;
[self addSubview:subview]; [self addSubview:subview];
[subview autoPinEdgesToSuperviewEdges]; [subview autoPinEdgesToSuperviewEdges];
[self sendSubviewToBack:subview];
return subview;
} }
@end @end

Loading…
Cancel
Save