Merge pull request #5221 from vector-im/ismail/5095_thread_search_results

Thread search results
This commit is contained in:
ismailgulek 2021-12-16 13:57:45 +03:00 committed by GitHub
commit 7ed7896ece
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 40 additions and 93 deletions

View file

@ -64,27 +64,6 @@
</objects>
<point key="canvasLocation" x="5047" y="-1437"/>
</scene>
<!--Room Context Timeline-->
<scene sceneID="Htr-h8-baq">
<objects>
<viewController title="Room Context Timeline" hidesBottomBarWhenPushed="YES" id="Too-LV-OLW" customClass="RoomViewController" sceneMemberID="viewController">
<navigationItem key="navigationItem" id="yLe-Hk-Sol">
<nil key="title"/>
<view key="titleView" contentMode="scaleToFill" id="djN-zB-Vni" userLabel="Room title view container">
<rect key="frame" x="8" y="2" width="312" height="40"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
</view>
</navigationItem>
<connections>
<outlet property="roomTitleViewContainer" destination="djN-zB-Vni" id="VQG-Mp-hSa"/>
<segue destination="gkO-rP-nGK" kind="show" identifier="showContactDetails" id="ziz-Xl-QVg"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="Yjg-uP-Hcy" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="3326" y="-1299"/>
</scene>
<!--Room Search View Controller-->
<scene sceneID="rUg-1s-vHX">
<objects>
@ -98,9 +77,6 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</view>
<connections>
<segue destination="Too-LV-OLW" kind="show" identifier="showTimeline" id="P1V-0d-mYL"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="bK5-DX-KSF" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
@ -543,10 +519,10 @@
</objects>
<point key="canvasLocation" x="374" y="449"/>
</scene>
<!--Room-->
<!--Thread-->
<scene sceneID="Opl-gU-pwm">
<objects>
<viewController storyboardIdentifier="ThreadViewControllerStoryboardId" title="Room" hidesBottomBarWhenPushed="YES" id="R2h-H9-hdJ" customClass="ThreadViewController" customModule="Riot" customModuleProvider="target" sceneMemberID="viewController">
<viewController storyboardIdentifier="ThreadViewControllerStoryboardId" title="Room" hidesBottomBarWhenPushed="YES" id="R2h-H9-hdJ" userLabel="Thread" customClass="ThreadViewController" customModule="Riot" customModuleProvider="target" sceneMemberID="viewController">
<navigationItem key="navigationItem" id="TFF-nx-BSb">
<nil key="title"/>
<view key="titleView" contentMode="scaleToFill" id="e4J-vI-jzo" userLabel="Room title view container">
@ -566,7 +542,6 @@
</scenes>
<inferredMetricsTieBreakers>
<segue reference="Tfl-tq-LQp"/>
<segue reference="f5u-Y1-7nt"/>
</inferredMetricsTieBreakers>
<resources>
<image name="launch_screen_logo" width="240" height="240"/>

View file

@ -18,9 +18,4 @@
@interface RoomFilesSearchViewController : MXKSearchViewController
/**
The event selected in the search results
*/
@property (nonatomic, readonly) MXEvent *selectedEvent;
@end

View file

@ -173,18 +173,16 @@
{
// Data in the cells are actually Vector RoomBubbleCellData
FilesSearchCellData *cellData = (FilesSearchCellData*)[self.dataSource cellDataAtIndex:indexPath.row];
_selectedEvent = cellData.searchResult.result;
MXEvent *event = cellData.searchResult.result;
RoomSearchViewController *roomSearchViewController = (RoomSearchViewController*)self.parentViewController;
// Hide the keyboard handled by the search text input which belongs to RoomSearchViewController
[((RoomSearchViewController*)self.parentViewController).searchBar resignFirstResponder];
[roomSearchViewController resignFirstResponder];
[tableView deselectRowAtIndexPath:indexPath animated:YES];
// Make the RoomSearchViewController (that contains this VC) open the RoomViewController
[self.parentViewController performSegueWithIdentifier:@"showTimeline" sender:self];
// Reset the selected event. RoomSearchViewController got it when here
_selectedEvent = nil;
[roomSearchViewController selectEvent:event];
}
@end

View file

