Remove #if DEBUG guards for TestFlight, polish weekly digest and insights UX
- Remove #if DEBUG from all debug settings, exporters, and IAP bypass so debug options are available in TestFlight builds - Weekly digest card: replace dismiss X with collapsible chevron caret - Weekly digest: generate on-demand when opening Insights tab if no cached digest exists (BGTask + notification kept as bonus path) - Fix digest intention text color (was .secondary, now uses theme textColor) - Add "Generate Weekly Digest" debug button in Settings - Add generating overlay on Insights tab with pulsing sparkles icon that stays visible until all sections finish loading (content at 0.2 opacity) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -10,7 +10,6 @@ import SwiftUI
|
||||
struct WeeklyDigestCardView: View {
|
||||
|
||||
let digest: WeeklyDigest
|
||||
let onDismiss: () -> Void
|
||||
|
||||
@AppStorage(UserDefaultsStore.Keys.moodTint.rawValue, store: GroupUserDefaults.groupDefaults) private var moodTint: MoodTints = .Default
|
||||
@AppStorage(UserDefaultsStore.Keys.theme.rawValue, store: GroupUserDefaults.groupDefaults) private var theme: Theme = .system
|
||||
@@ -18,82 +17,91 @@ struct WeeklyDigestCardView: View {
|
||||
private var textColor: Color { theme.currentTheme.labelColor }
|
||||
private var accentColor: Color { moodTint.color(forMood: .good) }
|
||||
|
||||
@State private var isExpanded = true
|
||||
@State private var appeared = false
|
||||
|
||||
var body: some View {
|
||||
VStack(alignment: .leading, spacing: 16) {
|
||||
// Header
|
||||
HStack {
|
||||
Image(systemName: digest.iconName)
|
||||
.font(.title2)
|
||||
.foregroundStyle(accentColor)
|
||||
|
||||
VStack(alignment: .leading, spacing: 2) {
|
||||
Text(String(localized: "Weekly Digest"))
|
||||
.font(.caption)
|
||||
.fontWeight(.semibold)
|
||||
.foregroundStyle(.secondary)
|
||||
.textCase(.uppercase)
|
||||
|
||||
Text(digest.headline)
|
||||
.font(.headline)
|
||||
.foregroundColor(textColor)
|
||||
VStack(alignment: .leading, spacing: 0) {
|
||||
// Header — always visible, tappable to toggle
|
||||
Button {
|
||||
withAnimation(.easeInOut(duration: 0.25)) {
|
||||
isExpanded.toggle()
|
||||
}
|
||||
} label: {
|
||||
HStack {
|
||||
Image(systemName: digest.iconName)
|
||||
.font(.title2)
|
||||
.foregroundStyle(accentColor)
|
||||
|
||||
Spacer()
|
||||
VStack(alignment: .leading, spacing: 2) {
|
||||
Text(String(localized: "Weekly Digest"))
|
||||
.font(.caption)
|
||||
.fontWeight(.semibold)
|
||||
.foregroundStyle(.secondary)
|
||||
.textCase(.uppercase)
|
||||
|
||||
Button {
|
||||
WeeklyDigest.markDismissed()
|
||||
withAnimation(.easeInOut(duration: 0.3)) {
|
||||
onDismiss()
|
||||
Text(digest.headline)
|
||||
.font(.headline)
|
||||
.foregroundColor(textColor)
|
||||
.multilineTextAlignment(.leading)
|
||||
}
|
||||
} label: {
|
||||
Image(systemName: "xmark.circle.fill")
|
||||
.font(.title3)
|
||||
|
||||
Spacer()
|
||||
|
||||
Image(systemName: "chevron.up")
|
||||
.font(.caption.weight(.semibold))
|
||||
.foregroundStyle(.secondary)
|
||||
.rotationEffect(.degrees(isExpanded ? 0 : 180))
|
||||
}
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
.accessibilityIdentifier(AccessibilityID.WeeklyDigest.dismissButton)
|
||||
|
||||
// Expandable content
|
||||
if isExpanded {
|
||||
VStack(alignment: .leading, spacing: 16) {
|
||||
// Summary
|
||||
Text(digest.summary)
|
||||
.font(.subheadline)
|
||||
.foregroundColor(textColor)
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
|
||||
Divider()
|
||||
|
||||
// Highlight
|
||||
HStack(alignment: .top, spacing: 10) {
|
||||
Image(systemName: "star.fill")
|
||||
.font(.caption)
|
||||
.foregroundStyle(.yellow)
|
||||
.padding(.top, 2)
|
||||
|
||||
Text(digest.highlight)
|
||||
.font(.subheadline)
|
||||
.foregroundColor(textColor)
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
}
|
||||
|
||||
// Intention
|
||||
HStack(alignment: .top, spacing: 10) {
|
||||
Image(systemName: "arrow.right.circle.fill")
|
||||
.font(.caption)
|
||||
.foregroundStyle(accentColor)
|
||||
.padding(.top, 2)
|
||||
|
||||
Text(digest.intention)
|
||||
.font(.subheadline)
|
||||
.foregroundColor(textColor)
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
}
|
||||
|
||||
// Date range
|
||||
Text(dateRangeString)
|
||||
.font(.caption2)
|
||||
.foregroundStyle(.tertiary)
|
||||
}
|
||||
.accessibilityLabel(String(localized: "Dismiss digest"))
|
||||
.accessibilityIdentifier(AccessibilityID.WeeklyDigest.dismissButton)
|
||||
.padding(.top, 16)
|
||||
.transition(.opacity.combined(with: .move(edge: .top)))
|
||||
}
|
||||
|
||||
// Summary
|
||||
Text(digest.summary)
|
||||
.font(.subheadline)
|
||||
.foregroundColor(textColor)
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
|
||||
Divider()
|
||||
|
||||
// Highlight
|
||||
HStack(alignment: .top, spacing: 10) {
|
||||
Image(systemName: "star.fill")
|
||||
.font(.caption)
|
||||
.foregroundStyle(.yellow)
|
||||
.padding(.top, 2)
|
||||
|
||||
Text(digest.highlight)
|
||||
.font(.subheadline)
|
||||
.foregroundColor(textColor)
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
}
|
||||
|
||||
// Intention
|
||||
HStack(alignment: .top, spacing: 10) {
|
||||
Image(systemName: "arrow.right.circle.fill")
|
||||
.font(.caption)
|
||||
.foregroundStyle(accentColor)
|
||||
.padding(.top, 2)
|
||||
|
||||
Text(digest.intention)
|
||||
.font(.subheadline)
|
||||
.foregroundColor(.secondary)
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
}
|
||||
|
||||
// Date range
|
||||
Text(dateRangeString)
|
||||
.font(.caption2)
|
||||
.foregroundStyle(.tertiary)
|
||||
}
|
||||
.padding(20)
|
||||
.background(
|
||||
|
||||
Reference in New Issue
Block a user