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

View file

@ -1056,6 +1056,7 @@
<navigationItem key="navigationItem" title="Settings" id="7NM-zW-wJT"/>
<connections>
<segue destination="KeQ-Sp-kmH" kind="show" identifier="showAccountDetails" id="flf-61-vgV"/>
<segue destination="ZlD-EU-ncw" kind="show" identifier="addAccount" id="17E-G9-IZ6"/>
</connections>
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="ZKJ-22-Asy" userLabel="First Responder" sceneMemberID="firstResponder"/>
@ -1167,5 +1168,6 @@
<inferredMetricsTieBreakers>
<segue reference="dfI-c6-tO5"/>
<segue reference="m9P-N3-WZN"/>
<segue reference="17E-G9-IZ6"/>
</inferredMetricsTieBreakers>
</document>

View file

@ -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) {