Merge pull request #5565 from vector-im/ismail/5562_search_aggregations

Search results bundled aggregations
This commit is contained in:
ismailgulek
2022-02-15 16:53:37 +03:00
committed by GitHub
12 changed files with 42 additions and 19 deletions
@@ -160,7 +160,7 @@
threadParameters = [[ThreadParameters alloc] initWithThreadId:event.threadId
stackRoomScreen:NO];
}
else if ([self.mainSession.threadingService isEventThreadRoot:event])
else if (event.unsignedData.relations.thread || [self.mainSession.threadingService isEventThreadRoot:event])
{
threadParameters = [[ThreadParameters alloc] initWithThreadId:event.eventId
stackRoomScreen:NO];
@@ -89,6 +89,10 @@
{
continueBlock();
}
else if (result.result.unsignedData.relations.thread)
{
continueBlock();
}
else if (room)
{
[room liveTimeline:^(id<MXEventTimeline> liveTimeline) {
@@ -164,8 +168,9 @@
{
if (cellData.hasThreadRoot)
{
MXThread *thread = cellData.bubbleComponents.firstObject.thread;
ThreadSummaryView *threadSummaryView = [[ThreadSummaryView alloc] initWithThread:thread];
id<MXThreadProtocol> thread = cellData.bubbleComponents.firstObject.thread;
ThreadSummaryView *threadSummaryView = [[ThreadSummaryView alloc] initWithThread:thread
session:self.mxSession];
[bubbleCell.tmpSubviews addObject:threadSummaryView];
threadSummaryView.translatesAutoresizingMaskIntoConstraints = NO;
@@ -167,7 +167,7 @@
threadParameters = [[ThreadParameters alloc] initWithThreadId:event.threadId
stackRoomScreen:NO];
}
else if ([self.mainSession.threadingService isEventThreadRoot:event])
else if (event.unsignedData.relations.thread || [self.mainSession.threadingService isEventThreadRoot:event])
{
threadParameters = [[ThreadParameters alloc] initWithThreadId:event.eventId
stackRoomScreen:NO];
@@ -19,7 +19,7 @@
#import "MXKEventFormatter.h"
#import "MXKURLPreviewDataProtocol.h"
@class MXThread;
@protocol MXThreadProtocol;
/**
Flags to indicate if a fix is required at the display time.
@@ -108,7 +108,7 @@ typedef enum : NSUInteger {
/**
Thread for the bubble component. Should only exist for thread root events.
*/
@property (nonatomic, readonly) MXThread *thread;
@property (nonatomic, readonly) id<MXThreadProtocol> thread;
/**
Create a new `MXKRoomBubbleComponent` object based on a `MXEvent` instance.
@@ -22,7 +22,7 @@
@interface MXKRoomBubbleComponent ()
@property (nonatomic, readwrite) MXThread *thread;
@property (nonatomic, readwrite) id<MXThreadProtocol> thread;
@end
@@ -69,8 +69,17 @@
_showEncryptionBadge = [self shouldShowWarningBadgeForEvent:event roomState:(MXRoomState*)roomState session:session];
[self updateLinkWithRoomState:roomState];
self.thread = [session.threadingService threadWithId:event.eventId];
if (event.unsignedData.relations.thread)
{
self.thread = [[MXThreadModel alloc] initWithRootEvent:event
notificationCount:0
highlightCount:0];
}
else
{
self.thread = [session.threadingService threadWithId:event.eventId];
}
}
return self;
}
@@ -130,6 +130,6 @@
@param roomDataSource room data source instance
*/
- (void)roomDataSource:(RoomDataSource * _Nonnull)roomDataSource
didTapThread:(MXThread * _Nonnull)thread;
didTapThread:(id<MXThreadProtocol> _Nonnull)thread;
@end
@@ -466,7 +466,8 @@ const CGFloat kTypingCellHeight = 24;
// display thread summary view if the component has a thread in the room timeline
if (RiotSettings.shared.enableThreads && component.thread && !self.threadId)
{
threadSummaryView = [[ThreadSummaryView alloc] initWithThread:component.thread];
threadSummaryView = [[ThreadSummaryView alloc] initWithThread:component.thread
session:self.mxSession];
threadSummaryView.delegate = self;
threadSummaryView.tag = index;
+1 -1
View File
@@ -4283,7 +4283,7 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05;
[self updateTitleViewEncryptionDecoration];
}
- (void)roomDataSource:(RoomDataSource *)roomDataSource didTapThread:(MXThread *)thread
- (void)roomDataSource:(RoomDataSource *)roomDataSource didTapThread:(id<MXThreadProtocol>)thread
{
[self openThreadWithId:thread.id];
}
@@ -96,6 +96,10 @@
{
continueBlock();
}
else if (result.result.unsignedData.relations.thread)
{
continueBlock();
}
else
{
[roomDataSource.room liveTimeline:^(id<MXEventTimeline> liveTimeline) {
@@ -143,8 +147,9 @@
{
if (cellData.hasThreadRoot)
{
MXThread *thread = cellData.bubbleComponents.firstObject.thread;
ThreadSummaryView *threadSummaryView = [[ThreadSummaryView alloc] initWithThread:thread];
id<MXThreadProtocol> thread = cellData.bubbleComponents.firstObject.thread;
ThreadSummaryView *threadSummaryView = [[ThreadSummaryView alloc] initWithThread:thread
session:self.mxSession];
[bubbleCell.tmpSubviews addObject:threadSummaryView];
threadSummaryView.translatesAutoresizingMaskIntoConstraints = NO;
@@ -165,7 +165,7 @@
threadParameters = [[ThreadParameters alloc] initWithThreadId:event.threadId
stackRoomScreen:NO];
}
else if ([self.mainSession.threadingService isEventThreadRoot:event])
else if (event.unsignedData.relations.thread || [self.mainSession.threadingService isEventThreadRoot:event])
{
threadParameters = [[ThreadParameters alloc] initWithThreadId:event.eventId
stackRoomScreen:NO];
@@ -38,7 +38,8 @@ class ThreadSummaryView: UIView {
@IBOutlet private weak var lastMessageContentLabel: UILabel!
private var theme: Theme = ThemeService.shared().theme
private(set) var thread: MXThread?
private(set) var thread: MXThreadProtocol?
private weak var session: MXSession?
private lazy var tapGestureRecognizer: UITapGestureRecognizer = {
return UITapGestureRecognizer(target: self, action: #selector(tapped(_:)))
@@ -48,8 +49,9 @@ class ThreadSummaryView: UIView {
// MARK: - Setup
init(withThread thread: MXThread) {
init(withThread thread: MXThreadProtocol, session: MXSession) {
self.thread = thread
self.session = session
super.init(frame: CGRect(origin: .zero,
size: CGSize(width: Constants.viewDefaultWidth,
height: RoomBubbleCellLayout.threadSummaryViewHeight)))
@@ -59,7 +61,7 @@ class ThreadSummaryView: UIView {
translatesAutoresizingMaskIntoConstraints = false
}
static func contentViewHeight(forThread thread: MXThread?, fitting maxWidth: CGFloat) -> CGFloat {
static func contentViewHeight(forThread thread: MXThreadProtocol?, fitting maxWidth: CGFloat) -> CGFloat {
return RoomBubbleCellLayout.threadSummaryViewHeight
}
@@ -93,7 +95,7 @@ class ThreadSummaryView: UIView {
guard let thread = thread,
let lastMessage = thread.lastMessage,
let session = thread.session,
let session = session,
let eventFormatter = session.roomSummaryUpdateDelegate as? MXKEventFormatter,
let room = session.room(withRoomId: lastMessage.roomId) else {
lastMessageAvatarView.avatarImageView.image = nil
+1
View File
@@ -0,0 +1 @@
Search: Use bundled aggregations if provided.