diff --git a/Signal/src/ViewControllers/ContactsPicker.swift b/Signal/src/ViewControllers/ContactsPicker.swift index cc262db46..3fd7f68ca 100644 --- a/Signal/src/ViewControllers/ContactsPicker.swift +++ b/Signal/src/ViewControllers/ContactsPicker.swift @@ -236,7 +236,6 @@ public class ContactsPicker: OWSViewController, UITableViewDelegate, UITableView owsFail("\(logTag) in \(#function) cell had unexpected type") return UITableViewCell() } - OWSTableItem.configureCell(cell) let dataSource = filteredSections let cnContact = dataSource[indexPath.section][indexPath.row] diff --git a/Signal/src/ViewControllers/ConversationView/Cells/OWSContactOffersCell.m b/Signal/src/ViewControllers/ConversationView/Cells/OWSContactOffersCell.m index 10bff29a3..f66679fe8 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/OWSContactOffersCell.m +++ b/Signal/src/ViewControllers/ConversationView/Cells/OWSContactOffersCell.m @@ -115,7 +115,6 @@ NS_ASSUME_NONNULL_BEGIN OWSAssert(self.viewItem); OWSAssert([self.viewItem.interaction isKindOfClass:[OWSContactOffersInteraction class]]); - // [OWSTableItem configureCell:self]; self.backgroundColor = [Theme backgroundColor]; [self configureFonts]; diff --git a/Signal/src/ViewControllers/ConversationView/Cells/OWSSystemMessageCell.m b/Signal/src/ViewControllers/ConversationView/Cells/OWSSystemMessageCell.m index cb79b795c..92b7d3cfd 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/OWSSystemMessageCell.m +++ b/Signal/src/ViewControllers/ConversationView/Cells/OWSSystemMessageCell.m @@ -49,6 +49,7 @@ typedef void (^SystemMessageActionBlock)(void); @property (nonatomic) UILabel *titleLabel; @property (nonatomic) UIButton *button; @property (nonatomic) UIStackView *vStackView; +@property (nonatomic) UIView *cellBackgroundView; @property (nonatomic) OWSMessageHeaderView *headerView; @property (nonatomic) NSLayoutConstraint *headerViewHeightConstraint; @property (nonatomic) NSArray *layoutConstraints; @@ -114,6 +115,7 @@ typedef void (^SystemMessageActionBlock)(void); self.vStackView.spacing = self.buttonVSpacing; self.vStackView.alignment = UIStackViewAlignmentCenter; self.vStackView.layoutMarginsRelativeArrangement = YES; + self.cellBackgroundView = [self.vStackView addBackgroundViewWithBackgroundColor:Theme.backgroundColor]; UIStackView *cellStackView = [[UIStackView alloc] initWithArrangedSubviews:@[ self.headerView, self.vStackView ]]; cellStackView.axis = UILayoutConstraintAxisVertical; @@ -162,6 +164,8 @@ typedef void (^SystemMessageActionBlock)(void); OWSAssert(self.viewItem); OWSAssert(transaction); + self.cellBackgroundView.backgroundColor = [Theme backgroundColor]; + [self.button setBackgroundColor:Theme.conversationButtonBackgroundColor]; TSInteraction *interaction = self.viewItem.interaction; diff --git a/Signal/src/ViewControllers/ConversationView/ConversationViewController.m b/Signal/src/ViewControllers/ConversationView/ConversationViewController.m index 95190f62b..f31cba94f 100644 --- a/Signal/src/ViewControllers/ConversationView/ConversationViewController.m +++ b/Signal/src/ViewControllers/ConversationView/ConversationViewController.m @@ -234,7 +234,6 @@ typedef enum : NSUInteger { @property (nonatomic) ContactShareViewHelper *contactShareViewHelper; @property (nonatomic) NSTimer *reloadTimer; @property (nonatomic, nullable) NSDate *lastReloadDate; -@property (nonatomic) BOOL didChangeTheme; @end @@ -353,10 +352,6 @@ typedef enum : NSUInteger { selector:@selector(keyboardWillChangeFrame:) name:UIKeyboardWillChangeFrameNotification object:nil]; - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(themeDidChange:) - name:ThemeDidChangeNotification - object:nil]; } - (BOOL)isGroupConversation @@ -1185,13 +1180,6 @@ typedef enum : NSUInteger { [self becomeFirstResponder]; } } - - if (self.didChangeTheme) { - self.didChangeTheme = NO; - - [self applyTheme]; - [self.collectionView reloadData]; - } } // `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 { OWSAssertIsOnMainThread(); diff --git a/Signal/src/ViewControllers/HomeView/ConversationSearchViewController.swift b/Signal/src/ViewControllers/HomeView/ConversationSearchViewController.swift index 525114c76..1c24fe4a5 100644 --- a/Signal/src/ViewControllers/HomeView/ConversationSearchViewController.swift +++ b/Signal/src/ViewControllers/HomeView/ConversationSearchViewController.swift @@ -214,7 +214,6 @@ class ConversationSearchViewController: UITableViewController { owsFail("searchResult was unexpectedly nil") return UITableViewCell() } - OWSTableItem.configureCell(cell) cell.configure(withThread: searchResult.thread, contactsManager: contactsManager, blockedPhoneNumber: self.blockedPhoneNumberSet) return cell case .contacts: @@ -227,7 +226,6 @@ class ConversationSearchViewController: UITableViewController { owsFail("searchResult was unexpectedly nil") return UITableViewCell() } - OWSTableItem.configureCell(cell) cell.configure(with: searchResult.signalAccount, contactsManager: contactsManager) return cell case .messages: @@ -241,8 +239,6 @@ class ConversationSearchViewController: UITableViewController { return UITableViewCell() } - OWSTableItem.configureCell(cell) - var overrideSnippet = NSAttributedString() var overrideDate: Date? if searchResult.messageId != nil { diff --git a/Signal/src/ViewControllers/HomeView/HomeViewCell.m b/Signal/src/ViewControllers/HomeView/HomeViewCell.m index 0b1abe0e6..f19b85795 100644 --- a/Signal/src/ViewControllers/HomeView/HomeViewCell.m +++ b/Signal/src/ViewControllers/HomeView/HomeViewCell.m @@ -194,6 +194,8 @@ NS_ASSUME_NONNULL_BEGIN OWSAssert(contactsManager); OWSAssert(blockedPhoneNumberSet); + [OWSTableItem configureCell:self]; + self.thread = thread; self.contactsManager = contactsManager; diff --git a/Signal/src/ViewControllers/HomeView/HomeViewController.m b/Signal/src/ViewControllers/HomeView/HomeViewController.m index f5fe3d0bf..0c0c92c6c 100644 --- a/Signal/src/ViewControllers/HomeView/HomeViewController.m +++ b/Signal/src/ViewControllers/HomeView/HomeViewController.m @@ -806,7 +806,6 @@ NSString *const kArchivedConversationsReuseIdentifier = @"kArchivedConversations { HomeViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:HomeViewCell.cellReuseIdentifier]; OWSAssert(cell); - [OWSTableItem configureCell:cell]; ThreadViewModel *thread = [self threadViewModelForIndexPath:indexPath]; [cell configureWithThread:thread diff --git a/Signal/src/views/ContactCell.swift b/Signal/src/views/ContactCell.swift index 3de569d79..b2956dc55 100644 --- a/Signal/src/views/ContactCell.swift +++ b/Signal/src/views/ContactCell.swift @@ -71,6 +71,9 @@ class ContactCell: UITableViewCell { } func configure(contact: Contact, subtitleType: SubtitleCellValue, showsWhenSelected: Bool, contactsManager: OWSContactsManager) { + + OWSTableItem.configureCell(self) + self.contact = contact self.showsWhenSelected = showsWhenSelected diff --git a/SignalMessaging/ViewControllers/OWSTableViewController.m b/SignalMessaging/ViewControllers/OWSTableViewController.m index 2024bc9d0..890a23930 100644 --- a/SignalMessaging/ViewControllers/OWSTableViewController.m +++ b/SignalMessaging/ViewControllers/OWSTableViewController.m @@ -108,6 +108,7 @@ const CGFloat kOWSTable_DefaultCellHeight = 45.f; + (void)configureCell:(UITableViewCell *)cell { cell.backgroundColor = [Theme backgroundColor]; + cell.contentView.backgroundColor = [Theme backgroundColor]; cell.textLabel.font = [UIFont ows_regularFontWithSize:18.f]; cell.textLabel.textColor = [Theme primaryColor]; diff --git a/SignalMessaging/Views/ContactTableViewCell.m b/SignalMessaging/Views/ContactTableViewCell.m index 606b854d6..64d407f39 100644 --- a/SignalMessaging/Views/ContactTableViewCell.m +++ b/SignalMessaging/Views/ContactTableViewCell.m @@ -46,7 +46,6 @@ NS_ASSUME_NONNULL_BEGIN self.preservesSuperviewLayoutMargins = YES; self.contentView.preservesSuperviewLayoutMargins = YES; - [OWSTableItem configureCell:self]; self.cellView = [ContactCellView new]; [self.contentView addSubview:self.cellView]; @@ -56,11 +55,13 @@ NS_ASSUME_NONNULL_BEGIN - (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 { + [OWSTableItem configureCell:self]; + [self.cellView configureWithRecipientId:recipientId contactsManager:contactsManager]; // Force layout, since imageView isn't being initally rendered on App Store optimized build. @@ -71,6 +72,8 @@ NS_ASSUME_NONNULL_BEGIN { OWSAssert(thread); + [OWSTableItem configureCell:self]; + [self.cellView configureWithThread:thread contactsManager:contactsManager]; // Force layout, since imageView isn't being initally rendered on App Store optimized build. diff --git a/SignalMessaging/categories/UIView+OWS.h b/SignalMessaging/categories/UIView+OWS.h index e661f64ea..729656459 100644 --- a/SignalMessaging/categories/UIView+OWS.h +++ b/SignalMessaging/categories/UIView+OWS.h @@ -143,7 +143,7 @@ CGFloat ScaleFromIPhone5(CGFloat iPhone5Value); @interface UIStackView (OWS) -- (void)addBackgroundViewWithBackgroundColor:(UIColor *)backgroundColor; +- (UIView *)addBackgroundViewWithBackgroundColor:(UIColor *)backgroundColor; @end diff --git a/SignalMessaging/categories/UIView+OWS.m b/SignalMessaging/categories/UIView+OWS.m index 0041884f7..aff3b6760 100644 --- a/SignalMessaging/categories/UIView+OWS.m +++ b/SignalMessaging/categories/UIView+OWS.m @@ -538,12 +538,14 @@ CGFloat ScaleFromIPhone5(CGFloat iPhone5Value) @implementation UIStackView (OWS) -- (void)addBackgroundViewWithBackgroundColor:(UIColor *)backgroundColor +- (UIView *)addBackgroundViewWithBackgroundColor:(UIColor *)backgroundColor { UIView *subview = [UIView new]; subview.backgroundColor = backgroundColor; [self addSubview:subview]; [subview autoPinEdgesToSuperviewEdges]; + [self sendSubviewToBack:subview]; + return subview; } @end