Rename ParsingResult to Result
From ConfigurationParser in TunnelKit.
This commit is contained in:
parent
86f60aefbd
commit
ab5517dcba
|
@ -104,11 +104,11 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDele
|
||||||
let passphraseCancelBlock = {
|
let passphraseCancelBlock = {
|
||||||
_ = try? FileManager.default.removeItem(at: url)
|
_ = try? FileManager.default.removeItem(at: url)
|
||||||
}
|
}
|
||||||
guard let parsingResult = ConfigurationParser.ParsingResult.from(url, withErrorAlertIn: target, passphrase: passphrase, passphraseBlock: passphraseBlock, passphraseCancelBlock: passphraseCancelBlock) else {
|
guard let parsingResult = ConfigurationParser.Result.from(url, withErrorAlertIn: target, passphrase: passphrase, passphraseBlock: passphraseBlock, passphraseCancelBlock: passphraseCancelBlock) else {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
if let warning = parsingResult.warning {
|
if let warning = parsingResult.warning {
|
||||||
ConfigurationParser.ParsingResult.alertImportWarning(url: url, in: target, withWarning: warning) {
|
ConfigurationParser.Result.alertImportWarning(url: url, in: target, withWarning: warning) {
|
||||||
if $0 {
|
if $0 {
|
||||||
self.handleParsingResult(parsingResult, in: target)
|
self.handleParsingResult(parsingResult, in: target)
|
||||||
} else {
|
} else {
|
||||||
|
@ -121,7 +121,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDele
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
private func handleParsingResult(_ parsingResult: ConfigurationParser.ParsingResult, in target: UIViewController) {
|
private func handleParsingResult(_ parsingResult: ConfigurationParser.Result, in target: UIViewController) {
|
||||||
|
|
||||||
// already presented: update parsed configuration
|
// already presented: update parsed configuration
|
||||||
if let nav = target as? UINavigationController, let wizard = nav.topViewController as? WizardHostViewController {
|
if let nav = target as? UINavigationController, let wizard = nav.topViewController as? WizardHostViewController {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
//
|
//
|
||||||
// ParsingResult+Alerts.swift
|
// ConfigurationParserResult+Alerts.swift
|
||||||
// Passepartout-iOS
|
// Passepartout-iOS
|
||||||
//
|
//
|
||||||
// Created by Davide De Rosa on 10/27/18.
|
// Created by Davide De Rosa on 10/27/18.
|
||||||
|
@ -31,11 +31,11 @@ import Passepartout_Core
|
||||||
|
|
||||||
private let log = SwiftyBeaver.self
|
private let log = SwiftyBeaver.self
|
||||||
|
|
||||||
extension ConfigurationParser.ParsingResult {
|
extension ConfigurationParser.Result {
|
||||||
static func from(_ url: URL, withErrorAlertIn viewController: UIViewController, passphrase: String?,
|
static func from(_ url: URL, withErrorAlertIn viewController: UIViewController, passphrase: String?,
|
||||||
passphraseBlock: @escaping (String) -> Void, passphraseCancelBlock: (() -> Void)?) -> ConfigurationParser.ParsingResult? {
|
passphraseBlock: @escaping (String) -> Void, passphraseCancelBlock: (() -> Void)?) -> ConfigurationParser.Result? {
|
||||||
|
|
||||||
let result: ConfigurationParser.ParsingResult
|
let result: ConfigurationParser.Result
|
||||||
let fm = FileManager.default
|
let fm = FileManager.default
|
||||||
|
|
||||||
log.debug("Parsing configuration URL: \(url)")
|
log.debug("Parsing configuration URL: \(url)")
|
|
@ -135,7 +135,7 @@ class ConfigurationViewController: UIViewController, TableModelHost {
|
||||||
log.warning("Resetting with no original configuration set? Bad table model?")
|
log.warning("Resetting with no original configuration set? Bad table model?")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
let parsingResult: ConfigurationParser.ParsingResult
|
let parsingResult: ConfigurationParser.Result
|
||||||
do {
|
do {
|
||||||
parsingResult = try ConfigurationParser.parsed(fromURL: originalURL)
|
parsingResult = try ConfigurationParser.parsed(fromURL: originalURL)
|
||||||
} catch let e {
|
} catch let e {
|
||||||
|
|
|
@ -33,7 +33,7 @@ private let log = SwiftyBeaver.self
|
||||||
class ImportedHostsViewController: UITableViewController {
|
class ImportedHostsViewController: UITableViewController {
|
||||||
private lazy var pendingConfigurationURLs = TransientStore.shared.service.pendingConfigurationURLs().sortedCaseInsensitive()
|
private lazy var pendingConfigurationURLs = TransientStore.shared.service.pendingConfigurationURLs().sortedCaseInsensitive()
|
||||||
|
|
||||||
private var parsingResult: ConfigurationParser.ParsingResult?
|
private var parsingResult: ConfigurationParser.Result?
|
||||||
|
|
||||||
override func viewDidLoad() {
|
override func viewDidLoad() {
|
||||||
super.viewDidLoad()
|
super.viewDidLoad()
|
||||||
|
@ -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, passphrase: passphrase, passphraseBlock: passphraseBlock, passphraseCancelBlock: nil) else {
|
guard let parsingResult = ConfigurationParser.Result.from(url, withErrorAlertIn: self, passphrase: passphrase, passphraseBlock: passphraseBlock, passphraseCancelBlock: nil) else {
|
||||||
deselectSelectedRow()
|
deselectSelectedRow()
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,7 @@ class ImportedHostsViewController: UITableViewController {
|
||||||
|
|
||||||
// postpone segue until alert dismissal
|
// postpone segue until alert dismissal
|
||||||
if let warning = parsingResult.warning {
|
if let warning = parsingResult.warning {
|
||||||
ConfigurationParser.ParsingResult.alertImportWarning(url: url, in: self, withWarning: warning) {
|
ConfigurationParser.Result.alertImportWarning(url: url, in: self, withWarning: warning) {
|
||||||
self.deselectSelectedRow()
|
self.deselectSelectedRow()
|
||||||
if $0 {
|
if $0 {
|
||||||
self.perform(segue: StoryboardSegue.Organizer.importHostSegueIdentifier)
|
self.perform(segue: StoryboardSegue.Organizer.importHostSegueIdentifier)
|
||||||
|
|
|
@ -37,7 +37,7 @@ class WizardHostViewController: UITableViewController, TableModelHost {
|
||||||
return TransientStore.shared.service.ids(forContext: .host).sortedCaseInsensitive()
|
return TransientStore.shared.service.ids(forContext: .host).sortedCaseInsensitive()
|
||||||
}()
|
}()
|
||||||
|
|
||||||
var parsingResult: ConfigurationParser.ParsingResult? {
|
var parsingResult: ConfigurationParser.Result? {
|
||||||
didSet {
|
didSet {
|
||||||
useSuggestedTitle()
|
useSuggestedTitle()
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,7 +77,7 @@
|
||||||
0E6BE13F20CFBAB300A6DD36 /* DebugLogViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E6BE13E20CFBAB300A6DD36 /* DebugLogViewController.swift */; };
|
0E6BE13F20CFBAB300A6DD36 /* DebugLogViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E6BE13E20CFBAB300A6DD36 /* DebugLogViewController.swift */; };
|
||||||
0E773BF8224BF37600CDDC8E /* ShortcutsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E773BF7224BF37600CDDC8E /* ShortcutsViewController.swift */; };
|
0E773BF8224BF37600CDDC8E /* ShortcutsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E773BF7224BF37600CDDC8E /* ShortcutsViewController.swift */; };
|
||||||
0E89DFCE213EEDFA00741BA1 /* WizardProviderViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E89DFCD213EEDFA00741BA1 /* WizardProviderViewController.swift */; };
|
0E89DFCE213EEDFA00741BA1 /* WizardProviderViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E89DFCD213EEDFA00741BA1 /* WizardProviderViewController.swift */; };
|
||||||
0EA068F4218475F800C320AD /* ParsingResult+Alerts.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EA068F3218475F800C320AD /* ParsingResult+Alerts.swift */; };
|
0EA068F4218475F800C320AD /* ConfigurationParserResult+Alerts.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EA068F3218475F800C320AD /* ConfigurationParserResult+Alerts.swift */; };
|
||||||
0EAAD71920E6669A0088754A /* GroupConstants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EDE8DED20C93E4C004C739C /* GroupConstants.swift */; };
|
0EAAD71920E6669A0088754A /* GroupConstants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EDE8DED20C93E4C004C739C /* GroupConstants.swift */; };
|
||||||
0EB60FDA2111136E00AD27F3 /* UITextView+Search.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EB60FD92111136E00AD27F3 /* UITextView+Search.swift */; };
|
0EB60FDA2111136E00AD27F3 /* UITextView+Search.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EB60FD92111136E00AD27F3 /* UITextView+Search.swift */; };
|
||||||
0EB67D6B2184581E00BA6200 /* ImportedHostsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EB67D6A2184581E00BA6200 /* ImportedHostsViewController.swift */; };
|
0EB67D6B2184581E00BA6200 /* ImportedHostsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EB67D6A2184581E00BA6200 /* ImportedHostsViewController.swift */; };
|
||||||
|
@ -209,7 +209,7 @@
|
||||||
0E89DFC7213E8FC500741BA1 /* SessionProxy+Communication.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "SessionProxy+Communication.swift"; sourceTree = "<group>"; };
|
0E89DFC7213E8FC500741BA1 /* SessionProxy+Communication.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "SessionProxy+Communication.swift"; sourceTree = "<group>"; };
|
||||||
0E89DFCD213EEDFA00741BA1 /* WizardProviderViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WizardProviderViewController.swift; sourceTree = "<group>"; };
|
0E89DFCD213EEDFA00741BA1 /* WizardProviderViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WizardProviderViewController.swift; sourceTree = "<group>"; };
|
||||||
0E8D97E121388B52006FB4A0 /* InfrastructurePreset.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InfrastructurePreset.swift; sourceTree = "<group>"; };
|
0E8D97E121388B52006FB4A0 /* InfrastructurePreset.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InfrastructurePreset.swift; sourceTree = "<group>"; };
|
||||||
0EA068F3218475F800C320AD /* ParsingResult+Alerts.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ParsingResult+Alerts.swift"; sourceTree = "<group>"; };
|
0EA068F3218475F800C320AD /* ConfigurationParserResult+Alerts.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ConfigurationParserResult+Alerts.swift"; sourceTree = "<group>"; };
|
||||||
0EB60FD92111136E00AD27F3 /* UITextView+Search.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UITextView+Search.swift"; sourceTree = "<group>"; };
|
0EB60FD92111136E00AD27F3 /* UITextView+Search.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UITextView+Search.swift"; sourceTree = "<group>"; };
|
||||||
0EB67D6A2184581E00BA6200 /* ImportedHostsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImportedHostsViewController.swift; sourceTree = "<group>"; };
|
0EB67D6A2184581E00BA6200 /* ImportedHostsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImportedHostsViewController.swift; sourceTree = "<group>"; };
|
||||||
0EBBE8F021822B4D00106008 /* ConnectionServiceTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConnectionServiceTests.swift; sourceTree = "<group>"; };
|
0EBBE8F021822B4D00106008 /* ConnectionServiceTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConnectionServiceTests.swift; sourceTree = "<group>"; };
|
||||||
|
@ -512,7 +512,7 @@
|
||||||
0EFD943D215BE10800529B64 /* IssueReporter.swift */,
|
0EFD943D215BE10800529B64 /* IssueReporter.swift */,
|
||||||
0E4FD7F020D58618002221FF /* Macros.swift */,
|
0E4FD7F020D58618002221FF /* Macros.swift */,
|
||||||
0ED38AE9214054A50004D387 /* OptionViewController.swift */,
|
0ED38AE9214054A50004D387 /* OptionViewController.swift */,
|
||||||
0EA068F3218475F800C320AD /* ParsingResult+Alerts.swift */,
|
0EA068F3218475F800C320AD /* ConfigurationParserResult+Alerts.swift */,
|
||||||
0EDE8DE320C89028004C739C /* SwiftGen+Scenes.swift */,
|
0EDE8DE320C89028004C739C /* SwiftGen+Scenes.swift */,
|
||||||
0EF56BBA2185AC8500B0C8AB /* SwiftGen+Segues.swift */,
|
0EF56BBA2185AC8500B0C8AB /* SwiftGen+Segues.swift */,
|
||||||
0E05C61C20D27C82006EE732 /* Theme.swift */,
|
0E05C61C20D27C82006EE732 /* Theme.swift */,
|
||||||
|
@ -1033,7 +1033,7 @@
|
||||||
0EB67D6B2184581E00BA6200 /* ImportedHostsViewController.swift in Sources */,
|
0EB67D6B2184581E00BA6200 /* ImportedHostsViewController.swift in Sources */,
|
||||||
0E57F63E20C83FC5008323CF /* ServiceViewController.swift in Sources */,
|
0E57F63E20C83FC5008323CF /* ServiceViewController.swift in Sources */,
|
||||||
0E36D24D2240234B006AF062 /* ShortcutsAddViewController.swift in Sources */,
|
0E36D24D2240234B006AF062 /* ShortcutsAddViewController.swift in Sources */,
|
||||||
0EA068F4218475F800C320AD /* ParsingResult+Alerts.swift in Sources */,
|
0EA068F4218475F800C320AD /* ConfigurationParserResult+Alerts.swift in Sources */,
|
||||||
0E57F63C20C83FC5008323CF /* AppDelegate.swift in Sources */,
|
0E57F63C20C83FC5008323CF /* AppDelegate.swift in Sources */,
|
||||||
0ED31C2920CF2A340027975F /* AccountViewController.swift in Sources */,
|
0ED31C2920CF2A340027975F /* AccountViewController.swift in Sources */,
|
||||||
0E158ADA20E11B0B00C85A82 /* EndpointViewController.swift in Sources */,
|
0E158ADA20E11B0B00C85A82 /* EndpointViewController.swift in Sources */,
|
||||||
|
|
4
Podfile
4
Podfile
|
@ -5,8 +5,8 @@ use_frameworks!
|
||||||
def shared_pods
|
def shared_pods
|
||||||
#pod 'TunnelKit', '~> 1.6.0'
|
#pod 'TunnelKit', '~> 1.6.0'
|
||||||
#pod 'TunnelKit/LZO', '~> 1.6.0'
|
#pod 'TunnelKit/LZO', '~> 1.6.0'
|
||||||
pod 'TunnelKit', :git => 'https://github.com/keeshux/tunnelkit', :commit => '7333ea2'
|
pod 'TunnelKit', :git => 'https://github.com/keeshux/tunnelkit', :commit => '5e2f9b5'
|
||||||
pod 'TunnelKit/LZO', :git => 'https://github.com/keeshux/tunnelkit', :commit => '7333ea2'
|
pod 'TunnelKit/LZO', :git => 'https://github.com/keeshux/tunnelkit', :commit => '5e2f9b5'
|
||||||
#pod 'TunnelKit', :path => '../../personal/tunnelkit'
|
#pod 'TunnelKit', :path => '../../personal/tunnelkit'
|
||||||
#pod 'TunnelKit/LZO', :path => '../../personal/tunnelkit'
|
#pod 'TunnelKit/LZO', :path => '../../personal/tunnelkit'
|
||||||
end
|
end
|
||||||
|
|
10
Podfile.lock
10
Podfile.lock
|
@ -15,8 +15,8 @@ PODS:
|
||||||
|
|
||||||
DEPENDENCIES:
|
DEPENDENCIES:
|
||||||
- MBProgressHUD
|
- MBProgressHUD
|
||||||
- TunnelKit (from `https://github.com/keeshux/tunnelkit`, commit `7333ea2`)
|
- TunnelKit (from `https://github.com/keeshux/tunnelkit`, commit `5e2f9b5`)
|
||||||
- TunnelKit/LZO (from `https://github.com/keeshux/tunnelkit`, commit `7333ea2`)
|
- TunnelKit/LZO (from `https://github.com/keeshux/tunnelkit`, commit `5e2f9b5`)
|
||||||
|
|
||||||
SPEC REPOS:
|
SPEC REPOS:
|
||||||
https://github.com/cocoapods/specs.git:
|
https://github.com/cocoapods/specs.git:
|
||||||
|
@ -26,12 +26,12 @@ SPEC REPOS:
|
||||||
|
|
||||||
EXTERNAL SOURCES:
|
EXTERNAL SOURCES:
|
||||||
TunnelKit:
|
TunnelKit:
|
||||||
:commit: 7333ea2
|
:commit: 5e2f9b5
|
||||||
:git: https://github.com/keeshux/tunnelkit
|
:git: https://github.com/keeshux/tunnelkit
|
||||||
|
|
||||||
CHECKOUT OPTIONS:
|
CHECKOUT OPTIONS:
|
||||||
TunnelKit:
|
TunnelKit:
|
||||||
:commit: 7333ea2
|
:commit: 5e2f9b5
|
||||||
:git: https://github.com/keeshux/tunnelkit
|
:git: https://github.com/keeshux/tunnelkit
|
||||||
|
|
||||||
SPEC CHECKSUMS:
|
SPEC CHECKSUMS:
|
||||||
|
@ -40,6 +40,6 @@ SPEC CHECKSUMS:
|
||||||
SwiftyBeaver: 4cc0080d2e23f980652e28978db11a5c9da39165
|
SwiftyBeaver: 4cc0080d2e23f980652e28978db11a5c9da39165
|
||||||
TunnelKit: cd10ff6f4368e82414a72e6a111dae369252964e
|
TunnelKit: cd10ff6f4368e82414a72e6a111dae369252964e
|
||||||
|
|
||||||
PODFILE CHECKSUM: ab7fe69f86411d5848909b12bfeb846d738d004d
|
PODFILE CHECKSUM: 63e02ccbcec92e2575a4fcc0e3e48aecef3fc973
|
||||||
|
|
||||||
COCOAPODS: 1.6.1
|
COCOAPODS: 1.6.1
|
||||||
|
|
Loading…
Reference in New Issue