Tweak system messages and unread indicators.

pull/1/head
Matthew Chen 7 years ago
parent 5970db6fdb
commit fa5bfc25e1

@ -55,7 +55,6 @@ NS_ASSUME_NONNULL_BEGIN
[self.imageView setContentHuggingHigh]; [self.imageView setContentHuggingHigh];
self.titleLabel = [UILabel new]; self.titleLabel = [UILabel new];
self.titleLabel.textColor = [UIColor colorWithRGBHex:0x403e3b];
self.titleLabel.numberOfLines = 0; self.titleLabel.numberOfLines = 0;
self.titleLabel.lineBreakMode = NSLineBreakByWordWrapping; self.titleLabel.lineBreakMode = NSLineBreakByWordWrapping;
@ -80,7 +79,7 @@ NS_ASSUME_NONNULL_BEGIN
- (void)configureFonts - (void)configureFonts
{ {
// Update cell to reflect changes in dynamic text. // Update cell to reflect changes in dynamic text.
self.titleLabel.font = UIFont.ows_dynamicTypeFootnoteFont; self.titleLabel.font = UIFont.ows_dynamicTypeSubheadlineFont;
} }
+ (NSString *)cellReuseIdentifier + (NSString *)cellReuseIdentifier
@ -122,14 +121,14 @@ NS_ASSUME_NONNULL_BEGIN
- (UIColor *)textColor - (UIColor *)textColor
{ {
return [UIColor colorWithRGBHex:0x303030]; return [UIColor ows_light60Color];
} }
- (UIColor *)iconColorForInteraction:(TSInteraction *)interaction - (UIColor *)iconColorForInteraction:(TSInteraction *)interaction
{ {
// "Phone", "Shield" and "Hourglass" icons have a lot of "ink" so they // "Phone", "Shield" and "Hourglass" icons have a lot of "ink" so they
// are less dark for balance. // are less dark for balance.
return [UIColor colorWithRGBHex:0x404040]; return [UIColor ows_light60Color];
} }
- (UIImage *)iconForInteraction:(TSInteraction *)interaction - (UIImage *)iconForInteraction:(TSInteraction *)interaction

