iOS: Finish support for key files

This commit is contained in:
Jonathan Schleifer 2017-11-26 22:51:37 +01:00
parent fa21a9d8f3
commit e5b90b856a
No known key found for this signature in database
GPG key ID: 28D65178B37F33E3
24 changed files with 225 additions and 27 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, Jonathan Schleifer <js@heap.zone>
* Copyright (c) 2016, 2017, Jonathan Schleifer <js@heap.zone>
*
* https://heap.zone/git/scrypt-pwgen.git
*
@ -23,6 +23,7 @@
#import <ObjFW_Bridge/ObjFW_Bridge.h>
#import "AddSiteController.h"
#import "SelectKeyFileController.h"
static void
showAlert(UIViewController *controller, NSString *title, NSString *message)
@ -47,6 +48,7 @@ showAlert(UIViewController *controller, NSString *title, NSString *message)
[_nameField release];
[_lengthField release];
[_legacySwitch release];
[_keyFile release];
[_keyFileLabel release];
[_mainViewController release];
@ -60,7 +62,8 @@ showAlert(UIViewController *controller, NSString *title, NSString *message)
animated: YES];
if (indexPath.section == 1 && indexPath.row == 1)
[self selectKeyFile];
[self performSegueWithIdentifier: @"selectKeyFile"
sender: self];
}
- (NSIndexPath *)tableView: (UITableView *)tableView
@ -72,11 +75,6 @@ showAlert(UIViewController *controller, NSString *title, NSString *message)
return nil;
}
- (void)selectKeyFile
{
showAlert(self, @"Not Supported", @"Key files are not supported yet");
}
- (IBAction)done: (id)sender
{
OFString *name = self.nameField.text.OFObject;
@ -113,7 +111,7 @@ showAlert(UIViewController *controller, NSString *title, NSString *message)
[self.mainViewController.siteStorage setSite: name
length: length
legacy: self.legacySwitch.on
keyFile: nil];
keyFile: self.keyFile.OFObject];
[self.mainViewController reset];
[self.navigationController popViewControllerAnimated: YES];
@ -123,4 +121,11 @@ showAlert(UIViewController *controller, NSString *title, NSString *message)
{
[self.navigationController popViewControllerAnimated: YES];
}
- (void)prepareForSegue: (UIStoryboardSegue *)segue
sender: (id)sender
{
if ([segue.identifier isEqual: @"selectKeyFile"])
[segue.destinationViewController setAddSiteController: self];
}
@end