Calm 2.0 Fase 2: check-in guiado full-screen (build 52)
El ritual mensual como flujo paso a paso en vez de formulario: - Una fuente por pantalla: valor anterior a la vista, entrada grande (40pt rounded), delta en vivo (chip verde/rojo con importe y %), sugerencia de portapapeles, 'Igual que el mes pasado' y 'Omitir' - Barra de progreso del ritual; cancelable solo al inicio (interactiveDismiss bloqueado a mitad para no perder valores) - Reflexión: mood (5 estados existentes) + nota de una línea - Cierre: total nuevo, delta del mes, streak, compartir y haptic de éxito - Persistencia por los MISMOS caminos que Quick Update (Snapshots) y el journal (MonthlyCheckInStore → JournalEntry): coherente con el resto de entradas - Entrada: CTA del check-in card en Home (fullScreenCover); la fila de completado sigue navegando al journal - Fix: referenceDate congelada en @State al presentar — el card la recalcula al guardar y SwiftUI re-evaluaba el contenido del cover cambiando el mes a mitad de flujo - --pending-checkin en ScreenshotMode (revierte el seed a 'mes pendiente') + UITest testGuidedCheckInFlow end-to-end (valor → skips → mood → cierre) ✓ - Strings ×7 idiomas Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WoScpmHdVj1aUf4rAp6hbe
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import SwiftUI
|
||||
import CoreData
|
||||
|
||||
/// Support for automated App Store screenshot capture. Activated by launching the app
|
||||
/// with the `--screenshots` argument (used by the UI-test capture flow). Only mutates
|
||||
@@ -29,6 +30,27 @@ enum ScreenshotMode {
|
||||
static func seedIfNeeded() {
|
||||
guard isActive else { return }
|
||||
SampleDataService.shared.seedSampleData()
|
||||
makeCheckInPendingIfNeeded()
|
||||
}
|
||||
|
||||
/// `--pending-checkin`: strip the seeded data back to a "month not done yet"
|
||||
/// state (recent snapshots + this month's journal completion removed) so the
|
||||
/// guided check-in flow can be exercised/captured.
|
||||
private static func makeCheckInPendingIfNeeded() {
|
||||
guard CommandLine.arguments.contains("--pending-checkin") else { return }
|
||||
let context = CoreDataStack.shared.viewContext
|
||||
let cutoff = Calendar.current.date(byAdding: .day, value: -40, to: Date()) ?? Date()
|
||||
|
||||
let snapshotRequest = Snapshot.fetchRequest()
|
||||
snapshotRequest.predicate = NSPredicate(format: "date >= %@", cutoff as NSDate)
|
||||
(try? context.fetch(snapshotRequest))?.forEach(context.delete)
|
||||
|
||||
let journalRequest = JournalEntry.fetchRequest()
|
||||
journalRequest.predicate = NSPredicate(format: "completionTime >= %@", cutoff as NSDate)
|
||||
(try? context.fetch(journalRequest))?.forEach(context.delete)
|
||||
|
||||
try? context.save()
|
||||
SharedQuickUpdateSync.refreshMirror()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user