RoomBubbleCellData: Add a method to get first visible component index.

This commit is contained in:
SBiOSoftWhare
2019-07-08 18:34:08 +02:00
parent 2674062905
commit 16340da07d
2 changed files with 29 additions and 0 deletions
@@ -277,6 +277,31 @@ static NSAttributedString *timestampVerticalWhitespace = nil;
return currentAttributedTextMsg;
}
- (NSInteger)firstVisibleComponentIndex
{
__block NSInteger firstVisibleComponentIndex = NSNotFound;
if (self.attachment && self.bubbleComponents.count)
{
firstVisibleComponentIndex = 0;
}
else
{
[self.bubbleComponents enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
MXKRoomBubbleComponent *component = (MXKRoomBubbleComponent*)obj;
if (component.attributedTextMessage)
{
firstVisibleComponentIndex = idx;
*stop = YES;
}
}];
}
return firstVisibleComponentIndex;
}
- (void)refreshBubbleComponentsPosition
{
// CAUTION: This method must be called on the main thread.