@ -20,9 +20,4 @@
@interface RoomMessagesSearchViewController : MXKSearchViewController
/**
The event selected in the search results
*/
@property (nonatomic, readonly) MXEvent *selectedEvent;
@end

View file

@ -209,18 +209,16 @@
{
// Data in the cells are actually Vector RoomBubbleCellData
RoomBubbleCellData *cellData = (RoomBubbleCellData*)[self.dataSource cellDataAtIndex:indexPath.row];
_selectedEvent = cellData.bubbleComponents[0].event;
MXEvent *event = cellData.bubbleComponents[0].event;
RoomSearchViewController *roomSearchViewController = (RoomSearchViewController*)self.parentViewController;
// Hide the keyboard handled by the search text input which belongs to RoomSearchViewController
[((RoomSearchViewController*)self.parentViewController).searchBar resignFirstResponder];
[roomSearchViewController.searchBar resignFirstResponder];
[tableView deselectRowAtIndexPath:indexPath animated:YES];
// Make the RoomSearchViewController (that contains this VC) open the RoomViewController
[self.parentViewController performSegueWithIdentifier:@"showTimeline" sender:self];
// Reset the selected event. RoomSearchViewController got it when here
_selectedEvent = nil;
[roomSearchViewController selectEvent:event];
}
@end

View file

@ -27,4 +27,6 @@
+ (instancetype)instantiate;
- (void)selectEvent:(MXEvent *)event;
@end

View file

@ -143,6 +143,31 @@
return ThemeService.shared.theme.statusBarStyle;
}
- (void)selectEvent:(MXEvent *)event
{
ThreadParameters *threadParameters = nil;
if (event.threadId)
{
threadParameters = [[ThreadParameters alloc] initWithThreadId:event.threadId
stackRoomScreen:NO];
}
else if ([self.mainSession.threadingService isEventThreadRoot:event])
{
threadParameters = [[ThreadParameters alloc] initWithThreadId:event.eventId
stackRoomScreen:NO];
}
ScreenPresentationParameters *screenParameters = [[ScreenPresentationParameters alloc] initWithRestoreInitialDisplay:NO
stackAboveVisibleViews:YES];
RoomNavigationParameters *parameters = [[RoomNavigationParameters alloc] initWithRoomId:event.roomId
eventId:event.eventId
mxSession:self.mainSession
threadParameters:threadParameters
presentationParameters:screenParameters];
[[LegacyAppDelegate theDelegate] showRoomWithParameters:parameters];
}
#pragma mark -
- (void)setRoomDataSource:(MXKRoomDataSource *)roomDataSource
@ -294,48 +319,6 @@
[self updateSearch];
}
#pragma mark - Navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
[super prepareForSegue:segue sender:sender];
if ([[segue identifier] isEqualToString:@"showTimeline"])
{
// Check whether an event has been selected from messages or files search tab
MXEvent *selectedSearchEvent = messagesSearchViewController.selectedEvent;
MXSession *selectedSearchEventSession = messagesSearchDataSource.mxSession;
if (!selectedSearchEvent)
{
selectedSearchEvent = filesSearchViewController.selectedEvent;
selectedSearchEventSession = filesSearchDataSource.mxSession;
}
if (selectedSearchEvent)
{
RoomViewController *roomViewController = segue.destinationViewController;
[RoomDataSource loadRoomDataSourceWithRoomId:selectedSearchEvent.roomId
initialEventId:selectedSearchEvent.eventId
threadId:selectedSearchEvent.threadId
andMatrixSession:selectedSearchEventSession
onComplete:^(RoomDataSource *roomDataSource) {
[roomDataSource finalizeInitialization];
roomDataSource.markTimelineInitialEvent = YES;
[roomViewController displayRoom:roomDataSource];
roomViewController.hasRoomDataSourceOwnership = YES;
roomViewController.navigationItem.leftItemsSupplementBackButton = YES;
}];
}
// Hide back button title
self.navigationItem.backBarButtonItem =[[UIBarButtonItem alloc] initWithTitle:@"" style:UIBarButtonItemStylePlain target:nil action:nil];
}
}
#pragma mark - Search
// Update search results under the currently selected tab

1
changelog.d/5095.change Normal file
View file

@ -0,0 +1 @@
Search: Navigate to thread view for search results in threads.