mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-25 19:10:49 +02:00
RoomBubbleCellData: Add a property to show or hide timestamp for selected component.
This commit is contained in:
@@ -35,6 +35,10 @@ typedef NS_ENUM(NSInteger, RoomBubbleCellDataTag)
|
||||
*/
|
||||
@property(nonatomic) BOOL containsLastMessage;
|
||||
|
||||
/**
|
||||
Indicate true to display the timestamp of the selected component.
|
||||
*/
|
||||
@property(nonatomic) BOOL showTimestampForSelectedComponent;
|
||||
|
||||
/**
|
||||
The event id of the current selected event inside the bubble. Default is nil.
|
||||
|
||||
@@ -199,7 +199,7 @@ static NSAttributedString *readReceiptVerticalWhitespace = nil;
|
||||
}
|
||||
|
||||
// Check whether the timestamp is displayed for this component, and check whether a vertical whitespace is required
|
||||
if ((selectedComponentIndex == index || lastMessageIndex == index) && (self.shouldHideSenderInformation || self.shouldHideSenderName))
|
||||
if (((selectedComponentIndex == index && self.showTimestampForSelectedComponent) || lastMessageIndex == index) && (self.shouldHideSenderInformation || self.shouldHideSenderName))
|
||||
{
|
||||
currentAttributedTextMsg = [[NSMutableAttributedString alloc] initWithAttributedString:[RoomBubbleCellData timestampVerticalWhitespace]];
|
||||
[currentAttributedTextMsg appendAttributedString:componentString];
|
||||
@@ -238,7 +238,7 @@ static NSAttributedString *readReceiptVerticalWhitespace = nil;
|
||||
}
|
||||
|
||||
// Check whether the timestamp is displayed
|
||||
if (selectedComponentIndex == index || lastMessageIndex == index)
|
||||
if ((selectedComponentIndex == index && self.showTimestampForSelectedComponent) || lastMessageIndex == index)
|
||||
{
|
||||
[currentAttributedTextMsg appendAttributedString:[RoomBubbleCellData timestampVerticalWhitespace]];
|
||||
}
|
||||
@@ -294,7 +294,7 @@ static NSAttributedString *readReceiptVerticalWhitespace = nil;
|
||||
NSInteger lastMessageIndex = self.containsLastMessage ? self.mostRecentComponentIndex : NSNotFound;
|
||||
|
||||
// Check whether the timestamp is displayed for this first component, and check whether a vertical whitespace is required
|
||||
if ((selectedComponentIndex == index || lastMessageIndex == index) && (self.shouldHideSenderInformation || self.shouldHideSenderName))
|
||||
if (((selectedComponentIndex == index && self.showTimestampForSelectedComponent) || lastMessageIndex == index) && (self.shouldHideSenderInformation || self.shouldHideSenderName))
|
||||
{
|
||||
attributedString = [[NSMutableAttributedString alloc] initWithAttributedString:[RoomBubbleCellData timestampVerticalWhitespace]];
|
||||
[attributedString appendAttributedString:component.attributedTextMessage];
|
||||
@@ -322,7 +322,7 @@ static NSAttributedString *readReceiptVerticalWhitespace = nil;
|
||||
{
|
||||
// Prepare its attributed string by considering potential vertical margin required to display timestamp.
|
||||
NSAttributedString *componentString;
|
||||
if (selectedComponentIndex == index || lastMessageIndex == index)
|
||||
if ((selectedComponentIndex == index && self.showTimestampForSelectedComponent) || lastMessageIndex == index)
|
||||
{
|
||||
NSMutableAttributedString *componentAttributedString = [[NSMutableAttributedString alloc] initWithAttributedString:[RoomBubbleCellData timestampVerticalWhitespace]];
|
||||
[componentAttributedString appendAttributedString:component.attributedTextMessage];
|
||||
|
||||
Reference in New Issue
Block a user