Merge develop -> main: full session (KC-51 through KC-71) #28

Merged
kutesir merged 64 commits from develop into main 2026-07-12 22:57:14 +00:00
4 changed files with 30 additions and 2 deletions
Showing only changes of commit 8f6980df13 - Show all commits

View File

@@ -1938,3 +1938,30 @@ parens checked programmatically; `logHabitDone`/`habitDoneCount` intentionally
left without `@MainActor` to match the existing nonisolated handler functions
(`markTaskComplete`, `snoozeTask`) they run alongside in the notification
delegate callback.
---
## KC-57 — Build error: Color(r:g:b:) used outside its file (coffee brown)
**Status:** Fixed (not build-verified)
**Reported by:** User (Xcode build errors: "Cannot convert value of type
'Int' to expected argument type 'Color'", "Extra argument 'b' in call")
### Root cause
`Color(r:g:b:)` (Double) is declared as `private extension Color` inside
`DesignTokens.swift` — invisible outside that file by design (only `UIColor`'s
`init(r:g:b:)` sibling is `private` too, both file-scoped). KC-55/56 used
`Color(r: 122, g: 84, b: 52)` directly in `SettingsView.swift` and
`OnboardingView.swift` for the coffee icon's brown background — neither file
can see the private initializer, so the compiler fell back to unrelated
overloads and produced the confusing "Cannot convert Int to Color" errors.
### Fix
Added `AppColors.coffeeBrown` (defined inside `DesignTokens.swift`, where the
private init IS visible) alongside the other fixed accent colors
(accent/green/blue/yellow/red). Both call sites now reference
`AppColors.coffeeBrown` instead of constructing the color inline — matches
how every other color in the app is centralized, and is accessible from any
file.
Files: `DesignTokens.swift`, `SettingsView.swift`, `OnboardingView.swift`.

View File

@@ -9,6 +9,7 @@ struct AppColors {
static let blue = Color(r: 77, g: 157, b: 224)
static let yellow = Color(r: 232, g: 184, b: 42)
static let red = Color(r: 232, g: 66, b: 66)
static let coffeeBrown = Color(r: 122, g: 84, b: 52)
static let accentSoft = Color(UIColor { $0.userInterfaceStyle == .dark
? UIColor(r: 52, g: 28, b: 14) // dark: deep warm orange

View File

@@ -531,7 +531,7 @@ struct OnboardingView: View {
isOn: $bedReminderEnabled)
Divider().background(AppColors.border(cs)).padding(.leading, 53)
OnboardingHabitToggle(
icon: "cup.and.saucer.fill", iconColor: .white, iconBg: Color(r: 122, g: 84, b: 52),
icon: "cup.and.saucer.fill", iconColor: .white, iconBg: AppColors.coffeeBrown,
title: "Coffee reminders",
subtitle: "Track when you usually reach for a cup",
isOn: $coffeeReminderEnabled)

View File

@@ -1000,7 +1000,7 @@ private struct HabitRemindersSheet: View {
HStack(spacing: 11) {
Image(systemName: "cup.and.saucer.fill")
.font(.system(size: 13)).foregroundColor(.white)
.frame(width: 28, height: 28).background(Color(r: 122, g: 84, b: 52)).cornerRadius(8)
.frame(width: 28, height: 28).background(AppColors.coffeeBrown).cornerRadius(8)
VStack(alignment: .leading, spacing: 1) {
HStack(spacing: 6) {
Text("Coffee reminders").font(AppFonts.sans(13)).foregroundColor(AppColors.text(cs))