SettingsViewController: Add "Add account" option.

This commit is contained in:
giomfo
2015-05-21 16:13:04 +02:00
parent e753170bf4
commit 951bf15f57
2 changed files with 22 additions and 5 deletions
@@ -212,10 +212,6 @@ NSString* const kCommandsDescriptionText = @"The following commands are availabl
[self.tableView reloadData];
}
- (void)logout {
[[AppDelegate theDelegate] logout];
}
- (void)reset {
// Remove observers
if (removedAccountObserver) {
@@ -246,6 +242,14 @@ NSString* const kCommandsDescriptionText = @"The following commands are availabl
#pragma mark - Actions
- (IBAction)addAccount:(id)sender {
[self performSegueWithIdentifier:@"addAccount" sender:self];
}
- (IBAction)logout:(id)sender {
[[AppDelegate theDelegate] logout];
}
- (IBAction)onButtonPressed:(id)sender {
if (sender == apnsNotificationsSwitch) {
@@ -366,7 +370,7 @@ NSString* const kCommandsDescriptionText = @"The following commands are availabl
}
[logoutBtnCell.mxkButton setTitle:@"Logout all accounts" forState:UIControlStateNormal];
[logoutBtnCell.mxkButton setTitle:@"Logout all accounts" forState:UIControlStateHighlighted];
[logoutBtnCell.mxkButton addTarget:self action:@selector(logout) forControlEvents:UIControlEventTouchUpInside];
[logoutBtnCell.mxkButton addTarget:self action:@selector(logout:) forControlEvents:UIControlEventTouchUpInside];
cell = logoutBtnCell;
}
@@ -560,6 +564,17 @@ NSString* const kCommandsDescriptionText = @"The following commands are availabl
if (section == SETTINGS_SECTION_ACCOUNTS_INDEX) {
sectionHeader.text = @" Accounts";
UIButton *addAccount = [UIButton buttonWithType:UIButtonTypeContactAdd];
[addAccount addTarget:self action:@selector(addAccount:) forControlEvents:UIControlEventTouchUpInside];
CGRect frame = addAccount.frame;
frame.origin.x = sectionHeader.frame.size.width - frame.size.width - 8;
frame.origin.y = (sectionHeader.frame.size.height - frame.size.height) / 2;
addAccount.frame = frame;
[sectionHeader addSubview:addAccount];
sectionHeader.userInteractionEnabled = YES;
} else if (section == SETTINGS_SECTION_NOTIFICATIONS_INDEX) {
sectionHeader.text = @" Notifications";
} else if (section == SETTINGS_SECTION_CONTACTS_INDEX) {