mirror of
https://github.com/vector-im/element-ios.git
synced 2024-09-29 15:52:40 +00:00
Merge pull request #5221 from vector-im/ismail/5095_thread_search_results
Thread search results
This commit is contained in:
commit
7ed7896ece
8 changed files with 40 additions and 93 deletions
|
@ -64,27 +64,6 @@
|
||||||
</objects>
|
</objects>
|
||||||
<point key="canvasLocation" x="5047" y="-1437"/>
|
<point key="canvasLocation" x="5047" y="-1437"/>
|
||||||
</scene>
|
</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-->
|
<!--Room Search View Controller-->
|
||||||
<scene sceneID="rUg-1s-vHX">
|
<scene sceneID="rUg-1s-vHX">
|
||||||
<objects>
|
<objects>
|
||||||
|
@ -98,9 +77,6 @@
|
||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||||
</view>
|
</view>
|
||||||
<connections>
|
|
||||||
<segue destination="Too-LV-OLW" kind="show" identifier="showTimeline" id="P1V-0d-mYL"/>
|
|
||||||
</connections>
|
|
||||||
</viewController>
|
</viewController>
|
||||||
<placeholder placeholderIdentifier="IBFirstResponder" id="bK5-DX-KSF" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
<placeholder placeholderIdentifier="IBFirstResponder" id="bK5-DX-KSF" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||||
</objects>
|
</objects>
|
||||||
|
@ -543,10 +519,10 @@
|
||||||
</objects>
|
</objects>
|
||||||
<point key="canvasLocation" x="374" y="449"/>
|
<point key="canvasLocation" x="374" y="449"/>
|
||||||
</scene>
|
</scene>
|
||||||
<!--Room-->
|
<!--Thread-->
|
||||||
<scene sceneID="Opl-gU-pwm">
|
<scene sceneID="Opl-gU-pwm">
|
||||||
<objects>
|
<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">
|
<navigationItem key="navigationItem" id="TFF-nx-BSb">
|
||||||
<nil key="title"/>
|
<nil key="title"/>
|
||||||
<view key="titleView" contentMode="scaleToFill" id="e4J-vI-jzo" userLabel="Room title view container">
|
<view key="titleView" contentMode="scaleToFill" id="e4J-vI-jzo" userLabel="Room title view container">
|
||||||
|
@ -566,7 +542,6 @@
|
||||||
</scenes>
|
</scenes>
|
||||||
<inferredMetricsTieBreakers>
|
<inferredMetricsTieBreakers>
|
||||||
<segue reference="Tfl-tq-LQp"/>
|
<segue reference="Tfl-tq-LQp"/>
|
||||||
<segue reference="f5u-Y1-7nt"/>
|
|
||||||
</inferredMetricsTieBreakers>
|
</inferredMetricsTieBreakers>
|
||||||
<resources>
|
<resources>
|
||||||
<image name="launch_screen_logo" width="240" height="240"/>
|
<image name="launch_screen_logo" width="240" height="240"/>
|
||||||
|
|
|
@ -18,9 +18,4 @@
|
||||||
|
|
||||||
@interface RoomFilesSearchViewController : MXKSearchViewController
|
@interface RoomFilesSearchViewController : MXKSearchViewController
|
||||||
|
|
||||||
/**
|
|
||||||
The event selected in the search results
|
|
||||||
*/
|
|
||||||
@property (nonatomic, readonly) MXEvent *selectedEvent;
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -173,18 +173,16 @@
|
||||||
{
|
{
|
||||||
// Data in the cells are actually Vector RoomBubbleCellData
|
// Data in the cells are actually Vector RoomBubbleCellData
|
||||||
FilesSearchCellData *cellData = (FilesSearchCellData*)[self.dataSource cellDataAtIndex:indexPath.row];
|
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
|
// 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];
|
[tableView deselectRowAtIndexPath:indexPath animated:YES];
|
||||||
|
|
||||||
// Make the RoomSearchViewController (that contains this VC) open the RoomViewController
|
[roomSearchViewController selectEvent:event];
|
||||||
[self.parentViewController performSegueWithIdentifier:@"showTimeline" sender:self];
|
|
||||||
|
|
||||||
// Reset the selected event. RoomSearchViewController got it when here
|
|
||||||
_selectedEvent = nil;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -20,9 +20,4 @@
|
||||||
|
|
||||||
@interface RoomMessagesSearchViewController : MXKSearchViewController
|
@interface RoomMessagesSearchViewController : MXKSearchViewController
|
||||||
|
|
||||||
/**
|
|
||||||
The event selected in the search results
|
|
||||||
*/
|
|
||||||
@property (nonatomic, readonly) MXEvent *selectedEvent;
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -209,18 +209,16 @@
|
||||||
{
|
{
|
||||||
// Data in the cells are actually Vector RoomBubbleCellData
|
// Data in the cells are actually Vector RoomBubbleCellData
|
||||||
RoomBubbleCellData *cellData = (RoomBubbleCellData*)[self.dataSource cellDataAtIndex:indexPath.row];
|
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
|
// 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];
|
[tableView deselectRowAtIndexPath:indexPath animated:YES];
|
||||||
|
|
||||||
// Make the RoomSearchViewController (that contains this VC) open the RoomViewController
|
[roomSearchViewController selectEvent:event];
|
||||||
[self.parentViewController performSegueWithIdentifier:@"showTimeline" sender:self];
|
|
||||||
|
|
||||||
// Reset the selected event. RoomSearchViewController got it when here
|
|
||||||
_selectedEvent = nil;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -27,4 +27,6 @@
|
||||||
|
|
||||||
+ (instancetype)instantiate;
|
+ (instancetype)instantiate;
|
||||||
|
|
||||||
|
- (void)selectEvent:(MXEvent *)event;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -143,6 +143,31 @@
|
||||||
return ThemeService.shared.theme.statusBarStyle;
|
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 -
|
#pragma mark -
|
||||||
|
|
||||||
- (void)setRoomDataSource:(MXKRoomDataSource *)roomDataSource
|
- (void)setRoomDataSource:(MXKRoomDataSource *)roomDataSource
|
||||||
|
@ -294,48 +319,6 @@
|
||||||
[self updateSearch];
|
[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
|
#pragma mark - Search
|
||||||
|
|
||||||
// Update search results under the currently selected tab
|
// Update search results under the currently selected tab
|
||||||
|
|
1
changelog.d/5095.change
Normal file
1
changelog.d/5095.change
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Search: Navigate to thread view for search results in threads.
|
Loading…
Reference in a new issue