mirror of
https://github.com/AU-COVIDSafe/mobile-ios.git
synced 2025-01-19 01:06:35 +00:00
26 lines
670 B
Swift
26 lines
670 B
Swift
// Copyright © 2020 Australian Government All rights reserved.
|
|
|
|
import Foundation
|
|
|
|
class GetJMCTargeAction: AsyncAction {
|
|
let onComplete: (Outcome<JMCTarget>) -> Void
|
|
|
|
init(onComplete: @escaping (Outcome<JMCTarget>) -> Void) {
|
|
self.onComplete = onComplete
|
|
super.init()
|
|
}
|
|
|
|
override func run() {
|
|
do {
|
|
let target = try JMCTarget.createTargetFromJSONOnDisk()
|
|
finishedExecutingOperationWithOutcome(.success(target))
|
|
} catch {
|
|
finishedExecutingOperationWithOutcome(.error(error))
|
|
}
|
|
}
|
|
|
|
func finishedExecutingOperationWithOutcome(_ outcome: Outcome<JMCTarget>) {
|
|
finishedExecutingOperation()
|
|
onComplete(outcome)
|
|
}
|
|
}
|