feat(clinical): labdb 자동 업로드 제거 — Upload 버튼으로 수동만

이전: endMeasurement → labdb 자동 업로드 → 사용자가 Upload 버튼 (Clinical Home) 못 봄
변경: endMeasurement 는 measurement.json 저장만, 업로드는 Upload 버튼으로만 트리거
→ 사용자가 측정 결과 확인 후 의도적으로 업로드

이미 존재하던 Clinical Home 'Last saved' 카드의 Upload 버튼이 항상 노출됨
(labdb 등록 + 업로드 안 된 상태일 때).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-06-26 10:12:18 +09:00
parent 48e6d72270
commit 12a9089102
@@ -197,25 +197,17 @@ object ClinicalSessionStore {
metaJsonFile(dir).writeText(meta.toString(2))
}
/** 측정 종료: endedAt → meta.json 갱신 → measurement.json 통합 생성 →
* labdb 자동 업로드 (apiKey 있고 active 상태일 때만) → currentSession=null */
/** 측정 종료: endedAt → meta.json 갱신 → measurement.json 통합 생성 → currentSession=null.
* labdb 업로드는 자동 X — Clinical Home 의 'Last saved' 카드의 Upload 버튼으로 수동 트리거. */
fun endMeasurement(context: Context): File? {
val s = currentSession ?: return null
s.endedAt = System.currentTimeMillis()
writeMeta(context)
writeMeasurementJson(context)
val capturedCount = cyclesBuffer.size
val dir = currentLogDir()
lastFinalizedFolder = dir
currentSession = null
cyclesBuffer.clear()
// 자동 업로드 — fire-and-forget. 실패해도 폴더는 그대로, 수동 재시도 가능.
if (dir != null && capturedCount > 0) {
val creds = com.example.medilightv2android.services.labdb.LabdbCredentials
if (creds.isRegistered && creds.lastStatus == "active") {
com.example.medilightv2android.services.labdb.LabdbUploader.uploadAsync(context, dir)
}
}
return dir
}