mirror of
https://github.com/XcodesOrg/XcodesApp.git
synced 2026-03-25 08:55:46 +00:00
Use helper from Current
This commit is contained in:
parent
2052ff54ff
commit
b1e6cffd09
2 changed files with 11 additions and 3 deletions
|
|
@ -9,7 +9,6 @@ import Version
|
|||
|
||||
class AppState: ObservableObject {
|
||||
private let client = AppleAPI.Client()
|
||||
private let helperClient = HelperClient()
|
||||
private var cancellables = Set<AnyCancellable>()
|
||||
private var selectPublisher: AnyCancellable?
|
||||
private var uninstallPublisher: AnyCancellable?
|
||||
|
|
@ -184,14 +183,14 @@ class AppState: ObservableObject {
|
|||
// MARK: - Helper
|
||||
|
||||
func installHelper() {
|
||||
HelperInstaller.install()
|
||||
Current.helper.install()
|
||||
checkIfHelperIsInstalled()
|
||||
}
|
||||
|
||||
private func checkIfHelperIsInstalled() {
|
||||
helperInstallState = .unknown
|
||||
|
||||
helperClient.checkIfLatestHelperIsInstalled()
|
||||
Current.helper.checkIfLatestHelperIsInstalled()
|
||||
.receive(on: DispatchQueue.main)
|
||||
.sink(
|
||||
receiveValue: { installed in
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ public struct Environment {
|
|||
public var keychain = Keychain()
|
||||
public var defaults = Defaults()
|
||||
public var date: () -> Date = Date.init
|
||||
public var helper = Helper()
|
||||
}
|
||||
|
||||
public var Current = Environment()
|
||||
|
|
@ -152,3 +153,11 @@ public struct Defaults {
|
|||
removeObject(key)
|
||||
}
|
||||
}
|
||||
|
||||
private let helperClient = HelperClient()
|
||||
public struct Helper {
|
||||
var install: () -> Void = HelperInstaller.install
|
||||
var checkIfLatestHelperIsInstalled: () -> AnyPublisher<Bool, Never> = helperClient.checkIfLatestHelperIsInstalled
|
||||
var getVersion: () -> AnyPublisher<String, Error> = helperClient.getVersion
|
||||
var switchXcodePath: (_ absolutePath: String) -> AnyPublisher<Void, Error> = helperClient.switchXcodePath
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue