mirror of
https://github.com/vector-im/element-ios.git
synced 2024-09-30 16:22:39 +00:00
Add ContactDetailsViewController : tapping on a contact thumbnail will open this new viewController if it contains some matrixIDs.
So, the user will be able to see - thumbnail - display name - list of matrix IDs + start a chat with one of them.
This commit is contained in:
parent
2bdf32e0bf
commit
3b07ae6910
8 changed files with 374 additions and 3 deletions
|
@ -17,6 +17,8 @@
|
|||
71193D381A6E49F000E59A9E /* MXCPhoneNumber.m in Sources */ = {isa = PBXBuildFile; fileRef = 71193D351A6E49F000E59A9E /* MXCPhoneNumber.m */; };
|
||||
71193D3B1A6E50EC00E59A9E /* ContactManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 71193D3A1A6E50EC00E59A9E /* ContactManager.m */; };
|
||||
71193D3E1A6E61AD00E59A9E /* SectionedContacts.m in Sources */ = {isa = PBXBuildFile; fileRef = 71193D3D1A6E61AD00E59A9E /* SectionedContacts.m */; };
|
||||
7176294C1A77F5D000927125 /* ContactDetailsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7176294B1A77F5D000927125 /* ContactDetailsViewController.m */; };
|
||||
7176294F1A77FED800927125 /* ContactDetailsTableCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 7176294E1A77FED800927125 /* ContactDetailsTableCell.m */; };
|
||||
71D2E4EC1A49814B000DE015 /* RoomMemberActionsCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 71D2E4EB1A49814B000DE015 /* RoomMemberActionsCell.m */; };
|
||||
71DB9DC11A495B6400504A09 /* MemberViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 71DB9DC01A495B6400504A09 /* MemberViewController.m */; };
|
||||
71E94A771A5C4020009F52E5 /* PieChartView.m in Sources */ = {isa = PBXBuildFile; fileRef = 71E94A761A5C4020009F52E5 /* PieChartView.m */; };
|
||||
|
@ -99,6 +101,10 @@
|
|||
71193D3A1A6E50EC00E59A9E /* ContactManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ContactManager.m; sourceTree = "<group>"; };
|
||||
71193D3C1A6E61AD00E59A9E /* SectionedContacts.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SectionedContacts.h; sourceTree = "<group>"; };
|
||||
71193D3D1A6E61AD00E59A9E /* SectionedContacts.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SectionedContacts.m; sourceTree = "<group>"; };
|
||||
7176294A1A77F5D000927125 /* ContactDetailsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContactDetailsViewController.h; sourceTree = "<group>"; };
|
||||
7176294B1A77F5D000927125 /* ContactDetailsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ContactDetailsViewController.m; sourceTree = "<group>"; };
|
||||
7176294D1A77FED800927125 /* ContactDetailsTableCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContactDetailsTableCell.h; sourceTree = "<group>"; };
|
||||
7176294E1A77FED800927125 /* ContactDetailsTableCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ContactDetailsTableCell.m; sourceTree = "<group>"; };
|
||||
71D2E4EA1A49814B000DE015 /* RoomMemberActionsCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RoomMemberActionsCell.h; sourceTree = "<group>"; };
|
||||
71D2E4EB1A49814B000DE015 /* RoomMemberActionsCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RoomMemberActionsCell.m; sourceTree = "<group>"; };
|
||||
71DB9DBF1A495B6400504A09 /* MemberViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MemberViewController.h; sourceTree = "<group>"; };
|
||||
|
@ -268,6 +274,8 @@
|
|||
F03EF5E919F171EB00A0EE52 /* ViewController */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
7176294A1A77F5D000927125 /* ContactDetailsViewController.h */,
|
||||
7176294B1A77F5D000927125 /* ContactDetailsViewController.m */,
|
||||
71193D271A6E3DC000E59A9E /* ContactsViewController.h */,
|
||||
71193D281A6E3DC000E59A9E /* ContactsViewController.m */,
|
||||
F03EF5EA19F171EB00A0EE52 /* HomeViewController.h */,
|
||||
|
@ -291,6 +299,8 @@
|
|||
F03EF5FC19F1762000A0EE52 /* View */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
7176294D1A77FED800927125 /* ContactDetailsTableCell.h */,
|
||||
7176294E1A77FED800927125 /* ContactDetailsTableCell.m */,
|
||||
71193D2A1A6E433900E59A9E /* ContactTableCell.h */,
|
||||
71193D2B1A6E433900E59A9E /* ContactTableCell.m */,
|
||||
F05237811A728A0A0079F3E0 /* MXCGrowingTextView.h */,
|
||||
|
@ -560,6 +570,7 @@
|
|||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
7176294F1A77FED800927125 /* ContactDetailsTableCell.m in Sources */,
|
||||
F04A8AD81A3B3DF4008AC915 /* RoomTitleView.m in Sources */,
|
||||
F07A80DB19DD9DE700B621A1 /* AppDelegate.m in Sources */,
|
||||
F052377C1A7289F00079F3E0 /* APNSHandler.m in Sources */,
|
||||
|
@ -594,6 +605,7 @@
|
|||
F00B5DB91A1B9BCE00EA1C8D /* MXCImageView.m in Sources */,
|
||||
F0D3C30C1A011EF10000D49E /* AppSettings.m in Sources */,
|
||||
F05237831A728A0A0079F3E0 /* MXCGrowingTextView.m in Sources */,
|
||||
7176294C1A77F5D000927125 /* ContactDetailsViewController.m in Sources */,
|
||||
F03EF5F719F171EB00A0EE52 /* LoginViewController.m in Sources */,
|
||||
F0D3C30F1A01330F0000D49E /* SettingsTableViewCell.m in Sources */,
|
||||
71D2E4EC1A49814B000DE015 /* RoomMemberActionsCell.m in Sources */,
|
||||
|
|
|
@ -532,7 +532,101 @@
|
|||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="94y-cU-qQD" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="1595" y="75"/>
|
||||
<point key="canvasLocation" x="1596" y="81"/>
|
||||
</scene>
|
||||
<!--Contact Details View Controller-->
|
||||
<scene sceneID="aUh-hv-QyM">
|
||||
<objects>
|
||||
<tableViewController storyboardIdentifier="ContailDetails" id="ro1-6w-v07" customClass="ContactDetailsViewController" sceneMemberID="viewController">
|
||||
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" id="KA5-Lt-UeW">
|
||||
<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"/>
|
||||
<view key="tableHeaderView" contentMode="scaleToFill" id="wHE-vJ-da4" userLabel="TableHeaderView">
|
||||
<rect key="frame" x="0.0" y="64" width="600" height="100"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<subviews>
|
||||
<button opaque="NO" contentMode="scaleAspectFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="TIr-2a-W5c" userLabel="PicturePickerButton">
|
||||
<rect key="frame" x="10" y="12" width="75" height="75"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="75" id="9l9-Va-Agc"/>
|
||||
<constraint firstAttribute="width" secondItem="TIr-2a-W5c" secondAttribute="height" multiplier="1:1" id="JeU-uN-1b1"/>
|
||||
<constraint firstAttribute="width" constant="75" id="dCr-jN-mEm"/>
|
||||
</constraints>
|
||||
<state key="normal" image="default-profile.png">
|
||||
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
|
||||
</state>
|
||||
</button>
|
||||
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" bounces="NO" scrollEnabled="NO" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" editable="NO" translatesAutoresizingMaskIntoConstraints="NO" id="xfL-PN-omV">
|
||||
<rect key="frame" x="95" y="-50" width="495" height="199"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<string key="text">Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda.</string>
|
||||
<fontDescription key="fontDescription" type="boldSystem" pointSize="17"/>
|
||||
<textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
|
||||
</textView>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="centerY" secondItem="xfL-PN-omV" secondAttribute="centerY" id="5Ms-9y-TtU"/>
|
||||
<constraint firstItem="xfL-PN-omV" firstAttribute="leading" secondItem="wHE-vJ-da4" secondAttribute="leading" constant="95" id="IRs-nX-c1a"/>
|
||||
<constraint firstAttribute="trailing" secondItem="xfL-PN-omV" secondAttribute="trailing" constant="10" id="QFM-cS-OBQ"/>
|
||||
<constraint firstAttribute="centerY" secondItem="TIr-2a-W5c" secondAttribute="centerY" id="RhC-Y8-xMS"/>
|
||||
<constraint firstItem="TIr-2a-W5c" firstAttribute="leading" secondItem="wHE-vJ-da4" secondAttribute="leading" constant="10" id="ZDO-K6-9fo"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<prototypes>
|
||||
<tableViewCell contentMode="scaleToFill" restorationIdentifier="ContactDetailsTableCell" selectionStyle="default" indentationWidth="10" reuseIdentifier="ContactDetailsTableCell" id="ey2-8d-bAQ" customClass="ContactDetailsTableCell">
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="ey2-8d-bAQ" id="ILF-Ln-sNi">
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="S9h-1k-m1C">
|
||||
<rect key="frame" x="8" y="12" width="504" height="19"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="kCn-d9-lc4">
|
||||
<rect key="frame" x="522" y="6" width="66" height="30"/>
|
||||
<color key="backgroundColor" red="0.81237262229999996" green="0.81237262229999996" blue="0.81237262229999996" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="66" id="eXR-zg-Qm3"/>
|
||||
<constraint firstAttribute="height" constant="30" id="tr0-3G-yTa"/>
|
||||
</constraints>
|
||||
<state key="normal" title="Chat">
|
||||
<color key="titleColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||
<color key="titleShadowColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
|
||||
</state>
|
||||
</button>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="S9h-1k-m1C" firstAttribute="leading" secondItem="ILF-Ln-sNi" secondAttribute="leadingMargin" id="5zV-bs-dj1"/>
|
||||
<constraint firstAttribute="trailingMargin" secondItem="kCn-d9-lc4" secondAttribute="trailing" constant="4" id="L4a-FW-jbQ"/>
|
||||
<constraint firstItem="S9h-1k-m1C" firstAttribute="top" secondItem="ILF-Ln-sNi" secondAttribute="topMargin" constant="4" id="MPG-Ag-s9W"/>
|
||||
<constraint firstAttribute="centerY" secondItem="kCn-d9-lc4" secondAttribute="centerY" constant="0.5" id="Oja-y0-bFI"/>
|
||||
<constraint firstItem="kCn-d9-lc4" firstAttribute="leading" secondItem="S9h-1k-m1C" secondAttribute="trailing" constant="10" id="Sjr-GD-lXR"/>
|
||||
<constraint firstAttribute="bottomMargin" secondItem="S9h-1k-m1C" secondAttribute="bottom" constant="4" id="iid-05-Gtz"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<connections>
|
||||
<outlet property="matrixUserIDLabel" destination="S9h-1k-m1C" id="qBo-4s-peS"/>
|
||||
<outlet property="startChatButton" destination="kCn-d9-lc4" id="huZ-QP-uor"/>
|
||||
</connections>
|
||||
</tableViewCell>
|
||||
</prototypes>
|
||||
<connections>
|
||||
<outlet property="dataSource" destination="ro1-6w-v07" id="QYY-hP-cyg"/>
|
||||
<outlet property="delegate" destination="ro1-6w-v07" id="WxI-AT-vO9"/>
|
||||
</connections>
|
||||
</tableView>
|
||||
<connections>
|
||||
<outlet property="memberThumbnailButton" destination="TIr-2a-W5c" id="85L-YN-L8P"/>
|
||||
<outlet property="roomMemberMID" destination="xfL-PN-omV" id="L07-JN-H3p"/>
|
||||
</connections>
|
||||
</tableViewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="cKT-B6-clR" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="1517" y="801"/>
|
||||
</scene>
|
||||
<!--DetailMember-->
|
||||
<scene sceneID="q1J-Wz-aLa">
|
||||
|
@ -636,7 +730,7 @@
|
|||
</tableViewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="mrY-z4-HGF" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="2297" y="74"/>
|
||||
<point key="canvasLocation" x="2298" y="81"/>
|
||||
</scene>
|
||||
<!--Home-->
|
||||
<scene sceneID="3rt-8o-eGh">
|
||||
|
@ -1489,6 +1583,7 @@
|
|||
</imageView>
|
||||
<view contentMode="scaleAspectFit" translatesAutoresizingMaskIntoConstraints="NO" id="jld-N3-vJN" customClass="MXCImageView">
|
||||
<rect key="frame" x="12" y="5" width="40" height="40"/>
|
||||
<gestureRecognizers/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="40" id="2As-na-nDF"/>
|
||||
<constraint firstAttribute="height" constant="40" id="I33-aW-Co1"/>
|
||||
|
@ -1553,6 +1648,7 @@
|
|||
<outlet property="activityIndicator" destination="OWX-v0-faA" id="vXQ-cW-GRq"/>
|
||||
<outlet property="contactsControls" destination="gMZ-iG-iB5" id="MbP-gm-SP2"/>
|
||||
<outlet property="tableView" destination="GiR-2B-wso" id="lQe-yC-KZP"/>
|
||||
<segue destination="ro1-6w-v07" kind="show" identifier="showContactDetails" id="QNn-Ne-Cer"/>
|
||||
</connections>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="uKz-PK-iTr" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
|
|
25
matrixConsole/View/ContactDetailsTableCell.h
Normal file
25
matrixConsole/View/ContactDetailsTableCell.h
Normal file
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
Copyright 2014 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 <UIKit/UIKit.h>
|
||||
|
||||
@interface ContactDetailsTableCell : UITableViewCell
|
||||
|
||||
@property (strong, nonatomic) IBOutlet UILabel *matrixUserIDLabel;
|
||||
@property (strong, nonatomic) IBOutlet UIButton *startChatButton;
|
||||
|
||||
@end
|
||||
|
20
matrixConsole/View/ContactDetailsTableCell.m
Normal file
20
matrixConsole/View/ContactDetailsTableCell.m
Normal file
|
@ -0,0 +1,20 @@
|
|||
/*
|
||||
Copyright 2014 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 "ContactDetailsTableCell.h"
|
||||
|
||||
@implementation ContactDetailsTableCell
|
||||
@end
|
25
matrixConsole/ViewController/ContactDetailsViewController.h
Normal file
25
matrixConsole/ViewController/ContactDetailsViewController.h
Normal file
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
Copyright 2014 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 <UIKit/UIKit.h>
|
||||
|
||||
#import "MXCContact.h"
|
||||
|
||||
@interface ContactDetailsViewController : UITableViewController
|
||||
|
||||
@property (strong, nonatomic) MXCContact* contact;
|
||||
@end
|
||||
|
130
matrixConsole/ViewController/ContactDetailsViewController.m
Normal file
130
matrixConsole/ViewController/ContactDetailsViewController.m
Normal file
|
@ -0,0 +1,130 @@
|
|||
/*
|
||||
Copyright 2014 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 "ContactDetailsViewController.h"
|
||||
|
||||
#import "ContactDetailsTableCell.h"
|
||||
|
||||
#import "MatrixSDKHandler.h"
|
||||
|
||||
@interface ContactDetailsViewController () {
|
||||
NSArray* matrixIDs;
|
||||
}
|
||||
|
||||
@property (weak, nonatomic) IBOutlet UIButton *memberThumbnailButton;
|
||||
@property (weak, nonatomic) IBOutlet UITextView *roomMemberMID;
|
||||
|
||||
@end
|
||||
|
||||
@implementation ContactDetailsViewController
|
||||
|
||||
- (void)dealloc {
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
self.memberThumbnailButton = nil;
|
||||
self.roomMemberMID = nil;
|
||||
matrixIDs = nil;
|
||||
}
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
|
||||
// remove the line separator color
|
||||
self.tableView.separatorColor = [UIColor clearColor];
|
||||
self.tableView.rowHeight = 44;
|
||||
self.tableView.allowsSelection = NO;
|
||||
}
|
||||
|
||||
- (void)viewWillAppear:(BOOL)animated {
|
||||
|
||||
[super viewWillAppear:animated];
|
||||
self.roomMemberMID.text = _contact.displayName;
|
||||
|
||||
// set the thumbnail info
|
||||
[self.memberThumbnailButton.imageView setContentMode: UIViewContentModeScaleAspectFill];
|
||||
[self.memberThumbnailButton.imageView setClipsToBounds:YES];
|
||||
|
||||
if (_contact.thumbnail) {
|
||||
self.memberThumbnailButton.imageView.image = _contact.thumbnail;
|
||||
}
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onThumbnailUpdate:) name:kMXCContactThumbnailUpdateNotification object:nil];
|
||||
}
|
||||
|
||||
- (void)viewWillDisappear:(BOOL)animated {
|
||||
[super viewWillDisappear:animated];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
}
|
||||
|
||||
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
|
||||
return 1;
|
||||
}
|
||||
|
||||
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
||||
matrixIDs = _contact.matrixIdentifiers;
|
||||
return matrixIDs.count;
|
||||
}
|
||||
|
||||
- (UITableViewCell *)tableView:(UITableView *)aTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
|
||||
NSInteger row = indexPath.row;
|
||||
ContactDetailsTableCell* contactDetailsTableCell = (ContactDetailsTableCell*)[aTableView dequeueReusableCellWithIdentifier:@"ContactDetailsTableCell" forIndexPath:indexPath];
|
||||
|
||||
if (row < matrixIDs.count) {
|
||||
contactDetailsTableCell.matrixUserIDLabel.text = [matrixIDs objectAtIndex:row];
|
||||
} else {
|
||||
// should never happen
|
||||
contactDetailsTableCell.matrixUserIDLabel.text = @"";
|
||||
}
|
||||
|
||||
contactDetailsTableCell.startChatButton.layer.cornerRadius = 5;
|
||||
contactDetailsTableCell.startChatButton.layer.borderColor = [UIColor blackColor].CGColor;
|
||||
contactDetailsTableCell.startChatButton.layer.borderWidth = 2;
|
||||
contactDetailsTableCell.startChatButton.clipsToBounds = YES;
|
||||
[contactDetailsTableCell.startChatButton addTarget:self action:@selector(startChat:) forControlEvents:UIControlEventTouchUpInside];
|
||||
|
||||
return contactDetailsTableCell;
|
||||
}
|
||||
|
||||
- (void)startChat:(UIButton*)sender {
|
||||
UIView* view = sender;
|
||||
|
||||
// search the parentce cell
|
||||
while (view && ![view isKindOfClass:[ContactDetailsTableCell class]]) {
|
||||
view = view.superview;
|
||||
}
|
||||
|
||||
if ([view isKindOfClass:[ContactDetailsTableCell class]]) {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[[MatrixSDKHandler sharedHandler] startPrivateOneToOneRoomWith:((ContactDetailsTableCell*)view).matrixUserIDLabel.text];
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
- (void)onThumbnailUpdate:(NSNotification *)notif {
|
||||
// sanity check
|
||||
if ([notif.object isKindOfClass:[NSString class]]) {
|
||||
NSString* matrixID = notif.object;
|
||||
|
||||
if ([matrixID isEqualToString:self.contact.contactID]) {
|
||||
if (_contact.thumbnail) {
|
||||
self.memberThumbnailButton.imageView.image = _contact.thumbnail;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
#import "SectionedContacts.h"
|
||||
|
||||
@interface ContactsViewController : UIViewController <UITableViewDataSource, UITableViewDelegate, UINavigationControllerDelegate, MFMessageComposeViewControllerDelegate, UISearchBarDelegate> {
|
||||
@interface ContactsViewController : UIViewController <UITableViewDataSource, UITableViewDelegate, UINavigationControllerDelegate, MFMessageComposeViewControllerDelegate, UISearchBarDelegate, UIGestureRecognizerDelegate> {
|
||||
NSArray* collationTitles;
|
||||
}
|
||||
|
||||
|
|
|
@ -37,6 +37,9 @@
|
|||
// settings
|
||||
#import "AppSettings.h"
|
||||
|
||||
//
|
||||
#import "ContactDetailsViewController.h"
|
||||
|
||||
NSString *const kInvitationMessage = @"I'd like to chat with you with matrix. Please, visit the website http://matrix.org to have more information.";
|
||||
|
||||
@interface ContactsViewController () {
|
||||
|
@ -52,6 +55,9 @@ NSString *const kInvitationMessage = @"I'd like to chat with you with matrix. Pl
|
|||
NSMutableDictionary* matrixUserByMatrixID;
|
||||
SectionedContacts* sectionedMatrixContacts;
|
||||
|
||||
// tap on thumbnail to display contact info
|
||||
MXCContact* selectedContact;
|
||||
|
||||
// Search
|
||||
UISearchBar *contactsSearchBar;
|
||||
NSMutableArray *filteredContacts;
|
||||
|
@ -372,6 +378,29 @@ NSString *const kInvitationMessage = @"I'd like to chat with you with matrix. Pl
|
|||
}
|
||||
}
|
||||
|
||||
// tap on matrix user thumbnail -> open a detailled sheet
|
||||
UITapGestureRecognizer* tapGesture = nil;
|
||||
|
||||
// check if it is already defined
|
||||
// gesture in storyboard does not seem to work properly
|
||||
// it always triggers a tap event on the first cell
|
||||
for (UIGestureRecognizer* gesture in cell.thumbnailView.gestureRecognizers) {
|
||||
|
||||
if ([gesture isKindOfClass:[UITapGestureRecognizer class]]) {
|
||||
tapGesture = (UITapGestureRecognizer*)gesture;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// add it if it is not yet defined
|
||||
if (!tapGesture) {
|
||||
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onContactThumbnailTap:)];
|
||||
[tap setNumberOfTouchesRequired:1];
|
||||
[tap setNumberOfTapsRequired:1];
|
||||
[tap setDelegate:self];
|
||||
[cell.thumbnailView addGestureRecognizer:tap];
|
||||
}
|
||||
|
||||
cell.contact = contact;
|
||||
|
||||
return cell;
|
||||
|
@ -577,6 +606,40 @@ NSString *const kInvitationMessage = @"I'd like to chat with you with matrix. Pl
|
|||
}
|
||||
}
|
||||
|
||||
- (IBAction)onContactThumbnailTap:(id)sender {
|
||||
|
||||
if ([sender isKindOfClass:[UITapGestureRecognizer class]]) {
|
||||
UIView* tappedView = ((UITapGestureRecognizer*)sender).view;
|
||||
|
||||
// search the parentce cell
|
||||
while (tappedView && ![tappedView isKindOfClass:[ContactTableCell class]]) {
|
||||
tappedView = tappedView.superview;
|
||||
}
|
||||
|
||||
// find it ?
|
||||
if ([tappedView isKindOfClass:[ContactTableCell class]]) {
|
||||
MXCContact* contact = ((ContactTableCell*)tappedView).contact;
|
||||
|
||||
// open detailled sheet if there
|
||||
if (contact.matrixIdentifiers.count > 0) {
|
||||
selectedContact = ((ContactTableCell*)tappedView).contact;
|
||||
[self performSegueWithIdentifier:@"showContactDetails" sender:self];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Segues
|
||||
|
||||
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
|
||||
if ([segue.identifier isEqualToString:@"showContactDetails"]) {
|
||||
ContactDetailsViewController *contactDetailsViewController = segue.destinationViewController;
|
||||
contactDetailsViewController.contact = selectedContact;
|
||||
selectedContact = nil;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark MFMessageComposeViewControllerDelegate
|
||||
|
||||
- (void)messageComposeViewController:(MFMessageComposeViewController *)controller didFinishWithResult:(MessageComposeResult)result {
|
||||
|
|
Loading…
Reference in a new issue