parent
01691b7ade
commit
032ec59d1c
|
@ -92,9 +92,7 @@
|
|||
34D1F0AA1F867BFC0066283D /* JSQMessagesCollectionViewCell+OWS.m in Sources */ = {isa = PBXBuildFile; fileRef = 34D1F0991F867BFC0066283D /* JSQMessagesCollectionViewCell+OWS.m */; };
|
||||
34D1F0AB1F867BFC0066283D /* OWSContactOffersCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 34D1F09B1F867BFC0066283D /* OWSContactOffersCell.m */; };
|
||||
34D1F0AC1F867BFC0066283D /* OWSExpirationTimerView.m in Sources */ = {isa = PBXBuildFile; fileRef = 34D1F09E1F867BFC0066283D /* OWSExpirationTimerView.m */; };
|
||||
34D1F0AD1F867BFC0066283D /* OWSIncomingMessageCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 34D1F0A01F867BFC0066283D /* OWSIncomingMessageCell.m */; };
|
||||
34D1F0AE1F867BFC0066283D /* OWSMessageCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 34D1F0A21F867BFC0066283D /* OWSMessageCell.m */; };
|
||||
34D1F0AF1F867BFC0066283D /* OWSOutgoingMessageCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 34D1F0A41F867BFC0066283D /* OWSOutgoingMessageCell.m */; };
|
||||
34D1F0B01F867BFC0066283D /* OWSSystemMessageCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 34D1F0A61F867BFC0066283D /* OWSSystemMessageCell.m */; };
|
||||
34D1F0B11F867BFC0066283D /* OWSUnreadIndicatorCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 34D1F0A81F867BFC0066283D /* OWSUnreadIndicatorCell.m */; };
|
||||
34D1F0B41F86D31D0066283D /* ConversationCollectionView.m in Sources */ = {isa = PBXBuildFile; fileRef = 34D1F0B31F86D31D0066283D /* ConversationCollectionView.m */; };
|
||||
|
@ -157,7 +155,6 @@
|
|||
452EA09E1EA7ABE00078744B /* AttachmentPointerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 452EA09D1EA7ABE00078744B /* AttachmentPointerView.swift */; };
|
||||
452ECA4D1E087E7200E2F016 /* MessageFetcherJob.swift in Sources */ = {isa = PBXBuildFile; fileRef = 452ECA4C1E087E7200E2F016 /* MessageFetcherJob.swift */; };
|
||||
452ECA4E1E087E7200E2F016 /* MessageFetcherJob.swift in Sources */ = {isa = PBXBuildFile; fileRef = 452ECA4C1E087E7200E2F016 /* MessageFetcherJob.swift */; };
|
||||
4531C9C41DD8E6D800F08304 /* JSQMessagesCollectionViewCell+OWS.m in Sources */ = {isa = PBXBuildFile; fileRef = 4531C9C31DD8E6D800F08304 /* JSQMessagesCollectionViewCell+OWS.m */; };
|
||||
45360B8D1F9521F800FA666C /* Searcher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 45360B8C1F9521F800FA666C /* Searcher.swift */; };
|
||||
45360B8E1F9521F800FA666C /* Searcher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 45360B8C1F9521F800FA666C /* Searcher.swift */; };
|
||||
45360B901F9527DA00FA666C /* SearcherTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 45360B8F1F9527DA00FA666C /* SearcherTest.swift */; };
|
||||
|
@ -551,12 +548,8 @@
|
|||
34D1F09C1F867BFC0066283D /* OWSExpirableMessageView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OWSExpirableMessageView.h; sourceTree = "<group>"; };
|
||||
34D1F09D1F867BFC0066283D /* OWSExpirationTimerView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OWSExpirationTimerView.h; sourceTree = "<group>"; };
|
||||
34D1F09E1F867BFC0066283D /* OWSExpirationTimerView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OWSExpirationTimerView.m; sourceTree = "<group>"; };
|
||||
34D1F09F1F867BFC0066283D /* OWSIncomingMessageCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OWSIncomingMessageCell.h; sourceTree = "<group>"; };
|
||||
34D1F0A01F867BFC0066283D /* OWSIncomingMessageCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OWSIncomingMessageCell.m; sourceTree = "<group>"; };
|
||||
34D1F0A11F867BFC0066283D /* OWSMessageCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OWSMessageCell.h; sourceTree = "<group>"; };
|
||||
34D1F0A21F867BFC0066283D /* OWSMessageCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OWSMessageCell.m; sourceTree = "<group>"; };
|
||||
34D1F0A31F867BFC0066283D /* OWSOutgoingMessageCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OWSOutgoingMessageCell.h; sourceTree = "<group>"; };
|
||||
34D1F0A41F867BFC0066283D /* OWSOutgoingMessageCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OWSOutgoingMessageCell.m; sourceTree = "<group>"; };
|
||||
34D1F0A51F867BFC0066283D /* OWSSystemMessageCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OWSSystemMessageCell.h; sourceTree = "<group>"; };
|
||||
34D1F0A61F867BFC0066283D /* OWSSystemMessageCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OWSSystemMessageCell.m; sourceTree = "<group>"; };
|
||||
34D1F0A71F867BFC0066283D /* OWSUnreadIndicatorCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OWSUnreadIndicatorCell.h; sourceTree = "<group>"; };
|
||||
|
@ -630,8 +623,6 @@
|
|||
452D1EE71DCA90D100A57EC4 /* MesssagesBubblesSizeCalculatorTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = MesssagesBubblesSizeCalculatorTest.swift; path = Models/MesssagesBubblesSizeCalculatorTest.swift; sourceTree = "<group>"; };
|
||||
452EA09D1EA7ABE00078744B /* AttachmentPointerView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AttachmentPointerView.swift; sourceTree = "<group>"; };
|
||||
452ECA4C1E087E7200E2F016 /* MessageFetcherJob.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = MessageFetcherJob.swift; path = Jobs/MessageFetcherJob.swift; sourceTree = "<group>"; };
|
||||
4531C9C21DD8E6D800F08304 /* JSQMessagesCollectionViewCell+OWS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "JSQMessagesCollectionViewCell+OWS.h"; sourceTree = "<group>"; };
|
||||
4531C9C31DD8E6D800F08304 /* JSQMessagesCollectionViewCell+OWS.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "JSQMessagesCollectionViewCell+OWS.m"; sourceTree = "<group>"; };
|
||||
45360B8C1F9521F800FA666C /* Searcher.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Searcher.swift; sourceTree = "<group>"; };
|
||||
45360B8F1F9527DA00FA666C /* SearcherTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearcherTest.swift; sourceTree = "<group>"; };
|
||||
45387B021E36D650005D00B3 /* OWS102MoveLoggingPreferenceToUserDefaults.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OWS102MoveLoggingPreferenceToUserDefaults.h; path = Migrations/OWS102MoveLoggingPreferenceToUserDefaults.h; sourceTree = "<group>"; };
|
||||
|
@ -1165,12 +1156,8 @@
|
|||
34D1F09E1F867BFC0066283D /* OWSExpirationTimerView.m */,
|
||||
34D1F0B51F87F8850066283D /* OWSGenericAttachmentView.h */,
|
||||
34D1F0B61F87F8850066283D /* OWSGenericAttachmentView.m */,
|
||||
34D1F09F1F867BFC0066283D /* OWSIncomingMessageCell.h */,
|
||||
34D1F0A01F867BFC0066283D /* OWSIncomingMessageCell.m */,
|
||||
34D1F0A11F867BFC0066283D /* OWSMessageCell.h */,
|
||||
34D1F0A21F867BFC0066283D /* OWSMessageCell.m */,
|
||||
34D1F0A31F867BFC0066283D /* OWSOutgoingMessageCell.h */,
|
||||
34D1F0A41F867BFC0066283D /* OWSOutgoingMessageCell.m */,
|
||||
34D1F0A51F867BFC0066283D /* OWSSystemMessageCell.h */,
|
||||
34D1F0A61F867BFC0066283D /* OWSSystemMessageCell.m */,
|
||||
34D1F0A71F867BFC0066283D /* OWSUnreadIndicatorCell.h */,
|
||||
|
@ -2294,7 +2281,6 @@
|
|||
4556FA681F54AA9500AF40DD /* DebugUIProfile.swift in Sources */,
|
||||
34DFCB851E8E04B500053165 /* AddToBlockListViewController.m in Sources */,
|
||||
45855F371D9498A40084F340 /* OWSContactAvatarBuilder.m in Sources */,
|
||||
34D1F0AD1F867BFC0066283D /* OWSIncomingMessageCell.m in Sources */,
|
||||
45A6DAD61EBBF85500893231 /* ReminderView.swift in Sources */,
|
||||
45666EC61D99483D008FE134 /* OWSAvatarBuilder.m in Sources */,
|
||||
45E615161E8C590B0018AD52 /* DisplayableTextFilter.swift in Sources */,
|
||||
|
@ -2328,7 +2314,6 @@
|
|||
45F659821E1BE77000444429 /* NonCallKitCallUIAdaptee.swift in Sources */,
|
||||
45AE48511E0732D6004D96C2 /* TurnServerInfo.swift in Sources */,
|
||||
34B3F8771E8DF1700035BE1A /* ContactsPicker.swift in Sources */,
|
||||
34D1F0AF1F867BFC0066283D /* OWSOutgoingMessageCell.m in Sources */,
|
||||
45C0DC1B1E68FE9000E04C47 /* UIApplication+OWS.swift in Sources */,
|
||||
45638BDF1F3DDB2200128435 /* MessageSender+Promise.swift in Sources */,
|
||||
34535D821E256BE9008A4747 /* UIView+OWS.m in Sources */,
|
||||
|
@ -2440,8 +2425,6 @@
|
|||
4504493A1F45EE7D002D1ADA /* NSString+OWS.m in Sources */,
|
||||
45843D201D2236B30013E85A /* OWSContactsSearcher.m in Sources */,
|
||||
45AE48521E0732D6004D96C2 /* TurnServerInfo.swift in Sources */,
|
||||
450873C41D9D5149006B54F2 /* OWSExpirationTimerView.m in Sources */,
|
||||
453D28BB1D332DB100D523F0 /* OWSMessagesBubblesSizeCalculator.m in Sources */,
|
||||
45360B901F9527DA00FA666C /* SearcherTest.swift in Sources */,
|
||||
B660F7561C29988E00687D6E /* PushManager.m in Sources */,
|
||||
45360B911F952AA900FA666C /* MarqueeLabel.swift in Sources */,
|
||||
|
|
|
@ -337,7 +337,7 @@ CGFloat ScaleFromIPhone5(CGFloat iPhone5Value)
|
|||
constraint.active = YES;
|
||||
return constraint;
|
||||
} else {
|
||||
return [self autoPinEdge:ALEdgeTrailing toEdge:ALEdgeLeading ofView:view withOffset:-margin];
|
||||
return [self autoPinEdge:ALEdgeTrailing toEdge:ALEdgeLeading ofView:view withOffset:margin];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
//
|
||||
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
#import "OWSMessageCell.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
// TODO: Remove this class.
|
||||
@interface OWSIncomingMessageCell : OWSMessageCell
|
||||
|
||||
+ (NSString *)cellReuseIdentifier;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
|
@ -1,25 +0,0 @@
|
|||
//
|
||||
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
#import "OWSIncomingMessageCell.h"
|
||||
#import "ConversationViewItem.h"
|
||||
#import <SignalServiceKit/TSIncomingMessage.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@implementation OWSIncomingMessageCell
|
||||
|
||||
+ (NSString *)cellReuseIdentifier
|
||||
{
|
||||
return NSStringFromClass([self class]);
|
||||
}
|
||||
|
||||
- (BOOL)isIncoming
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
|
@ -8,6 +8,8 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
|
||||
@interface OWSMessageCell : ConversationViewCell
|
||||
|
||||
+ (NSString *)cellReuseIdentifier;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
|
|
@ -143,7 +143,6 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
self.dateHeaderLabel.hidden = YES;
|
||||
self.footerLabel.hidden = YES;
|
||||
|
||||
[self.dateHeaderLabel autoPinEdgeToSuperviewEdge:ALEdgeTop];
|
||||
[self.payloadView autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:self.dateHeaderLabel];
|
||||
[self.payloadView autoPinWidthToSuperview];
|
||||
[self.footerView autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:self.payloadView];
|
||||
|
@ -159,6 +158,11 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
[self addGestureRecognizer:longPress];
|
||||
}
|
||||
|
||||
+ (NSString *)cellReuseIdentifier
|
||||
{
|
||||
return NSStringFromClass([self class]);
|
||||
}
|
||||
|
||||
- (OWSMessageCellType)cellType
|
||||
{
|
||||
return self.viewItem.messageCellType;
|
||||
|
@ -196,6 +200,13 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
return self.viewItem.contentSize;
|
||||
}
|
||||
|
||||
- (TSMessage *)message
|
||||
{
|
||||
OWSAssert([self.viewItem.interaction isKindOfClass:[TSMessage class]]);
|
||||
|
||||
return (TSMessage *)self.viewItem.interaction;
|
||||
}
|
||||
|
||||
- (void)loadForDisplay:(int)contentWidth
|
||||
{
|
||||
OWSAssert(self.viewItem);
|
||||
|
@ -304,6 +315,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
[self.dateHeaderLabel autoSetDimension:ALDimensionWidth toSize:contentWidth],
|
||||
(self.isIncoming ? [self.dateHeaderLabel autoPinEdgeToSuperviewEdge:ALEdgeLeading]
|
||||
: [self.dateHeaderLabel autoPinEdgeToSuperviewEdge:ALEdgeTrailing]),
|
||||
[self.dateHeaderLabel autoPinEdgeToSuperviewEdge:ALEdgeTop],
|
||||
[self.dateHeaderLabel autoSetDimension:ALDimensionHeight toSize:self.dateHeaderHeight],
|
||||
];
|
||||
} else {
|
||||
|
@ -318,12 +330,11 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
{
|
||||
BOOL showFooter = NO;
|
||||
|
||||
TSMessage *message = (TSMessage *)self.viewItem.interaction;
|
||||
BOOL hasExpirationTimer = message.shouldStartExpireTimer;
|
||||
BOOL hasExpirationTimer = self.message.shouldStartExpireTimer;
|
||||
|
||||
if (hasExpirationTimer) {
|
||||
showFooter = YES;
|
||||
} else if (!self.isIncoming) {
|
||||
} else if (self.isOutgoing) {
|
||||
showFooter = !self.viewItem.shouldHideRecipientStatus;
|
||||
} else if (self.viewItem.isGroupThread) {
|
||||
showFooter = YES;
|
||||
|
@ -341,10 +352,10 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
OWSAssert(self.viewItem.interaction.interactionType == OWSInteractionType_IncomingMessage
|
||||
|| self.viewItem.interaction.interactionType == OWSInteractionType_OutgoingMessage);
|
||||
|
||||
TSMessage *message = (TSMessage *)self.viewItem.interaction;
|
||||
TSMessage *message = self.message;
|
||||
BOOL hasExpirationTimer = message.shouldStartExpireTimer;
|
||||
NSAttributedString *attributedText = nil;
|
||||
if (!self.isIncoming) {
|
||||
if (self.isOutgoing) {
|
||||
if (!self.viewItem.shouldHideRecipientStatus || hasExpirationTimer) {
|
||||
TSOutgoingMessage *outgoingMessage = (TSOutgoingMessage *)message;
|
||||
NSString *statusMessage =
|
||||
|
@ -364,9 +375,8 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
];
|
||||
return;
|
||||
}
|
||||
|
||||
if (hasExpirationTimer)
|
||||
{
|
||||
|
||||
if (hasExpirationTimer) {
|
||||
uint64_t expirationTimestamp = message.expiresAt;
|
||||
uint32_t expiresInSeconds = message.expiresInSeconds;
|
||||
self.expirationTimerView = [[OWSExpirationTimerView alloc] initWithExpiration:expirationTimestamp
|
||||
|
@ -587,7 +597,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
OWSAssert(attachmentView);
|
||||
OWSAssert(attachmentStateCallback);
|
||||
|
||||
if (!self.isIncoming) {
|
||||
if (self.isOutgoing) {
|
||||
self.attachmentUploadView = [[AttachmentUploadView alloc] initWithAttachment:self.attachmentStream
|
||||
superview:attachmentView
|
||||
attachmentStateCallback:attachmentStateCallback];
|
||||
|
@ -599,7 +609,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
OWSAssert(view);
|
||||
OWSAssert(view.superview == self.payloadView);
|
||||
|
||||
self.payloadView.isOutgoing = !self.isIncoming;
|
||||
self.payloadView.isOutgoing = self.isOutgoing;
|
||||
self.payloadView.maskedSubview = view;
|
||||
[self.payloadView updateMask];
|
||||
}
|
||||
|
@ -715,7 +725,12 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
|
||||
- (BOOL)isIncoming
|
||||
{
|
||||
return YES;
|
||||
return self.viewItem.interaction.interactionType == OWSInteractionType_IncomingMessage;
|
||||
}
|
||||
|
||||
- (BOOL)isOutgoing
|
||||
{
|
||||
return self.viewItem.interaction.interactionType == OWSInteractionType_OutgoingMessage;
|
||||
}
|
||||
|
||||
- (CGFloat)textLeadingMargin
|
||||
|
@ -837,15 +852,16 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
#pragma mark - Notifications
|
||||
|
||||
- (void)setIsCellVisible:(BOOL)isCellVisible {
|
||||
if (self.isCellVisible == isCellVisible) {
|
||||
BOOL didChange = self.isCellVisible != isCellVisible;
|
||||
|
||||
[super setIsCellVisible:isCellVisible];
|
||||
|
||||
if (!didChange) {
|
||||
return;
|
||||
}
|
||||
|
||||
[super setIsCellVisible:isCellVisible];
|
||||
|
||||
|
||||
if (isCellVisible) {
|
||||
TSMessage *message = (TSMessage *)self.viewItem.interaction;
|
||||
if (message.shouldStartExpireTimer) {
|
||||
if (self.message.shouldStartExpireTimer) {
|
||||
[self.expirationTimerView ensureAnimations];
|
||||
} else {
|
||||
[self.expirationTimerView clearAnimations];
|
||||
|
@ -985,7 +1001,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
{
|
||||
OWSAssert([self.viewItem.interaction isKindOfClass:[TSMessage class]]);
|
||||
|
||||
[self.delegate showMetadataViewForMessage:(TSMessage *)self.viewItem.interaction];
|
||||
[self.delegate showMetadataViewForMessage:self.message];
|
||||
}
|
||||
|
||||
- (BOOL)canBecomeFirstResponder
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
//
|
||||
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
#import "OWSMessageCell.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
// TODO: Remove this class.
|
||||
@interface OWSOutgoingMessageCell : OWSMessageCell
|
||||
|
||||
+ (NSString *)cellReuseIdentifier;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
|
@ -1,26 +0,0 @@
|
|||
//
|
||||
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
#import "OWSOutgoingMessageCell.h"
|
||||
#import "ConversationViewItem.h"
|
||||
#import "UIView+OWS.h"
|
||||
#import <SignalServiceKit/TSOutgoingMessage.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@implementation OWSOutgoingMessageCell
|
||||
|
||||
+ (NSString *)cellReuseIdentifier
|
||||
{
|
||||
return NSStringFromClass([self class]);
|
||||
}
|
||||
|
||||
- (BOOL)isIncoming
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
|
@ -28,8 +28,7 @@
|
|||
#import "OWSConversationSettingsViewController.h"
|
||||
#import "OWSConversationSettingsViewDelegate.h"
|
||||
#import "OWSDisappearingMessagesJob.h"
|
||||
#import "OWSIncomingMessageCell.h"
|
||||
#import "OWSOutgoingMessageCell.h"
|
||||
#import "OWSMessageCell.h"
|
||||
#import "OWSSystemMessageCell.h"
|
||||
#import "OWSUnreadIndicatorCell.h"
|
||||
#import "Signal-Swift.h"
|
||||
|
@ -494,10 +493,8 @@ typedef NS_ENUM(NSInteger, MessagesRangeSizeMode) {
|
|||
forCellWithReuseIdentifier:[OWSUnreadIndicatorCell cellReuseIdentifier]];
|
||||
[self.collectionView registerClass:[OWSContactOffersCell class]
|
||||
forCellWithReuseIdentifier:[OWSContactOffersCell cellReuseIdentifier]];
|
||||
[self.collectionView registerClass:[OWSOutgoingMessageCell class]
|
||||
forCellWithReuseIdentifier:[OWSOutgoingMessageCell cellReuseIdentifier]];
|
||||
[self.collectionView registerClass:[OWSIncomingMessageCell class]
|
||||
forCellWithReuseIdentifier:[OWSIncomingMessageCell cellReuseIdentifier]];
|
||||
[self.collectionView registerClass:[OWSMessageCell class]
|
||||
forCellWithReuseIdentifier:[OWSMessageCell cellReuseIdentifier]];
|
||||
}
|
||||
|
||||
- (void)applicationWillEnterForeground:(NSNotification *)notification
|
||||
|
@ -3846,7 +3843,7 @@ typedef NS_ENUM(NSInteger, MessagesRangeSizeMode) {
|
|||
|
||||
ConversationViewItem *_Nullable viewItem = self.viewItemMap[interaction.uniqueId];
|
||||
if (viewItem) {
|
||||
viewItem.lastRow = viewItem.row;
|
||||
viewItem.previousRow = viewItem.row;
|
||||
} else {
|
||||
viewItem = [[ConversationViewItem alloc] initWithTSInteraction:interaction isGroupThread:isGroupThread];
|
||||
}
|
||||
|
@ -3901,8 +3898,8 @@ typedef NS_ENUM(NSInteger, MessagesRangeSizeMode) {
|
|||
// If this is an existing view item and it has changed size,
|
||||
// note that so that we can reload this cell while doing
|
||||
// incremental updates.
|
||||
if (viewItem.shouldShowDate != shouldShowDate && viewItem.lastRow != NSNotFound) {
|
||||
[rowsThatChangedSize addObject:@(viewItem.lastRow)];
|
||||
if (viewItem.shouldShowDate != shouldShowDate && viewItem.previousRow != NSNotFound) {
|
||||
[rowsThatChangedSize addObject:@(viewItem.previousRow)];
|
||||
}
|
||||
viewItem.shouldShowDate = shouldShowDate;
|
||||
|
||||
|
@ -3929,8 +3926,8 @@ typedef NS_ENUM(NSInteger, MessagesRangeSizeMode) {
|
|||
// If this is an existing view item and it has changed size,
|
||||
// note that so that we can reload this cell while doing
|
||||
// incremental updates.
|
||||
if (viewItem.shouldHideRecipientStatus != shouldHideRecipientStatus && viewItem.lastRow != NSNotFound) {
|
||||
[rowsThatChangedSize addObject:@(viewItem.lastRow)];
|
||||
if (viewItem.shouldHideRecipientStatus != shouldHideRecipientStatus && viewItem.previousRow != NSNotFound) {
|
||||
[rowsThatChangedSize addObject:@(viewItem.previousRow)];
|
||||
}
|
||||
viewItem.shouldHideRecipientStatus = shouldHideRecipientStatus;
|
||||
}
|
||||
|
|
|
@ -45,7 +45,9 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType);
|
|||
@property (nonatomic) BOOL shouldHideRecipientStatus;
|
||||
|
||||
@property (nonatomic) NSInteger row;
|
||||
@property (nonatomic) NSInteger lastRow;
|
||||
// During updates, we sometimes need the previous row index
|
||||
// (before this update) of this item.
|
||||
@property (nonatomic) NSInteger previousRow;
|
||||
|
||||
//@property (nonatomic, weak) ConversationViewCell *lastCell;
|
||||
|
||||
|
|
|
@ -5,8 +5,7 @@
|
|||
#import "ConversationViewItem.h"
|
||||
#import "OWSAudioMessageView.h"
|
||||
#import "OWSContactOffersCell.h"
|
||||
#import "OWSIncomingMessageCell.h"
|
||||
#import "OWSOutgoingMessageCell.h"
|
||||
#import "OWSMessageCell.h"
|
||||
#import "OWSSystemMessageCell.h"
|
||||
#import "OWSUnreadIndicatorCell.h"
|
||||
#import "Signal-Swift.h"
|
||||
|
@ -72,7 +71,7 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType)
|
|||
_interaction = interaction;
|
||||
_isGroupThread = isGroupThread;
|
||||
self.row = NSNotFound;
|
||||
self.lastRow = NSNotFound;
|
||||
self.previousRow = NSNotFound;
|
||||
|
||||
return self;
|
||||
}
|
||||
|
@ -176,10 +175,8 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType)
|
|||
OWSFail(@"%@ Unknown interaction type.", self.tag);
|
||||
return nil;
|
||||
case OWSInteractionType_IncomingMessage:
|
||||
measurementCell = [OWSIncomingMessageCell new];
|
||||
break;
|
||||
case OWSInteractionType_OutgoingMessage:
|
||||
measurementCell = [OWSOutgoingMessageCell new];
|
||||
measurementCell = [OWSMessageCell new];
|
||||
break;
|
||||
case OWSInteractionType_Error:
|
||||
case OWSInteractionType_Info:
|
||||
|
@ -214,10 +211,8 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType)
|
|||
OWSFail(@"%@ Unknown interaction type.", self.tag);
|
||||
return nil;
|
||||
case OWSInteractionType_IncomingMessage:
|
||||
return [collectionView dequeueReusableCellWithReuseIdentifier:[OWSIncomingMessageCell cellReuseIdentifier]
|
||||
forIndexPath:indexPath];
|
||||
case OWSInteractionType_OutgoingMessage:
|
||||
return [collectionView dequeueReusableCellWithReuseIdentifier:[OWSOutgoingMessageCell cellReuseIdentifier]
|
||||
return [collectionView dequeueReusableCellWithReuseIdentifier:[OWSMessageCell cellReuseIdentifier]
|
||||
forIndexPath:indexPath];
|
||||
case OWSInteractionType_Error:
|
||||
case OWSInteractionType_Info:
|
||||
|
|
|
@ -71,9 +71,9 @@ class MessageMetadataViewController: OWSViewController {
|
|||
}
|
||||
|
||||
NotificationCenter.default.addObserver(self,
|
||||
selector:#selector(yapDatabaseModified),
|
||||
name:NSNotification.Name.YapDatabaseModified,
|
||||
object:nil)
|
||||
selector: #selector(yapDatabaseModified),
|
||||
name: NSNotification.Name.YapDatabaseModified,
|
||||
object: nil)
|
||||
}
|
||||
|
||||
override func viewWillAppear(_ animated: Bool) {
|
||||
|
@ -96,8 +96,8 @@ class MessageMetadataViewController: OWSViewController {
|
|||
let scrollView = UIScrollView()
|
||||
self.scrollView = scrollView
|
||||
view.addSubview(scrollView)
|
||||
scrollView.autoPinWidthToSuperview(withMargin:0)
|
||||
scrollView.autoPin(toTopLayoutGuideOf: self, withInset:0)
|
||||
scrollView.autoPinWidthToSuperview(withMargin: 0)
|
||||
scrollView.autoPin(toTopLayoutGuideOf: self, withInset: 0)
|
||||
|
||||
// See notes on how to use UIScrollView with iOS Auto Layout:
|
||||
//
|
||||
|
@ -107,8 +107,8 @@ class MessageMetadataViewController: OWSViewController {
|
|||
scrollView.addSubview(contentView)
|
||||
contentView.autoPinLeadingToSuperview()
|
||||
contentView.autoPinTrailingToSuperview()
|
||||
contentView.autoPinEdge(toSuperviewEdge:.top)
|
||||
contentView.autoPinEdge(toSuperviewEdge:.bottom)
|
||||
contentView.autoPinEdge(toSuperviewEdge: .top)
|
||||
contentView.autoPinEdge(toSuperviewEdge: .bottom)
|
||||
scrollView.layoutMargins = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
|
||||
|
||||
let hasAttachment = message.attachmentIds.count > 0
|
||||
|
@ -117,9 +117,9 @@ class MessageMetadataViewController: OWSViewController {
|
|||
let footer = UIToolbar()
|
||||
footer.barTintColor = UIColor.ows_materialBlue()
|
||||
view.addSubview(footer)
|
||||
footer.autoPinWidthToSuperview(withMargin:0)
|
||||
footer.autoPinEdge(.top, to:.bottom, of:scrollView)
|
||||
footer.autoPin(toBottomLayoutGuideOf: self, withInset:0)
|
||||
footer.autoPinWidthToSuperview(withMargin: 0)
|
||||
footer.autoPinEdge(.top, to: .bottom, of: scrollView)
|
||||
footer.autoPin(toBottomLayoutGuideOf: self, withInset: 0)
|
||||
|
||||
footer.items = [
|
||||
UIBarButtonItem(barButtonSystemItem: .flexibleSpace, target: nil, action: nil),
|
||||
|
@ -127,7 +127,7 @@ class MessageMetadataViewController: OWSViewController {
|
|||
UIBarButtonItem(barButtonSystemItem: .flexibleSpace, target: nil, action: nil)
|
||||
]
|
||||
} else {
|
||||
scrollView.autoPin(toBottomLayoutGuideOf: self, withInset:0)
|
||||
scrollView.autoPin(toBottomLayoutGuideOf: self, withInset: 0)
|
||||
}
|
||||
|
||||
updateContent()
|
||||
|
@ -154,10 +154,10 @@ class MessageMetadataViewController: OWSViewController {
|
|||
// Sender?
|
||||
if let incomingMessage = message as? TSIncomingMessage {
|
||||
let senderId = incomingMessage.authorId
|
||||
let senderName = contactsManager.contactOrProfileName(forPhoneIdentifier:senderId)
|
||||
let senderName = contactsManager.contactOrProfileName(forPhoneIdentifier: senderId)
|
||||
rows.append(valueRow(name: NSLocalizedString("MESSAGE_METADATA_VIEW_SENDER",
|
||||
comment: "Label for the 'sender' field of the 'message metadata' view."),
|
||||
value:senderName))
|
||||
value: senderName))
|
||||
}
|
||||
|
||||
// Recipient(s)
|
||||
|
@ -179,13 +179,13 @@ class MessageMetadataViewController: OWSViewController {
|
|||
// TODO: It'd be nice to inset these dividers from the edge of the screen.
|
||||
let addDivider = {
|
||||
let divider = UIView()
|
||||
divider.backgroundColor = UIColor(white:0.9, alpha:1.0)
|
||||
divider.autoSetDimension(.height, toSize:0.5)
|
||||
divider.backgroundColor = UIColor(white: 0.9, alpha: 1.0)
|
||||
divider.autoSetDimension(.height, toSize: 0.5)
|
||||
groupRows.append(divider)
|
||||
}
|
||||
|
||||
for recipientId in thread.recipientIdentifiers {
|
||||
let (recipientStatus, statusMessage) = MessageRecipientStatusUtils.recipientStatusAndStatusMessage(outgoingMessage: outgoingMessage, recipientId: recipientId, referenceView:self.view)
|
||||
let (recipientStatus, statusMessage) = MessageRecipientStatusUtils.recipientStatusAndStatusMessage(outgoingMessage: outgoingMessage, recipientId: recipientId, referenceView: self.view)
|
||||
|
||||
guard recipientStatus == recipientStatusGroup else {
|
||||
continue
|
||||
|
@ -193,8 +193,8 @@ class MessageMetadataViewController: OWSViewController {
|
|||
|
||||
if groupRows.count < 1 {
|
||||
if isGroupThread {
|
||||
groupRows.append(valueRow(name: MessageRecipientStatusName(recipientStatusGroup),
|
||||
value:""))
|
||||
groupRows.append(valueRow(name: string(for: recipientStatusGroup),
|
||||
value: ""))
|
||||
}
|
||||
|
||||
addDivider()
|
||||
|
@ -208,7 +208,7 @@ class MessageMetadataViewController: OWSViewController {
|
|||
statusLabel.font = UIFont.ows_footnote()
|
||||
statusLabel.sizeToFit()
|
||||
cell.accessoryView = statusLabel
|
||||
cell.autoSetDimension(.height, toSize:ContactTableViewCell.rowHeight())
|
||||
cell.autoSetDimension(.height, toSize: ContactTableViewCell.rowHeight())
|
||||
cell.setContentHuggingLow()
|
||||
cell.isUserInteractionEnabled = false
|
||||
groupRows.append(cell)
|
||||
|
@ -218,7 +218,7 @@ class MessageMetadataViewController: OWSViewController {
|
|||
addDivider()
|
||||
|
||||
let spacer = UIView()
|
||||
spacer.autoSetDimension(.height, toSize:10)
|
||||
spacer.autoSetDimension(.height, toSize: 10)
|
||||
groupRows.append(spacer)
|
||||
}
|
||||
|
||||
|
@ -232,12 +232,12 @@ class MessageMetadataViewController: OWSViewController {
|
|||
|
||||
rows.append(valueRow(name: NSLocalizedString("MESSAGE_METADATA_VIEW_SENT_DATE_TIME",
|
||||
comment: "Label for the 'sent date & time' field of the 'message metadata' view."),
|
||||
value:DateUtil.formatPastTimestampRelativeToNow(message.timestamp)))
|
||||
value: DateUtil.formatPastTimestampRelativeToNow(message.timestamp)))
|
||||
|
||||
if message as? TSIncomingMessage != nil {
|
||||
rows.append(valueRow(name: NSLocalizedString("MESSAGE_METADATA_VIEW_RECEIVED_DATE_TIME",
|
||||
comment: "Label for the 'received date & time' field of the 'message metadata' view."),
|
||||
value:DateUtil.formatPastTimestampRelativeToNow(message.timestampForSorting())))
|
||||
value: DateUtil.formatPastTimestampRelativeToNow(message.timestampForSorting())))
|
||||
}
|
||||
|
||||
rows += addAttachmentMetadataRows()
|
||||
|
@ -251,15 +251,15 @@ class MessageMetadataViewController: OWSViewController {
|
|||
row.autoPinTrailingToSuperview()
|
||||
|
||||
if let lastRow = lastRow {
|
||||
row.autoPinEdge(.top, to:.bottom, of:lastRow, withOffset:5)
|
||||
row.autoPinEdge(.top, to: .bottom, of: lastRow, withOffset: 5)
|
||||
} else {
|
||||
row.autoPinEdge(toSuperviewEdge:.top, withInset:20)
|
||||
row.autoPinEdge(toSuperviewEdge: .top, withInset: 20)
|
||||
}
|
||||
|
||||
lastRow = row
|
||||
}
|
||||
if let lastRow = lastRow {
|
||||
lastRow.autoPinEdge(toSuperviewEdge:.bottom, withInset:20)
|
||||
lastRow.autoPinEdge(toSuperviewEdge: .bottom, withInset: 20)
|
||||
}
|
||||
|
||||
if let mediaMessageView = mediaMessageView {
|
||||
|
@ -282,7 +282,7 @@ class MessageMetadataViewController: OWSViewController {
|
|||
|
||||
let bodyLabel = UILabel()
|
||||
bodyLabel.textColor = isIncoming ? UIColor.black : UIColor.white
|
||||
bodyLabel.font = UIFont.ows_regularFont(withSize:16)
|
||||
bodyLabel.font = UIFont.ows_regularFont(withSize: 16)
|
||||
bodyLabel.text = messageBody
|
||||
bodyLabel.numberOfLines = 0
|
||||
bodyLabel.lineBreakMode = .byWordWrapping
|
||||
|
@ -307,7 +307,7 @@ class MessageMetadataViewController: OWSViewController {
|
|||
bodyLabel.setContentHuggingPriority(UILayoutPriorityDefaultLow, for: .horizontal)
|
||||
bodyLabel.setContentHuggingPriority(UILayoutPriorityDefaultHigh, for: .vertical)
|
||||
bodyLabel.setContentCompressionResistancePriority(UILayoutPriorityRequired, for: .vertical)
|
||||
bodyLabel.autoSetDimension(.width, toSize:ScaleFromIPhone5(210), relation:.lessThanOrEqual)
|
||||
bodyLabel.autoSetDimension(.width, toSize: ScaleFromIPhone5(210), relation: .lessThanOrEqual)
|
||||
|
||||
let bubbleSpacer = UIView()
|
||||
|
||||
|
@ -320,13 +320,13 @@ class MessageMetadataViewController: OWSViewController {
|
|||
bubbleSpacer.setContentHuggingLow()
|
||||
|
||||
if isIncoming {
|
||||
bubbleView.autoPinLeadingToSuperview(withMargin:10)
|
||||
bubbleSpacer.autoPinLeading(toTrailingOf:bubbleView)
|
||||
bubbleSpacer.autoPinTrailingToSuperview(withMargin:10)
|
||||
bubbleView.autoPinLeadingToSuperview(withMargin: 10)
|
||||
bubbleSpacer.autoPinLeading(toTrailingOf: bubbleView)
|
||||
bubbleSpacer.autoPinTrailingToSuperview(withMargin: 10)
|
||||
} else {
|
||||
bubbleSpacer.autoPinLeadingToSuperview(withMargin:10)
|
||||
bubbleView.autoPinLeading(toTrailingOf:bubbleSpacer)
|
||||
bubbleView.autoPinTrailingToSuperview(withMargin:10)
|
||||
bubbleSpacer.autoPinLeadingToSuperview(withMargin: 10)
|
||||
bubbleView.autoPinLeading(toTrailingOf: bubbleSpacer)
|
||||
bubbleView.autoPinTrailingToSuperview(withMargin: 10)
|
||||
}
|
||||
|
||||
rows.append(row)
|
||||
|
@ -335,12 +335,12 @@ class MessageMetadataViewController: OWSViewController {
|
|||
owsFail("\(self.TAG) Message has neither attachment nor body.")
|
||||
rows.append(valueRow(name: NSLocalizedString("MESSAGE_METADATA_VIEW_NO_ATTACHMENT_OR_BODY",
|
||||
comment: "Label for messages without a body or attachment in the 'message metadata' view."),
|
||||
value:""))
|
||||
value: ""))
|
||||
}
|
||||
}
|
||||
|
||||
let spacer = UIView()
|
||||
spacer.autoSetDimension(.height, toSize:15)
|
||||
spacer.autoSetDimension(.height, toSize: 15)
|
||||
rows.append(spacer)
|
||||
|
||||
return rows
|
||||
|
@ -354,7 +354,7 @@ class MessageMetadataViewController: OWSViewController {
|
|||
return rows
|
||||
}
|
||||
|
||||
guard let attachment = TSAttachment.fetch(uniqueId:attachmentId) else {
|
||||
guard let attachment = TSAttachment.fetch(uniqueId: attachmentId) else {
|
||||
owsFail("Missing attachment")
|
||||
return rows
|
||||
}
|
||||
|
@ -363,26 +363,26 @@ class MessageMetadataViewController: OWSViewController {
|
|||
guard let attachmentStream = attachment as? TSAttachmentStream else {
|
||||
rows.append(valueRow(name: NSLocalizedString("MESSAGE_METADATA_VIEW_ATTACHMENT_NOT_YET_DOWNLOADED",
|
||||
comment: "Label for 'not yet downloaded' attachments in the 'message metadata' view."),
|
||||
value:""))
|
||||
value: ""))
|
||||
return rows
|
||||
}
|
||||
self.attachmentStream = attachmentStream
|
||||
|
||||
if let filePath = attachmentStream.filePath() {
|
||||
dataSource = DataSourcePath.dataSource(withFilePath:filePath)
|
||||
dataSource = DataSourcePath.dataSource(withFilePath: filePath)
|
||||
}
|
||||
|
||||
guard let dataSource = dataSource else {
|
||||
rows.append(valueRow(name: NSLocalizedString("MESSAGE_METADATA_VIEW_ATTACHMENT_MISSING_FILE",
|
||||
comment: "Label for 'missing' attachments in the 'message metadata' view."),
|
||||
value:""))
|
||||
value: ""))
|
||||
return rows
|
||||
}
|
||||
|
||||
let contentType = attachment.contentType
|
||||
if let dataUTI = MIMETypeUtil.utiType(forMIMEType:contentType) {
|
||||
let attachment = SignalAttachment(dataSource : dataSource, dataUTI: dataUTI)
|
||||
let mediaMessageView = MediaMessageView(attachment:attachment)
|
||||
if let dataUTI = MIMETypeUtil.utiType(forMIMEType: contentType) {
|
||||
let attachment = SignalAttachment(dataSource: dataSource, dataUTI: dataUTI)
|
||||
let mediaMessageView = MediaMessageView(attachment: attachment)
|
||||
self.mediaMessageView = mediaMessageView
|
||||
rows.append(mediaMessageView)
|
||||
}
|
||||
|
@ -396,12 +396,12 @@ class MessageMetadataViewController: OWSViewController {
|
|||
let contentType = attachment.contentType
|
||||
rows.append(valueRow(name: NSLocalizedString("MESSAGE_METADATA_VIEW_ATTACHMENT_MIME_TYPE",
|
||||
comment: "Label for the MIME type of attachments in the 'message metadata' view."),
|
||||
value:contentType))
|
||||
value: contentType))
|
||||
|
||||
if let sourceFilename = attachment.sourceFilename {
|
||||
rows.append(valueRow(name: NSLocalizedString("MESSAGE_METADATA_VIEW_SOURCE_FILENAME",
|
||||
comment: "Label for the original filename of any attachment in the 'message metadata' view."),
|
||||
value:sourceFilename))
|
||||
value: sourceFilename))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -409,7 +409,7 @@ class MessageMetadataViewController: OWSViewController {
|
|||
let fileSize = dataSource.dataLength()
|
||||
rows.append(valueRow(name: NSLocalizedString("MESSAGE_METADATA_VIEW_ATTACHMENT_FILE_SIZE",
|
||||
comment: "Label for file size of attachments in the 'message metadata' view."),
|
||||
value:ViewControllerUtils.formatFileSize(UInt(fileSize))))
|
||||
value: ViewControllerUtils.formatFileSize(UInt(fileSize))))
|
||||
}
|
||||
|
||||
return rows
|
||||
|
@ -418,7 +418,7 @@ class MessageMetadataViewController: OWSViewController {
|
|||
private func nameLabel(text: String) -> UILabel {
|
||||
let label = UILabel()
|
||||
label.textColor = UIColor.black
|
||||
label.font = UIFont.ows_mediumFont(withSize:14)
|
||||
label.font = UIFont.ows_mediumFont(withSize: 14)
|
||||
label.text = text
|
||||
label.setContentHuggingHorizontalHigh()
|
||||
return label
|
||||
|
@ -427,7 +427,7 @@ class MessageMetadataViewController: OWSViewController {
|
|||
private func valueLabel(text: String) -> UILabel {
|
||||
let label = UILabel()
|
||||
label.textColor = UIColor.black
|
||||
label.font = UIFont.ows_regularFont(withSize:14)
|
||||
label.font = UIFont.ows_regularFont(withSize: 14)
|
||||
label.text = text
|
||||
label.setContentHuggingHorizontalLow()
|
||||
return label
|
||||
|
@ -435,28 +435,28 @@ class MessageMetadataViewController: OWSViewController {
|
|||
|
||||
private func valueRow(name: String, value: String, subtitle: String = "") -> UIView {
|
||||
let row = UIView.container()
|
||||
let nameLabel = self.nameLabel(text:name)
|
||||
let valueLabel = self.valueLabel(text:value)
|
||||
let nameLabel = self.nameLabel(text: name)
|
||||
let valueLabel = self.valueLabel(text: value)
|
||||
row.addSubview(nameLabel)
|
||||
row.addSubview(valueLabel)
|
||||
nameLabel.autoPinLeadingToSuperview(withMargin:20)
|
||||
valueLabel.autoPinTrailingToSuperview(withMargin:20)
|
||||
valueLabel.autoPinLeading(toTrailingOf:nameLabel, margin: 10)
|
||||
nameLabel.autoPinEdge(toSuperviewEdge:.top)
|
||||
valueLabel.autoPinEdge(toSuperviewEdge:.top)
|
||||
nameLabel.autoPinLeadingToSuperview(withMargin: 20)
|
||||
valueLabel.autoPinTrailingToSuperview(withMargin: 20)
|
||||
valueLabel.autoPinLeading(toTrailingOf: nameLabel, margin: 10)
|
||||
nameLabel.autoPinEdge(toSuperviewEdge: .top)
|
||||
valueLabel.autoPinEdge(toSuperviewEdge: .top)
|
||||
|
||||
if subtitle.characters.count > 0 {
|
||||
let subtitleLabel = self.valueLabel(text:subtitle)
|
||||
let subtitleLabel = self.valueLabel(text: subtitle)
|
||||
subtitleLabel.textColor = UIColor.ows_darkGray()
|
||||
row.addSubview(subtitleLabel)
|
||||
subtitleLabel.autoPinTrailingToSuperview()
|
||||
subtitleLabel.autoPinLeading(toTrailingOf:nameLabel, margin: 10)
|
||||
subtitleLabel.autoPinEdge(.top, to:.bottom, of:valueLabel, withOffset:1)
|
||||
subtitleLabel.autoPinEdge(toSuperviewEdge:.bottom)
|
||||
subtitleLabel.autoPinLeading(toTrailingOf: nameLabel, margin: 10)
|
||||
subtitleLabel.autoPinEdge(.top, to: .bottom, of: valueLabel, withOffset: 1)
|
||||
subtitleLabel.autoPinEdge(toSuperviewEdge: .bottom)
|
||||
} else if value.characters.count > 0 {
|
||||
valueLabel.autoPinEdge(toSuperviewEdge:.bottom)
|
||||
valueLabel.autoPinEdge(toSuperviewEdge: .bottom)
|
||||
} else {
|
||||
nameLabel.autoPinEdge(toSuperviewEdge:.bottom)
|
||||
nameLabel.autoPinEdge(toSuperviewEdge: .bottom)
|
||||
}
|
||||
|
||||
return row
|
||||
|
@ -474,7 +474,7 @@ class MessageMetadataViewController: OWSViewController {
|
|||
Logger.error("\(TAG) Message has neither attachment nor message body.")
|
||||
return
|
||||
}
|
||||
AttachmentSharing.showShareUI(forAttachment:attachmentStream)
|
||||
AttachmentSharing.showShareUI(forAttachment: attachmentStream)
|
||||
}
|
||||
|
||||
func copyToPasteboard() {
|
||||
|
@ -487,7 +487,7 @@ class MessageMetadataViewController: OWSViewController {
|
|||
Logger.error("\(TAG) Message has neither attachment nor message body.")
|
||||
return
|
||||
}
|
||||
guard let utiType = MIMETypeUtil.utiType(forMIMEType:attachmentStream.contentType) else {
|
||||
guard let utiType = MIMETypeUtil.utiType(forMIMEType: attachmentStream.contentType) else {
|
||||
Logger.error("\(TAG) Attachment has invalid MIME type: \(attachmentStream.contentType).")
|
||||
return
|
||||
}
|
||||
|
@ -496,7 +496,7 @@ class MessageMetadataViewController: OWSViewController {
|
|||
return
|
||||
}
|
||||
let data = dataSource.data()
|
||||
UIPasteboard.general.setData(data, forPasteboardType:utiType)
|
||||
UIPasteboard.general.setData(data, forPasteboardType: utiType)
|
||||
}
|
||||
|
||||
// MARK: - Actions
|
||||
|
@ -507,7 +507,7 @@ class MessageMetadataViewController: OWSViewController {
|
|||
AssertIsOnMainThread()
|
||||
|
||||
self.databaseConnection.read { transaction in
|
||||
guard let newMessage = TSInteraction.fetch(uniqueId:self.message.uniqueId, transaction:transaction) as? TSMessage else {
|
||||
guard let newMessage = TSInteraction.fetch(uniqueId: self.message.uniqueId, transaction: transaction) as? TSMessage else {
|
||||
Logger.error("\(self.TAG) Couldn't reload message.")
|
||||
return
|
||||
}
|
||||
|
@ -520,9 +520,9 @@ class MessageMetadataViewController: OWSViewController {
|
|||
|
||||
let notifications = self.databaseConnection.beginLongLivedReadTransaction()
|
||||
|
||||
guard self.databaseConnection.hasChange(forKey:message.uniqueId,
|
||||
inCollection:TSInteraction.collection(),
|
||||
in:notifications) else {
|
||||
guard self.databaseConnection.hasChange(forKey: message.uniqueId,
|
||||
inCollection: TSInteraction.collection(),
|
||||
in: notifications) else {
|
||||
Logger.debug("\(TAG) No relevant changes.")
|
||||
return
|
||||
}
|
||||
|
@ -532,8 +532,8 @@ class MessageMetadataViewController: OWSViewController {
|
|||
updateContent()
|
||||
}
|
||||
|
||||
private func MessageRecipientStatusName(_ value: MessageRecipientStatus) -> String {
|
||||
switch value {
|
||||
private func string(for messageRecipientStatus: MessageRecipientStatus) -> String {
|
||||
switch messageRecipientStatus {
|
||||
case .uploading:
|
||||
return NSLocalizedString("MESSAGE_METADATA_VIEW_MESSAGE_STATUS_UPLOADING",
|
||||
comment: "Status label for messages which are uploading.")
|
||||
|
|
Loading…
Reference in New Issue