Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions Widgets/Views/HomeWidgetView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ struct HomeWidgetView: View {
Image(systemName: "flame.fill")
.font(WidgetTypography.badge)
.foregroundStyle(snapshot.streak > 0 ? palette.accent : palette.textMuted)
.accessibilityHidden(true)
Text("\(snapshot.streak)")
.font(WidgetTypography.badge)
.foregroundStyle(palette.textPrimary)
Expand All @@ -91,6 +92,8 @@ struct HomeWidgetView: View {
.padding(.vertical, 4)
.background(palette.surface.opacity(0.9))
.clipShape(Capsule())
.accessibilityElement(children: .combine)
.accessibilityLabel("\(snapshot.streak) day streak")
}
}
private var defaultURL: URL? {
Expand Down Expand Up @@ -181,11 +184,14 @@ private struct FocusListView: View {
HStack(spacing: 8) {
Image(systemName: focus.isCompleted ? "checkmark.circle.fill" : "circle")
.foregroundStyle(focus.isCompleted ? palette.accent : palette.textMuted)
.accessibilityHidden(true)
Text(focus.title)
.lineLimit(1)
}
.font(WidgetTypography.body)
.foregroundStyle(palette.textPrimary)
.accessibilityElement(children: .combine)
.accessibilityLabel("\(focus.title), \(focus.isCompleted ? "completed" : "not completed")")
}
}
}
Expand All @@ -201,6 +207,7 @@ private struct StreakBadgeView: View {
Image(systemName: "flame.fill")
.font(WidgetTypography.badge)
.foregroundStyle(streak > 0 ? palette.accent : palette.textMuted)
.accessibilityHidden(true)
Text("\(streak)")
.font(WidgetTypography.badge)
.foregroundStyle(palette.textPrimary)
Expand All @@ -209,6 +216,8 @@ private struct StreakBadgeView: View {
.padding(.vertical, 4)
.background(palette.surface.opacity(0.9))
.clipShape(Capsule())
.accessibilityElement(children: .combine)
.accessibilityLabel("\(streak) day streak")
}
.frame(width: 70, alignment: .topTrailing)
}
Expand Down Expand Up @@ -241,6 +250,7 @@ private struct YearPreviewWidgetView: View {
.frame(height: gridHeight)
.background(palette.surface)
.clipShape(RoundedRectangle(cornerRadius: 10, style: .continuous))
.accessibilityHidden(true)
} else {
Text(WidgetCopy.openToSyncYear)
.font(WidgetTypography.caption)
Expand All @@ -256,6 +266,7 @@ private struct YearPreviewWidgetView: View {
.font(WidgetTypography.caption)
.foregroundStyle(palette.textSecondary)
.lineLimit(1)
.accessibilityLabel(footerAccessibilityLabel)
}
}

Expand Down Expand Up @@ -287,6 +298,11 @@ private struct YearPreviewWidgetView: View {
return "\(String(format: "%.0f%%", preview.yearCompletionPercent)) • \(preview.daysLeft)d left"
}

private var footerAccessibilityLabel: String {
guard let preview, preview.totalDays > 0 else { return WidgetCopy.yearProgressFallback }
return "\(preview.daysLeft) days left, \(String(format: "%.0f", preview.yearCompletionPercent)) percent complete"
}

private var gridHeight: CGFloat {
switch layout {
case .medium:
Expand Down
3 changes: 3 additions & 0 deletions Widgets/Views/LockWidgetView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,11 @@ struct LockWidgetView: View {
}
.gaugeStyle(.accessoryCircular)
.tint(snapshot.completedCount >= total ? palette.complete : palette.accent)
.accessibilityLabel("Focus progress")
.accessibilityValue("\(snapshot.completedCount) of \(total) completed")
} else {
Image(systemName: "target")
.accessibilityLabel("10x")
}
}
.containerBackground(Color.clear, for: .widget)
Expand Down
2 changes: 2 additions & 0 deletions Widgets/Views/ProgressRing.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,7 @@ struct ProgressRing: View {
.stroke(palette.textPrimary, style: StrokeStyle(lineWidth: 4, lineCap: .round))
.rotationEffect(.degrees(-90))
}
.accessibilityLabel("Progress")
.accessibilityValue("\(Int(progress * 100)) percent")
}
}
6 changes: 6 additions & 0 deletions Widgets/Views/SmallHomeWidgetView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ struct SmallHomeWidgetView: View {
Image(systemName: "flame.fill")
.font(WidgetTypography.badge)
.foregroundStyle(snapshot.streak > 0 ? palette.accent : palette.textMuted)
.accessibilityHidden(true)
Text("\(snapshot.streak)")
.font(WidgetTypography.badge)
.foregroundStyle(palette.textPrimary)
Expand All @@ -87,6 +88,8 @@ struct SmallHomeWidgetView: View {
.padding(.vertical, 3)
.background(palette.surface.opacity(0.9))
.clipShape(Capsule())
.accessibilityElement(children: .combine)
.accessibilityLabel("\(snapshot.streak) day streak")
}
}

Expand All @@ -100,11 +103,14 @@ struct SmallHomeWidgetView: View {
Image(systemName: focus.isCompleted ? "checkmark.circle.fill" : "circle")
.imageScale(.small)
.foregroundStyle(focus.isCompleted ? palette.accent : palette.textMuted)
.accessibilityHidden(true)
Text(focus.title)
.lineLimit(1)
}
.font(WidgetTypography.body)
.foregroundStyle(palette.textPrimary)
.accessibilityElement(children: .combine)
.accessibilityLabel("\(focus.title), \(focus.isCompleted ? "completed" : "not completed")")
}
}
}
Expand Down
Loading