@ -20,6 +20,7 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic) UILabel *subtitleLabel; @property (nonatomic) UILabel *subtitleLabel;
@property (nonatomic) UIView *strokeView; @property (nonatomic) UIView *strokeView;
@property (nonatomic) NSArray<NSLayoutConstraint *> *layoutConstraints; @property (nonatomic) NSArray<NSLayoutConstraint *> *layoutConstraints;
@property (nonatomic) UIStackView *stackView;
@end @end
@ -45,24 +46,28 @@ NS_ASSUME_NONNULL_BEGIN
self.contentView.layoutMargins = UIEdgeInsetsZero; self.contentView.layoutMargins = UIEdgeInsetsZero;
self.strokeView = [UIView new]; self.strokeView = [UIView new];
// TODO: color. self.strokeView.backgroundColor = [UIColor ows_light60Color];
self.strokeView.backgroundColor = [UIColor blackColor]; [self.strokeView autoSetDimension:ALDimensionHeight toSize:self.strokeHeight];
[self.contentView addSubview:self.strokeView]; [self.strokeView setContentHuggingHigh];
self.titleLabel = [UILabel new]; self.titleLabel = [UILabel new];
// TODO: color. self.titleLabel.textColor = [UIColor ows_light90Color];
self.titleLabel.textColor = [UIColor blackColor];
self.titleLabel.textAlignment = NSTextAlignmentCenter; self.titleLabel.textAlignment = NSTextAlignmentCenter;
[self.contentView addSubview:self.titleLabel];
self.subtitleLabel = [UILabel new]; self.subtitleLabel = [UILabel new];
// TODO: color. self.subtitleLabel.textColor = [UIColor ows_light90Color];
self.subtitleLabel.textColor = [UIColor lightGrayColor];
// The subtitle may wrap to a second line. // The subtitle may wrap to a second line.
self.subtitleLabel.numberOfLines = 0; self.subtitleLabel.numberOfLines = 0;
self.subtitleLabel.lineBreakMode = NSLineBreakByWordWrapping; self.subtitleLabel.lineBreakMode = NSLineBreakByWordWrapping;
self.subtitleLabel.textAlignment = NSTextAlignmentCenter; self.subtitleLabel.textAlignment = NSTextAlignmentCenter;
[self.contentView addSubview:self.subtitleLabel];
self.stackView = [[UIStackView alloc] initWithArrangedSubviews:@[
self.strokeView,
self.titleLabel,
self.subtitleLabel,
]];
self.stackView.axis = NSTextLayoutOrientationVertical;
[self.contentView addSubview:self.stackView];
[self configureFonts]; [self configureFonts];
} }
@ -70,8 +75,6 @@ NS_ASSUME_NONNULL_BEGIN
- (void)configureFonts - (void)configureFonts
{ {
// Update cell to reflect changes in dynamic text. // Update cell to reflect changes in dynamic text.
//
// TODO: Font size.
self.titleLabel.font = UIFont.ows_dynamicTypeCaption1Font.ows_mediumWeight; self.titleLabel.font = UIFont.ows_dynamicTypeCaption1Font.ows_mediumWeight;
self.subtitleLabel.font = UIFont.ows_dynamicTypeCaption1Font; self.subtitleLabel.font = UIFont.ows_dynamicTypeCaption1Font;
} }
@ -94,26 +97,14 @@ NS_ASSUME_NONNULL_BEGIN
self.titleLabel.text = [self titleForInteraction:interaction]; self.titleLabel.text = [self titleForInteraction:interaction];
self.subtitleLabel.text = [self subtitleForInteraction:interaction]; self.subtitleLabel.text = [self subtitleForInteraction:interaction];
self.backgroundColor = [UIColor whiteColor]; self.subtitleLabel.hidden = self.subtitleLabel.text.length < 1;
[NSLayoutConstraint deactivateConstraints:self.layoutConstraints]; [NSLayoutConstraint deactivateConstraints:self.layoutConstraints];
self.layoutConstraints = @[ self.layoutConstraints = @[
[self.strokeView autoPinEdgeToSuperviewEdge:ALEdgeTop], [self.stackView autoPinEdgeToSuperviewEdge:ALEdgeTop],
[self.strokeView autoPinLeadingToSuperviewMarginWithInset:self.conversationStyle.fullWidthGutterLeading], [self.stackView autoPinEdgeToSuperviewEdge:ALEdgeBottom],
[self.strokeView autoPinTrailingToSuperviewMarginWithInset:self.conversationStyle.fullWidthGutterTrailing], [self.stackView autoPinLeadingToSuperviewMarginWithInset:self.conversationStyle.fullWidthGutterLeading],
[self.strokeView autoSetDimension:ALDimensionHeight toSize:self.strokeHeight], [self.stackView autoPinTrailingToSuperviewMarginWithInset:self.conversationStyle.fullWidthGutterTrailing],
[self.titleLabel autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:self.strokeView],
[self.titleLabel autoPinEdgeToSuperviewEdge:ALEdgeTop],
[self.titleLabel autoPinLeadingToSuperviewMarginWithInset:self.conversationStyle.fullWidthGutterLeading],
[self.titleLabel autoPinTrailingToSuperviewMarginWithInset:self.conversationStyle.fullWidthGutterTrailing],
[self.subtitleLabel autoPinEdge:ALEdgeTop
toEdge:ALEdgeBottom
ofView:self.titleLabel
withOffset:self.subtitleVSpacing],
[self.subtitleLabel autoPinLeadingToSuperviewMarginWithInset:self.conversationStyle.fullWidthGutterLeading],
[self.subtitleLabel autoPinTrailingToSuperviewMarginWithInset:self.conversationStyle.fullWidthGutterTrailing],
]; ];
} }
@ -140,11 +131,6 @@ NS_ASSUME_NONNULL_BEGIN
return 1.f; return 1.f;
} }
- (CGFloat)subtitleVSpacing
{
return 3.f;
}
- (CGSize)cellSizeWithTransaction:(YapDatabaseReadTransaction *)transaction - (CGSize)cellSizeWithTransaction:(YapDatabaseReadTransaction *)transaction
{ {
OWSAssert(self.conversationStyle); OWSAssert(self.conversationStyle);
@ -159,7 +145,6 @@ NS_ASSUME_NONNULL_BEGIN
TSUnreadIndicatorInteraction *interaction = (TSUnreadIndicatorInteraction *)self.viewItem.interaction; TSUnreadIndicatorInteraction *interaction = (TSUnreadIndicatorInteraction *)self.viewItem.interaction;
self.subtitleLabel.text = [self subtitleForInteraction:interaction]; self.subtitleLabel.text = [self subtitleForInteraction:interaction];
if (self.subtitleLabel.text.length > 0) { if (self.subtitleLabel.text.length > 0) {
result.height += self.subtitleVSpacing;
result.height += ceil( result.height += ceil(
[self.subtitleLabel sizeThatFits:CGSizeMake(self.conversationStyle.fullWidthContentWidth, CGFLOAT_MAX)] [self.subtitleLabel sizeThatFits:CGSizeMake(self.conversationStyle.fullWidthContentWidth, CGFLOAT_MAX)]
.height); .height);

Loading…
Cancel
Save