Forward input passphrase to parser
This commit is contained in:
parent
dc81356b31
commit
8f0e28e315
|
@ -101,7 +101,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDele
|
|||
let passphraseBlock = { (passphrase) in
|
||||
_ = self.tryParseURL(url, passphrase: passphrase, target: target)
|
||||
}
|
||||
guard let parsingResult = ConfigurationParser.ParsingResult.from(url, withErrorAlertIn: target, passphraseBlock: passphraseBlock) else {
|
||||
guard let parsingResult = ConfigurationParser.ParsingResult.from(url, withErrorAlertIn: target, passphrase: passphrase, passphraseBlock: passphraseBlock) else {
|
||||
return true
|
||||
}
|
||||
if let warning = parsingResult.warning {
|
||||
|
|
|
@ -32,13 +32,13 @@ import Passepartout_Core
|
|||
private let log = SwiftyBeaver.self
|
||||
|
||||
extension ConfigurationParser.ParsingResult {
|
||||
static func from(_ url: URL, withErrorAlertIn viewController: UIViewController, passphraseBlock: @escaping (String) -> Void) -> ConfigurationParser.ParsingResult? {
|
||||
static func from(_ url: URL, withErrorAlertIn viewController: UIViewController, passphrase: String?, passphraseBlock: @escaping (String) -> Void) -> ConfigurationParser.ParsingResult? {
|
||||
let result: ConfigurationParser.ParsingResult
|
||||
let fm = FileManager.default
|
||||
|
||||
log.debug("Parsing configuration URL: \(url)")
|
||||
do {
|
||||
result = try ConfigurationParser.parsed(fromURL: url)
|
||||
result = try ConfigurationParser.parsed(fromURL: url, passphrase: passphrase)
|
||||
} catch let e as ConfigurationParser.ParsingError {
|
||||
switch e {
|
||||
case .encryptionPassphrase, .unableToDecrypt(_):
|
||||
|
|
|
@ -88,7 +88,7 @@ class ImportedHostsViewController: UITableViewController {
|
|||
}
|
||||
self.perform(segue: StoryboardSegue.Organizer.importHostSegueIdentifier, sender: cell)
|
||||
}
|
||||
guard let parsingResult = ConfigurationParser.ParsingResult.from(url, withErrorAlertIn: self, passphraseBlock: passphraseBlock) else {
|
||||
guard let parsingResult = ConfigurationParser.ParsingResult.from(url, withErrorAlertIn: self, passphrase: passphrase, passphraseBlock: passphraseBlock) else {
|
||||
deselectSelectedRow()
|
||||
return false
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue