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

View File

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

View File

@ -19,7 +19,7 @@ NS_ASSUME_NONNULL_BEGIN
const CGFloat kRemotelySourcedContentGlyphLength = 16;
const CGFloat kRemotelySourcedContentRowMargin = 4;
const CGFloat kRemotelySourcedContentRowSpacing = 3;
const CGFloat kRemotelySourcedContentRowSpacing = 4;
@interface OWSQuotedMessageView ()
@ -162,7 +162,7 @@ const CGFloat kRemotelySourcedContentRowSpacing = 3;
self.userInteractionEnabled = YES;
self.layoutMargins = UIEdgeInsetsZero;
self.clipsToBounds = YES;
CAShapeLayer *maskLayer = [CAShapeLayer new];
OWSDirectionalRectCorner sharpCorners = self.sharpCorners;
@ -176,7 +176,7 @@ const CGFloat kRemotelySourcedContentRowSpacing = 3;
const CGFloat bubbleTop = 0.f;
const CGFloat bubbleBottom = layerFrame.size.height;
const CGFloat sharpCornerRadius = self.isForPreview ? 4 : 2;
const CGFloat sharpCornerRadius = 2;
const CGFloat wideCornerRadius = self.isForPreview ? 14 : 4;
UIBezierPath *bezierPath = [OWSBubbleView roundedBezierRectWithBubbleTop:bubbleTop
@ -321,22 +321,21 @@ const CGFloat kRemotelySourcedContentRowSpacing = 3;
if (self.isForPreview) {
UIButton *cancelButton = [UIButton buttonWithType:UIButtonTypeCustom];
[cancelButton setImage:[UIImage imageNamed:@"X"] forState:UIControlStateNormal];
cancelButton.contentMode = UIViewContentModeScaleAspectFit;
[cancelButton addTarget:self action:@selector(didTapCancel) forControlEvents:UIControlEventTouchUpInside];
[cancelButton setContentHuggingHorizontalHigh];
[cancelButton setCompressionResistanceHorizontalHigh];
[cancelButton autoSetDimension:ALDimensionWidth toSize:14.f];
[cancelButton autoSetDimension:ALDimensionHeight toSize:14.f];
UIStackView *cancelStack = [[UIStackView alloc] initWithArrangedSubviews:@[ cancelButton ]];
cancelStack.axis = UILayoutConstraintAxisHorizontal;
cancelStack.alignment = UIStackViewAlignmentTop;
cancelStack.layoutMarginsRelativeArrangement = YES;
CGFloat hMarginLeading = 0;
CGFloat hMarginTrailing = 6;
cancelStack.layoutMargins = UIEdgeInsetsMake(6,
CGFloat hMarginLeading = 8;
CGFloat hMarginTrailing = 8;
cancelStack.layoutMargins = UIEdgeInsetsMake(8,
CurrentAppContext().isRTL ? hMarginTrailing : hMarginLeading,
0,
CurrentAppContext().isRTL ? hMarginLeading : hMarginTrailing);
[cancelStack setContentHuggingHorizontalHigh];
[cancelStack setCompressionResistanceHorizontalHigh];
UIStackView *cancelWrapper = [[UIStackView alloc] initWithArrangedSubviews:@[
contentView,
@ -361,7 +360,7 @@ const CGFloat kRemotelySourcedContentRowSpacing = 3;
OWSAssertDebug(CGSizeEqualToSize(
CGSizeMake(kRemotelySourcedContentGlyphLength, kRemotelySourcedContentGlyphLength), glyphImage.size));
UIImageView *glyphView = [[UIImageView alloc] initWithImage:glyphImage];
glyphView.tintColor = UIColor.whiteColor;
glyphView.tintColor = LKColors.text;
[glyphView
autoSetDimensionsToSize:CGSizeMake(kRemotelySourcedContentGlyphLength, kRemotelySourcedContentGlyphLength)];
@ -373,13 +372,13 @@ const CGFloat kRemotelySourcedContentRowSpacing = 3;
sourceRow.spacing = kRemotelySourcedContentRowSpacing;
sourceRow.layoutMarginsRelativeArrangement = YES;
const CGFloat leftMargin = 8;
const CGFloat leftMargin = 4;
sourceRow.layoutMargins = UIEdgeInsetsMake(kRemotelySourcedContentRowMargin,
leftMargin,
kRemotelySourcedContentRowMargin,
kRemotelySourcedContentRowMargin);
UIColor *backgroundColor = [UIColor.whiteColor colorWithAlphaComponent:0.4];
UIColor *backgroundColor = [LKColors.text colorWithAlphaComponent:LKValues.unimportantElementOpacity];
[sourceRow addBackgroundViewWithBackgroundColor:backgroundColor];
return sourceRow;
@ -476,8 +475,8 @@ const CGFloat kRemotelySourcedContentRowSpacing = 3;
{
OWSAssertDebug(self.quoteContentSourceLabel);
self.quoteContentSourceLabel.font = UIFont.ows_dynamicTypeFootnoteFont;
self.quoteContentSourceLabel.textColor = Theme.primaryColor;
self.quoteContentSourceLabel.font = [UIFont systemFontOfSize:LKValues.smallFontSize];
self.quoteContentSourceLabel.textColor = LKColors.text;
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 "
@"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 (self.isOutgoing) {
quotedAuthorText = NSLocalizedString(
@"QUOTED_REPLY_AUTHOR_INDICATOR_YOURSELF", @"message header label when quoting yourself");
quotedAuthorText = NSLocalizedString(@"You", @"");
} else {
quotedAuthorText = NSLocalizedString(
@"QUOTED_REPLY_AUTHOR_INDICATOR_YOU", @"message header label when someone else is quoting you");
quotedAuthorText = NSLocalizedString(@"You", @"");
}
} else {
OWSContactsManager *contactsManager = Environment.shared.contactsManager;

View File

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

View File

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

View File

@ -685,11 +685,10 @@ typedef enum : NSUInteger {
[self updateInputToolbar];
self.loadMoreHeader = [UILabel new];
self.loadMoreHeader.text = NSLocalizedString(@"CONVERSATION_VIEW_LOADING_MORE_MESSAGES",
@"Indicates that the app is loading more messages in this conversation.");
self.loadMoreHeader.textColor = [UIColor ows_materialBlueColor];
self.loadMoreHeader.text = NSLocalizedString(@"CONVERSATION_VIEW_LOADING_MORE_MESSAGES", @"Indicates that the app is loading more messages in this conversation.");
self.loadMoreHeader.textColor = [LKColors.text colorWithAlphaComponent:0.8];
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.loadMoreHeader autoPinWidthToWidthOfView:self.view];
[self.loadMoreHeader autoPinEdgeToSuperviewEdge:ALEdgeTop];
@ -2574,7 +2573,7 @@ typedef enum : NSUInteger {
- (void)createConversationScrollButtons
{
self.scrollDownButton = [[ConversationScrollButton alloc] initWithIconText:@"\uf103"];
self.scrollDownButton = [[ConversationScrollButton alloc] initWithIconText:@"\uf107"];
[self.scrollDownButton addTarget:self
action:@selector(scrollDownButtonTapped)
forControlEvents:UIControlEventTouchUpInside];

View File

@ -1540,7 +1540,9 @@ static const int kYapDatabaseRangeMaxLength = 25000;
// the next message has the same sender avatar and
// no "date break" separates us.
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]);
}
}

View File

@ -1770,7 +1770,7 @@
"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. */
"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. */
"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";
"Enter your seed" = "Enter your seed";
"Message" = "Message";
"You" = "You";

View File

@ -91,8 +91,13 @@ public class ConversationStyle: NSObject {
@objc
public func updateProperties() {
if thread.isGroupThread() {
gutterLeading = 16 + 35 + 24 // Values.mediumSpacing + Values.smallProfilePictureSize + Values.largeSpacing
gutterTrailing = 16
if let thread = thread as? TSGroupThread, thread.isRSSFeed {
gutterLeading = 16
gutterTrailing = 16
} else {
gutterLeading = 16 + 35 + 24 // Values.mediumSpacing + Values.smallProfilePictureSize + Values.largeSpacing
gutterTrailing = 16
}
} else {
gutterLeading = 16
gutterTrailing = 16
@ -103,7 +108,11 @@ public class ConversationStyle: NSObject {
headerGutterTrailing = 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
@ -232,8 +241,7 @@ public class ConversationStyle: NSObject {
@objc
public func quotingSelfHighlightColor() -> UIColor {
// TODO:
return UIColor.init(rgbHex: 0xFF0000)
return UIColor.init(rgbHex: 0xB5B5B5)
}
@objc