mirror of
https://github.com/passepartoutvpn/passepartout-apple.git
synced 2025-01-29 12:02:11 +00:00
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
|
let passphraseBlock = { (passphrase) in
|
||||||
_ = self.tryParseURL(url, passphrase: passphrase, target: target)
|
_ = 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
|
return true
|
||||||
}
|
}
|
||||||
if let warning = parsingResult.warning {
|
if let warning = parsingResult.warning {
|
||||||
|
@ -32,13 +32,13 @@ import Passepartout_Core
|
|||||||
private let log = SwiftyBeaver.self
|
private let log = SwiftyBeaver.self
|
||||||
|
|
||||||
extension ConfigurationParser.ParsingResult {
|
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 result: ConfigurationParser.ParsingResult
|
||||||
let fm = FileManager.default
|
let fm = FileManager.default
|
||||||
|
|
||||||
log.debug("Parsing configuration URL: \(url)")
|
log.debug("Parsing configuration URL: \(url)")
|
||||||
do {
|
do {
|
||||||
result = try ConfigurationParser.parsed(fromURL: url)
|
result = try ConfigurationParser.parsed(fromURL: url, passphrase: passphrase)
|
||||||
} catch let e as ConfigurationParser.ParsingError {
|
} catch let e as ConfigurationParser.ParsingError {
|
||||||
switch e {
|
switch e {
|
||||||
case .encryptionPassphrase, .unableToDecrypt(_):
|
case .encryptionPassphrase, .unableToDecrypt(_):
|
||||||
|
@ -88,7 +88,7 @@ class ImportedHostsViewController: UITableViewController {
|
|||||||
}
|
}
|
||||||
self.perform(segue: StoryboardSegue.Organizer.importHostSegueIdentifier, sender: cell)
|
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()
|
deselectSelectedRow()
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user