Public rooms search: Start

This commit is contained in:
manuroe
2015-12-16 16:29:34 +01:00
parent a321ffc9f7
commit 2082bcc7e0
6 changed files with 153 additions and 22 deletions
+1
View File
@@ -61,6 +61,7 @@
"room_creation_make_private" = "Make private";
// Room recents
"room_recents_directory" = "DIRECTORY";
"room_recents_favourites" = "FAVORITES";
"room_recents_conversations" = "CONVERSATIONS";
"room_recents_low_priority" = "LOW PRIORITY";
+33 -13
View File
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9060" systemVersion="15B42" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="H1p-Uh-vWS">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9531" systemVersion="15B42" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="H1p-Uh-vWS">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9051"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9529"/>
</dependencies>
<scenes>
<!--RecentsNav-->
@@ -11,7 +11,6 @@
<navigationController title="Recents" id="RMx-3f-FxP" userLabel="RecentsNav" sceneMemberID="viewController">
<navigationBar key="navigationBar" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" id="Pmd-2v-anx">
<autoresizingMask key="autoresizingMask"/>
<animations/>
</navigationBar>
<connections>
<segue destination="Zhm-Yz-mrT" kind="relationship" relationship="rootViewController" id="OEv-Oh-v9s"/>
@@ -30,7 +29,6 @@
<view key="titleView" contentMode="scaleToFill" id="aas-th-FW1" userLabel="Room title view container">
<rect key="frame" x="60" y="2" width="480" height="40"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<animations/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
</view>
<barButtonItem key="rightBarButtonItem" systemItem="search" id="wyR-qv-IxC" userLabel="Menu Bar Button Item"/>
@@ -63,7 +61,6 @@
<view key="view" contentMode="scaleToFill" id="wIi-Yi-2pi">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<animations/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</view>
</viewController>
@@ -78,7 +75,6 @@
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" keyboardDismissMode="interactive" dataMode="prototypes" style="grouped" separatorStyle="default" rowHeight="44" sectionHeaderHeight="10" sectionFooterHeight="10" id="etG-ZU-b2r">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<animations/>
<color key="backgroundColor" red="0.93725490196078431" green="0.93725490196078431" blue="0.95686274509803926" alpha="1" colorSpace="calibratedRGB"/>
<connections>
<outlet property="dataSource" destination="1TJ-Md-cjN" id="Lqt-w3-NjQ"/>
@@ -137,7 +133,6 @@
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" bounces="NO" alwaysBounceVertical="YES" dataMode="prototypes" style="grouped" separatorStyle="none" rowHeight="44" sectionHeaderHeight="20" sectionFooterHeight="10" id="NUY-Lz-fh7">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<animations/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<connections>
<outlet property="dataSource" destination="Cbg-8m-X8i" id="SOv-BE-z4t"/>
@@ -164,7 +159,6 @@
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" bounces="NO" alwaysBounceVertical="YES" dataMode="prototypes" style="grouped" separatorStyle="none" rowHeight="44" sectionHeaderHeight="20" sectionFooterHeight="10" id="zDo-5c-N7t">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<animations/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<connections>
<outlet property="dataSource" destination="ora-EF-y8t" id="h2d-VL-Bb2"/>
@@ -187,7 +181,6 @@
<view key="view" contentMode="scaleToFill" id="jgV-fC-DUP">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<animations/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</view>
<navigationItem key="navigationItem" id="lkL-Yi-y5i">
@@ -208,19 +201,47 @@
<segue destination="cLJ-Zo-cIe" kind="presentation" identifier="presentRoomCreationStep1" id="EwV-tH-4jl"/>
<segue destination="vC3-pB-5Vb" kind="showDetail" identifier="showDetails" id="agy-3r-khl"/>
<segue destination="ZlD-EU-ncw" kind="presentation" identifier="showAuth" id="vfC-8C-AsT"/>
<segue destination="dP6-5F-5s0" kind="show" identifier="showDirectory" id="hvq-zV-OB7"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="pF2-9z-Wl6" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1364" y="-2374"/>
</scene>
<!--Directory View Controller-->
<scene sceneID="zQD-eP-aY2">
<objects>
<tableViewController id="dP6-5F-5s0" customClass="DirectoryViewController" sceneMemberID="viewController">
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" id="JIN-S2-qUn">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="sgB-0b-hbe">
<rect key="frame" x="0.0" y="92" width="600" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="sgB-0b-hbe" id="29k-1a-GRN">
<rect key="frame" x="0.0" y="0.0" width="600" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
</tableViewCellContentView>
</tableViewCell>
</prototypes>
<connections>
<outlet property="dataSource" destination="dP6-5F-5s0" id="977-CD-fdo"/>
<outlet property="delegate" destination="dP6-5F-5s0" id="ycx-Nj-kqv"/>
</connections>
</tableView>
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="yn2-Xd-dn4" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="2364" y="-2374"/>
</scene>
<!--RoomNav-->
<scene sceneID="r7l-gg-dq7">
<objects>
<navigationController title="RoomNav" id="vC3-pB-5Vb" sceneMemberID="viewController">
<navigationBar key="navigationBar" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" id="DjV-YW-jjY">
<autoresizingMask key="autoresizingMask"/>
<animations/>
</navigationBar>
<connections>
<segue destination="msb-ol-2LB" kind="relationship" relationship="rootViewController" id="5tu-jh-ZP6"/>
@@ -238,7 +259,6 @@
<navigationBar key="navigationBar" contentMode="scaleToFill" id="lWd-xy-Xa1">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<animations/>
</navigationBar>
<nil name="viewControllers"/>
<connections>
@@ -251,8 +271,8 @@
</scene>
</scenes>
<resources>
<image name="search_icon.png" width="11" height="11"/>
<image name="settings_icon.png" width="22" height="22"/>
<image name="search_icon.png" width="22" height="22"/>
<image name="settings_icon.png" width="24" height="24"/>
</resources>
<inferredMetricsTieBreakers>
<segue reference="agy-3r-khl"/>
+47 -9
View File
@@ -24,11 +24,13 @@
@interface RecentsDataSource()
{
NSMutableArray* directoryCellDataArray; // Used only to display search among public rooms
NSMutableArray* invitesCellDataArray;
NSMutableArray* favoriteCellDataArray;
NSMutableArray* conversationCellDataArray;
NSMutableArray* lowPriorityCellDataArray;
NSInteger directorySection;
NSInteger invitesSection;
NSInteger favoritesSection;
NSInteger conversationSection;
@@ -54,7 +56,8 @@
favoriteCellDataArray = [[NSMutableArray alloc] init];
conversationCellDataArray = [[NSMutableArray alloc] init];
lowPriorityCellDataArray = [[NSMutableArray alloc] init];
directorySection = -1;
invitesSection = -1;
favoritesSection = -1;
conversationSection = -1;
@@ -138,7 +141,7 @@
*/
- (CGFloat)heightForHeaderInSection:(NSInteger)section
{
if ((section == invitesSection) || (section == favoritesSection) || (section == conversationSection) || (section == lowPrioritySection))
if ((section == directorySection) || (section == invitesSection) || (section == favoritesSection) || (section == conversationSection) || (section == lowPrioritySection))
{
return 30.0f;
}
@@ -170,8 +173,12 @@
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
NSUInteger count = 0;
if (section == favoritesSection)
if (section == directorySection)
{
count = directoryCellDataArray.count;
}
else if (section == favoritesSection)
{
count = favoriteCellDataArray.count;
}
@@ -205,13 +212,17 @@
{
// add multi accounts section management
if ((section == favoritesSection) || (section == conversationSection) || (section == lowPrioritySection) || (section == invitesSection))
if ((section == directorySection) || (section == favoritesSection) || (section == conversationSection) || (section == lowPrioritySection) || (section == invitesSection))
{
UILabel* label = [[UILabel alloc] initWithFrame:frame];
NSString* text = @"";
if (section == favoritesSection)
if (section == directorySection)
{
text = NSLocalizedStringFromTable(@"room_recents_directory", @"Vector", nil);
}
else if (section == favoritesSection)
{
text = NSLocalizedStringFromTable(@"room_recents_favourites", @"Vector", nil);
}
@@ -323,7 +334,11 @@
}
}
if (section == favoritesSection)
if (section == directorySection)
{
cellData = [directoryCellDataArray objectAtIndex:row];
}
else if (section == favoritesSection)
{
cellData = [favoriteCellDataArray objectAtIndex:row];
}
@@ -458,7 +473,7 @@
conversationCellDataArray = [[NSMutableArray alloc] init];
lowPriorityCellDataArray = [[NSMutableArray alloc] init];
favoritesSection = conversationSection = lowPrioritySection = invitesSection = -1;
directorySection = favoritesSection = conversationSection = lowPrioritySection = invitesSection = -1;
sectionsCount = 0;
if (displayedRecentsDataSourceArray.count > 0)
@@ -510,7 +525,14 @@
}
int sectionIndex = 0;
[directoryCellDataArray removeObject:[NSNull null]];
if (directoryCellDataArray.count > 0)
{
directorySection = sectionIndex;
sectionIndex++;
}
[invitesCellDataArray removeObject:[NSNull null]];
if (invitesCellDataArray.count > 0)
{
@@ -576,6 +598,22 @@
[super destroy];
}
#pragma mark - Override MXKRecentsDataSource
- (void)searchWithPatterns:(NSArray *)patternsList
{
[super searchWithPatterns:patternsList];
if (patternsList)
{
// Search among public rooms
//[sel]
}
else
{
[directoryCellDataArray removeAllObjects];
}
}
#pragma mark - drag and drop managemenent
@@ -0,0 +1,21 @@
/*
Copyright 2015 OpenMarket Ltd
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#import <MatrixKit/MatrixKit.h>
@interface DirectoryViewController : MXKTableViewController
@end
@@ -0,0 +1,45 @@
/*
Copyright 2015 OpenMarket Ltd
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#import "DirectoryViewController.h"
@interface DirectoryViewController ()
@end
@implementation DirectoryViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end