Merge branch 'charlesmchen/fixConversationSettingsSegues'

pull/1/head
Matthew Chen 8 years ago
commit 9f3e5561fc

@ -30,11 +30,6 @@
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
static NSString *const OWSConversationSettingsTableViewControllerSegueUpdateGroup =
@"OWSConversationSettingsTableViewControllerSegueUpdateGroup";
static NSString *const OWSConversationSettingsTableViewControllerSegueShowGroupMembers =
@"OWSConversationSettingsTableViewControllerSegueShowGroupMembers";
@interface OWSConversationSettingsTableViewController () @interface OWSConversationSettingsTableViewController ()
@property (nonatomic) TSThread *thread; @property (nonatomic) TSThread *thread;
@ -168,7 +163,8 @@ static NSString *const OWSConversationSettingsTableViewControllerSegueShowGroupM
firstSection.customHeaderHeight = @(100.f); firstSection.customHeaderHeight = @(100.f);
if (!self.isGroupThread && self.thread.hasSafetyNumbers) { if (!self.isGroupThread && self.thread.hasSafetyNumbers) {
[firstSection addItem:[OWSTableItem itemWithCustomCellBlock:^{ [firstSection
addItem:[OWSTableItem itemWithCustomCellBlock:^{
UITableViewCell *cell = [UITableViewCell new]; UITableViewCell *cell = [UITableViewCell new];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
@ -189,9 +185,27 @@ static NSString *const OWSConversationSettingsTableViewControllerSegueShowGroupM
return cell; return cell;
} }
actionBlock:^{ actionBlock:^{
[weakSelf performSegueWithIdentifier: OWSConversationSettingsTableViewController *strongSelf = weakSelf;
@"OWSConversationSettingsTableViewControllerSegueSafetyNumbers" if (!strongSelf) {
sender:weakSelf]; return;
}
FingerprintViewController *fingerprintViewController =
[[UIStoryboard storyboardWithName:@"Main" bundle:NULL]
instantiateViewControllerWithIdentifier:@"FingerprintViewController"];
OWSFingerprintBuilder *fingerprintBuilder =
[[OWSFingerprintBuilder alloc] initWithStorageManager:strongSelf.storageManager
contactsManager:strongSelf.contactsManager];
OWSFingerprint *fingerprint =
[fingerprintBuilder fingerprintWithTheirSignalId:strongSelf.thread.contactIdentifier];
[fingerprintViewController configureWithThread:strongSelf.thread
fingerprint:fingerprint
contactName:[strongSelf threadName]];
fingerprintViewController.dismissDelegate = strongSelf;
[strongSelf presentViewController:fingerprintViewController animated:YES completion:nil];
}]]; }]];
} }
@ -311,8 +325,15 @@ static NSString *const OWSConversationSettingsTableViewControllerSegueShowGroupM
return cell; return cell;
} }
actionBlock:^{ actionBlock:^{
[weakSelf performSegueWithIdentifier:@"OWSConversationSettingsTableViewControllerSegueUpdateGroup" OWSConversationSettingsTableViewController *strongSelf = weakSelf;
sender:weakSelf]; if (!strongSelf) {
return;
}
NewGroupViewController *newGroupViewController =
[[UIStoryboard storyboardWithName:@"Main" bundle:NULL]
instantiateViewControllerWithIdentifier:@"NewGroupViewController"];
[newGroupViewController configWithThread:(TSGroupThread *)strongSelf.thread];
[strongSelf.navigationController pushViewController:newGroupViewController animated:YES];
}], }],
[OWSTableItem itemWithCustomCellBlock:^{ [OWSTableItem itemWithCustomCellBlock:^{
UITableViewCell *cell = [UITableViewCell new]; UITableViewCell *cell = [UITableViewCell new];
@ -338,9 +359,15 @@ static NSString *const OWSConversationSettingsTableViewControllerSegueShowGroupM
return cell; return cell;
} }
actionBlock:^{ actionBlock:^{
[weakSelf OWSConversationSettingsTableViewController *strongSelf = weakSelf;
performSegueWithIdentifier:@"OWSConversationSettingsTableViewControllerSegueShowGroupMembers" if (!strongSelf) {
sender:weakSelf]; return;
}
ShowGroupMembersViewController *showGroupMembersViewController =
[[UIStoryboard storyboardWithName:@"Main" bundle:NULL]
instantiateViewControllerWithIdentifier:@"ShowGroupMembersViewController"];
[showGroupMembersViewController configWithThread:(TSGroupThread *)strongSelf.thread];
[strongSelf.navigationController pushViewController:showGroupMembersViewController animated:YES];
}], }],
]; ];
@ -836,31 +863,6 @@ static NSString *const OWSConversationSettingsTableViewControllerSegueShowGroupM
[self.tableView reloadData]; [self.tableView reloadData];
} }
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(nullable id)sender
{
if ([segue.destinationViewController isKindOfClass:[FingerprintViewController class]]) {
FingerprintViewController *controller = (FingerprintViewController *)segue.destinationViewController;
OWSFingerprintBuilder *fingerprintBuilder =
[[OWSFingerprintBuilder alloc] initWithStorageManager:self.storageManager
contactsManager:self.contactsManager];
OWSFingerprint *fingerprint = [fingerprintBuilder fingerprintWithTheirSignalId:self.thread.contactIdentifier];
[controller configureWithThread:self.thread fingerprint:fingerprint contactName:[self threadName]];
controller.dismissDelegate = self;
} else if ([segue.identifier isEqualToString:OWSConversationSettingsTableViewControllerSegueUpdateGroup]) {
NewGroupViewController *vc = [segue destinationViewController];
[vc configWithThread:(TSGroupThread *)self.thread];
} else if ([segue.identifier isEqualToString:OWSConversationSettingsTableViewControllerSegueShowGroupMembers]) {
ShowGroupMembersViewController *vc = [segue destinationViewController];
[vc configWithThread:(TSGroupThread *)self.thread];
}
}
#pragma mark - Logging #pragma mark - Logging
+ (NSString *)tag + (NSString *)tag

Loading…
Cancel
Save