Members of groups selection

Reviewed-by: @FredericJacobs
pull/1/head
Christine Corbett 11 years ago committed by Frederic Jacobs
parent ee07490d3e
commit c9c4a93715

@ -822,6 +822,9 @@ A0 09 9A FF A8 8A 09 99</string>
<outlet property="delegate" destination="JeZ-9g-U61" id="qYP-nN-CLJ"/>
</connections>
</tableView>
<connections>
<segue destination="0XE-hu-8cu" kind="show" identifier="DetailSegue" id="0BB-Wo-N9f"/>
</connections>
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="3R8-C6-Zq8" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
@ -2557,7 +2560,7 @@ A0 09 9A FF A8 8A 09 99</string>
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="srg-3q-gF9" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="3172.5" y="437.25"/>
<point key="canvasLocation" x="4138.5" y="1172.25"/>
</scene>
<!--Signals Navigation Controller-->
<scene sceneID="miN-Ma-3eR">
@ -3877,5 +3880,6 @@ Licensed under the GPLv3</string>
</resources>
<inferredMetricsTieBreakers>
<segue reference="gZ1-lh-srF"/>
<segue reference="0BB-Wo-N9f"/>
</inferredMetricsTieBreakers>
</document>

@ -263,6 +263,7 @@ static NSString* const kUnwindToMessagesViewSegue = @"UnwindToMessagesViewSegue"
} else {
cell.textLabel.text = @"Add People:";
cell.textLabel.textColor = [UIColor lightGrayColor];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
}
tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
@ -274,14 +275,18 @@ static NSString* const kUnwindToMessagesViewSegue = @"UnwindToMessagesViewSegue"
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell * cell = [tableView cellForRowAtIndexPath:indexPath];
cell.accessoryType = UITableViewCellAccessoryCheckmark;
if(indexPath.row>0) {
cell.accessoryType = UITableViewCellAccessoryCheckmark;
}
}
-(void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell * cell = [tableView cellForRowAtIndexPath:indexPath];
cell.accessoryType = UITableViewCellAccessoryNone;
if(indexPath.row>0) {
cell.accessoryType = UITableViewCellAccessoryNone;
}
}
#pragma mark - Text Field Delegate

@ -10,9 +10,8 @@
#import "TSGroupThread.h"
#import "GroupModel.h"
@interface ShowGroupMembersViewController : UIViewController <UITableViewDelegate, UITabBarDelegate, UIImagePickerControllerDelegate, UINavigationControllerDelegate, UITextFieldDelegate>
@interface ShowGroupMembersViewController : UITableViewController <UITableViewDelegate, UITabBarDelegate, UIImagePickerControllerDelegate, UINavigationControllerDelegate, UITextFieldDelegate>
- (void)configWithThread:(TSGroupThread*)thread;
@property(nonatomic, strong) IBOutlet UITableView* tableView;
@end

@ -8,6 +8,7 @@
#import "ShowGroupMembersViewController.h"
#import "SignalsViewController.h"
#import "ContactDetailTableViewController.h"
#import "Contact.h"
#import "ContactsManager.h"
#import "Environment.h"
@ -102,14 +103,14 @@ static NSString* const kUnwindToMessagesViewSegue = @"UnwindToMessagesViewSegue"
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier: indexPath.row == 0 ? @"HeaderCell" : @"GroupSearchCell"];
}
if (indexPath.row > 0) {
NSUInteger row = (NSUInteger)indexPath.row;
Contact* contact = contacts[row-1];
Contact* contact = [self contactForIndexPath:indexPath];
cell.textLabel.attributedText = [self attributedStringForContact:contact inCell:cell];
} else {
cell.textLabel.text = @"Group conversation Recipients:";
cell.textLabel.textColor = [UIColor lightGrayColor];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
}
tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
@ -118,6 +119,35 @@ static NSString* const kUnwindToMessagesViewSegue = @"UnwindToMessagesViewSegue"
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
if(indexPath.row>0) {
[self performSegueWithIdentifier:@"DetailSegue" sender:self];
[tableView deselectRowAtIndexPath:indexPath animated:YES];
}
}
-(Contact*)contactForIndexPath:(NSIndexPath*)indexPath
{
Contact *contact = contacts[(NSUInteger)(indexPath.row-1)];
return contact;
}
#pragma mark - Segue
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([segue.identifier isEqualToString:@"DetailSegue"]) {
ContactDetailTableViewController * detailvc = [segue destinationViewController];
NSIndexPath * indexPath = [self.tableView indexPathForSelectedRow]; // this is nil
Contact *contact = [self contactForIndexPath:indexPath];
detailvc.contact = contact;
}
}
#pragma mark - Cell Utility
- (NSAttributedString *)attributedStringForContact:(Contact *)contact inCell:(UITableViewCell*)cell {

Loading…
Cancel
Save