Audit found ~50+ interactive elements (buttons, toggles, pickers, alerts, links) missing accessibility identifiers across 13 view files. Added centralized ID definitions and applied them to every entry detail button, guided reflection control, settings toggle, paywall unlock button, subscription/IAP button, lock screen control, and photo action dialog.
131 lines
4.7 KiB
Swift
131 lines
4.7 KiB
Swift
//
|
|
// GuidedReflectionInfoView.swift
|
|
// Reflect
|
|
//
|
|
// Explains the clinical techniques behind the guided reflection questions.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
struct GuidedReflectionInfoView: View {
|
|
|
|
@Environment(\.dismiss) private var dismiss
|
|
|
|
private let cbtURL = URL(string: "https://www.ncbi.nlm.nih.gov/books/NBK470241/")!
|
|
private let actURL = URL(string: "https://link.springer.com/article/10.1007/s40732-017-0254-z")!
|
|
private let baURL = URL(string: "https://www.psychologytools.com/self-help/behavioral-activation")!
|
|
|
|
var body: some View {
|
|
NavigationStack {
|
|
ScrollView {
|
|
VStack(alignment: .leading, spacing: 28) {
|
|
// Intro
|
|
Text(String(localized: "guided_reflection_about_body"))
|
|
.font(.body)
|
|
.foregroundStyle(.secondary)
|
|
|
|
// CBT
|
|
techniqueSection(
|
|
icon: "brain.head.profile",
|
|
color: .red,
|
|
title: String(localized: "guided_reflection_about_cbt_title"),
|
|
body: String(localized: "guided_reflection_about_cbt_body"),
|
|
citation: "Beck, J. S. (2020). Cognitive Behavior Therapy: Basics and Beyond, 3rd ed.",
|
|
url: cbtURL,
|
|
linkID: AccessibilityID.GuidedReflection.cbtLearnMoreLink
|
|
)
|
|
|
|
// ACT
|
|
techniqueSection(
|
|
icon: "eye",
|
|
color: .orange,
|
|
title: String(localized: "guided_reflection_about_act_title"),
|
|
body: String(localized: "guided_reflection_about_act_body"),
|
|
citation: "Harris, R. (2009). ACT Made Simple. New Harbinger Publications.",
|
|
url: actURL,
|
|
linkID: AccessibilityID.GuidedReflection.actLearnMoreLink
|
|
)
|
|
|
|
// BA
|
|
techniqueSection(
|
|
icon: "figure.walk",
|
|
color: .green,
|
|
title: String(localized: "guided_reflection_about_ba_title"),
|
|
body: String(localized: "guided_reflection_about_ba_body"),
|
|
citation: "Martell, C. R., Dimidjian, S., & Herman-Dunn, R. (2010). Behavioral Activation for Depression.",
|
|
url: baURL,
|
|
linkID: AccessibilityID.GuidedReflection.baLearnMoreLink
|
|
)
|
|
|
|
// Disclaimer
|
|
Text(String(localized: "guided_reflection_about_disclaimer"))
|
|
.font(.footnote)
|
|
.foregroundStyle(.tertiary)
|
|
.padding(.top, 8)
|
|
}
|
|
.padding()
|
|
}
|
|
.navigationTitle(String(localized: "guided_reflection_about_title"))
|
|
.navigationBarTitleDisplayMode(.inline)
|
|
.toolbar {
|
|
ToolbarItem(placement: .confirmationAction) {
|
|
Button(String(localized: "Done")) {
|
|
dismiss()
|
|
}
|
|
.accessibilityIdentifier(AccessibilityID.GuidedReflection.infoDoneButton)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// MARK: - Technique Section
|
|
|
|
@ViewBuilder
|
|
private func techniqueSection(
|
|
icon: String,
|
|
color: Color,
|
|
title: String,
|
|
body: String,
|
|
citation: String,
|
|
url: URL,
|
|
linkID: String
|
|
) -> some View {
|
|
VStack(alignment: .leading, spacing: 12) {
|
|
HStack(spacing: 10) {
|
|
Image(systemName: icon)
|
|
.font(.title3)
|
|
.foregroundStyle(color)
|
|
.frame(width: 32)
|
|
|
|
Text(title)
|
|
.font(.headline)
|
|
}
|
|
|
|
Text(body)
|
|
.font(.subheadline)
|
|
.foregroundStyle(.secondary)
|
|
|
|
VStack(alignment: .leading, spacing: 4) {
|
|
Text(citation)
|
|
.font(.caption)
|
|
.foregroundStyle(.tertiary)
|
|
.italic()
|
|
|
|
Link(destination: url) {
|
|
HStack(spacing: 4) {
|
|
Text(String(localized: "guided_reflection_about_learn_more"))
|
|
Image(systemName: "arrow.up.right")
|
|
}
|
|
.font(.caption)
|
|
}
|
|
.accessibilityIdentifier(linkID)
|
|
}
|
|
}
|
|
.padding()
|
|
.background(
|
|
RoundedRectangle(cornerRadius: 16)
|
|
.fill(Color(.systemGray6))
|
|
)
|
|
}
|
|
}
|