Add support for removing a site

This commit is contained in:
Jonathan Schleifer 2016-10-09 18:37:48 +02:00
parent 43adab7b39
commit c7872db0ba
No known key found for this signature in database
GPG key ID: 338C3541DB54E169
3 changed files with 35 additions and 1 deletions

View file

@ -402,7 +402,14 @@
<outlet property="delegate" destination="ayJ-fs-aIU" id="af9-4J-p1D"/> <outlet property="delegate" destination="ayJ-fs-aIU" id="af9-4J-p1D"/>
</connections> </connections>
</tableView> </tableView>
<navigationItem key="navigationItem" id="xhc-og-4ho"/> <navigationItem key="navigationItem" id="xhc-og-4ho">
<barButtonItem key="rightBarButtonItem" title="Remove" id="vzP-cA-Wig">
<color key="tintColor" red="1" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<connections>
<action selector="remove:" destination="ayJ-fs-aIU" id="0mA-Jx-Oqa"/>
</connections>
</barButtonItem>
</navigationItem>
<connections> <connections>
<outlet property="legacySwitch" destination="qW3-51-hZP" id="NsI-F3-hVQ"/> <outlet property="legacySwitch" destination="qW3-51-hZP" id="NsI-F3-hVQ"/>
<outlet property="lengthField" destination="Lp1-jC-8cn" id="05B-m5-JnB"/> <outlet property="lengthField" destination="Lp1-jC-8cn" id="05B-m5-JnB"/>

View file

@ -37,4 +37,6 @@
@property (retain, nonatomic) IBOutlet UISwitch *legacySwitch; @property (retain, nonatomic) IBOutlet UISwitch *legacySwitch;
@property (retain, nonatomic) IBOutlet UITextField *passphraseField; @property (retain, nonatomic) IBOutlet UITextField *passphraseField;
@property (retain) MainViewController *mainViewController; @property (retain) MainViewController *mainViewController;
- (IBAction)remove: (id)sender;
@end @end

View file

@ -183,4 +183,29 @@ clearNSMutableString(NSMutableString *string)
return password; return password;
} }
- (IBAction)remove: (id)sender
{
UIAlertController *alert = [UIAlertController
alertControllerWithTitle: @"Remove Site?"
message: @"Do you want to remove this site?"
preferredStyle: UIAlertControllerStyleAlert];
[alert addAction:
[UIAlertAction actionWithTitle: @"No"
style: UIAlertActionStyleCancel
handler: nil]];
[alert addAction:
[UIAlertAction actionWithTitle: @"Yes"
style: UIAlertActionStyleDestructive
handler: ^ (UIAlertAction *action) {
[self.mainViewController.siteStorage removeSite: _name];
[self.mainViewController.tableView reloadData];
[self.navigationController popViewControllerAnimated: YES];
}]];
[self presentViewController: alert
animated: YES
completion: nil];
}
@end @end