mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
Rename to ConversationStyle.
This commit is contained in:
parent
661272750b
commit
33b1628c26
|
@ -224,7 +224,7 @@
|
||||||
34D8C0271ED3673300188D7C /* DebugUIMessages.m in Sources */ = {isa = PBXBuildFile; fileRef = 34D8C0241ED3673300188D7C /* DebugUIMessages.m */; };
|
34D8C0271ED3673300188D7C /* DebugUIMessages.m in Sources */ = {isa = PBXBuildFile; fileRef = 34D8C0241ED3673300188D7C /* DebugUIMessages.m */; };
|
||||||
34D8C0281ED3673300188D7C /* DebugUITableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 34D8C0261ED3673300188D7C /* DebugUITableViewController.m */; };
|
34D8C0281ED3673300188D7C /* DebugUITableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 34D8C0261ED3673300188D7C /* DebugUITableViewController.m */; };
|
||||||
34D8C02B1ED3685800188D7C /* DebugUIContacts.m in Sources */ = {isa = PBXBuildFile; fileRef = 34D8C02A1ED3685800188D7C /* DebugUIContacts.m */; };
|
34D8C02B1ED3685800188D7C /* DebugUIContacts.m in Sources */ = {isa = PBXBuildFile; fileRef = 34D8C02A1ED3685800188D7C /* DebugUIContacts.m */; };
|
||||||
34D920E220DD39EA00D51158 /* ConversationLayoutInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34D920E120DD39E900D51158 /* ConversationLayoutInfo.swift */; };
|
34D920E220DD39EA00D51158 /* ConversationStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34D920E120DD39E900D51158 /* ConversationStyle.swift */; };
|
||||||
34D99C931F2937CC00D284D6 /* OWSAnalytics.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34D99C911F2937CC00D284D6 /* OWSAnalytics.swift */; };
|
34D99C931F2937CC00D284D6 /* OWSAnalytics.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34D99C911F2937CC00D284D6 /* OWSAnalytics.swift */; };
|
||||||
34DB0BED2011548B007B313F /* OWSDatabaseConverterTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 34DB0BEC2011548B007B313F /* OWSDatabaseConverterTest.m */; };
|
34DB0BED2011548B007B313F /* OWSDatabaseConverterTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 34DB0BEC2011548B007B313F /* OWSDatabaseConverterTest.m */; };
|
||||||
34DBF003206BD5A500025978 /* OWSMessageTextView.m in Sources */ = {isa = PBXBuildFile; fileRef = 34DBEFFF206BD5A400025978 /* OWSMessageTextView.m */; };
|
34DBF003206BD5A500025978 /* OWSMessageTextView.m in Sources */ = {isa = PBXBuildFile; fileRef = 34DBEFFF206BD5A400025978 /* OWSMessageTextView.m */; };
|
||||||
|
@ -882,7 +882,7 @@
|
||||||
34D8C0291ED3685800188D7C /* DebugUIContacts.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DebugUIContacts.h; sourceTree = "<group>"; };
|
34D8C0291ED3685800188D7C /* DebugUIContacts.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DebugUIContacts.h; sourceTree = "<group>"; };
|
||||||
34D8C02A1ED3685800188D7C /* DebugUIContacts.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DebugUIContacts.m; sourceTree = "<group>"; };
|
34D8C02A1ED3685800188D7C /* DebugUIContacts.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DebugUIContacts.m; sourceTree = "<group>"; };
|
||||||
34D913491F62D4A500722898 /* SignalAttachment.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SignalAttachment.swift; sourceTree = "<group>"; };
|
34D913491F62D4A500722898 /* SignalAttachment.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SignalAttachment.swift; sourceTree = "<group>"; };
|
||||||
34D920E120DD39E900D51158 /* ConversationLayoutInfo.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConversationLayoutInfo.swift; sourceTree = "<group>"; };
|
34D920E120DD39E900D51158 /* ConversationStyle.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConversationStyle.swift; sourceTree = "<group>"; };
|
||||||
34D99C8A1F27B13B00D284D6 /* OWSViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OWSViewController.h; sourceTree = "<group>"; };
|
34D99C8A1F27B13B00D284D6 /* OWSViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OWSViewController.h; sourceTree = "<group>"; };
|
||||||
34D99C8B1F27B13B00D284D6 /* OWSViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OWSViewController.m; sourceTree = "<group>"; };
|
34D99C8B1F27B13B00D284D6 /* OWSViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OWSViewController.m; sourceTree = "<group>"; };
|
||||||
34D99C911F2937CC00D284D6 /* OWSAnalytics.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OWSAnalytics.swift; sourceTree = "<group>"; };
|
34D99C911F2937CC00D284D6 /* OWSAnalytics.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OWSAnalytics.swift; sourceTree = "<group>"; };
|
||||||
|
@ -1503,9 +1503,9 @@
|
||||||
34D1F0681F8678AA0066283D /* ConversationInputTextView.m */,
|
34D1F0681F8678AA0066283D /* ConversationInputTextView.m */,
|
||||||
34D1F0691F8678AA0066283D /* ConversationInputToolbar.h */,
|
34D1F0691F8678AA0066283D /* ConversationInputToolbar.h */,
|
||||||
34D1F06A1F8678AA0066283D /* ConversationInputToolbar.m */,
|
34D1F06A1F8678AA0066283D /* ConversationInputToolbar.m */,
|
||||||
34D920E120DD39E900D51158 /* ConversationLayoutInfo.swift */,
|
|
||||||
343A65971FC4CFE7000477A1 /* ConversationScrollButton.h */,
|
343A65971FC4CFE7000477A1 /* ConversationScrollButton.h */,
|
||||||
343A65961FC4CFE6000477A1 /* ConversationScrollButton.m */,
|
343A65961FC4CFE6000477A1 /* ConversationScrollButton.m */,
|
||||||
|
34D920E120DD39E900D51158 /* ConversationStyle.swift */,
|
||||||
34D1F06D1F8678AA0066283D /* ConversationViewController.h */,
|
34D1F06D1F8678AA0066283D /* ConversationViewController.h */,
|
||||||
34D1F06E1F8678AA0066283D /* ConversationViewController.m */,
|
34D1F06E1F8678AA0066283D /* ConversationViewController.m */,
|
||||||
34D1F06F1F8678AA0066283D /* ConversationViewItem.h */,
|
34D1F06F1F8678AA0066283D /* ConversationViewItem.h */,
|
||||||
|
@ -3313,7 +3313,7 @@
|
||||||
34D1F0C01F8EC1760066283D /* MessageRecipientStatusUtils.swift in Sources */,
|
34D1F0C01F8EC1760066283D /* MessageRecipientStatusUtils.swift in Sources */,
|
||||||
45F659731E1BD99C00444429 /* CallKitCallUIAdaptee.swift in Sources */,
|
45F659731E1BD99C00444429 /* CallKitCallUIAdaptee.swift in Sources */,
|
||||||
34277A5E20751BDC006049F2 /* OWSQuotedMessageView.m in Sources */,
|
34277A5E20751BDC006049F2 /* OWSQuotedMessageView.m in Sources */,
|
||||||
34D920E220DD39EA00D51158 /* ConversationLayoutInfo.swift in Sources */,
|
34D920E220DD39EA00D51158 /* ConversationStyle.swift in Sources */,
|
||||||
458DE9D61DEE3FD00071BB03 /* PeerConnectionClient.swift in Sources */,
|
458DE9D61DEE3FD00071BB03 /* PeerConnectionClient.swift in Sources */,
|
||||||
45DDA6242090CEB500DE97F8 /* ConversationHeaderView.swift in Sources */,
|
45DDA6242090CEB500DE97F8 /* ConversationHeaderView.swift in Sources */,
|
||||||
45F32C242057297A00A300D5 /* MessageDetailViewController.swift in Sources */,
|
45F32C242057297A00A300D5 /* MessageDetailViewController.swift in Sources */,
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
@class ConversationLayoutInfo;
|
@class ConversationStyle;
|
||||||
@class ConversationViewCell;
|
@class ConversationViewCell;
|
||||||
@class ConversationViewItem;
|
@class ConversationViewItem;
|
||||||
@class OWSContactOffersInteraction;
|
@class OWSContactOffersInteraction;
|
||||||
|
@ -75,7 +75,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
// * Users enters another view (e.g. conversation settings view, call screen, etc.).
|
// * Users enters another view (e.g. conversation settings view, call screen, etc.).
|
||||||
@property (nonatomic) BOOL isCellVisible;
|
@property (nonatomic) BOOL isCellVisible;
|
||||||
|
|
||||||
@property (nonatomic, nullable) ConversationLayoutInfo *layoutInfo;
|
@property (nonatomic, nullable) ConversationStyle *conversationStyle;
|
||||||
|
|
||||||
- (void)loadForDisplayWithTransaction:(YapDatabaseReadTransaction *)transaction;
|
- (void)loadForDisplayWithTransaction:(YapDatabaseReadTransaction *)transaction;
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
self.viewItem = nil;
|
self.viewItem = nil;
|
||||||
self.delegate = nil;
|
self.delegate = nil;
|
||||||
self.isCellVisible = NO;
|
self.isCellVisible = NO;
|
||||||
self.layoutInfo = nil;
|
self.conversationStyle = nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)loadForDisplayWithTransaction:(YapDatabaseReadTransaction *)transaction
|
- (void)loadForDisplayWithTransaction:(YapDatabaseReadTransaction *)transaction
|
||||||
|
|
|
@ -114,8 +114,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
- (void)loadForDisplayWithTransaction:(YapDatabaseReadTransaction *)transaction
|
- (void)loadForDisplayWithTransaction:(YapDatabaseReadTransaction *)transaction
|
||||||
{
|
{
|
||||||
OWSAssert(self.layoutInfo);
|
OWSAssert(self.conversationStyle);
|
||||||
OWSAssert(self.layoutInfo.viewWidth > 0);
|
OWSAssert(self.conversationStyle.viewWidth > 0);
|
||||||
OWSAssert(self.viewItem);
|
OWSAssert(self.viewItem);
|
||||||
OWSAssert([self.viewItem.interaction isKindOfClass:[OWSContactOffersInteraction class]]);
|
OWSAssert([self.viewItem.interaction isKindOfClass:[OWSContactOffersInteraction class]]);
|
||||||
|
|
||||||
|
@ -135,8 +135,10 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
[self.stackView autoPinEdgeToSuperviewEdge:ALEdgeTop withInset:self.topVMargin],
|
[self.stackView autoPinEdgeToSuperviewEdge:ALEdgeTop withInset:self.topVMargin],
|
||||||
[self.stackView autoPinEdgeToSuperviewEdge:ALEdgeBottom withInset:self.bottomVMargin],
|
[self.stackView autoPinEdgeToSuperviewEdge:ALEdgeBottom withInset:self.bottomVMargin],
|
||||||
// TODO: Honor "full-width gutters"?
|
// TODO: Honor "full-width gutters"?
|
||||||
[self.stackView autoPinEdgeToSuperviewEdge:ALEdgeLeading withInset:self.layoutInfo.fullWidthGutterLeading],
|
[self.stackView autoPinEdgeToSuperviewEdge:ALEdgeLeading
|
||||||
[self.stackView autoPinEdgeToSuperviewEdge:ALEdgeTrailing withInset:self.layoutInfo.fullWidthGutterTrailing],
|
withInset:self.conversationStyle.fullWidthGutterLeading],
|
||||||
|
[self.stackView autoPinEdgeToSuperviewEdge:ALEdgeTrailing
|
||||||
|
withInset:self.conversationStyle.fullWidthGutterTrailing],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,8 +169,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
- (CGSize)cellSizeWithTransaction:(YapDatabaseReadTransaction *)transaction
|
- (CGSize)cellSizeWithTransaction:(YapDatabaseReadTransaction *)transaction
|
||||||
{
|
{
|
||||||
OWSAssert(self.layoutInfo);
|
OWSAssert(self.conversationStyle);
|
||||||
OWSAssert(self.layoutInfo.viewWidth > 0);
|
OWSAssert(self.conversationStyle.viewWidth > 0);
|
||||||
OWSAssert(self.viewItem);
|
OWSAssert(self.viewItem);
|
||||||
OWSAssert([self.viewItem.interaction isKindOfClass:[OWSContactOffersInteraction class]]);
|
OWSAssert([self.viewItem.interaction isKindOfClass:[OWSContactOffersInteraction class]]);
|
||||||
|
|
||||||
|
@ -176,7 +178,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
OWSContactOffersInteraction *interaction = (OWSContactOffersInteraction *)self.viewItem.interaction;
|
OWSContactOffersInteraction *interaction = (OWSContactOffersInteraction *)self.viewItem.interaction;
|
||||||
|
|
||||||
CGSize result = CGSizeMake(self.layoutInfo.viewWidth, 0);
|
CGSize result = CGSizeMake(self.conversationStyle.viewWidth, 0);
|
||||||
result.height += self.topVMargin;
|
result.height += self.topVMargin;
|
||||||
result.height += self.bottomVMargin;
|
result.height += self.bottomVMargin;
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
@class ContactShareViewModel;
|
@class ContactShareViewModel;
|
||||||
@class ConversationLayoutInfo;
|
@class ConversationStyle;
|
||||||
@class ConversationViewItem;
|
@class ConversationViewItem;
|
||||||
@class OWSContact;
|
@class OWSContact;
|
||||||
@class OWSQuotedReplyModel;
|
@class OWSQuotedReplyModel;
|
||||||
|
@ -60,7 +60,7 @@ typedef NS_ENUM(NSUInteger, OWSMessageGestureLocation) {
|
||||||
|
|
||||||
@property (nonatomic, nullable) ConversationViewItem *viewItem;
|
@property (nonatomic, nullable) ConversationViewItem *viewItem;
|
||||||
|
|
||||||
@property (nonatomic) ConversationLayoutInfo *layoutInfo;
|
@property (nonatomic) ConversationStyle *conversationStyle;
|
||||||
|
|
||||||
@property (nonatomic) NSCache *cellMediaCache;
|
@property (nonatomic) NSCache *cellMediaCache;
|
||||||
|
|
||||||
|
|
|
@ -237,7 +237,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
- (void)configureViews
|
- (void)configureViews
|
||||||
{
|
{
|
||||||
OWSAssert(self.layoutInfo);
|
OWSAssert(self.conversationStyle);
|
||||||
OWSAssert(self.viewItem);
|
OWSAssert(self.viewItem);
|
||||||
OWSAssert(self.viewItem.interaction);
|
OWSAssert(self.viewItem.interaction);
|
||||||
OWSAssert([self.viewItem.interaction isKindOfClass:[TSMessage class]]);
|
OWSAssert([self.viewItem.interaction isKindOfClass:[TSMessage class]]);
|
||||||
|
@ -390,7 +390,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
OWSDirectionalEdgeInsets *textInsets = self.layoutInfo.textInsets;
|
OWSDirectionalEdgeInsets *textInsets = self.conversationStyle.textInsets;
|
||||||
OWSAssert(textInsets);
|
OWSAssert(textInsets);
|
||||||
|
|
||||||
OWSMessageTextView *_Nullable bodyTextView = nil;
|
OWSMessageTextView *_Nullable bodyTextView = nil;
|
||||||
|
@ -855,19 +855,19 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
// Size of "message body" text, not quoted reply text.
|
// Size of "message body" text, not quoted reply text.
|
||||||
- (CGSize)bodyTextSizeWithIncludeMargins:(BOOL)includeMargins
|
- (CGSize)bodyTextSizeWithIncludeMargins:(BOOL)includeMargins
|
||||||
{
|
{
|
||||||
OWSAssert(self.layoutInfo);
|
OWSAssert(self.conversationStyle);
|
||||||
OWSAssert(self.layoutInfo.maxMessageWidth > 0);
|
OWSAssert(self.conversationStyle.maxMessageWidth > 0);
|
||||||
|
|
||||||
if (!self.hasBodyText) {
|
if (!self.hasBodyText) {
|
||||||
return CGSizeZero;
|
return CGSizeZero;
|
||||||
}
|
}
|
||||||
|
|
||||||
OWSDirectionalEdgeInsets *textInsets = self.layoutInfo.textInsets;
|
OWSDirectionalEdgeInsets *textInsets = self.conversationStyle.textInsets;
|
||||||
OWSAssert(textInsets);
|
OWSAssert(textInsets);
|
||||||
|
|
||||||
CGFloat hMargins = textInsets.leading + textInsets.trailing;
|
CGFloat hMargins = textInsets.leading + textInsets.trailing;
|
||||||
|
|
||||||
const int maxTextWidth = (int)floor(self.layoutInfo.maxMessageWidth - hMargins);
|
const int maxTextWidth = (int)floor(self.conversationStyle.maxMessageWidth - hMargins);
|
||||||
|
|
||||||
OWSMessageTextView *bodyTextView = [self configureBodyTextView];
|
OWSMessageTextView *bodyTextView = [self configureBodyTextView];
|
||||||
CGSize textSize = CGSizeCeil([bodyTextView sizeThatFits:CGSizeMake(maxTextWidth, CGFLOAT_MAX)]);
|
CGSize textSize = CGSizeCeil([bodyTextView sizeThatFits:CGSizeMake(maxTextWidth, CGFLOAT_MAX)]);
|
||||||
|
@ -884,10 +884,10 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
- (CGSize)bodyMediaSize
|
- (CGSize)bodyMediaSize
|
||||||
{
|
{
|
||||||
OWSAssert(self.layoutInfo);
|
OWSAssert(self.conversationStyle);
|
||||||
OWSAssert(self.layoutInfo.maxMessageWidth > 0);
|
OWSAssert(self.conversationStyle.maxMessageWidth > 0);
|
||||||
|
|
||||||
CGFloat maxMessageWidth = self.layoutInfo.maxMessageWidth;
|
CGFloat maxMessageWidth = self.conversationStyle.maxMessageWidth;
|
||||||
|
|
||||||
CGSize result = CGSizeZero;
|
CGSize result = CGSizeZero;
|
||||||
switch (self.cellType) {
|
switch (self.cellType) {
|
||||||
|
@ -956,8 +956,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
- (CGSize)quotedMessageSize
|
- (CGSize)quotedMessageSize
|
||||||
{
|
{
|
||||||
OWSAssert(self.layoutInfo);
|
OWSAssert(self.conversationStyle);
|
||||||
OWSAssert(self.layoutInfo.maxMessageWidth > 0);
|
OWSAssert(self.conversationStyle.maxMessageWidth > 0);
|
||||||
OWSAssert(self.viewItem);
|
OWSAssert(self.viewItem);
|
||||||
OWSAssert([self.viewItem.interaction isKindOfClass:[TSMessage class]]);
|
OWSAssert([self.viewItem.interaction isKindOfClass:[TSMessage class]]);
|
||||||
|
|
||||||
|
@ -973,14 +973,14 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
[OWSQuotedMessageView quotedMessageViewForConversation:self.viewItem.quotedReply
|
[OWSQuotedMessageView quotedMessageViewForConversation:self.viewItem.quotedReply
|
||||||
displayableQuotedText:displayableQuotedText
|
displayableQuotedText:displayableQuotedText
|
||||||
isOutgoing:isOutgoing];
|
isOutgoing:isOutgoing];
|
||||||
CGSize result = [quotedMessageView sizeForMaxWidth:self.layoutInfo.maxMessageWidth];
|
CGSize result = [quotedMessageView sizeForMaxWidth:self.conversationStyle.maxMessageWidth];
|
||||||
return CGSizeCeil(result);
|
return CGSizeCeil(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (CGSize)measureSize
|
- (CGSize)measureSize
|
||||||
{
|
{
|
||||||
OWSAssert(self.layoutInfo);
|
OWSAssert(self.conversationStyle);
|
||||||
OWSAssert(self.layoutInfo.viewWidth > 0);
|
OWSAssert(self.conversationStyle.viewWidth > 0);
|
||||||
OWSAssert(self.viewItem);
|
OWSAssert(self.viewItem);
|
||||||
OWSAssert([self.viewItem.interaction isKindOfClass:[TSMessage class]]);
|
OWSAssert([self.viewItem.interaction isKindOfClass:[TSMessage class]]);
|
||||||
|
|
||||||
|
|
|
@ -108,11 +108,11 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setLayoutInfo:(nullable ConversationLayoutInfo *)layoutInfo
|
- (void)setConversationStyle:(nullable ConversationStyle *)conversationStyle
|
||||||
{
|
{
|
||||||
[super setLayoutInfo:layoutInfo];
|
[super setConversationStyle:conversationStyle];
|
||||||
|
|
||||||
self.messageBubbleView.layoutInfo = layoutInfo;
|
self.messageBubbleView.conversationStyle = conversationStyle;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (NSString *)cellReuseIdentifier
|
+ (NSString *)cellReuseIdentifier
|
||||||
|
@ -148,7 +148,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
- (void)loadForDisplayWithTransaction:(YapDatabaseReadTransaction *)transaction
|
- (void)loadForDisplayWithTransaction:(YapDatabaseReadTransaction *)transaction
|
||||||
{
|
{
|
||||||
OWSAssert(self.layoutInfo);
|
OWSAssert(self.conversationStyle);
|
||||||
OWSAssert(self.viewItem);
|
OWSAssert(self.viewItem);
|
||||||
OWSAssert(self.viewItem.interaction);
|
OWSAssert(self.viewItem.interaction);
|
||||||
OWSAssert([self.viewItem.interaction isKindOfClass:[TSMessage class]]);
|
OWSAssert([self.viewItem.interaction isKindOfClass:[TSMessage class]]);
|
||||||
|
@ -165,17 +165,19 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
if (self.isIncoming) {
|
if (self.isIncoming) {
|
||||||
[self.viewConstraints addObjectsFromArray:@[
|
[self.viewConstraints addObjectsFromArray:@[
|
||||||
[self.messageBubbleView autoPinEdgeToSuperviewEdge:ALEdgeLeading withInset:self.layoutInfo.gutterLeading],
|
[self.messageBubbleView autoPinEdgeToSuperviewEdge:ALEdgeLeading
|
||||||
|
withInset:self.conversationStyle.gutterLeading],
|
||||||
[self.messageBubbleView autoPinEdgeToSuperviewEdge:ALEdgeTrailing
|
[self.messageBubbleView autoPinEdgeToSuperviewEdge:ALEdgeTrailing
|
||||||
withInset:self.layoutInfo.gutterTrailing
|
withInset:self.conversationStyle.gutterTrailing
|
||||||
relation:NSLayoutRelationGreaterThanOrEqual],
|
relation:NSLayoutRelationGreaterThanOrEqual],
|
||||||
]];
|
]];
|
||||||
} else {
|
} else {
|
||||||
[self.viewConstraints addObjectsFromArray:@[
|
[self.viewConstraints addObjectsFromArray:@[
|
||||||
[self.messageBubbleView autoPinEdgeToSuperviewEdge:ALEdgeLeading
|
[self.messageBubbleView autoPinEdgeToSuperviewEdge:ALEdgeLeading
|
||||||
withInset:self.layoutInfo.gutterLeading
|
withInset:self.conversationStyle.gutterLeading
|
||||||
relation:NSLayoutRelationGreaterThanOrEqual],
|
relation:NSLayoutRelationGreaterThanOrEqual],
|
||||||
[self.messageBubbleView autoPinEdgeToSuperviewEdge:ALEdgeTrailing withInset:self.layoutInfo.gutterTrailing],
|
[self.messageBubbleView autoPinEdgeToSuperviewEdge:ALEdgeTrailing
|
||||||
|
withInset:self.conversationStyle.gutterTrailing],
|
||||||
]];
|
]];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -183,7 +185,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
[self updateFooter];
|
[self updateFooter];
|
||||||
|
|
||||||
if ([self updateAvatarView]) {
|
if ([self updateAvatarView]) {
|
||||||
CGFloat avatarBottomMargin = round(self.layoutInfo.lastTextLineAxis - self.avatarSize * 0.5f);
|
CGFloat avatarBottomMargin = round(self.conversationStyle.lastTextLineAxis - self.avatarSize * 0.5f);
|
||||||
[self.viewConstraints addObjectsFromArray:@[
|
[self.viewConstraints addObjectsFromArray:@[
|
||||||
// V-align the "group sender" avatar with the
|
// V-align the "group sender" avatar with the
|
||||||
// last line of the text (if any, or where it
|
// last line of the text (if any, or where it
|
||||||
|
@ -214,7 +216,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
- (void)updateDateHeader
|
- (void)updateDateHeader
|
||||||
{
|
{
|
||||||
OWSAssert(self.layoutInfo);
|
OWSAssert(self.conversationStyle);
|
||||||
|
|
||||||
static NSDateFormatter *dateHeaderDateFormatter = nil;
|
static NSDateFormatter *dateHeaderDateFormatter = nil;
|
||||||
static NSDateFormatter *dateHeaderTimeFormatter = nil;
|
static NSDateFormatter *dateHeaderTimeFormatter = nil;
|
||||||
|
@ -262,8 +264,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
[self.viewConstraints addObjectsFromArray:@[
|
[self.viewConstraints addObjectsFromArray:@[
|
||||||
// TODO: Are data headers symmetric or are they asymmetric? gutters are asymmetric?
|
// TODO: Are data headers symmetric or are they asymmetric? gutters are asymmetric?
|
||||||
[self.dateHeaderLabel autoPinLeadingToSuperviewMarginWithInset:self.layoutInfo.gutterLeading],
|
[self.dateHeaderLabel autoPinLeadingToSuperviewMarginWithInset:self.conversationStyle.gutterLeading],
|
||||||
[self.dateHeaderLabel autoPinTrailingToSuperviewMarginWithInset:self.layoutInfo.gutterTrailing],
|
[self.dateHeaderLabel autoPinTrailingToSuperviewMarginWithInset:self.conversationStyle.gutterTrailing],
|
||||||
[self.dateHeaderLabel autoPinEdgeToSuperviewEdge:ALEdgeTop],
|
[self.dateHeaderLabel autoPinEdgeToSuperviewEdge:ALEdgeTop],
|
||||||
[self.dateHeaderLabel autoSetDimension:ALDimensionHeight toSize:self.dateHeaderHeight],
|
[self.dateHeaderLabel autoSetDimension:ALDimensionHeight toSize:self.dateHeaderHeight],
|
||||||
]];
|
]];
|
||||||
|
@ -309,7 +311,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
- (void)updateFooter
|
- (void)updateFooter
|
||||||
{
|
{
|
||||||
OWSAssert(self.layoutInfo);
|
OWSAssert(self.conversationStyle);
|
||||||
OWSAssert(self.viewItem.interaction.interactionType == OWSInteractionType_IncomingMessage
|
OWSAssert(self.viewItem.interaction.interactionType == OWSInteractionType_IncomingMessage
|
||||||
|| self.viewItem.interaction.interactionType == OWSInteractionType_OutgoingMessage);
|
|| self.viewItem.interaction.interactionType == OWSInteractionType_OutgoingMessage);
|
||||||
|
|
||||||
|
@ -339,8 +341,9 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
}
|
}
|
||||||
|
|
||||||
[self.viewConstraints addObjectsFromArray:@[
|
[self.viewConstraints addObjectsFromArray:@[
|
||||||
(self.isIncoming ? [self.footerView autoPinLeadingToSuperviewMarginWithInset:self.layoutInfo.gutterLeading]
|
(self.isIncoming
|
||||||
: [self.footerView autoPinTrailingToSuperviewMarginWithInset:self.layoutInfo.gutterTrailing]),
|
? [self.footerView autoPinLeadingToSuperviewMarginWithInset:self.conversationStyle.gutterLeading]
|
||||||
|
: [self.footerView autoPinTrailingToSuperviewMarginWithInset:self.conversationStyle.gutterTrailing]),
|
||||||
]];
|
]];
|
||||||
|
|
||||||
[self.viewConstraints addObject:[self.footerView autoPinEdge:ALEdgeTop
|
[self.viewConstraints addObject:[self.footerView autoPinEdge:ALEdgeTop
|
||||||
|
@ -364,7 +367,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
// we want to leave spaces for an expiration timer and
|
// we want to leave spaces for an expiration timer and
|
||||||
// include padding so that they still visually "cling" to the
|
// include padding so that they still visually "cling" to the
|
||||||
// appropriate incoming/outgoing edge.
|
// appropriate incoming/outgoing edge.
|
||||||
const CGFloat maxFooterLabelWidth = self.layoutInfo.maxFooterWidth;
|
const CGFloat maxFooterLabelWidth = self.conversationStyle.maxFooterWidth;
|
||||||
if (hasExpirationTimer &&
|
if (hasExpirationTimer &&
|
||||||
attributedText) {
|
attributedText) {
|
||||||
[self.viewConstraints addObjectsFromArray:@[
|
[self.viewConstraints addObjectsFromArray:@[
|
||||||
|
@ -483,8 +486,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
- (CGSize)cellSizeWithTransaction:(YapDatabaseReadTransaction *)transaction
|
- (CGSize)cellSizeWithTransaction:(YapDatabaseReadTransaction *)transaction
|
||||||
{
|
{
|
||||||
OWSAssert(self.layoutInfo);
|
OWSAssert(self.conversationStyle);
|
||||||
OWSAssert(self.layoutInfo.viewWidth > 0);
|
OWSAssert(self.conversationStyle.viewWidth > 0);
|
||||||
OWSAssert(self.viewItem);
|
OWSAssert(self.viewItem);
|
||||||
OWSAssert([self.viewItem.interaction isKindOfClass:[TSMessage class]]);
|
OWSAssert([self.viewItem.interaction isKindOfClass:[TSMessage class]]);
|
||||||
OWSAssert(self.messageBubbleView);
|
OWSAssert(self.messageBubbleView);
|
||||||
|
|
|
@ -90,7 +90,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
- (void)loadForDisplayWithTransaction:(YapDatabaseReadTransaction *)transaction
|
- (void)loadForDisplayWithTransaction:(YapDatabaseReadTransaction *)transaction
|
||||||
{
|
{
|
||||||
OWSAssert(self.layoutInfo);
|
OWSAssert(self.conversationStyle);
|
||||||
OWSAssert(self.viewItem);
|
OWSAssert(self.viewItem);
|
||||||
OWSAssert(transaction);
|
OWSAssert(transaction);
|
||||||
|
|
||||||
|
@ -112,10 +112,10 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
// H-center the stack.
|
// H-center the stack.
|
||||||
[self.stackView autoHCenterInSuperview],
|
[self.stackView autoHCenterInSuperview],
|
||||||
[self.stackView autoPinEdgeToSuperviewEdge:ALEdgeLeading
|
[self.stackView autoPinEdgeToSuperviewEdge:ALEdgeLeading
|
||||||
withInset:self.layoutInfo.fullWidthGutterLeading
|
withInset:self.conversationStyle.fullWidthGutterLeading
|
||||||
relation:NSLayoutRelationGreaterThanOrEqual],
|
relation:NSLayoutRelationGreaterThanOrEqual],
|
||||||
[self.stackView autoPinEdgeToSuperviewEdge:ALEdgeTrailing
|
[self.stackView autoPinEdgeToSuperviewEdge:ALEdgeTrailing
|
||||||
withInset:self.layoutInfo.fullWidthGutterTrailing
|
withInset:self.conversationStyle.fullWidthGutterTrailing
|
||||||
relation:NSLayoutRelationGreaterThanOrEqual],
|
relation:NSLayoutRelationGreaterThanOrEqual],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -266,23 +266,23 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
- (CGSize)titleSize
|
- (CGSize)titleSize
|
||||||
{
|
{
|
||||||
OWSAssert(self.layoutInfo);
|
OWSAssert(self.conversationStyle);
|
||||||
OWSAssert(self.viewItem);
|
OWSAssert(self.viewItem);
|
||||||
|
|
||||||
CGFloat hMargins = (self.layoutInfo.fullWidthGutterLeading + self.layoutInfo.fullWidthGutterTrailing);
|
CGFloat hMargins = (self.conversationStyle.fullWidthGutterLeading + self.conversationStyle.fullWidthGutterTrailing);
|
||||||
CGFloat maxTitleWidth
|
CGFloat maxTitleWidth
|
||||||
= (CGFloat)floor(self.layoutInfo.fullWidthContentWidth - (hMargins + self.iconSize + self.hSpacing));
|
= (CGFloat)floor(self.conversationStyle.fullWidthContentWidth - (hMargins + self.iconSize + self.hSpacing));
|
||||||
return [self.titleLabel sizeThatFits:CGSizeMake(maxTitleWidth, CGFLOAT_MAX)];
|
return [self.titleLabel sizeThatFits:CGSizeMake(maxTitleWidth, CGFLOAT_MAX)];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (CGSize)cellSizeWithTransaction:(YapDatabaseReadTransaction *)transaction
|
- (CGSize)cellSizeWithTransaction:(YapDatabaseReadTransaction *)transaction
|
||||||
{
|
{
|
||||||
OWSAssert(self.layoutInfo);
|
OWSAssert(self.conversationStyle);
|
||||||
OWSAssert(self.viewItem);
|
OWSAssert(self.viewItem);
|
||||||
|
|
||||||
TSInteraction *interaction = self.viewItem.interaction;
|
TSInteraction *interaction = self.viewItem.interaction;
|
||||||
|
|
||||||
CGSize result = CGSizeMake(self.layoutInfo.viewWidth, 0);
|
CGSize result = CGSizeMake(self.conversationStyle.viewWidth, 0);
|
||||||
|
|
||||||
[self applyTitleForInteraction:interaction label:self.titleLabel transaction:transaction];
|
[self applyTitleForInteraction:interaction label:self.titleLabel transaction:transaction];
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
- (void)loadForDisplayWithTransaction:(YapDatabaseReadTransaction *)transaction
|
- (void)loadForDisplayWithTransaction:(YapDatabaseReadTransaction *)transaction
|
||||||
{
|
{
|
||||||
OWSAssert(self.layoutInfo);
|
OWSAssert(self.conversationStyle);
|
||||||
OWSAssert(self.viewItem);
|
OWSAssert(self.viewItem);
|
||||||
OWSAssert([self.viewItem.interaction isKindOfClass:[TSUnreadIndicatorInteraction class]]);
|
OWSAssert([self.viewItem.interaction isKindOfClass:[TSUnreadIndicatorInteraction class]]);
|
||||||
|
|
||||||
|
@ -87,13 +87,13 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
[NSLayoutConstraint deactivateConstraints:self.layoutConstraints];
|
[NSLayoutConstraint deactivateConstraints:self.layoutConstraints];
|
||||||
self.layoutConstraints = @[
|
self.layoutConstraints = @[
|
||||||
[self.titleLabel autoVCenterInSuperview],
|
[self.titleLabel autoVCenterInSuperview],
|
||||||
[self.titleLabel autoPinLeadingToSuperviewMarginWithInset:self.layoutInfo.fullWidthGutterLeading],
|
[self.titleLabel autoPinLeadingToSuperviewMarginWithInset:self.conversationStyle.fullWidthGutterLeading],
|
||||||
[self.titleLabel autoPinTrailingToSuperviewMarginWithInset:self.layoutInfo.fullWidthGutterTrailing],
|
[self.titleLabel autoPinTrailingToSuperviewMarginWithInset:self.conversationStyle.fullWidthGutterTrailing],
|
||||||
|
|
||||||
// TODO: offset.
|
// TODO: offset.
|
||||||
[self.strokeView autoPinEdge:ALEdgeBottom toEdge:ALEdgeTop ofView:self.titleLabel withOffset:0.f],
|
[self.strokeView autoPinEdge:ALEdgeBottom toEdge:ALEdgeTop ofView:self.titleLabel withOffset:0.f],
|
||||||
[self.strokeView autoPinLeadingToSuperviewMarginWithInset:self.layoutInfo.fullWidthGutterLeading],
|
[self.strokeView autoPinLeadingToSuperviewMarginWithInset:self.conversationStyle.fullWidthGutterLeading],
|
||||||
[self.strokeView autoPinTrailingToSuperviewMarginWithInset:self.layoutInfo.fullWidthGutterTrailing],
|
[self.strokeView autoPinTrailingToSuperviewMarginWithInset:self.conversationStyle.fullWidthGutterTrailing],
|
||||||
[self.strokeView autoSetDimension:ALDimensionHeight toSize:1.f],
|
[self.strokeView autoSetDimension:ALDimensionHeight toSize:1.f],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -106,7 +106,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
- (CGSize)cellSizeWithTransaction:(YapDatabaseReadTransaction *)transaction
|
- (CGSize)cellSizeWithTransaction:(YapDatabaseReadTransaction *)transaction
|
||||||
{
|
{
|
||||||
OWSAssert(self.layoutInfo);
|
OWSAssert(self.conversationStyle);
|
||||||
OWSAssert(self.viewItem);
|
OWSAssert(self.viewItem);
|
||||||
OWSAssert([self.viewItem.interaction isKindOfClass:[TSUnreadIndicatorInteraction class]]);
|
OWSAssert([self.viewItem.interaction isKindOfClass:[TSUnreadIndicatorInteraction class]]);
|
||||||
|
|
||||||
|
@ -114,7 +114,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
// TODO: offset.
|
// TODO: offset.
|
||||||
CGFloat vOffset = 24.f;
|
CGFloat vOffset = 24.f;
|
||||||
CGSize result = CGSizeMake(self.layoutInfo.fullWidthContentWidth, self.titleLabel.font.lineHeight + vOffset * 2);
|
CGSize result
|
||||||
|
= CGSizeMake(self.conversationStyle.fullWidthContentWidth, self.titleLabel.font.lineHeight + vOffset * 2);
|
||||||
|
|
||||||
return CGSizeCeil(result);
|
return CGSizeCeil(result);
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ public class OWSDirectionalEdgeInsets: NSObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc
|
@objc
|
||||||
public class ConversationLayoutInfo: NSObject {
|
public class ConversationStyle: NSObject {
|
||||||
|
|
||||||
private let thread: TSThread
|
private let thread: TSThread
|
||||||
|
|
|
@ -174,7 +174,7 @@ typedef enum : NSUInteger {
|
||||||
@property (nonatomic, readonly) ConversationInputToolbar *inputToolbar;
|
@property (nonatomic, readonly) ConversationInputToolbar *inputToolbar;
|
||||||
@property (nonatomic, readonly) ConversationCollectionView *collectionView;
|
@property (nonatomic, readonly) ConversationCollectionView *collectionView;
|
||||||
@property (nonatomic, readonly) ConversationViewLayout *layout;
|
@property (nonatomic, readonly) ConversationViewLayout *layout;
|
||||||
@property (nonatomic, readonly) ConversationLayoutInfo *layoutInfo;
|
@property (nonatomic, readonly) ConversationStyle *conversationStyle;
|
||||||
|
|
||||||
@property (nonatomic) NSArray<ConversationViewItem *> *viewItems;
|
@property (nonatomic) NSArray<ConversationViewItem *> *viewItems;
|
||||||
@property (nonatomic) NSMutableDictionary<NSString *, ConversationViewItem *> *viewItemCache;
|
@property (nonatomic) NSMutableDictionary<NSString *, ConversationViewItem *> *viewItemCache;
|
||||||
|
@ -447,7 +447,7 @@ typedef enum : NSUInteger {
|
||||||
_cellMediaCache = [NSCache new];
|
_cellMediaCache = [NSCache new];
|
||||||
// Cache the cell media for ~24 cells.
|
// Cache the cell media for ~24 cells.
|
||||||
self.cellMediaCache.countLimit = 24;
|
self.cellMediaCache.countLimit = 24;
|
||||||
_layoutInfo = [[ConversationLayoutInfo alloc] initWithThread:thread];
|
_conversationStyle = [[ConversationStyle alloc] initWithThread:thread];
|
||||||
|
|
||||||
// We need to update the "unread indicator" _before_ we determine the initial range
|
// We need to update the "unread indicator" _before_ we determine the initial range
|
||||||
// size, since it depends on where the unread indicator is placed.
|
// size, since it depends on where the unread indicator is placed.
|
||||||
|
@ -533,11 +533,11 @@ typedef enum : NSUInteger {
|
||||||
|
|
||||||
- (void)createContents
|
- (void)createContents
|
||||||
{
|
{
|
||||||
OWSAssert(self.layoutInfo);
|
OWSAssert(self.conversationStyle);
|
||||||
|
|
||||||
_layout = [[ConversationViewLayout alloc] initWithLayoutInfo:self.layoutInfo
|
_layout = [[ConversationViewLayout alloc] initWithConversationStyle:self.conversationStyle
|
||||||
uiDatabaseConnection:self.uiDatabaseConnection];
|
uiDatabaseConnection:self.uiDatabaseConnection];
|
||||||
self.layoutInfo.viewWidth = self.view.width;
|
self.conversationStyle.viewWidth = self.view.width;
|
||||||
|
|
||||||
self.layout.delegate = self;
|
self.layout.delegate = self;
|
||||||
// We use the root view bounds as the initial frame for the collection
|
// We use the root view bounds as the initial frame for the collection
|
||||||
|
@ -4768,7 +4768,7 @@ typedef enum : NSUInteger {
|
||||||
OWSAssertIsOnMainThread();
|
OWSAssertIsOnMainThread();
|
||||||
|
|
||||||
[self updateLastVisibleTimestamp];
|
[self updateLastVisibleTimestamp];
|
||||||
self.layoutInfo.viewWidth = self.collectionView.width;
|
self.conversationStyle.viewWidth = self.collectionView.width;
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - View Items
|
#pragma mark - View Items
|
||||||
|
@ -4815,7 +4815,7 @@ typedef enum : NSUInteger {
|
||||||
viewItem = [[ConversationViewItem alloc] initWithInteraction:interaction
|
viewItem = [[ConversationViewItem alloc] initWithInteraction:interaction
|
||||||
isGroupThread:isGroupThread
|
isGroupThread:isGroupThread
|
||||||
transaction:transaction
|
transaction:transaction
|
||||||
layoutInfo:self.layoutInfo];
|
conversationStyle:self.conversationStyle];
|
||||||
}
|
}
|
||||||
viewItem.row = (NSInteger)row;
|
viewItem.row = (NSInteger)row;
|
||||||
[viewItems addObject:viewItem];
|
[viewItems addObject:viewItem];
|
||||||
|
@ -4980,7 +4980,7 @@ typedef enum : NSUInteger {
|
||||||
OWSMessageCell *messageCell = (OWSMessageCell *)cell;
|
OWSMessageCell *messageCell = (OWSMessageCell *)cell;
|
||||||
messageCell.messageBubbleView.delegate = self;
|
messageCell.messageBubbleView.delegate = self;
|
||||||
}
|
}
|
||||||
cell.layoutInfo = self.layoutInfo;
|
cell.conversationStyle = self.conversationStyle;
|
||||||
|
|
||||||
[self.uiDatabaseConnection readWithBlock:^(YapDatabaseReadTransaction *transaction) {
|
[self.uiDatabaseConnection readWithBlock:^(YapDatabaseReadTransaction *transaction) {
|
||||||
[cell loadForDisplayWithTransaction:transaction];
|
[cell loadForDisplayWithTransaction:transaction];
|
||||||
|
|
|
@ -67,13 +67,13 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType);
|
||||||
// previous update.
|
// previous update.
|
||||||
@property (nonatomic) NSInteger previousRow;
|
@property (nonatomic) NSInteger previousRow;
|
||||||
|
|
||||||
@property (nonatomic, readonly) ConversationLayoutInfo *layoutInfo;
|
@property (nonatomic, readonly) ConversationStyle *conversationStyle;
|
||||||
|
|
||||||
- (instancetype)init NS_UNAVAILABLE;
|
- (instancetype)init NS_UNAVAILABLE;
|
||||||
- (instancetype)initWithInteraction:(TSInteraction *)interaction
|
- (instancetype)initWithInteraction:(TSInteraction *)interaction
|
||||||
isGroupThread:(BOOL)isGroupThread
|
isGroupThread:(BOOL)isGroupThread
|
||||||
transaction:(YapDatabaseReadTransaction *)transaction
|
transaction:(YapDatabaseReadTransaction *)transaction
|
||||||
layoutInfo:(ConversationLayoutInfo *)layoutInfo;
|
conversationStyle:(ConversationStyle *)conversationStyle;
|
||||||
|
|
||||||
- (ConversationViewCell *)dequeueCellForCollectionView:(UICollectionView *)collectionView
|
- (ConversationViewCell *)dequeueCellForCollectionView:(UICollectionView *)collectionView
|
||||||
indexPath:(NSIndexPath *)indexPath;
|
indexPath:(NSIndexPath *)indexPath;
|
||||||
|
|
|
@ -77,11 +77,11 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType)
|
||||||
- (instancetype)initWithInteraction:(TSInteraction *)interaction
|
- (instancetype)initWithInteraction:(TSInteraction *)interaction
|
||||||
isGroupThread:(BOOL)isGroupThread
|
isGroupThread:(BOOL)isGroupThread
|
||||||
transaction:(YapDatabaseReadTransaction *)transaction
|
transaction:(YapDatabaseReadTransaction *)transaction
|
||||||
layoutInfo:(ConversationLayoutInfo *)layoutInfo
|
conversationStyle:(ConversationStyle *)conversationStyle
|
||||||
{
|
{
|
||||||
OWSAssert(interaction);
|
OWSAssert(interaction);
|
||||||
OWSAssert(transaction);
|
OWSAssert(transaction);
|
||||||
OWSAssert(layoutInfo);
|
OWSAssert(conversationStyle);
|
||||||
|
|
||||||
self = [super init];
|
self = [super init];
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType)
|
||||||
|
|
||||||
_interaction = interaction;
|
_interaction = interaction;
|
||||||
_isGroupThread = isGroupThread;
|
_isGroupThread = isGroupThread;
|
||||||
_layoutInfo = layoutInfo;
|
_conversationStyle = conversationStyle;
|
||||||
self.row = NSNotFound;
|
self.row = NSNotFound;
|
||||||
self.previousRow = NSNotFound;
|
self.previousRow = NSNotFound;
|
||||||
|
|
||||||
|
@ -182,12 +182,12 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType)
|
||||||
{
|
{
|
||||||
OWSAssert(transaction);
|
OWSAssert(transaction);
|
||||||
OWSAssertIsOnMainThread();
|
OWSAssertIsOnMainThread();
|
||||||
OWSAssert(self.layoutInfo);
|
OWSAssert(self.conversationStyle);
|
||||||
|
|
||||||
if (!self.cachedCellSize) {
|
if (!self.cachedCellSize) {
|
||||||
ConversationViewCell *_Nullable measurementCell = [self measurementCell];
|
ConversationViewCell *_Nullable measurementCell = [self measurementCell];
|
||||||
measurementCell.viewItem = self;
|
measurementCell.viewItem = self;
|
||||||
measurementCell.layoutInfo = self.layoutInfo;
|
measurementCell.conversationStyle = self.conversationStyle;
|
||||||
CGSize cellSize = [measurementCell cellSizeWithTransaction:transaction];
|
CGSize cellSize = [measurementCell cellSizeWithTransaction:transaction];
|
||||||
self.cachedCellSize = [NSValue valueWithCGSize:cellSize];
|
self.cachedCellSize = [NSValue valueWithCGSize:cellSize];
|
||||||
[measurementCell prepareForReuse];
|
[measurementCell prepareForReuse];
|
||||||
|
|
|
@ -13,7 +13,7 @@ typedef NS_ENUM(NSInteger, ConversationViewLayoutAlignment) {
|
||||||
ConversationViewLayoutAlignment_Center,
|
ConversationViewLayoutAlignment_Center,
|
||||||
};
|
};
|
||||||
|
|
||||||
@class ConversationLayoutInfo;
|
@class ConversationStyle;
|
||||||
@class YapDatabaseConnection;
|
@class YapDatabaseConnection;
|
||||||
@class YapDatabaseReadTransaction;
|
@class YapDatabaseReadTransaction;
|
||||||
|
|
||||||
|
@ -46,11 +46,11 @@ typedef NS_ENUM(NSInteger, ConversationViewLayoutAlignment) {
|
||||||
@property (nonatomic, weak) id<ConversationViewLayoutDelegate> delegate;
|
@property (nonatomic, weak) id<ConversationViewLayoutDelegate> delegate;
|
||||||
@property (nonatomic, readonly) BOOL hasLayout;
|
@property (nonatomic, readonly) BOOL hasLayout;
|
||||||
@property (nonatomic, readonly) BOOL hasEverHadLayout;
|
@property (nonatomic, readonly) BOOL hasEverHadLayout;
|
||||||
@property (nonatomic, readonly) ConversationLayoutInfo *layoutInfo;
|
@property (nonatomic, readonly) ConversationStyle *conversationStyle;
|
||||||
|
|
||||||
- (instancetype)init NS_UNAVAILABLE;
|
- (instancetype)init NS_UNAVAILABLE;
|
||||||
|
|
||||||
- (instancetype)initWithLayoutInfo:(ConversationLayoutInfo *)layoutInfo
|
- (instancetype)initWithConversationStyle:(ConversationStyle *)conversationStyle
|
||||||
uiDatabaseConnection:(YapDatabaseConnection *)uiDatabaseConnection;
|
uiDatabaseConnection:(YapDatabaseConnection *)uiDatabaseConnection;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -30,12 +30,12 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
@implementation ConversationViewLayout
|
@implementation ConversationViewLayout
|
||||||
|
|
||||||
- (instancetype)initWithLayoutInfo:(ConversationLayoutInfo *)layoutInfo
|
- (instancetype)initWithConversationStyle:(ConversationStyle *)conversationStyle
|
||||||
uiDatabaseConnection:(YapDatabaseConnection *)uiDatabaseConnection
|
uiDatabaseConnection:(YapDatabaseConnection *)uiDatabaseConnection
|
||||||
{
|
{
|
||||||
if (self = [super init]) {
|
if (self = [super init]) {
|
||||||
_itemAttributesMap = [NSMutableDictionary new];
|
_itemAttributesMap = [NSMutableDictionary new];
|
||||||
_layoutInfo = layoutInfo;
|
_conversationStyle = conversationStyle;
|
||||||
_uiDatabaseConnection = uiDatabaseConnection;
|
_uiDatabaseConnection = uiDatabaseConnection;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,11 +107,11 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
{
|
{
|
||||||
OWSAssert(transaction);
|
OWSAssert(transaction);
|
||||||
|
|
||||||
const CGFloat viewWidth = self.layoutInfo.viewWidth;
|
const CGFloat viewWidth = self.conversationStyle.viewWidth;
|
||||||
|
|
||||||
NSArray<id<ConversationViewLayoutItem>> *layoutItems = self.delegate.layoutItems;
|
NSArray<id<ConversationViewLayoutItem>> *layoutItems = self.delegate.layoutItems;
|
||||||
|
|
||||||
CGFloat y = self.layoutInfo.contentMarginTop + self.delegate.layoutHeaderHeight;
|
CGFloat y = self.conversationStyle.contentMarginTop + self.delegate.layoutHeaderHeight;
|
||||||
CGFloat contentBottom = y;
|
CGFloat contentBottom = y;
|
||||||
|
|
||||||
NSInteger row = 0;
|
NSInteger row = 0;
|
||||||
|
@ -142,7 +142,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
previousLayoutItem = layoutItem;
|
previousLayoutItem = layoutItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
contentBottom += self.layoutInfo.contentMarginBottom;
|
contentBottom += self.conversationStyle.contentMarginBottom;
|
||||||
self.contentSize = CGSizeMake(viewWidth, contentBottom);
|
self.contentSize = CGSizeMake(viewWidth, contentBottom);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1963,8 +1963,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
[prepareBlocks addObject:replyAssetLoader.prepareBlock];
|
[prepareBlocks addObject:replyAssetLoader.prepareBlock];
|
||||||
}
|
}
|
||||||
|
|
||||||
// We don't need to configure ConversationLayoutInfo's view width in this case.
|
// We don't need to configure ConversationStyle's view width in this case.
|
||||||
ConversationLayoutInfo *layoutInfo = [[ConversationLayoutInfo alloc] initWithThread:thread];
|
ConversationStyle *conversationStyle = [[ConversationStyle alloc] initWithThread:thread];
|
||||||
|
|
||||||
return [DebugUIMessagesSingleAction
|
return [DebugUIMessagesSingleAction
|
||||||
actionWithLabel:label
|
actionWithLabel:label
|
||||||
|
@ -1986,7 +1986,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
ConversationViewItem *viewItem = [[ConversationViewItem alloc] initWithInteraction:messageToQuote
|
ConversationViewItem *viewItem = [[ConversationViewItem alloc] initWithInteraction:messageToQuote
|
||||||
isGroupThread:thread.isGroupThread
|
isGroupThread:thread.isGroupThread
|
||||||
transaction:transaction
|
transaction:transaction
|
||||||
layoutInfo:layoutInfo];
|
conversationStyle:conversationStyle];
|
||||||
quotedMessage = [[OWSQuotedReplyModel quotedReplyForConversationViewItem:viewItem transaction:transaction] buildQuotedMessage];
|
quotedMessage = [[OWSQuotedReplyModel quotedReplyForConversationViewItem:viewItem transaction:transaction] buildQuotedMessage];
|
||||||
} else {
|
} else {
|
||||||
TSOutgoingMessage *_Nullable messageToQuote = [self createFakeOutgoingMessage:thread
|
TSOutgoingMessage *_Nullable messageToQuote = [self createFakeOutgoingMessage:thread
|
||||||
|
@ -2003,7 +2003,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
ConversationViewItem *viewItem = [[ConversationViewItem alloc] initWithInteraction:messageToQuote
|
ConversationViewItem *viewItem = [[ConversationViewItem alloc] initWithInteraction:messageToQuote
|
||||||
isGroupThread:thread.isGroupThread
|
isGroupThread:thread.isGroupThread
|
||||||
transaction:transaction
|
transaction:transaction
|
||||||
layoutInfo:layoutInfo];
|
conversationStyle:conversationStyle];
|
||||||
quotedMessage = [[OWSQuotedReplyModel quotedReplyForConversationViewItem:viewItem transaction:transaction] buildQuotedMessage];
|
quotedMessage = [[OWSQuotedReplyModel quotedReplyForConversationViewItem:viewItem transaction:transaction] buildQuotedMessage];
|
||||||
}
|
}
|
||||||
OWSAssert(quotedMessage);
|
OWSAssert(quotedMessage);
|
||||||
|
|
|
@ -479,11 +479,11 @@ class MediaPageViewController: UIPageViewController, UIPageViewControllerDataSou
|
||||||
self.uiDatabaseConnection.read { transaction in
|
self.uiDatabaseConnection.read { transaction in
|
||||||
let message = galleryItem.message
|
let message = galleryItem.message
|
||||||
let thread = message.thread(with: transaction)
|
let thread = message.thread(with: transaction)
|
||||||
let conversationLayoutInfo = ConversationLayoutInfo(thread: thread)
|
let conversationStyle = ConversationStyle(thread: thread)
|
||||||
fetchedItem = ConversationViewItem(interaction: message,
|
fetchedItem = ConversationViewItem(interaction: message,
|
||||||
isGroupThread: thread.isGroupThread(),
|
isGroupThread: thread.isGroupThread(),
|
||||||
transaction: transaction,
|
transaction: transaction,
|
||||||
layoutInfo: conversationLayoutInfo)
|
conversationStyle: conversationStyle)
|
||||||
}
|
}
|
||||||
|
|
||||||
guard let viewItem = fetchedItem else {
|
guard let viewItem = fetchedItem else {
|
||||||
|
|
|
@ -40,7 +40,7 @@ class MessageDetailViewController: OWSViewController, MediaGalleryDataSourceDele
|
||||||
var attachmentStream: TSAttachmentStream?
|
var attachmentStream: TSAttachmentStream?
|
||||||
var messageBody: String?
|
var messageBody: String?
|
||||||
|
|
||||||
var conversationLayoutInfo: ConversationLayoutInfo
|
var conversationStyle: ConversationStyle
|
||||||
|
|
||||||
private var contactShareViewHelper: ContactShareViewHelper
|
private var contactShareViewHelper: ContactShareViewHelper
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ class MessageDetailViewController: OWSViewController, MediaGalleryDataSourceDele
|
||||||
self.mode = mode
|
self.mode = mode
|
||||||
self.uiDatabaseConnection = OWSPrimaryStorage.shared().newDatabaseConnection()
|
self.uiDatabaseConnection = OWSPrimaryStorage.shared().newDatabaseConnection()
|
||||||
self.contactShareViewHelper = ContactShareViewHelper(contactsManager: contactsManager)
|
self.contactShareViewHelper = ContactShareViewHelper(contactsManager: contactsManager)
|
||||||
self.conversationLayoutInfo = ConversationLayoutInfo(thread: thread)
|
self.conversationStyle = ConversationStyle(thread: thread)
|
||||||
|
|
||||||
super.init(nibName: nil, bundle: nil)
|
super.init(nibName: nil, bundle: nil)
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ class MessageDetailViewController: OWSViewController, MediaGalleryDataSourceDele
|
||||||
self.uiDatabaseConnection.beginLongLivedReadTransaction()
|
self.uiDatabaseConnection.beginLongLivedReadTransaction()
|
||||||
updateDBConnectionAndMessageToLatest()
|
updateDBConnectionAndMessageToLatest()
|
||||||
|
|
||||||
self.conversationLayoutInfo.viewWidth = view.width()
|
self.conversationStyle.viewWidth = view.width()
|
||||||
|
|
||||||
self.navigationItem.title = NSLocalizedString("MESSAGE_METADATA_VIEW_TITLE",
|
self.navigationItem.title = NSLocalizedString("MESSAGE_METADATA_VIEW_TITLE",
|
||||||
comment: "Title for the 'message metadata' view.")
|
comment: "Title for the 'message metadata' view.")
|
||||||
|
@ -94,7 +94,7 @@ class MessageDetailViewController: OWSViewController, MediaGalleryDataSourceDele
|
||||||
|
|
||||||
super.viewWillTransition(to: size, with: coordinator)
|
super.viewWillTransition(to: size, with: coordinator)
|
||||||
|
|
||||||
self.conversationLayoutInfo.viewWidth = size.width
|
self.conversationStyle.viewWidth = size.width
|
||||||
}
|
}
|
||||||
|
|
||||||
override func viewWillAppear(_ animated: Bool) {
|
override func viewWillAppear(_ animated: Bool) {
|
||||||
|
@ -345,7 +345,7 @@ class MessageDetailViewController: OWSViewController, MediaGalleryDataSourceDele
|
||||||
self.messageBubbleView = messageBubbleView
|
self.messageBubbleView = messageBubbleView
|
||||||
messageBubbleView.viewItem = viewItem
|
messageBubbleView.viewItem = viewItem
|
||||||
messageBubbleView.cellMediaCache = NSCache()
|
messageBubbleView.cellMediaCache = NSCache()
|
||||||
messageBubbleView.layoutInfo = conversationLayoutInfo
|
messageBubbleView.conversationStyle = conversationStyle
|
||||||
messageBubbleView.configureViews()
|
messageBubbleView.configureViews()
|
||||||
messageBubbleView.loadContent()
|
messageBubbleView.loadContent()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue