This commit is contained in:
Niels Andriesse 2019-12-11 10:25:53 +11:00
parent 5a373d04fa
commit 5ffff3d3b7
9 changed files with 52 additions and 50 deletions

View file

@ -74,12 +74,12 @@ NS_ASSUME_NONNULL_BEGIN
return self; return self;
} }
[self commontInit]; [self commonInit];
return self; return self;
} }
- (void)commontInit - (void)commonInit
{ {
// Ensure only called once. // Ensure only called once.
OWSAssertDebug(!self.bodyTextView); OWSAssertDebug(!self.bodyTextView);
@ -633,7 +633,7 @@ NS_ASSUME_NONNULL_BEGIN
- (CGFloat)quotedReplyTopMargin - (CGFloat)quotedReplyTopMargin
{ {
return 6.f; return 22.f;
} }
- (nullable LinkPreviewSent *)linkPreviewState - (nullable LinkPreviewSent *)linkPreviewState
@ -1153,7 +1153,7 @@ NS_ASSUME_NONNULL_BEGIN
return [NSValue valueWithCGSize:CGSizeCeil(result)]; return [NSValue valueWithCGSize:CGSizeCeil(result)];
} }
- (DisplayableText *)getDisplayableQuotedText - (DisplayableText *_Nullable)getDisplayableQuotedText
{ {
if (!self.viewItem.hasQuotedText) { return nil; } if (!self.viewItem.hasQuotedText) { return nil; }
NSString *rawText = self.viewItem.displayableQuotedText.fullText; NSString *rawText = self.viewItem.displayableQuotedText.fullText;

View file

@ -12,7 +12,7 @@
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
const CGFloat OWSMessageHeaderViewDateHeaderVMargin = 16; const CGFloat OWSMessageHeaderViewDateHeaderVMargin = 16; // Values.mediumSpacing
@interface OWSMessageHeaderView () @interface OWSMessageHeaderView ()
@ -80,8 +80,8 @@ const CGFloat OWSMessageHeaderViewDateHeaderVMargin = 16;
OWSAssertDebug(conversationStyle); OWSAssertDebug(conversationStyle);
OWSAssertDebug(viewItem.unreadIndicator || viewItem.shouldShowDate); OWSAssertDebug(viewItem.unreadIndicator || viewItem.shouldShowDate);
self.titleLabel.textColor = Theme.primaryColor; self.titleLabel.textColor = [LKColors.text colorWithAlphaComponent:0.8];
self.subtitleLabel.textColor = Theme.primaryColor; self.subtitleLabel.textColor = [LKColors.text colorWithAlphaComponent:0.8];
[self configureLabelsWithViewItem:viewItem]; [self configureLabelsWithViewItem:viewItem];

View file

@ -19,7 +19,7 @@ NS_ASSUME_NONNULL_BEGIN
const CGFloat kRemotelySourcedContentGlyphLength = 16; const CGFloat kRemotelySourcedContentGlyphLength = 16;
const CGFloat kRemotelySourcedContentRowMargin = 4; const CGFloat kRemotelySourcedContentRowMargin = 4;
const CGFloat kRemotelySourcedContentRowSpacing = 3; const CGFloat kRemotelySourcedContentRowSpacing = 4;
@interface OWSQuotedMessageView () @interface OWSQuotedMessageView ()
@ -162,7 +162,7 @@ const CGFloat kRemotelySourcedContentRowSpacing = 3;
self.userInteractionEnabled = YES; self.userInteractionEnabled = YES;
self.layoutMargins = UIEdgeInsetsZero; self.layoutMargins = UIEdgeInsetsZero;
self.clipsToBounds = YES; self.clipsToBounds = YES;
CAShapeLayer *maskLayer = [CAShapeLayer new]; CAShapeLayer *maskLayer = [CAShapeLayer new];
OWSDirectionalRectCorner sharpCorners = self.sharpCorners; OWSDirectionalRectCorner sharpCorners = self.sharpCorners;
@ -176,7 +176,7 @@ const CGFloat kRemotelySourcedContentRowSpacing = 3;
const CGFloat bubbleTop = 0.f; const CGFloat bubbleTop = 0.f;
const CGFloat bubbleBottom = layerFrame.size.height; const CGFloat bubbleBottom = layerFrame.size.height;
const CGFloat sharpCornerRadius = self.isForPreview ? 4 : 2; const CGFloat sharpCornerRadius = 2;
const CGFloat wideCornerRadius = self.isForPreview ? 14 : 4; const CGFloat wideCornerRadius = self.isForPreview ? 14 : 4;
UIBezierPath *bezierPath = [OWSBubbleView roundedBezierRectWithBubbleTop:bubbleTop UIBezierPath *bezierPath = [OWSBubbleView roundedBezierRectWithBubbleTop:bubbleTop
@ -321,22 +321,21 @@ const CGFloat kRemotelySourcedContentRowSpacing = 3;
if (self.isForPreview) { if (self.isForPreview) {
UIButton *cancelButton = [UIButton buttonWithType:UIButtonTypeCustom]; UIButton *cancelButton = [UIButton buttonWithType:UIButtonTypeCustom];
[cancelButton setImage:[UIImage imageNamed:@"X"] forState:UIControlStateNormal]; [cancelButton setImage:[UIImage imageNamed:@"X"] forState:UIControlStateNormal];
cancelButton.contentMode = UIViewContentModeScaleAspectFit;
[cancelButton addTarget:self action:@selector(didTapCancel) forControlEvents:UIControlEventTouchUpInside]; [cancelButton addTarget:self action:@selector(didTapCancel) forControlEvents:UIControlEventTouchUpInside];
[cancelButton setContentHuggingHorizontalHigh]; [cancelButton autoSetDimension:ALDimensionWidth toSize:14.f];
[cancelButton setCompressionResistanceHorizontalHigh]; [cancelButton autoSetDimension:ALDimensionHeight toSize:14.f];
UIStackView *cancelStack = [[UIStackView alloc] initWithArrangedSubviews:@[ cancelButton ]]; UIStackView *cancelStack = [[UIStackView alloc] initWithArrangedSubviews:@[ cancelButton ]];
cancelStack.axis = UILayoutConstraintAxisHorizontal; cancelStack.axis = UILayoutConstraintAxisHorizontal;
cancelStack.alignment = UIStackViewAlignmentTop; cancelStack.alignment = UIStackViewAlignmentTop;
cancelStack.layoutMarginsRelativeArrangement = YES; cancelStack.layoutMarginsRelativeArrangement = YES;
CGFloat hMarginLeading = 0; CGFloat hMarginLeading = 8;
CGFloat hMarginTrailing = 6; CGFloat hMarginTrailing = 8;
cancelStack.layoutMargins = UIEdgeInsetsMake(6, cancelStack.layoutMargins = UIEdgeInsetsMake(8,
CurrentAppContext().isRTL ? hMarginTrailing : hMarginLeading, CurrentAppContext().isRTL ? hMarginTrailing : hMarginLeading,
0, 0,
CurrentAppContext().isRTL ? hMarginLeading : hMarginTrailing); CurrentAppContext().isRTL ? hMarginLeading : hMarginTrailing);
[cancelStack setContentHuggingHorizontalHigh];
[cancelStack setCompressionResistanceHorizontalHigh];
UIStackView *cancelWrapper = [[UIStackView alloc] initWithArrangedSubviews:@[ UIStackView *cancelWrapper = [[UIStackView alloc] initWithArrangedSubviews:@[
contentView, contentView,
@ -361,7 +360,7 @@ const CGFloat kRemotelySourcedContentRowSpacing = 3;
OWSAssertDebug(CGSizeEqualToSize( OWSAssertDebug(CGSizeEqualToSize(
CGSizeMake(kRemotelySourcedContentGlyphLength, kRemotelySourcedContentGlyphLength), glyphImage.size)); CGSizeMake(kRemotelySourcedContentGlyphLength, kRemotelySourcedContentGlyphLength), glyphImage.size));
UIImageView *glyphView = [[UIImageView alloc] initWithImage:glyphImage]; UIImageView *glyphView = [[UIImageView alloc] initWithImage:glyphImage];
glyphView.tintColor = UIColor.whiteColor; glyphView.tintColor = LKColors.text;
[glyphView [glyphView
autoSetDimensionsToSize:CGSizeMake(kRemotelySourcedContentGlyphLength, kRemotelySourcedContentGlyphLength)]; autoSetDimensionsToSize:CGSizeMake(kRemotelySourcedContentGlyphLength, kRemotelySourcedContentGlyphLength)];
@ -373,13 +372,13 @@ const CGFloat kRemotelySourcedContentRowSpacing = 3;
sourceRow.spacing = kRemotelySourcedContentRowSpacing; sourceRow.spacing = kRemotelySourcedContentRowSpacing;
sourceRow.layoutMarginsRelativeArrangement = YES; sourceRow.layoutMarginsRelativeArrangement = YES;
const CGFloat leftMargin = 8; const CGFloat leftMargin = 4;
sourceRow.layoutMargins = UIEdgeInsetsMake(kRemotelySourcedContentRowMargin, sourceRow.layoutMargins = UIEdgeInsetsMake(kRemotelySourcedContentRowMargin,
leftMargin, leftMargin,
kRemotelySourcedContentRowMargin, kRemotelySourcedContentRowMargin,
kRemotelySourcedContentRowMargin); kRemotelySourcedContentRowMargin);
UIColor *backgroundColor = [UIColor.whiteColor colorWithAlphaComponent:0.4]; UIColor *backgroundColor = [LKColors.text colorWithAlphaComponent:LKValues.unimportantElementOpacity];
[sourceRow addBackgroundViewWithBackgroundColor:backgroundColor]; [sourceRow addBackgroundViewWithBackgroundColor:backgroundColor];
return sourceRow; return sourceRow;
@ -476,8 +475,8 @@ const CGFloat kRemotelySourcedContentRowSpacing = 3;
{ {
OWSAssertDebug(self.quoteContentSourceLabel); OWSAssertDebug(self.quoteContentSourceLabel);
self.quoteContentSourceLabel.font = UIFont.ows_dynamicTypeFootnoteFont; self.quoteContentSourceLabel.font = [UIFont systemFontOfSize:LKValues.smallFontSize];
self.quoteContentSourceLabel.textColor = Theme.primaryColor; self.quoteContentSourceLabel.textColor = LKColors.text;
self.quoteContentSourceLabel.text = NSLocalizedString(@"QUOTED_REPLY_CONTENT_FROM_REMOTE_SOURCE", self.quoteContentSourceLabel.text = NSLocalizedString(@"QUOTED_REPLY_CONTENT_FROM_REMOTE_SOURCE",
@"Footer label that appears below quoted messages when the quoted content was not derived locally. When the " @"Footer label that appears below quoted messages when the quoted content was not derived locally. When the "
@"local user doesn't have a copy of the message being quoted, e.g. if it had since been deleted, we instead " @"local user doesn't have a copy of the message being quoted, e.g. if it had since been deleted, we instead "
@ -541,11 +540,9 @@ const CGFloat kRemotelySourcedContentRowSpacing = 3;
if ([localNumber isEqualToString:self.quotedMessage.authorId]) { if ([localNumber isEqualToString:self.quotedMessage.authorId]) {
if (self.isOutgoing) { if (self.isOutgoing) {
quotedAuthorText = NSLocalizedString( quotedAuthorText = NSLocalizedString(@"You", @"");
@"QUOTED_REPLY_AUTHOR_INDICATOR_YOURSELF", @"message header label when quoting yourself");
} else { } else {
quotedAuthorText = NSLocalizedString( quotedAuthorText = NSLocalizedString(@"You", @"");
@"QUOTED_REPLY_AUTHOR_INDICATOR_YOU", @"message header label when someone else is quoting you");
} }
} else { } else {
OWSContactsManager *contactsManager = Environment.shared.contactsManager; OWSContactsManager *contactsManager = Environment.shared.contactsManager;

View file

@ -166,6 +166,7 @@ const CGFloat kMaxTextViewHeight = 120;
self.userInteractionEnabled = YES; self.userInteractionEnabled = YES;
_quotedReplyWrapper = [UIView containerView]; _quotedReplyWrapper = [UIView containerView];
self.quotedReplyWrapper.backgroundColor = LKColors.composeViewTextFieldBackground;
self.quotedReplyWrapper.hidden = YES; self.quotedReplyWrapper.hidden = YES;
[self.quotedReplyWrapper setContentHuggingHorizontalLow]; [self.quotedReplyWrapper setContentHuggingHorizontalLow];
[self.quotedReplyWrapper setCompressionResistanceHorizontalLow]; [self.quotedReplyWrapper setCompressionResistanceHorizontalLow];

View file

@ -7,6 +7,7 @@
#import "UIFont+OWS.h" #import "UIFont+OWS.h"
#import "UIView+OWS.h" #import "UIView+OWS.h"
#import <SignalMessaging/Theme.h> #import <SignalMessaging/Theme.h>
#import "Session-Swift.h"
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@ -57,8 +58,8 @@ NS_ASSUME_NONNULL_BEGIN
self.circleView = circleView; self.circleView = circleView;
circleView.userInteractionEnabled = NO; circleView.userInteractionEnabled = NO;
circleView.layer.cornerRadius = circleSize * 0.5f; circleView.layer.cornerRadius = circleSize * 0.5f;
circleView.layer.borderColor = UIColor.whiteColor.CGColor; circleView.layer.borderColor = [LKColors.text colorWithAlphaComponent:LKValues.composeViewTextFieldBorderOpacity].CGColor;
circleView.layer.borderWidth = 1 / UIScreen.mainScreen.scale; circleView.layer.borderWidth = LKValues.composeViewTextFieldBorderThickness;
[circleView autoSetDimension:ALDimensionWidth toSize:circleSize]; [circleView autoSetDimension:ALDimensionWidth toSize:circleSize];
[circleView autoSetDimension:ALDimensionHeight toSize:circleSize]; [circleView autoSetDimension:ALDimensionHeight toSize:circleSize];
@ -79,22 +80,15 @@ NS_ASSUME_NONNULL_BEGIN
- (void)updateColors - (void)updateColors
{ {
UIColor *foregroundColor; UIColor *foregroundColor = LKColors.text;
UIColor *backgroundColor; UIColor *backgroundColor = LKColors.composeViewBackground;
if (self.hasUnreadMessages) {
foregroundColor = UIColor.whiteColor;
backgroundColor = UIColor.ows_materialBlueColor;
} else {
foregroundColor = UIColor.ows_materialBlueColor;
backgroundColor = Theme.scrollButtonBackgroundColor;
}
const CGFloat circleSize = self.class.circleSize; const CGFloat circleSize = self.class.circleSize;
self.circleView.backgroundColor = backgroundColor; self.circleView.backgroundColor = backgroundColor;
self.iconLabel.attributedText = self.iconLabel.attributedText =
[[NSAttributedString alloc] initWithString:self.iconText [[NSAttributedString alloc] initWithString:self.iconText
attributes:@{ attributes:@{
NSFontAttributeName : [UIFont ows_fontAwesomeFont:circleSize * 0.8f], NSFontAttributeName : [UIFont ows_fontAwesomeFont:circleSize * 0.75f],
NSForegroundColorAttributeName : foregroundColor, NSForegroundColorAttributeName : foregroundColor,
NSBaselineOffsetAttributeName : @(-0.5f), NSBaselineOffsetAttributeName : @(-0.5f),
}]; }];

View file

@ -685,11 +685,10 @@ typedef enum : NSUInteger {
[self updateInputToolbar]; [self updateInputToolbar];
self.loadMoreHeader = [UILabel new]; self.loadMoreHeader = [UILabel new];
self.loadMoreHeader.text = NSLocalizedString(@"CONVERSATION_VIEW_LOADING_MORE_MESSAGES", self.loadMoreHeader.text = NSLocalizedString(@"CONVERSATION_VIEW_LOADING_MORE_MESSAGES", @"Indicates that the app is loading more messages in this conversation.");
@"Indicates that the app is loading more messages in this conversation."); self.loadMoreHeader.textColor = [LKColors.text colorWithAlphaComponent:0.8];
self.loadMoreHeader.textColor = [UIColor ows_materialBlueColor];
self.loadMoreHeader.textAlignment = NSTextAlignmentCenter; self.loadMoreHeader.textAlignment = NSTextAlignmentCenter;
self.loadMoreHeader.font = [UIFont ows_mediumFontWithSize:16.f]; self.loadMoreHeader.font = [UIFont boldSystemFontOfSize:LKValues.verySmallFontSize];
[self.collectionView addSubview:self.loadMoreHeader]; [self.collectionView addSubview:self.loadMoreHeader];
[self.loadMoreHeader autoPinWidthToWidthOfView:self.view]; [self.loadMoreHeader autoPinWidthToWidthOfView:self.view];
[self.loadMoreHeader autoPinEdgeToSuperviewEdge:ALEdgeTop]; [self.loadMoreHeader autoPinEdgeToSuperviewEdge:ALEdgeTop];
@ -2574,7 +2573,7 @@ typedef enum : NSUInteger {
- (void)createConversationScrollButtons - (void)createConversationScrollButtons
{ {
self.scrollDownButton = [[ConversationScrollButton alloc] initWithIconText:@"\uf103"]; self.scrollDownButton = [[ConversationScrollButton alloc] initWithIconText:@"\uf107"];
[self.scrollDownButton addTarget:self [self.scrollDownButton addTarget:self
action:@selector(scrollDownButtonTapped) action:@selector(scrollDownButtonTapped)
forControlEvents:UIControlEventTouchUpInside]; forControlEvents:UIControlEventTouchUpInside];

View file

@ -1540,7 +1540,9 @@ static const int kYapDatabaseRangeMaxLength = 25000;
// the next message has the same sender avatar and // the next message has the same sender avatar and
// no "date break" separates us. // no "date break" separates us.
shouldShowSenderAvatar = YES; shouldShowSenderAvatar = YES;
if (previousViewItem && previousViewItem.interaction.interactionType == interactionType) { if (viewItem.isRSSFeed) {
shouldShowSenderAvatar = NO;
} else if (previousViewItem && previousViewItem.interaction.interactionType == interactionType) {
shouldShowSenderAvatar = (![NSObject isNullableObject:previousIncomingSenderId equalTo:incomingSenderId]); shouldShowSenderAvatar = (![NSObject isNullableObject:previousIncomingSenderId equalTo:incomingSenderId]);
} }
} }

View file

@ -1770,7 +1770,7 @@
"QUOTED_REPLY_AUTHOR_INDICATOR_YOURSELF" = "Replying to Yourself"; "QUOTED_REPLY_AUTHOR_INDICATOR_YOURSELF" = "Replying to Yourself";
/* Footer label that appears below quoted messages when the quoted content was not derived locally. When the local user doesn't have a copy of the message being quoted, e.g. if it had since been deleted, we instead show the content specified by the sender. */ /* Footer label that appears below quoted messages when the quoted content was not derived locally. When the local user doesn't have a copy of the message being quoted, e.g. if it had since been deleted, we instead show the content specified by the sender. */
"QUOTED_REPLY_CONTENT_FROM_REMOTE_SOURCE" = "Original message not found."; "QUOTED_REPLY_CONTENT_FROM_REMOTE_SOURCE" = "Original message not found";
/* Toast alert text shown when tapping on a quoted message which we cannot scroll to because the local copy of the message was since deleted. */ /* Toast alert text shown when tapping on a quoted message which we cannot scroll to because the local copy of the message was since deleted. */
"QUOTED_REPLY_ORIGINAL_MESSAGE_DELETED" = "Original message no longer available."; "QUOTED_REPLY_ORIGINAL_MESSAGE_DELETED" = "Original message no longer available.";
@ -2739,3 +2739,4 @@
"Restore your account using your seed" = "Restore your account using your seed"; "Restore your account using your seed" = "Restore your account using your seed";
"Enter your seed" = "Enter your seed"; "Enter your seed" = "Enter your seed";
"Message" = "Message"; "Message" = "Message";
"You" = "You";

View file

@ -91,8 +91,13 @@ public class ConversationStyle: NSObject {
@objc @objc
public func updateProperties() { public func updateProperties() {
if thread.isGroupThread() { if thread.isGroupThread() {
gutterLeading = 16 + 35 + 24 // Values.mediumSpacing + Values.smallProfilePictureSize + Values.largeSpacing if let thread = thread as? TSGroupThread, thread.isRSSFeed {
gutterTrailing = 16 gutterLeading = 16
gutterTrailing = 16
} else {
gutterLeading = 16 + 35 + 24 // Values.mediumSpacing + Values.smallProfilePictureSize + Values.largeSpacing
gutterTrailing = 16
}
} else { } else {
gutterLeading = 16 gutterLeading = 16
gutterTrailing = 16 gutterTrailing = 16
@ -103,7 +108,11 @@ public class ConversationStyle: NSObject {
headerGutterTrailing = 16 headerGutterTrailing = 16
errorGutterTrailing = 16 errorGutterTrailing = 16
maxMessageWidth = floor(contentWidth - 32) if let thread = thread as? TSGroupThread, thread.isRSSFeed {
maxMessageWidth = floor(contentWidth)
} else {
maxMessageWidth = floor(contentWidth - 32)
}
let messageTextFont = UIFont.systemFont(ofSize: 13) // Values.smallFontSize let messageTextFont = UIFont.systemFont(ofSize: 13) // Values.smallFontSize
@ -232,8 +241,7 @@ public class ConversationStyle: NSObject {
@objc @objc
public func quotingSelfHighlightColor() -> UIColor { public func quotingSelfHighlightColor() -> UIColor {
// TODO: return UIColor.init(rgbHex: 0xB5B5B5)
return UIColor.init(rgbHex: 0xFF0000)
} }
@objc @objc