Slide 30
Slide 30 text
open func postWaveformWithLead(
_ lead: Lead,
subjectiveSymptoms: [Checkup.SubjectiveSymptom]?,
createDate: Date,
saving: Bool,
waveformData: Data) -> Future {
let waveformUUID = UUID().uuidString
return createLocalWaveformWithUuid(
waveformUUID,
lead: lead,
subjectiveSymptoms: subjectiveSymptoms,
createDate: createDate,
waveformData: waveformData)
.flatMap { [weak self] _ -> Future in
self?.uploadWaveformDatumWithLead(
lead,
subjectiveSymptoms: subjectiveSymptoms,
createDate: createDate,
saving: saving,
waveformData: waveformData
) ?? Future(error: InteractorCancelError)
}
.flatMap { [weak self] json -> Future in
self?.executeTaskAfterUploadWithJson(json, uuid: waveformUUID) ??
Future(error: InteractorCancelError)
}
}